diff --git a/media_common/agnostic/common/codec/shared/codec_def_encode_av1.h b/media_common/agnostic/common/codec/shared/codec_def_encode_av1.h index a85509b9958..f3c30f320eb 100644 --- a/media_common/agnostic/common/codec/shared/codec_def_encode_av1.h +++ b/media_common/agnostic/common/codec/shared/codec_def_encode_av1.h @@ -192,7 +192,9 @@ typedef struct _CODEC_AV1_ENCODE_SEQUENCE_PARAMS uint32_t DisplayFormatSwizzle : 1; //[0] uint32_t bLookAheadPhase : 1; uint32_t HierarchicalFlag : 1; - uint32_t Reserved0 : 26; + uint32_t RGBInputStudioRange : 1; // [0, 1] + uint32_t ConvertedYUVStudioRange : 1; // [0, 1] + uint32_t Reserved0 : 24; } fields; uint32_t value; } SeqFlags; diff --git a/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h b/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h index 5cdac963f6b..fcf119e3b70 100644 --- a/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h +++ b/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h @@ -489,7 +489,9 @@ typedef struct _CODEC_HEVC_ENCODE_SEQUENCE_PARAMS uint32_t RGBEncodingEnable : 1; uint32_t PrimaryChannelForRGBEncoding : 2; uint32_t SecondaryChannelForRGBEncoding : 2; - uint32_t : 15; // [0] + uint32_t RGBInputStudioRange : 1; + uint32_t ConvertedYUVStudioRange : 1; + uint32_t : 13; // [0] }; uint32_t EncodeTools; }; diff --git a/media_softlet/agnostic/common/codec/hal/enc/av1/features/encode_av1_basic_feature.cpp b/media_softlet/agnostic/common/codec/hal/enc/av1/features/encode_av1_basic_feature.cpp index a61463eac16..8a93aece2de 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/av1/features/encode_av1_basic_feature.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/av1/features/encode_av1_basic_feature.cpp @@ -651,7 +651,10 @@ MHW_SETPAR_DECL_SRC(VDENC_PIPE_MODE_SELECT, Av1BasicFeature) params.streamIn = false; params.randomAccess = !m_ref.IsLowDelay(); - params.rgbEncodingMode = m_rgbEncodingEnable; + params.rgbEncodingMode = m_rgbEncodingEnable; + params.bt2020RGB2YUV = m_av1SeqParams->InputColorSpace == ECOLORSPACE_P2020; + params.rgbInputStudioRange = params.bt2020RGB2YUV ? m_av1SeqParams->SeqFlags.fields.RGBInputStudioRange : 0; + params.convertedYUVStudioRange = params.bt2020RGB2YUV ? m_av1SeqParams->SeqFlags.fields.ConvertedYUVStudioRange : 0; if (m_captureModeEnable) { params.captureMode = 1; diff --git a/media_softlet/agnostic/common/codec/hal/enc/hevc/features/encode_hevc_basic_feature.cpp b/media_softlet/agnostic/common/codec/hal/enc/hevc/features/encode_hevc_basic_feature.cpp index d853178f5e4..a7545ba8cd8 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/hevc/features/encode_hevc_basic_feature.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/hevc/features/encode_hevc_basic_feature.cpp @@ -800,6 +800,9 @@ MHW_SETPAR_DECL_SRC(VDENC_PIPE_MODE_SELECT, HevcBasicFeature) params.chromaType = m_hevcSeqParams->chroma_format_idc; params.wirelessSessionId = 0; params.randomAccess = !m_ref.IsLowDelay(); + params.bt2020RGB2YUV = m_hevcSeqParams->InputColorSpace == ECOLORSPACE_P2020; + params.rgbInputStudioRange = params.bt2020RGB2YUV ? m_hevcSeqParams->RGBInputStudioRange : 0; + params.convertedYUVStudioRange = params.bt2020RGB2YUV ? m_hevcSeqParams->ConvertedYUVStudioRange : 0; if (m_captureModeEnable) { diff --git a/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_cmdpar.h b/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_cmdpar.h index b364cedfe1a..33c52176676 100644 --- a/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_cmdpar.h +++ b/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_cmdpar.h @@ -167,6 +167,9 @@ struct _MHW_PAR_T(VDENC_PIPE_MODE_SELECT) uint8_t wirelessSessionId = 0; uint8_t tailPointerReadFrequency = 0; uint8_t streamingBufferConfig = 0; + bool bt2020RGB2YUV = 0; + uint8_t rgbInputStudioRange = 0; + uint8_t convertedYUVStudioRange = 0; uint8_t VdencPipeModeSelectPar0 = 0; uint8_t VdencPipeModeSelectPar1 = 0; uint8_t VdencPipeModeSelectPar2 = 0;