From 0ac8dd3bae85a373b824934784c9903ddd65f0b7 Mon Sep 17 00:00:00 2001 From: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> Date: Mon, 6 May 2024 08:09:23 -0400 Subject: [PATCH] * rocDecode: Set the correct surface format for high bit depths. (#339) - No functional changes as surface format does not affect the actual allocation of the VA surface in this call due to IHV specific implementation. The app still needs to set the format correctly. Co-authored-by: Aryan Salmanpour [ROCm/rocdecode commit: 21ae1d010af29786ad94cb582216234f96c2a4c3] --- .../src/rocdecode/vaapi/vaapi_videodecoder.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 5d654492f6..65c4d3ca54 100644 --- a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -168,13 +168,19 @@ rocDecStatus VaapiVideoDecoder::CreateSurfaces() { return ROCDEC_INVALID_PARAMETER; } va_surface_ids_.resize(decoder_create_info_.num_decode_surfaces); - uint8_t surface_format; + uint32_t surface_format; switch (decoder_create_info_.chroma_format) { case rocDecVideoChromaFormat_Monochrome: surface_format = VA_RT_FORMAT_YUV400; break; case rocDecVideoChromaFormat_420: - surface_format = VA_RT_FORMAT_YUV420; + if (decoder_create_info_.bit_depth_minus_8 == 2) { + surface_format = VA_RT_FORMAT_YUV420_10; + } else if (decoder_create_info_.bit_depth_minus_8 == 4) { + surface_format = VA_RT_FORMAT_YUV420_12; + } else { + surface_format = VA_RT_FORMAT_YUV420; + } break; case rocDecVideoChromaFormat_422: surface_format = VA_RT_FORMAT_YUV422;