From: "Martin Storsjö" <martin@martin.st> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v3 2/3] checkasm: add hevc_deblock chroma test Date: Wed, 22 Mar 2023 11:04:58 +0200 (EET) Message-ID: <86f7951b-7433-78cd-d866-2e6b9d809e6c@martin.st> (raw) In-Reply-To: <20230322000710.47513-2-jdek@itanimul.li> On Wed, 22 Mar 2023, J. Dekker wrote: > Signed-off-by: J. Dekker <jdek@itanimul.li> > --- > > Added missing FATE target. > > tests/checkasm/Makefile | 2 +- > tests/checkasm/checkasm.c | 1 + > tests/checkasm/checkasm.h | 1 + > tests/checkasm/hevc_deblock.c | 87 +++++++++++++++++++++++++++++++++++ > tests/fate/checkasm.mak | 1 + > 5 files changed, 91 insertions(+), 1 deletion(-) > create mode 100644 tests/checkasm/hevc_deblock.c > > diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile > index a6f06c7007..3e62a22bd6 100644 > --- a/tests/checkasm/Makefile > +++ b/tests/checkasm/Makefile > @@ -28,7 +28,7 @@ AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuvdsp.o > AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o > AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o > AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o > -AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_idct.o hevc_sao.o hevc_pel.o > +AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o > AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o > AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o > AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o > diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c > index e96d84a7da..c2184d260d 100644 > --- a/tests/checkasm/checkasm.c > +++ b/tests/checkasm/checkasm.c > @@ -116,6 +116,7 @@ static const struct { > #endif > #if CONFIG_HEVC_DECODER > { "hevc_add_res", checkasm_check_hevc_add_res }, > + { "hevc_deblock", checkasm_check_hevc_deblock }, > { "hevc_idct", checkasm_check_hevc_idct }, > { "hevc_pel", checkasm_check_hevc_pel }, > { "hevc_sao", checkasm_check_hevc_sao }, > diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h > index 8744a81218..89c643e6a0 100644 > --- a/tests/checkasm/checkasm.h > +++ b/tests/checkasm/checkasm.h > @@ -60,6 +60,7 @@ void checkasm_check_h264dsp(void); > void checkasm_check_h264pred(void); > void checkasm_check_h264qpel(void); > void checkasm_check_hevc_add_res(void); > +void checkasm_check_hevc_deblock(void); > void checkasm_check_hevc_idct(void); > void checkasm_check_hevc_pel(void); > void checkasm_check_hevc_sao(void); > diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c > new file mode 100644 > index 0000000000..06c9c1969e > --- /dev/null > +++ b/tests/checkasm/hevc_deblock.c > @@ -0,0 +1,87 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with FFmpeg; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#include <string.h> > + > +#include "libavutil/intreadwrite.h" > +#include "libavutil/mem_internal.h" > + > +#include "libavcodec/avcodec.h" > +#include "libavcodec/hevcdsp.h" > + > +#include "checkasm.h" > + > +static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff }; > + > +#define SIZEOF_PIXEL ((bit_depth + 7) / 8) > +#define BUF_STRIDE (8 * 2) > +#define BUF_LINES (8) > +#define BUF_OFFSET (BUF_STRIDE * BUF_LINES) > +#define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2) This looks like it's at least plenty of space, although it leaves me a bit confused about the intended layout of the test buffer. The way I think about it is that we'd have our buffer to be e.g. a 8x8 square (or 16x16); then when we're deblocking vertically, we'd have BUF_OFFSET be (height/2)*stride, i.e. starting at the middle left side of the square. When deblocking horizontally, the start position can be (width/2), i.e at the center of the top edge of the square. The current version is acceptable though, but I don't quite get the intended layout/sizing here, other than "big enough". > + > +#define randomize_buffers(buf0, buf1, size) \ > + do { \ > + uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \ > + int k; \ > + for (k = 0; k < size; k += 4) { \ > + uint32_t r = rnd() & mask; \ > + AV_WN32A(buf0 + k, r); \ > + AV_WN32A(buf1 + k, r); \ > + } \ > + } while (0) > + > +static void check_deblock_chroma(HEVCDSPContext h, int bit_depth) > +{ > + int32_t tc[2] = { 1, 1 }; > + uint8_t no_p[2] = { 0, 0 }; > + uint8_t no_q[2] = { 0, 0 }; I think it might be good to check what we honor these flags too; either an exhaustive loop testing all combinations of 0/1 for the no_p/no_q flags, plus possibly some different values for tc - or at least maybe a couple tests with these flags/coefficients set to random combinations? > + LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]); > + LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]); > + > + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q); > + > + randomize_buffers(buf0, buf1, BUF_SIZE); > + if (check_func(h.hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma_%d", bit_depth)) { > + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + if (memcmp(buf0, buf1, BUF_SIZE)) > + fail(); > + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + } > + > + randomize_buffers(buf0, buf1, BUF_SIZE); > + if (check_func(h.hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma_%d", bit_depth)) { > + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + if (memcmp(buf0, buf1, BUF_SIZE)) > + fail(); > + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); > + } > +} I mentioned last time that pure random data isn't a very good input for deblocking tests, but I see that the hevc chroma deblocker doesn't compare pixel differences for deciding whether to deblock or not, so with that in mind, I guess this is sufficient. The current test is at least good enough for making sure we run through the code (for the non-functional test aspects, register clobbering etc) and makes sure we do some work so that we can do proper benchmarking. So I guess this is acceptable in this form, but with a suggestion to check more combinations of tc/no_p/no_c. // Martin _______________________________________________ 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:[~2023-03-22 9:05 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-21 18:35 [FFmpeg-devel] [PATCH 1/2] " J. Dekker 2023-03-21 18:35 ` [FFmpeg-devel] [PATCH v2 2/2] lavc/aarch64: add hevc deblock chroma 8-12bit J. Dekker 2023-03-21 20:30 ` Martin Storsjö 2023-03-22 0:07 ` [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: add clip N macro J. Dekker 2023-03-22 0:07 ` [FFmpeg-devel] [PATCH v3 2/3] checkasm: add hevc_deblock chroma test J. Dekker 2023-03-22 9:04 ` Martin Storsjö [this message] 2023-03-22 0:07 ` [FFmpeg-devel] [PATCH v3 3/3] lavc/aarch64: add hevc deblock chroma 8-12bit J. Dekker 2023-03-22 9:26 ` Martin Storsjö 2023-03-22 8:38 ` [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: add clip N macro 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=86f7951b-7433-78cd-d866-2e6b9d809e6c@martin.st \ --to=martin@martin.st \ --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