From: "Martin Storsjö" <martin@martin.st> To: ffmpeg-devel@ffmpeg.org Cc: "Martin Storsjö" <martin@martin.st>, "Alan Kelly" <alankelly@google.com> Subject: [FFmpeg-devel] [PATCH 2/2] checkasm: sw_scale: Reduce range of test data in the yuv2yuvX test to get closer to real data Date: Wed, 17 Aug 2022 23:31:47 +0300 Message-ID: <20220817203147.1957322-2-martin@martin.st> (raw) In-Reply-To: <20220817203147.1957322-1-martin@martin.st> This avoids overflows on some inputs in the x86 case, where the assembly version would clip/overflow differently from the C reference function. This doesn't seem to be a real issue with actual input data, but only with the previous fully random input data. This also makes the test produce a bit more realistic output pixel values, instead of having essentially all pixels clipped to either 0 or 255. Signed-off-by: Martin Storsjö <martin@martin.st> --- tests/checkasm/sw_scale.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index d72506ed86..89403da317 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -187,8 +187,16 @@ static void check_yuv2yuvX(int accurate) } *vFilterData; uint8_t d_val = rnd(); memset(dither, d_val, LARGEST_INPUT_SIZE); + randomize_buffers((uint8_t*)src_pixels, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int16_t)); randomize_buffers((uint8_t*)filter_coeff, LARGEST_FILTER * sizeof(int16_t)); + // Limit the range of the filter coefficients and intermediate + // pixel values, to avoid risk of clipping filter intermediates on x86. + for (i = 0; i < LARGEST_FILTER; i++) + filter_coeff[i] >>= 2; + for (i = 0; i < LARGEST_FILTER * LARGEST_INPUT_SIZE; i++) + src_pixels[i] >>= 2; + ctx = sws_alloc_context(); if (accurate) ctx->flags |= SWS_ACCURATE_RND; -- 2.25.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".
next prev parent reply other threads:[~2022-08-17 20:32 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-17 20:31 [FFmpeg-devel] [PATCH 1/2] checkasm: sw_scale: Fix the difference printing for approximate functions Martin Storsjö 2022-08-17 20:31 ` Martin Storsjö [this message] 2022-08-17 20:49 ` [FFmpeg-devel] [PATCH 2/2] checkasm: sw_scale: Reduce range of test data in the yuv2yuvX test to get closer to real data Ronald S. Bultje 2022-08-18 7:22 ` Martin Storsjö
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220817203147.1957322-2-martin@martin.st \ --to=martin@martin.st \ --cc=alankelly@google.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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