Commit graph

10 commits

Author SHA1 Message Date
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
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 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
Víctor Manuel Jáquez Leal 4625ac92b6 va: mpeg2dec: refactor the picture reference filling
Add the helper function _get_surface_id() which extracts the
VASurfaceID from the passed picture. This function gets the surface of
the next and previous reference picture.

Instead of if-statements, this refactor uses a switch-statement with a
fall-through, for P-type pictures, making the code a bit more readable.

Also it adds quirks for gallium driver, which cannot handle invalid
surfaces as forwarding nor backwarding references, so the function fails.
Also iHD cannot handle them, but to avoid failing, the current picture
is used as self-reference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
2021-01-06 17:27:10 +01:00
Víctor Manuel Jáquez Leal aff338bb24 va: mpeg2dec: set first field either frame or has a first field
Add a helper function _is_frame_start() which check if picture has a
frame structure or if it has not an interlaced first field yet. This
function is used with filling is_first_field parameter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
2021-01-06 17:27:10 +01:00
He Junyan 4c66a0265c va: mpeg2dec: Using the current picture's surface when missing reference.
When missing the reference frames, we should not just discard the current
frame. Some streams have group of picture header. It is an optional header
that can be used immediately before a coded I-frame to indicate to the decoder
if the first consecutive B-pictures immediately following the coded I-frame can
be reconstructed properly in the case of a random access.
In that case, the B frames may miss the previous reference and can still be
correctly decoded. We also notice that the second field of the I frame may
be set to P type, and it only ref its first field.
We should not skip all those frames, and even the frame really misses the
reference frame, some manner such as inserting grey picture should be used
to handle these cases.

The driver crashes when it needs to access the reference picture while we set
forward_reference_picture or backward_reference_picture to VA_INVALID_ID. We
now set it to current picture to avoid this. This is just a temp manner.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
2021-01-04 13:09:01 +00:00
He Junyan b2b0483d03 va: mpeg2dec: Apply buffer_flags to the output buffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
2021-01-04 13:09:01 +00:00
Víctor Manuel Jáquez Leal f1fe62dbe5 va: mpeg2dec: cosmetic changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
2020-12-28 13:17:21 +08:00
He Junyan 19811759d6 va: Add mpeg2 VA decoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
2020-12-28 13:14:06 +08:00