From 5044e65de356dd6df5c2c0c2e5d9bc69558b6492 Mon Sep 17 00:00:00 2001 From: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:06:51 -0500 Subject: [PATCH] Changed MD5 calculation of 10 bit to match reference MD5. (#127) * * rocDecode/HEVC: Changed MD5 calculation of 10 bit to match reference MD5. - Need to convert P010 YUV to little endian. * * rocDecode/HEVC: Convert to C++ type cast style. [ROCm/rocdecode commit: 5d45ac6d927d1b8335ded21b46a2d605876f7d83] --- .../rocdecode/utils/rocvideodecode/roc_video_dec.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/rocdecode/utils/rocvideodecode/roc_video_dec.cpp b/projects/rocdecode/utils/rocvideodecode/roc_video_dec.cpp index 6dd05bdc03..28404d6ba8 100644 --- a/projects/rocdecode/utils/rocvideodecode/roc_video_dec.cpp +++ b/projects/rocdecode/utils/rocvideodecode/roc_video_dec.cpp @@ -919,6 +919,15 @@ void RocVideoDecoder::UpdateMd5ForFrame(void *surf_mem, OutputSurfaceInfo *surf_ } int img_size = img_width * surf_info->bytes_per_pixel * (img_height + chroma_height_); + + // For 10 bit, convert from P010 to little endian to match reference decoder output + if (surf_info->bytes_per_pixel == 2) { + uint16_t *ptr = reinterpret_cast (stacked_ptr); + for (i = 0; i < img_size / 2; i++) { + ptr[i] = ptr[i] >> 6; + } + } + av_md5_update(md5_ctx_, stacked_ptr, img_size); if (hst_ptr && (surf_info->mem_type != OUT_SURFACE_MEM_HOST_COPIED)) {