1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avcodec/hevc/pred_template: substitute out-of-picture samples with constrained intra pred

When the bottom-left (or top-right) reference samples cross the picture
edge, the part outside the picture was filled from the last in-picture
sample before the constrained_intra_pred substitution, which only runs up
to the picture edge. If that sample belongs to an inter CU, its raw value
stayed in the out-of-picture part instead of the substituted one
(8.4.4.2.2), and the prediction no longer matched the encoder or HM.

Seen with x265 at 1080p, 64x64 CTBs and constrained intra prediction:
TUs in the partial bottom CTB row next to inter CUs mismatch from there
on.
This commit is contained in:
Kieran Kunhya
2026-10-20 09:23:58 -04:00
committed by kierank
parent bf0e831606
commit a2ff5eb55f

View File

@@ -291,6 +291,14 @@ do { \
a = PIXEL_SPLAT_X4(left[-1]);
EXTEND_RIGHT_CIP(top, 0, size_max_x);
}
// Samples past the picture edge repeat the substituted last
// sample, not the one read before the substitution.
if (cand_bottom_left && bottom_left_size < size)
EXTEND(left + size + bottom_left_size, left[size + bottom_left_size - 1],
size - bottom_left_size);
if (cand_up_right && top_right_size < size)
EXTEND(top + size + top_right_size, top[size + top_right_size - 1],
size - top_right_size);
}
}
// Infer the unavailable samples