From 692d0b034df70336ead2561bcea90feb6c974217 Mon Sep 17 00:00:00 2001
From: huangli2018
Date: Tue, 22 Oct 2024 12:55:39 +0800
Subject: [PATCH] [Encode] Fix downscaledFieldHeightInMB4x align issue
Fix downscaledFieldHeightInMB4x align issue
---
.../agnostic/common/codec/hal/codechal_encode_avc.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp b/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp
index dc948a39a44..55b9587505d 100644
--- a/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp
+++ b/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp
@@ -7613,7 +7613,7 @@ MOS_STATUS CodechalEncodeAvcEnc::AllocateResourcesBrc()
if (bBrcDistortionBufferSupported)
{
// BRC Distortion Surface
- downscaledFieldHeightInMB4x = CODECHAL_GET_HEIGHT_IN_MACROBLOCKS((m_frameHeight + 1) >> 3);
+ downscaledFieldHeightInMB4x = CODECHAL_GET_HEIGHT_IN_MACROBLOCKS((m_frameHeight + 7) >> 3);
width = MOS_ALIGN_CEIL((m_downscaledWidthInMb4x << 3), 64);
height = MOS_ALIGN_CEIL((downscaledFieldHeightInMB4x << 2), 8) << 1;
@@ -7778,7 +7778,7 @@ MOS_STATUS CodechalEncodeAvcEnc::AllocateResourcesMbBrc()
MOS_ZeroMemory(&lockFlagsWriteOnly, sizeof(MOS_LOCK_PARAMS));
lockFlagsWriteOnly.WriteOnly = 1;
- uint32_t downscaledFieldHeightInMB4x = CODECHAL_GET_HEIGHT_IN_MACROBLOCKS((m_frameHeight + 1) >> 3);
+ uint32_t downscaledFieldHeightInMB4x = CODECHAL_GET_HEIGHT_IN_MACROBLOCKS((m_frameHeight + 7) >> 3);
// Mb QP Surface
if (Mos_ResourceIsNull(&BrcBuffers.sBrcMbQpBuffer.OsResource))