* [FFmpeg-devel] [PATCH] checkasm/hevc_deblock: adjust RANDCLIP to clip after rng()
@ 2025-02-16 0:16 Stone Chen
0 siblings, 0 replies; only message in thread
From: Stone Chen @ 2025-02-16 0:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: nuomi2021, Stone Chen
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.stonechen@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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-16 0:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-16 0:16 [FFmpeg-devel] [PATCH] checkasm/hevc_deblock: adjust RANDCLIP to clip after rng() Stone Chen
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git