d3d12: max_frame_poc workaround for infinite GOPs

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26456>
This commit is contained in:
Sil Vilerino
2023-11-19 14:25:18 -05:00
committed by Marge Bot
parent c89766f416
commit 25e2a7544b

View File

@@ -718,6 +718,8 @@ d3d12_video_encoder_update_h264_gop_configuration(struct d3d12_video_encoder *pD
// So in that case, derive an artificial log2_max_pic_order_cnt_lsb_minus4
// to avoid unexpected wrapping
if (picture->seq.pic_order_cnt_type == 2u) {
if (GOPLength == 0) // Use max frame num to wrap on infinite GOPs
GOPLength = 1 << (picture->seq.log2_max_frame_num_minus4 + 4);
const uint32_t max_pic_order_cnt_lsb = 2 * GOPLength;
picture->seq.log2_max_pic_order_cnt_lsb_minus4 = std::max(0.0, std::ceil(std::log2(max_pic_order_cnt_lsb)) - 4);
assert(picture->seq.log2_max_pic_order_cnt_lsb_minus4 < UCHAR_MAX);