summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2021-07-28 16:15:47 +0800
committerJames Almer <jamrial@gmail.com>2021-08-04 10:06:26 -0300
commit65fdc0e589551179f793f69528a975b2253699d2 (patch)
tree1083af941afacc3216b88ec680ce94202dc4c7a0 /libavcodec/qsvenc.c
parentc8cfe676948c1d97c8d6d50564065d0f2d52a568 (diff)
lavc/qsvenc: pass the color properties to the SDK
Otherwise the color properties won't be encoded into the bitstream header Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index f6fa759447..e7e65ebfcf 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -805,6 +805,24 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
}
#endif
+ q->extvsi.VideoFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
+ q->extvsi.ColourDescriptionPresent = 0;
+
+ if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+ avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
+ avctx->colorspace != AVCOL_SPC_UNSPECIFIED) {
+ q->extvsi.ColourDescriptionPresent = 1;
+ q->extvsi.ColourPrimaries = avctx->color_primaries;
+ q->extvsi.TransferCharacteristics = avctx->color_trc;
+ q->extvsi.MatrixCoefficients = avctx->colorspace;
+ }
+
+ if (q->extvsi.VideoFullRange || q->extvsi.ColourDescriptionPresent) {
+ q->extvsi.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO;
+ q->extvsi.Header.BufferSz = sizeof(q->extvsi);
+ q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvsi;
+ }
+
if (!check_enc_param(avctx,q)) {
av_log(avctx, AV_LOG_ERROR,
"some encoding parameters are not supported by the QSV "