aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2020-11-02 22:46:48 +0000
committerMark Thompson <sw@jkqxz.net>2020-11-03 20:36:14 +0000
commit486817e1aedda759bd21287b462ee0bb6e100949 (patch)
treebeba8f4a69ef1dcb45ef3d33b664e9f550b0b201
parent9faf4dcf234dbc34f05cd2d973473df2eece4881 (diff)
downloadffmpeg-486817e1aedda759bd21287b462ee0bb6e100949.tar.gz
vaapi_encode_h265: Fix setting colour properties
Matching the previous commit for H.264. Reviewed-By: Jan Ekström <jeebjp@gmail.com> Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
-rw-r--r--libavcodec/vaapi_encode_h265.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 316030914c..3e0af17ea5 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -488,30 +488,20 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
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.
+ vui->video_format = 5;
+ vui->video_full_range_flag =
+ avctx->color_range == AVCOL_RANGE_JPEG;
+ vui->colour_primaries = avctx->color_primaries;
+ vui->transfer_characteristics = avctx->color_trc;
+ 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)
+ vui->colour_description_present_flag = 1;
+ if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED ||
+ vui->colour_description_present_flag)
vui->video_signal_type_present_flag = 1;
- vui->video_format = 5; // Unspecified.
- 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) {
- vui->colour_description_present_flag = 1;
- vui->colour_primaries = avctx->color_primaries;
- vui->transfer_characteristics = avctx->color_trc;
- vui->matrix_coefficients = avctx->colorspace;
- }
- } else {
- vui->video_format = 5;
- vui->video_full_range_flag = 0;
- vui->colour_primaries = avctx->color_primaries;
- vui->transfer_characteristics = avctx->color_trc;
- vui->matrix_coefficients = avctx->colorspace;
- }
if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
vui->chroma_loc_info_present_flag = 1;