diff --git a/src/gallium/frontends/mediafoundation/encode_h264.cpp b/src/gallium/frontends/mediafoundation/encode_h264.cpp index a3f50a16fa9..83851edcbd7 100644 --- a/src/gallium/frontends/mediafoundation/encode_h264.cpp +++ b/src/gallium/frontends/mediafoundation/encode_h264.cpp @@ -426,14 +426,17 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, uint32_t current_poc = pPicInfo->pic_order_cnt; // Validate frame number first - if( moveRegionFrameNum != current_poc ) + // Due to the way the move region frame number is generated, there can be cases where the frame number doesn't match the + // current POC. In those cases, we will log a warning but still try to use the move regions. + if( m_uiGopSize > 0 && ( moveRegionFrameNum % m_uiGopSize ) != current_poc ) { - debug_printf( "[dx12 hmft 0x%p] MoveRegions frame mismatch (MRFN=%u, cur POC=%u), ignoring\n", + debug_printf( "[dx12 hmft 0x%p] WARNING: MoveRegions frame mismatch (MRFN=%u, cur POC=%u, GOPSize=%u)\n", this, moveRegionFrameNum, - current_poc ); + current_poc, + m_uiGopSize ); } - else + { MOVEREGION_INFO *pMoveInfo = reinterpret_cast( m_pMoveRegionBlob.data() ); uint32_t maxRects = m_EncoderCapabilities.m_HWSupportMoveRects.bits.max_motion_hints; diff --git a/src/gallium/frontends/mediafoundation/encode_hevc.cpp b/src/gallium/frontends/mediafoundation/encode_hevc.cpp index 0c79bc5ea25..bfc3d29ae78 100644 --- a/src/gallium/frontends/mediafoundation/encode_hevc.cpp +++ b/src/gallium/frontends/mediafoundation/encode_hevc.cpp @@ -434,14 +434,17 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, uint32_t current_poc = pPicInfo->pic_order_cnt; // Validate frame number first - if( moveRegionFrameNum != current_poc ) + // Due to the way the move region frame number is generated, there can be cases where the frame number doesn't match the + // current POC. In those cases, we will log a warning but still try to use the move regions. + if( m_uiGopSize > 0 && ( moveRegionFrameNum % m_uiGopSize ) != current_poc ) { - debug_printf( "[dx12 hmft 0x%p] MoveRegions frame mismatch (MRFN=%u, cur POC=%u), ignoring\n", + debug_printf( "[dx12 hmft 0x%p] WARNING: MoveRegions frame mismatch (MRFN=%u, cur POC=%u, GOPSize=%u)\n", this, moveRegionFrameNum, - current_poc ); + current_poc, + m_uiGopSize ); } - else + { MOVEREGION_INFO *pMoveInfo = reinterpret_cast( m_pMoveRegionBlob.data() ); uint32_t maxRects = m_EncoderCapabilities.m_HWSupportMoveRects.bits.max_motion_hints;