Commit graph

23 commits

Author SHA1 Message Date
Thibault Saunier
019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
He Junyan
fbf6bfd4d8 va: Use GST_CAPS_FEATURE_MEMORY_VA to replace "memory:VAMemory".
"memory:VAMemory" is a commonly used string which notates our VA-kind
memory type. We now used a definition in va lib to replace the simply
string usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>
2021-08-16 16:25:15 +08:00
He Junyan
99636cd101 va: h265dec: Do not assign the frame->output_buffer until output_picture.
We may need to drop the slices such as RASL pictures with the NoRaslOutputFlag, so
the current picture of h265decoder may be freed. We should not assign the frame->
output_buffer too early until we really output it. Or, the later coming slices will
allocate another picture and trigger the assert of:
  gst_video_decoder_allocate_output_frame_with_params:
  assertion 'frame->output_buffer == NULL' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2421>
2021-07-23 07:17:06 +00:00
He Junyan
0c8d41b8b0 va: H265: Add odd bit depth and chroma depth in get_rtformat.
In H265, the stream may have odd bit depth such as 9 or 11. And
the bit depth of luma and chroma may differ. For example, the
stream with luma depth of 8 and chroma depth of 9 should use the
10 bit rtformat as the decoded picture format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2420>
2021-07-22 14:18:11 +08:00
Víctor Manuel Jáquez Leal
ea8b372ceb va: Refactor _format_changed() to _config_is_equal().
Change gst_va_decoder_format_changed() to
gst_va_decoder_config_is_equal(), which is more similar with other
GStreamer API.

The function call is replaced but it has to be negated because the
return value is the opposite.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:51:29 +02:00
Víctor Manuel Jáquez Leal
1bf2805560 va: Refactor _set_format() to _set_frame_size().
Renamed gst_va_decoder_set_format() to
gst_va_decoder_set_frame_size_with_surfaces() which resembles better
the passed parameters. Internally it creates the vaContext.

Added gst_va_decoder_set_frame_size() which is an alias of
gst_va_decoder_set_frame_size_with_surfaces() without surfaces. This
is the function which replaces gst_va_decoder_set_format() where
used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:51:27 +02:00
He Junyan
6a9f84a2de va: h265dec: Do not add non reference frames into ref list.
The VA's ReferenceFrames should only contain the reference frame, we
should not add the non reference frames into this list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>
2021-07-16 15:50:47 +08:00
He Junyan
67d482f8fb va: h265dec: Fix a temp var overflow bug when write pred weight table.
The temp guint8 var of delta_chroma_offset_l0 and delta_chroma_offset_l1
can not cover the full range of delta_chroma_weight_l0/1 in the slice
header. When overflow happens, the decoder result is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2412>
2021-07-15 14:25:09 +00:00
He Junyan
b269cd5319 va: Consider the compatibility when we get_profile() for H265 decoder.
Adding the compatile profiles when we decide the final profile used for decoding.
The final profile candidates include:
1. The profile directly specified by SPS, which is the exact one.
2. The compatile profiles decided by the upstream element such as the h265parse.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
2021-07-02 10:27:41 +00:00
He Junyan
027726d6c8 va: h265dec: Set the GstVideoAlignment correctly.
We should set GstVideoAlignment based on the conformance window info.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>
2021-06-28 15:16:39 +00:00
He Junyan
0849583210 va: Add 12 bits rt_format setting in H265.
In order to support 12 bits format decoding, we need to add the
support for 12 bits rt_format in H265.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2332>
2021-06-16 14:12:59 +00:00
He Junyan
c4bb5f06c9 va: h265dec: Add current picture into reference list for SCC.
The current picture is not in the DPB, so we need to add it manually
to the reference list when SCC is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2255>
2021-05-25 12:11:05 +02:00
He Junyan
ceb2df1751 va: h265dec: Set Screen Content extension (SCC) for picture parameters.
We already declare the support of HEVC screen content extension profiles
in the profile mapping list, but we fail to generate the correct VA picture
parameters buffers. This may cause the GPU hang.

We need to fill the buffer of VAPictureParameterBufferHEVCExtension correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2255>
2021-05-25 12:11:05 +02:00
He Junyan
bfbb49144c va: h265dec: Use get_profile_from_sps() to recognize the profile.
The function of gst_h265_get_profile_from_sps() is better than the
function gst_h265_profile_tier_level_get_profile() when we recognize
the profile of the stream, becaue it considers the compatibility.

It is also used by h265parse to recognize the profile. So it is
better to keep the same behaviour with the parse and other decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2255>
2021-05-25 12:11:05 +02:00
He Junyan
08dc70b6f4 va: h265dec: Set range extension for picture and slice parameters.
We already declare the support of HEVC range extension profiles in
the profile mapping list, but we fail to generate the correct VA
picture and slice parameters buffers. This may cause the GPU hang.

We need to fill the buffer of VAPictureParameterBufferHEVCExtension
and VASliceParameterBufferHEVCExtension correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2255>
2021-05-25 12:11:05 +02:00
Víctor Manuel Jáquez Leal
0edc2f6b98 va: h265dec: Use picture and slide extension parameters.
This is transitional commit to later implement extended and screen
profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2255>
2021-05-25 12:11:05 +02:00
He Junyan
3bca4045e5 va: h265dec: Set LastSliceOfPic for multi sliced frames.
VA-API HEVC decoding needs to known which is the last slice of a
picture, but slices are processed sequencially, so we know the
last slice until all the slices are already pushed into the
VABuffer array.

In order to mark the last slice, they are pushed into the
VABuffer array with a delay of one slice: the first slice is
hold, and when the second slice come, the first one is pushed
while holding the second, and so on. Finally, at end_picture(),
the last slice is marked and pushed into the array.

Co-author: Victor Jaquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2246>
2021-05-21 13:22:03 +02:00
He Junyan
64b596103a va: Do not use a common parent_class in vabasedec.
We have only one copy of gst_va_base_dec_parent_class inside the
vabasedec, so it can not handle the case when there are multi va
decoders inside one pipeline. The pipeline:

  gst-launch-1.0 filesrc location=xxx.h264 ! h264parse \
      ! vah264dec ! msdkh265enc ! vah265dec ! fakesink

generates a assertion of

"invalid cast from 'GstVaH264Dec' to 'GstH265Decoder"

and gets a crash.

We should keep the parent_class for each decoder type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2231>
2021-05-10 22:47:11 +08:00
Seungha Yang
b00b1654f3 vah265dec: Don't need to pass picture structure to VA
This code came from gstvaapidecoder_h265 implementation
but picture structure is always GST_VAAPI_PICTURE_STRUCTURE_FRAME.
Moreover, in theory, VA doesn't need to know picture structure for
decoding HEVC stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2008>
2021-02-09 16:19:41 +00:00
Víctor Manuel Jáquez Leal
64cca0f791 va: h265dec: fix HVC1 stream format name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1999>
2021-02-05 21:25:20 +01:00
Víctor Manuel Jáquez Leal
14c28415b9 va: Remove gst_va_decoder_destroy_buffers()
Since GstVaDecodePicture is destroyed completely with its free() function and
it's used as destroy notify by codecs picture, there's no need to call
gst_va_decoder_destroy_buffers() externally, since the codecs base classes
destroy the codec picture when it's required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
2020-11-30 16:53:25 +01:00
He Junyan
f5c7ada98e va: Destroy picture unreleased buffers when finalize.
The current way of GstVaDecodePicture's finalize will leak some
resource such as parameter buffers and slice data.
The current way deliberately leaves these resource releasing logic
to va decoder related function and trigger a warning if we free the
GstVaDecodePicture without releasing these resources.
But in practice, sometimes, you do not have the chance to release
these resource before picture is freed. For example, H264/Mpeg2
support multi slice NALs/Packets for one frame. It is possible that
we already succeed to parse and generate the first several slices
data by _decode_slice(), but then we get a wrong slice NAL/packet
and fail to parse it. We decide to discard the whole frame in the
decoder's base class, it just free the current picture and does not
trigger sub class's function again. In this kind of cases, we do
not have the chance to cleanup the resource, and the resource will
be leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
2020-11-30 13:03:11 +00:00
Nicolas Dufresne
2950c76c8f va: Add HEVC decoding support
This add HEVC decoding support into the new VA plugin. This implementation has
been tested using the ITU comformance test (through fluster). It fails all
MAIN10 tests, as this is not implemented yet along with the following:

CONFWIN_A_Sony_1 (looks fine, but md5sum is incorrect)
PICSIZE_A_Bossen_1 (height too high)
PICSIZE_B_Bossen_1 (same)
VPSSPSPPS_A_MainConcept_1 (parser issue)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1714>
2020-11-04 17:53:23 +00:00