Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct
@ 2024-05-06 17:18 Ramiro Polla
  2024-05-06 17:46 ` Rémi Denis-Courmont
  0 siblings, 1 reply; 4+ messages in thread
From: Ramiro Polla @ 2024-05-06 17:18 UTC (permalink / raw)
  To: ffmpeg-devel

Reviewed-by: Martin Storsjö <martin@martin.st>
Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
---
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 tests/checkasm/fdctdsp.c  | 71 +++++++++++++++++++++++++++++++++++++++
 tests/fate/checkasm.mak   |  1 +
 5 files changed, 77 insertions(+)
 create mode 100644 tests/checkasm/fdctdsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 3e40aba2c3..b5bb885201 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -4,6 +4,7 @@ AVCODECOBJS-$(CONFIG_AC3DSP)            += ac3dsp.o
 AVCODECOBJS-$(CONFIG_AUDIODSP)          += audiodsp.o
 AVCODECOBJS-$(CONFIG_BLOCKDSP)          += blockdsp.o
 AVCODECOBJS-$(CONFIG_BSWAPDSP)          += bswapdsp.o
+AVCODECOBJS-$(CONFIG_FDCTDSP)           += fdctdsp.o
 AVCODECOBJS-$(CONFIG_FMTCONVERT)        += fmtconvert.o
 AVCODECOBJS-$(CONFIG_G722DSP)           += g722dsp.o
 AVCODECOBJS-$(CONFIG_H264CHROMA)        += h264chroma.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 9be32fc16e..e5d39e2116 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -106,6 +106,9 @@ static const struct {
     #if CONFIG_EXR_DECODER
         { "exrdsp", checkasm_check_exrdsp },
     #endif
+    #if CONFIG_FDCTDSP
+        { "fdctdsp", checkasm_check_fdctdsp },
+    #endif
     #if CONFIG_FLAC_DECODER
         { "flacdsp", checkasm_check_flacdsp },
     #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 173360af60..8807a37a43 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -85,6 +85,7 @@ void checkasm_check_blockdsp(void);
 void checkasm_check_bswapdsp(void);
 void checkasm_check_colorspace(void);
 void checkasm_check_exrdsp(void);
+void checkasm_check_fdctdsp(void);
 void checkasm_check_fixed_dsp(void);
 void checkasm_check_flacdsp(void);
 void checkasm_check_float_dsp(void);
diff --git a/tests/checkasm/fdctdsp.c b/tests/checkasm/fdctdsp.c
new file mode 100644
index 0000000000..c640a00656
--- /dev/null
+++ b/tests/checkasm/fdctdsp.c
@@ -0,0 +1,71 @@
+/*
+ * 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 "checkasm.h"
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/fdctdsp.h"
+
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
+
+static int int16_cmp_off_by_n(const int16_t *ref, const int16_t *test, size_t n, int accuracy)
+{
+    for (size_t i = 0; i < n; i++) {
+        if (abs(ref[i] - test[i]) > accuracy)
+            return 1;
+    }
+    return 0;
+}
+
+static void check_fdct(void)
+{
+    LOCAL_ALIGNED_16(int16_t, block0, [64]);
+    LOCAL_ALIGNED_16(int16_t, block1, [64]);
+
+    AVCodecContext avctx = {
+        .bits_per_raw_sample = 8,
+        .dct_algo = FF_DCT_AUTO,
+    };
+    FDCTDSPContext h;
+
+    ff_fdctdsp_init(&h, &avctx);
+
+    if (check_func(h.fdct, "fdct")) {
+        declare_func(void, int16_t *);
+        for (int i = 0; i < 64; i++) {
+            uint8_t r = rnd();
+            block0[i] = r;
+            block1[i] = r;
+        }
+        call_ref(block0);
+        call_new(block1);
+        if (int16_cmp_off_by_n(block0, block1, 64, 2))
+            fail();
+        bench_new(block1);
+    }
+}
+
+void checkasm_check_fdctdsp(void)
+{
+    check_fdct();
+    report("fdctdsp");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 4a8e312da9..9b5e2b0d98 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -8,6 +8,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp                                 \
                 fate-checkasm-blockdsp                                  \
                 fate-checkasm-bswapdsp                                  \
                 fate-checkasm-exrdsp                                    \
+                fate-checkasm-fdctdsp                                   \
                 fate-checkasm-fixed_dsp                                 \
                 fate-checkasm-flacdsp                                   \
                 fate-checkasm-float_dsp                                 \
-- 
2.30.2

_______________________________________________
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] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct
  2024-05-06 17:18 [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct Ramiro Polla
@ 2024-05-06 17:46 ` Rémi Denis-Courmont
  2024-05-11  8:32   ` Ramiro Polla
  0 siblings, 1 reply; 4+ messages in thread
From: Rémi Denis-Courmont @ 2024-05-06 17:46 UTC (permalink / raw)
  To: ffmpeg-devel

Le maanantaina 6. toukokuuta 2024, 20.18.39 EEST Ramiro Polla a écrit :
> Reviewed-by: Martin Storsjö <martin@martin.st>
> Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
> ---
>  tests/checkasm/Makefile   |  1 +
>  tests/checkasm/checkasm.c |  3 ++
>  tests/checkasm/checkasm.h |  1 +
>  tests/checkasm/fdctdsp.c  | 71 +++++++++++++++++++++++++++++++++++++++
>  tests/fate/checkasm.mak   |  1 +
>  5 files changed, 77 insertions(+)
>  create mode 100644 tests/checkasm/fdctdsp.c
> 
> diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
> index 3e40aba2c3..b5bb885201 100644
> --- a/tests/checkasm/Makefile
> +++ b/tests/checkasm/Makefile
> @@ -4,6 +4,7 @@ AVCODECOBJS-$(CONFIG_AC3DSP)            += ac3dsp.o
>  AVCODECOBJS-$(CONFIG_AUDIODSP)          += audiodsp.o
>  AVCODECOBJS-$(CONFIG_BLOCKDSP)          += blockdsp.o
>  AVCODECOBJS-$(CONFIG_BSWAPDSP)          += bswapdsp.o
> +AVCODECOBJS-$(CONFIG_FDCTDSP)           += fdctdsp.o
>  AVCODECOBJS-$(CONFIG_FMTCONVERT)        += fmtconvert.o
>  AVCODECOBJS-$(CONFIG_G722DSP)           += g722dsp.o
>  AVCODECOBJS-$(CONFIG_H264CHROMA)        += h264chroma.o
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index 9be32fc16e..e5d39e2116 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -106,6 +106,9 @@ static const struct {
>      #if CONFIG_EXR_DECODER
>          { "exrdsp", checkasm_check_exrdsp },
>      #endif
> +    #if CONFIG_FDCTDSP
> +        { "fdctdsp", checkasm_check_fdctdsp },
> +    #endif
>      #if CONFIG_FLAC_DECODER
>          { "flacdsp", checkasm_check_flacdsp },
>      #endif
> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> index 173360af60..8807a37a43 100644
> --- a/tests/checkasm/checkasm.h
> +++ b/tests/checkasm/checkasm.h
> @@ -85,6 +85,7 @@ void checkasm_check_blockdsp(void);
>  void checkasm_check_bswapdsp(void);
>  void checkasm_check_colorspace(void);
>  void checkasm_check_exrdsp(void);
> +void checkasm_check_fdctdsp(void);
>  void checkasm_check_fixed_dsp(void);
>  void checkasm_check_flacdsp(void);
>  void checkasm_check_float_dsp(void);
> diff --git a/tests/checkasm/fdctdsp.c b/tests/checkasm/fdctdsp.c
> new file mode 100644
> index 0000000000..c640a00656
> --- /dev/null
> +++ b/tests/checkasm/fdctdsp.c
> @@ -0,0 +1,71 @@
> +/*
> + * 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 "checkasm.h"
> +
> +#include "libavcodec/avcodec.h"
> +#include "libavcodec/fdctdsp.h"
> +
> +#include "libavutil/common.h"
> +#include "libavutil/internal.h"
> +#include "libavutil/mem_internal.h"
> +
> +static int int16_cmp_off_by_n(const int16_t *ref, const int16_t *test,
> size_t n, int accuracy) +{
> +    for (size_t i = 0; i < n; i++) {
> +        if (abs(ref[i] - test[i]) > accuracy)
> +            return 1;
> +    }
> +    return 0;
> +}
> +
> +static void check_fdct(void)
> +{
> +    LOCAL_ALIGNED_16(int16_t, block0, [64]);
> +    LOCAL_ALIGNED_16(int16_t, block1, [64]);
> +
> +    AVCodecContext avctx = {
> +        .bits_per_raw_sample = 8,
> +        .dct_algo = FF_DCT_AUTO,
> +    };
> +    FDCTDSPContext h;
> +
> +    ff_fdctdsp_init(&h, &avctx);
> +
> +    if (check_func(h.fdct, "fdct")) {
> +        declare_func(void, int16_t *);
> +        for (int i = 0; i < 64; i++) {
> +            uint8_t r = rnd();
> +            block0[i] = r;
> +            block1[i] = r;
> +        }
> +        call_ref(block0);
> +        call_new(block1);
> +        if (int16_cmp_off_by_n(block0, block1, 64, 2))
> +            fail();
> +        bench_new(block1);
> +    }
> +}
> +
> +void checkasm_check_fdctdsp(void)
> +{
> +    check_fdct();
> +    report("fdctdsp");
> +}
> diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
> index 4a8e312da9..9b5e2b0d98 100644
> --- a/tests/fate/checkasm.mak
> +++ b/tests/fate/checkasm.mak
> @@ -8,6 +8,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp                     
>            \ fate-checkasm-blockdsp                                  \
> fate-checkasm-bswapdsp                                  \
> fate-checkasm-exrdsp                                    \ +               
> fate-checkasm-fdctdsp                                   \
> fate-checkasm-fixed_dsp                                 \
> fate-checkasm-flacdsp                                   \
> fate-checkasm-float_dsp                                 \

No objections from me, but it would be nice and seemingly trivial to add 9 and 
10 bits while at it.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/



_______________________________________________
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] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct
  2024-05-06 17:46 ` Rémi Denis-Courmont
@ 2024-05-11  8:32   ` Ramiro Polla
  2024-05-11 20:15     ` Ramiro Polla
  0 siblings, 1 reply; 4+ messages in thread
From: Ramiro Polla @ 2024-05-11  8:32 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, May 6, 2024 at 7:46 PM Rémi Denis-Courmont <remi@remlab.net> wrote:
> Le maanantaina 6. toukokuuta 2024, 20.18.39 EEST Ramiro Polla a écrit :
> > Reviewed-by: Martin Storsjö <martin@martin.st>
> > Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
> > ---
> >  tests/checkasm/Makefile   |  1 +
> >  tests/checkasm/checkasm.c |  3 ++
> >  tests/checkasm/checkasm.h |  1 +
> >  tests/checkasm/fdctdsp.c  | 71 +++++++++++++++++++++++++++++++++++++++
> >  tests/fate/checkasm.mak   |  1 +
> >  5 files changed, 77 insertions(+)
> >  create mode 100644 tests/checkasm/fdctdsp.c
> >
> > diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
> > index 3e40aba2c3..b5bb885201 100644
> > --- a/tests/checkasm/Makefile
> > +++ b/tests/checkasm/Makefile
> > @@ -4,6 +4,7 @@ AVCODECOBJS-$(CONFIG_AC3DSP)            += ac3dsp.o
> >  AVCODECOBJS-$(CONFIG_AUDIODSP)          += audiodsp.o
> >  AVCODECOBJS-$(CONFIG_BLOCKDSP)          += blockdsp.o
> >  AVCODECOBJS-$(CONFIG_BSWAPDSP)          += bswapdsp.o
> > +AVCODECOBJS-$(CONFIG_FDCTDSP)           += fdctdsp.o
> >  AVCODECOBJS-$(CONFIG_FMTCONVERT)        += fmtconvert.o
> >  AVCODECOBJS-$(CONFIG_G722DSP)           += g722dsp.o
> >  AVCODECOBJS-$(CONFIG_H264CHROMA)        += h264chroma.o
> > diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> > index 9be32fc16e..e5d39e2116 100644
> > --- a/tests/checkasm/checkasm.c
> > +++ b/tests/checkasm/checkasm.c
> > @@ -106,6 +106,9 @@ static const struct {
> >      #if CONFIG_EXR_DECODER
> >          { "exrdsp", checkasm_check_exrdsp },
> >      #endif
> > +    #if CONFIG_FDCTDSP
> > +        { "fdctdsp", checkasm_check_fdctdsp },
> > +    #endif
> >      #if CONFIG_FLAC_DECODER
> >          { "flacdsp", checkasm_check_flacdsp },
> >      #endif
> > diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> > index 173360af60..8807a37a43 100644
> > --- a/tests/checkasm/checkasm.h
> > +++ b/tests/checkasm/checkasm.h
> > @@ -85,6 +85,7 @@ void checkasm_check_blockdsp(void);
> >  void checkasm_check_bswapdsp(void);
> >  void checkasm_check_colorspace(void);
> >  void checkasm_check_exrdsp(void);
> > +void checkasm_check_fdctdsp(void);
> >  void checkasm_check_fixed_dsp(void);
> >  void checkasm_check_flacdsp(void);
> >  void checkasm_check_float_dsp(void);
> > diff --git a/tests/checkasm/fdctdsp.c b/tests/checkasm/fdctdsp.c
> > new file mode 100644
> > index 0000000000..c640a00656
> > --- /dev/null
> > +++ b/tests/checkasm/fdctdsp.c
> > @@ -0,0 +1,71 @@
> > +/*
> > + * 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 "checkasm.h"
> > +
> > +#include "libavcodec/avcodec.h"
> > +#include "libavcodec/fdctdsp.h"
> > +
> > +#include "libavutil/common.h"
> > +#include "libavutil/internal.h"
> > +#include "libavutil/mem_internal.h"
> > +
> > +static int int16_cmp_off_by_n(const int16_t *ref, const int16_t *test,
> > size_t n, int accuracy) +{
> > +    for (size_t i = 0; i < n; i++) {
> > +        if (abs(ref[i] - test[i]) > accuracy)
> > +            return 1;
> > +    }
> > +    return 0;
> > +}
> > +
> > +static void check_fdct(void)
> > +{
> > +    LOCAL_ALIGNED_16(int16_t, block0, [64]);
> > +    LOCAL_ALIGNED_16(int16_t, block1, [64]);
> > +
> > +    AVCodecContext avctx = {
> > +        .bits_per_raw_sample = 8,
> > +        .dct_algo = FF_DCT_AUTO,
> > +    };
> > +    FDCTDSPContext h;
> > +
> > +    ff_fdctdsp_init(&h, &avctx);
> > +
> > +    if (check_func(h.fdct, "fdct")) {
> > +        declare_func(void, int16_t *);
> > +        for (int i = 0; i < 64; i++) {
> > +            uint8_t r = rnd();
> > +            block0[i] = r;
> > +            block1[i] = r;
> > +        }
> > +        call_ref(block0);
> > +        call_new(block1);
> > +        if (int16_cmp_off_by_n(block0, block1, 64, 2))
> > +            fail();
> > +        bench_new(block1);
> > +    }
> > +}
> > +
> > +void checkasm_check_fdctdsp(void)
> > +{
> > +    check_fdct();
> > +    report("fdctdsp");
> > +}
> > diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
> > index 4a8e312da9..9b5e2b0d98 100644
> > --- a/tests/fate/checkasm.mak
> > +++ b/tests/fate/checkasm.mak
> > @@ -8,6 +8,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp
> >            \ fate-checkasm-blockdsp                                  \
> > fate-checkasm-bswapdsp                                  \
> > fate-checkasm-exrdsp                                    \ +
> > fate-checkasm-fdctdsp                                   \
> > fate-checkasm-fixed_dsp                                 \
> > fate-checkasm-flacdsp                                   \
> > fate-checkasm-float_dsp                                 \
>
> No objections from me, but it would be nice and seemingly trivial to add 9 and
> 10 bits while at it.

Thanks. Pushed.

I'll add checks for the 9 and 10 bits later.
_______________________________________________
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] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct
  2024-05-11  8:32   ` Ramiro Polla
@ 2024-05-11 20:15     ` Ramiro Polla
  0 siblings, 0 replies; 4+ messages in thread
From: Ramiro Polla @ 2024-05-11 20:15 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Sat, May 11, 2024 at 10:32 AM Ramiro Polla <ramiro.polla@gmail.com> wrote:
> On Mon, May 6, 2024 at 7:46 PM Rémi Denis-Courmont <remi@remlab.net> wrote:
[...]
> > No objections from me, but it would be nice and seemingly trivial to add 9 and
> > 10 bits while at it.
[...]
> I'll add checks for the 9 and 10 bits later.

Apparently we have no assembly versions of 9 and 10 bits fdct, so
there's not much point in adding it to checkasm for the time being.
_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2024-05-11 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 17:18 [FFmpeg-devel] [PATCH v4 1/2] checkasm: add test for fdct Ramiro Polla
2024-05-06 17:46 ` Rémi Denis-Courmont
2024-05-11  8:32   ` Ramiro Polla
2024-05-11 20:15     ` Ramiro Polla

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