Increase chances of generating a strong deblock test case by changing RANDCLIP to generate the random value first before clipping.
RANDCLIP(x, diff) attempts to generate a random value such the distance to x is less than diff. This is also clipped to the pixel range. This is done by subtracting diff from x and adding a random value between 0 and 2*diff. However since this occurs after clipping, if e.g. x - diff is negative, then it's possible to exceed the diff. Instead generate the number first and then clip. Signed-off-by: Stone Chen <chen.stonec...@gmail.com> --- tests/checkasm/hevc_deblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c index 89dd8a308b..46faf34c2d 100644 --- a/tests/checkasm/hevc_deblock.c +++ b/tests/checkasm/hevc_deblock.c @@ -104,8 +104,8 @@ static void check_deblock_chroma(HEVCDSPContext *h, int bit_depth, int c) else \ *(uint16_t*)(&x) = z; \ } while (0) -#define RANDCLIP(x, diff) av_clip(GET(x) - (diff), 0, \ - (1 << (bit_depth)) - 1) + rnd() % FFMAX(2 * (diff), 1) +#define RANDCLIP(x, diff) av_clip(GET(x) - (diff) + rnd() % FFMAX(2 * (diff), 1), 0, \ + (1 << (bit_depth)) - 1) // NOTE: this function doesn't work 'correctly' in that it won't always choose // strong/strong or weak/weak, in most cases it tends to but will sometimes mix -- 2.47.1.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".