diff options
author | Mark Thompson <sw@jkqxz.net> | 2020-11-02 22:46:47 +0000 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2020-11-03 20:35:39 +0000 |
commit | 9faf4dcf234dbc34f05cd2d973473df2eece4881 (patch) | |
tree | 9ae50b74c6948f4f0998aa0d44b33284245d82d1 /libavcodec | |
parent | 4ad7af085cd3db473bf035394d7d934800461bdf (diff) | |
download | ffmpeg-9faf4dcf234dbc34f05cd2d973473df2eece4881.tar.gz |
vaapi_encode_h264: Fix setting colour properties
The properties should always be set; only the presence flags want to be
conditional.
Fixes #8959.
Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vaapi_encode_h264.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 5e1683e851..e52a0e37a4 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -411,30 +411,20 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) sps->vui.aspect_ratio_info_present_flag = 1; } - if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED || - avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || + // Unspecified video format, from table E-2. + sps->vui.video_format = 5; + sps->vui.video_full_range_flag = + avctx->color_range == AVCOL_RANGE_JPEG; + sps->vui.colour_primaries = avctx->color_primaries; + sps->vui.transfer_characteristics = avctx->color_trc; + sps->vui.matrix_coefficients = avctx->colorspace; + if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || avctx->color_trc != AVCOL_TRC_UNSPECIFIED || - avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { + avctx->colorspace != AVCOL_SPC_UNSPECIFIED) + sps->vui.colour_description_present_flag = 1; + if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED || + sps->vui.colour_description_present_flag) sps->vui.video_signal_type_present_flag = 1; - sps->vui.video_format = 5; // Unspecified. - sps->vui.video_full_range_flag = - avctx->color_range == AVCOL_RANGE_JPEG; - - if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || - avctx->color_trc != AVCOL_TRC_UNSPECIFIED || - avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { - sps->vui.colour_description_present_flag = 1; - sps->vui.colour_primaries = avctx->color_primaries; - sps->vui.transfer_characteristics = avctx->color_trc; - sps->vui.matrix_coefficients = avctx->colorspace; - } - } else { - sps->vui.video_format = 5; - sps->vui.video_full_range_flag = 0; - sps->vui.colour_primaries = avctx->color_primaries; - sps->vui.transfer_characteristics = avctx->color_trc; - sps->vui.matrix_coefficients = avctx->colorspace; - } if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) { sps->vui.chroma_loc_info_present_flag = 1; |