From: Teng, Jin Chung Date: Fri, 26 May 2023 05:54:47 +0000 (+0800) Subject: d3d12: HEVC Encode - Fix num_subregions_per_scanline rounding X-Git-Tag: upstream/23.3.3~7900 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a63a38aeafdfdbe05ff867dcb3cf18700016b4b9;p=platform%2Fupstream%2Fmesa.git d3d12: HEVC Encode - Fix num_subregions_per_scanline rounding num_subregions_per_scanline need to be round up Signed-off-by: Teng, Jin Chung Part-of: --- diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc_hevc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc_hevc.cpp index ad766f4..6680465 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc_hevc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc_hevc.cpp @@ -318,7 +318,7 @@ d3d12_video_encoder_negotiate_current_hevc_slices_configuration(struct d3d12_vid uint32_t subregion_block_pixel_size = pD3D12Enc->m_currentEncodeCapabilities.m_currentResolutionSupportCaps.SubregionBlockPixelsSize; uint32_t num_subregions_per_scanline = - pD3D12Enc->m_currentEncodeConfig.m_currentResolution.Width / subregion_block_pixel_size; + DIV_ROUND_UP(pD3D12Enc->m_currentEncodeConfig.m_currentResolution.Width, subregion_block_pixel_size); /* m_currentResolutionSupportCaps.SubregionBlockPixelsSize can be a multiple of MinCUSize to accomodate for HW requirements So, if the allowed subregion (slice) pixel size partition is bigger (a multiple) than the CTU size, we have to adjust @@ -334,7 +334,9 @@ d3d12_video_encoder_negotiate_current_hevc_slices_configuration(struct d3d12_vid uint32_t subregionsize_to_ctu_factor = pD3D12Enc->m_currentEncodeCapabilities.m_currentResolutionSupportCaps.SubregionBlockPixelsSize / minCUSize; - uint32_t num_subregions_per_slice = picture->slices_descriptors[0].num_ctu_in_slice / (subregionsize_to_ctu_factor*subregionsize_to_ctu_factor); + uint32_t num_subregions_per_slice = picture->slices_descriptors[0].num_ctu_in_slice + * pD3D12Enc->m_currentEncodeCapabilities.m_currentResolutionSupportCaps.SubregionBlockPixelsSize + / (subregionsize_to_ctu_factor * subregionsize_to_ctu_factor); bool bSliceAligned = ((num_subregions_per_slice % num_subregions_per_scanline) == 0);