aboutsummaryrefslogtreecommitdiffstats
path: root/libpostproc/tests/test_utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2025-05-04 16:29:19 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2025-05-05 19:13:29 +0200
commite5640e67d08c9b95632a88f3916edb4face4d265 (patch)
tree1009dc3fefbc10cc7ce43d4c5f64b477d2fd724d /libpostproc/tests/test_utils.c
parent9bf54cdb19f15e90e79fd4bcf6eebe3992e60b4f (diff)
downloadffmpeg-e5640e67d08c9b95632a88f3916edb4face4d265.tar.gz
libpostproc/tests: Factor ff_chksum() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libpostproc/tests/test_utils.c')
-rw-r--r--libpostproc/tests/test_utils.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libpostproc/tests/test_utils.c b/libpostproc/tests/test_utils.c
new file mode 100644
index 0000000000..f1642c0c81
--- /dev/null
+++ b/libpostproc/tests/test_utils.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2025 Michael Niedermayer
+ *
+ * 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 "libavutil/frame.h"
+#include "libavutil/adler32.h"
+#include "test_utils.h"
+
+int64_t ff_chksum(AVFrame *f)
+{
+ AVAdler a = 123;
+
+ for(int y=0; y<f->height; y++) {
+ a = av_adler32_update(a, &f->data[0][y*f->linesize[0]], f->width);
+ }
+ for(int y=0; y<(f->height+1)/2; y++) {
+ a = av_adler32_update(a, &f->data[1][y*f->linesize[1]], (f->width+1)/2);
+ a = av_adler32_update(a, &f->data[2][y*f->linesize[2]], (f->width+1)/2);
+ }
+
+ return a;
+}