av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier to set the frame's output_buffer if we already have one available. Also documented that unlike VP9, it is not optional to implement this as the picture will populate the DPB if it is a key-frame. To ensure this, remove the default implementation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
This commit is contained in:
parent
a7ceac50b2
commit
9a364464f0
@ -74,9 +74,6 @@ static GstFlowReturn gst_av1_decoder_drain (GstVideoDecoder * decoder);
|
|||||||
static GstFlowReturn gst_av1_decoder_handle_frame (GstVideoDecoder * decoder,
|
static GstFlowReturn gst_av1_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GstVideoCodecFrame * frame);
|
GstVideoCodecFrame * frame);
|
||||||
|
|
||||||
static GstAV1Picture *gst_av1_decoder_duplicate_picture_default (GstAV1Decoder *
|
|
||||||
decoder, GstAV1Picture * picture);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_av1_decoder_class_init (GstAV1DecoderClass * klass)
|
gst_av1_decoder_class_init (GstAV1DecoderClass * klass)
|
||||||
{
|
{
|
||||||
@ -90,9 +87,6 @@ gst_av1_decoder_class_init (GstAV1DecoderClass * klass)
|
|||||||
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_av1_decoder_drain);
|
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_av1_decoder_drain);
|
||||||
decoder_class->handle_frame =
|
decoder_class->handle_frame =
|
||||||
GST_DEBUG_FUNCPTR (gst_av1_decoder_handle_frame);
|
GST_DEBUG_FUNCPTR (gst_av1_decoder_handle_frame);
|
||||||
|
|
||||||
klass->duplicate_picture =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_av1_decoder_duplicate_picture_default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -199,17 +193,6 @@ gst_av1_decoder_drain (GstVideoDecoder * decoder)
|
|||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstAV1Picture *
|
|
||||||
gst_av1_decoder_duplicate_picture_default (GstAV1Decoder * decoder,
|
|
||||||
GstAV1Picture * picture)
|
|
||||||
{
|
|
||||||
GstAV1Picture *new_picture;
|
|
||||||
|
|
||||||
new_picture = gst_av1_picture_new ();
|
|
||||||
|
|
||||||
return new_picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_obu_name (GstAV1OBUType type)
|
get_obu_name (GstAV1OBUType type)
|
||||||
{
|
{
|
||||||
@ -363,10 +346,10 @@ gst_av1_decoder_decode_frame_header (GstAV1Decoder * self,
|
|||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: duplicate picture might be optional feature like that of VP9
|
/* The duplicated picture, if a key frame, will be placed in the DPB and
|
||||||
* decoder baseclass */
|
* for this reason is not optional. */
|
||||||
g_assert (klass->duplicate_picture);
|
g_assert (klass->duplicate_picture);
|
||||||
picture = klass->duplicate_picture (self, ref_picture);
|
picture = klass->duplicate_picture (self, priv->current_frame, ref_picture);
|
||||||
if (!picture) {
|
if (!picture) {
|
||||||
GST_ERROR_OBJECT (self, "subclass didn't provide duplicated picture");
|
GST_ERROR_OBJECT (self, "subclass didn't provide duplicated picture");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -96,13 +96,16 @@ struct _GstAV1DecoderClass
|
|||||||
* GstAV1DecoderClass::duplicate_picture:
|
* GstAV1DecoderClass::duplicate_picture:
|
||||||
* @decoder: a #GstAV1Decoder
|
* @decoder: a #GstAV1Decoder
|
||||||
* @picture: (transfer none): a #GstAV1Picture
|
* @picture: (transfer none): a #GstAV1Picture
|
||||||
|
* @frame: (transfer none): the current #GstVideoCodecFrame
|
||||||
*
|
*
|
||||||
* Optional. Called when need to duplicate an existing
|
* Called when need to duplicate an existing #GstAV1Picture. As
|
||||||
* #GstAV1Picture.
|
* duplicated key-frame will populate the DPB, this virtual
|
||||||
|
* function is not optional.
|
||||||
*
|
*
|
||||||
* Since: 1.20
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstAV1Picture * (*duplicate_picture) (GstAV1Decoder * decoder,
|
GstAV1Picture * (*duplicate_picture) (GstAV1Decoder * decoder,
|
||||||
|
GstVideoCodecFrame * frame,
|
||||||
GstAV1Picture * picture);
|
GstAV1Picture * picture);
|
||||||
/**
|
/**
|
||||||
* GstAV1DecoderClass::start_picture:
|
* GstAV1DecoderClass::start_picture:
|
||||||
|
@ -459,6 +459,7 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||||||
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
|
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
|
||||||
|
|
||||||
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
|
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_to_dup = priv->dpb->pic_list[frame_hdr.frame_to_show_map_idx];
|
pic_to_dup = priv->dpb->pic_list[frame_hdr.frame_to_show_map_idx];
|
||||||
|
@ -427,7 +427,7 @@ static GstFlowReturn gst_d3d11_av1_dec_new_sequence (GstAV1Decoder * decoder,
|
|||||||
static GstFlowReturn gst_d3d11_av1_dec_new_picture (GstAV1Decoder * decoder,
|
static GstFlowReturn gst_d3d11_av1_dec_new_picture (GstAV1Decoder * decoder,
|
||||||
GstVideoCodecFrame * frame, GstAV1Picture * picture);
|
GstVideoCodecFrame * frame, GstAV1Picture * picture);
|
||||||
static GstAV1Picture *gst_d3d11_av1_dec_duplicate_picture (GstAV1Decoder *
|
static GstAV1Picture *gst_d3d11_av1_dec_duplicate_picture (GstAV1Decoder *
|
||||||
decoder, GstAV1Picture * picture);
|
decoder, GstVideoCodecFrame * frame, GstAV1Picture * picture);
|
||||||
static GstFlowReturn gst_d3d11_av1_dec_start_picture (GstAV1Decoder * decoder,
|
static GstFlowReturn gst_d3d11_av1_dec_start_picture (GstAV1Decoder * decoder,
|
||||||
GstAV1Picture * picture, GstAV1Dpb * dpb);
|
GstAV1Picture * picture, GstAV1Dpb * dpb);
|
||||||
static GstFlowReturn gst_d3d11_av1_dec_decode_tile (GstAV1Decoder * decoder,
|
static GstFlowReturn gst_d3d11_av1_dec_decode_tile (GstAV1Decoder * decoder,
|
||||||
@ -728,7 +728,7 @@ gst_d3d11_av1_dec_new_picture (GstAV1Decoder * decoder,
|
|||||||
|
|
||||||
static GstAV1Picture *
|
static GstAV1Picture *
|
||||||
gst_d3d11_av1_dec_duplicate_picture (GstAV1Decoder * decoder,
|
gst_d3d11_av1_dec_duplicate_picture (GstAV1Decoder * decoder,
|
||||||
GstAV1Picture * picture)
|
GstVideoCodecFrame * frame, GstAV1Picture * picture)
|
||||||
{
|
{
|
||||||
GstD3D11AV1Dec *self = GST_D3D11_AV1_DEC (decoder);
|
GstD3D11AV1Dec *self = GST_D3D11_AV1_DEC (decoder);
|
||||||
GstBuffer *view_buffer;
|
GstBuffer *view_buffer;
|
||||||
|
@ -357,7 +357,7 @@ gst_va_av1_dec_new_picture (GstAV1Decoder * decoder,
|
|||||||
|
|
||||||
static GstAV1Picture *
|
static GstAV1Picture *
|
||||||
gst_va_av1_dec_duplicate_picture (GstAV1Decoder * decoder,
|
gst_va_av1_dec_duplicate_picture (GstAV1Decoder * decoder,
|
||||||
GstAV1Picture * picture)
|
GstVideoCodecFrame * frame, GstAV1Picture * picture)
|
||||||
{
|
{
|
||||||
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
|
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
|
||||||
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
|
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user