mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
v4l2codecs: h264: Reduce controls for subsequent slices
Only the SLICE_PARAMS and PRED_WEIGHTS are needed for the second and following slices. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1624>
This commit is contained in:
parent
1c082b79e1
commit
84daea6be2
1 changed files with 29 additions and 22 deletions
|
@ -67,6 +67,7 @@ struct _GstV4l2CodecH264Dec
|
||||||
guint bitdepth;
|
guint bitdepth;
|
||||||
guint chroma_format_idc;
|
guint chroma_format_idc;
|
||||||
guint num_slices;
|
guint num_slices;
|
||||||
|
gboolean first_slice;
|
||||||
|
|
||||||
GstV4l2CodecAllocator *sink_allocator;
|
GstV4l2CodecAllocator *sink_allocator;
|
||||||
GstV4l2CodecAllocator *src_allocator;
|
GstV4l2CodecAllocator *src_allocator;
|
||||||
|
@ -883,6 +884,8 @@ gst_v4l2_codec_h264_dec_start_picture (GstH264Decoder * decoder,
|
||||||
gst_v4l2_codec_h264_dec_fill_decoder_params (self, &slice->header, picture,
|
gst_v4l2_codec_h264_dec_fill_decoder_params (self, &slice->header, picture,
|
||||||
dpb);
|
dpb);
|
||||||
|
|
||||||
|
self->first_slice = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,24 +1030,17 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
|
||||||
GstV4l2Request *prev_request, *request = NULL;
|
GstV4l2Request *prev_request, *request = NULL;
|
||||||
gsize bytesused;
|
gsize bytesused;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
guint count;
|
guint count = 0;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
/* Reserve space for controls */
|
||||||
struct v4l2_ext_control control[] = {
|
struct v4l2_ext_control control[] = {
|
||||||
{
|
{ }, /* SPS */
|
||||||
.id = V4L2_CID_STATELESS_H264_PPS,
|
{ }, /* PPS */
|
||||||
.ptr = &self->pps,
|
{ }, /* DECODE_PARAMS */
|
||||||
.size = sizeof (self->pps),
|
{ }, /* SLICE_PARAMS */
|
||||||
},
|
{ }, /* SCALING_MATRIX */
|
||||||
{
|
{ }, /* PRED_WEIGHTS */
|
||||||
.id = V4L2_CID_STATELESS_H264_DECODE_PARAMS,
|
|
||||||
.ptr = &self->decode_params,
|
|
||||||
.size = sizeof (self->decode_params),
|
|
||||||
},
|
|
||||||
{ },
|
|
||||||
{ },
|
|
||||||
{ },
|
|
||||||
{ },
|
|
||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
@ -1080,9 +1076,6 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always set PPS and DECODE_PARAMS */
|
|
||||||
count = 2;
|
|
||||||
|
|
||||||
if (self->need_sequence) {
|
if (self->need_sequence) {
|
||||||
control[count].id = V4L2_CID_STATELESS_H264_SPS;
|
control[count].id = V4L2_CID_STATELESS_H264_SPS;
|
||||||
control[count].ptr = &self->sps;
|
control[count].ptr = &self->sps;
|
||||||
|
@ -1091,11 +1084,25 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
|
||||||
self->need_sequence = FALSE;
|
self->need_sequence = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->scaling_matrix_present) {
|
if (self->first_slice) {
|
||||||
control[count].id = V4L2_CID_STATELESS_H264_SCALING_MATRIX;
|
control[count].id = V4L2_CID_STATELESS_H264_PPS;
|
||||||
control[count].ptr = &self->scaling_matrix;
|
control[count].ptr = &self->pps;
|
||||||
control[count].size = sizeof (self->scaling_matrix);
|
control[count].size = sizeof (self->pps);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
if (self->scaling_matrix_present) {
|
||||||
|
control[count].id = V4L2_CID_STATELESS_H264_SCALING_MATRIX;
|
||||||
|
control[count].ptr = &self->scaling_matrix;
|
||||||
|
control[count].size = sizeof (self->scaling_matrix);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
control[count].id = V4L2_CID_STATELESS_H264_DECODE_PARAMS;
|
||||||
|
control[count].ptr = &self->decode_params;
|
||||||
|
control[count].size = sizeof (self->decode_params);
|
||||||
|
count++;
|
||||||
|
|
||||||
|
self->first_slice = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's not slice-based then it doesn't support per-slice controls. */
|
/* If it's not slice-based then it doesn't support per-slice controls. */
|
||||||
|
|
Loading…
Reference in a new issue