libs: encoder: h265: chroma and luma with format

If the profile is main-10 the bit_depth_luma_minus8, in the sequence
parameter buffer, shall be the color format bit depth minus 8, 10-8
which is 2. Also for bit_depth_chroma_minus8.

This patch gets the negotiated sink caps format and queries its
luma's depth and uses that value to fill the mentioned parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-04-03 15:34:51 +02:00
parent d744aeb5fa
commit 3532dca16a

View file

@ -1436,6 +1436,13 @@ static gboolean
fill_sequence (GstVaapiEncoderH265 * encoder, GstVaapiEncSequence * sequence)
{
VAEncSequenceParameterBufferHEVC *const seq_param = sequence->param;
const GstVideoFormat format =
GST_VIDEO_INFO_FORMAT (GST_VAAPI_ENCODER_VIDEO_INFO (encoder));
guint bits_depth_luma_minus8 =
GST_VIDEO_FORMAT_INFO_DEPTH (gst_video_format_get_info (format), 0);
if (bits_depth_luma_minus8 < 8)
return FALSE;
bits_depth_luma_minus8 -= 8;
memset (seq_param, 0, sizeof (VAEncSequenceParameterBufferHEVC));
@ -1457,8 +1464,8 @@ fill_sequence (GstVaapiEncoderH265 * encoder, GstVaapiEncSequence * sequence)
seq_param->seq_fields.value = 0;
seq_param->seq_fields.bits.chroma_format_idc = 1;
seq_param->seq_fields.bits.separate_colour_plane_flag = 0;
seq_param->seq_fields.bits.bit_depth_luma_minus8 = 0;
seq_param->seq_fields.bits.bit_depth_chroma_minus8 = 0;
seq_param->seq_fields.bits.bit_depth_luma_minus8 = bits_depth_luma_minus8;
seq_param->seq_fields.bits.bit_depth_chroma_minus8 = bits_depth_luma_minus8;
seq_param->seq_fields.bits.scaling_list_enabled_flag = FALSE;
seq_param->seq_fields.bits.strong_intra_smoothing_enabled_flag = TRUE;
seq_param->seq_fields.bits.amp_enabled_flag = TRUE;