Re: [FFmpeg-devel] [PATCH v2 1/2] libswscale/tests: add floatimg_cmp test

2020-10-02 Thread Michael Niedermayer
On Mon, Sep 28, 2020 at 08:44:33PM -0700, mindm...@gmail.com wrote:
> From: Mark Reid 
> 
> changes since v1:
> - made into fate test
> - fixed c90 warnings
> - tests more intermediate formats 
> - tested on BE mips too
> 
> ---
>  libswscale/Makefile |   1 +
>  libswscale/tests/.gitignore |   1 +
>  libswscale/tests/floatimg_cmp.c | 296 
>  tests/fate/libswscale.mak   |   4 +
>  tests/ref/fate/sws-floatimg-cmp | 120 +
>  5 files changed, 422 insertions(+)

will apply patchset

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: PGP signature
___
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".

[FFmpeg-devel] [PATCH v2 1/2] libswscale/tests: add floatimg_cmp test

2020-09-28 Thread mindmark
From: Mark Reid 

changes since v1:
- made into fate test
- fixed c90 warnings
- tests more intermediate formats 
- tested on BE mips too

---
 libswscale/Makefile |   1 +
 libswscale/tests/.gitignore |   1 +
 libswscale/tests/floatimg_cmp.c | 296 
 tests/fate/libswscale.mak   |   4 +
 tests/ref/fate/sws-floatimg-cmp | 120 +
 5 files changed, 422 insertions(+)
 create mode 100644 libswscale/tests/floatimg_cmp.c
 create mode 100644 tests/ref/fate/sws-floatimg-cmp

diff --git a/libswscale/Makefile b/libswscale/Makefile
index 5e03e6fa0a..4b8f9de425 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -25,5 +25,6 @@ OBJS-$(CONFIG_SHARED)+= log2_tab.o
 SLIBOBJS-$(HAVE_GNU_WINDRES) += swscaleres.o
 
 TESTPROGS = colorspace  \
+floatimg_cmp\
 pixdesc_query   \
 swscale \
diff --git a/libswscale/tests/.gitignore b/libswscale/tests/.gitignore
index 1a26f038c4..c56abf0ee7 100644
--- a/libswscale/tests/.gitignore
+++ b/libswscale/tests/.gitignore
@@ -1,3 +1,4 @@
 /colorspace
+/floatimg_cmp
 /pixdesc_query
 /swscale
diff --git a/libswscale/tests/floatimg_cmp.c b/libswscale/tests/floatimg_cmp.c
new file mode 100644
index 00..5c67594fb6
--- /dev/null
+++ b/libswscale/tests/floatimg_cmp.c
@@ -0,0 +1,296 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "libavutil/avutil.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/intfloat.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/lfg.h"
+#include "libavutil/mem.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+
+#include "libswscale/swscale.h"
+
+#define DEFAULT_W 96
+#define DEFAULT_H 96
+
+static const enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_YUV444P16LE,
+AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_YUV444P9LE, AV_PIX_FMT_YUV444P10LE,
+AV_PIX_FMT_YUV444P12LE, AV_PIX_FMT_YUV444P14LE,
+AV_PIX_FMT_RGB24,  AV_PIX_FMT_BGR24,
+AV_PIX_FMT_RGBA,   AV_PIX_FMT_BGRA,
+AV_PIX_FMT_ARGB,   AV_PIX_FMT_ABGR,
+AV_PIX_FMT_0RGB,   AV_PIX_FMT_0BGR,
+AV_PIX_FMT_RGB0,   AV_PIX_FMT_BGR0,
+AV_PIX_FMT_RGB48LE,  AV_PIX_FMT_BGR48LE,
+AV_PIX_FMT_RGBA64LE, AV_PIX_FMT_BGRA64LE,
+AV_PIX_FMT_GBRP,   AV_PIX_FMT_GBRAP,
+AV_PIX_FMT_GBRP9LE,
+AV_PIX_FMT_GBRP10LE, AV_PIX_FMT_GBRAP10LE,
+AV_PIX_FMT_GBRP12LE, AV_PIX_FMT_GBRAP12LE,
+AV_PIX_FMT_GBRP14LE,
+AV_PIX_FMT_GBRP16LE,  AV_PIX_FMT_GBRAP16LE
+};
+
+const char *usage =  "floatimg_cmp -pixel_format  -size  
-ref \n";
+
+int main(int argc, char **argv)
+{
+enum AVPixelFormat inFormat = AV_PIX_FMT_NONE;
+enum AVPixelFormat dstFormat = AV_PIX_FMT_NONE;
+const AVPixFmtDescriptor *desc;
+uint8_t *ptr;
+uint32_t *in, *out;
+
+uint8_t *rgbIn[4]  = {NULL, NULL, NULL, NULL};
+uint8_t *rgbOut[4] = {NULL, NULL, NULL, NULL};
+int rgbStride[4];
+
+uint8_t *dst[4] = {NULL, NULL, NULL, NULL};
+int dstStride[4];
+
+int i, x, y, p, size, count;
+int res = -1;
+int w = -1;
+int h = -1;
+union av_intfloat32 v0, v1;
+
+double sum;
+float minimum, maximum, diff;
+
+struct SwsContext *sws = NULL;
+AVLFG rand;
+FILE *fp = NULL;
+
+for (i = 1; i < argc; i += 2) {
+if (argv[i][0] != '-' || i + 1 == argc)
+goto bad_option;
+if (!strcmp(argv[i], "-ref")) {
+fp = fopen(argv[i + 1], "rb");
+if (!fp) {
+fprintf(stderr, "could not open '%s'\n", argv[i + 1]);
+goto end;
+}
+} else if (!strcmp(argv[i], "-size")) {
+res = av_parse_video_size(&w, &h, argv[i + 1]);
+if (res < 0) {
+fprintf(stderr, "invalid video size %s\n",  argv[i + 1]);
+goto end;
+}
+} else if (!strcmp(argv[i], "-pixel_format")) {
+inFormat = av_get_pix_fmt(argv[i + 1]);
+if (inFormat == AV_PIX_FMT_NONE) {
+fprintf(stde