react-native-vision-camera-spoof-detector 1.1.23 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +12 -0
- package/android/build.gradle +10 -9
- package/android/src/main/cpp/cpp-adapter.cpp +6 -3
- package/ios/HybridSpoofDetectorOutput.swift +112 -72
- package/package.json +1 -1
- package/android/src/main/cpp/CMakeLists.txt +0 -33
- package/android/src/main/cpp/FaceAntiSpoofJSI.cpp +0 -142
- package/android/src/main/cpp/FastYuvJni.cpp +0 -111
- package/android/src/main/cpp/fast_yuv.cpp +0 -342
- package/android/src/main/cpp/fast_yuv.h +0 -23
- package/android/src/main/cpp/libyuv/.clang-format +0 -6
- package/android/src/main/cpp/libyuv/.gn +0 -40
- package/android/src/main/cpp/libyuv/.vpython3 +0 -410
- package/android/src/main/cpp/libyuv/AUTHORS +0 -7
- package/android/src/main/cpp/libyuv/Android.bp +0 -202
- package/android/src/main/cpp/libyuv/Android.mk +0 -106
- package/android/src/main/cpp/libyuv/BUILD.gn +0 -490
- package/android/src/main/cpp/libyuv/CM_linux_packages.cmake +0 -70
- package/android/src/main/cpp/libyuv/CMakeLists.txt +0 -259
- package/android/src/main/cpp/libyuv/DEPS +0 -935
- package/android/src/main/cpp/libyuv/DIR_METADATA +0 -3
- package/android/src/main/cpp/libyuv/LICENSE +0 -29
- package/android/src/main/cpp/libyuv/OWNERS +0 -11
- package/android/src/main/cpp/libyuv/PATENTS +0 -24
- package/android/src/main/cpp/libyuv/PRESUBMIT.py +0 -65
- package/android/src/main/cpp/libyuv/README.chromium +0 -11
- package/android/src/main/cpp/libyuv/README.md +0 -19
- package/android/src/main/cpp/libyuv/build_overrides/build.gni +0 -60
- package/android/src/main/cpp/libyuv/build_overrides/gtest.gni +0 -19
- package/android/src/main/cpp/libyuv/build_overrides/partition_alloc.gni +0 -17
- package/android/src/main/cpp/libyuv/codereview.settings +0 -5
- package/android/src/main/cpp/libyuv/docs/deprecated_builds.md +0 -409
- package/android/src/main/cpp/libyuv/docs/environment_variables.md +0 -64
- package/android/src/main/cpp/libyuv/docs/feature_detection.md +0 -108
- package/android/src/main/cpp/libyuv/docs/filtering.md +0 -196
- package/android/src/main/cpp/libyuv/docs/formats.md +0 -208
- package/android/src/main/cpp/libyuv/docs/getting_started.md +0 -296
- package/android/src/main/cpp/libyuv/docs/rotation.md +0 -107
- package/android/src/main/cpp/libyuv/download_vs_toolchain.py +0 -29
- package/android/src/main/cpp/libyuv/include/libyuv/basic_types.h +0 -68
- package/android/src/main/cpp/libyuv/include/libyuv/compare.h +0 -111
- package/android/src/main/cpp/libyuv/include/libyuv/compare_row.h +0 -112
- package/android/src/main/cpp/libyuv/include/libyuv/convert.h +0 -1117
- package/android/src/main/cpp/libyuv/include/libyuv/convert_argb.h +0 -2335
- package/android/src/main/cpp/libyuv/include/libyuv/convert_from.h +0 -203
- package/android/src/main/cpp/libyuv/include/libyuv/convert_from_argb.h +0 -394
- package/android/src/main/cpp/libyuv/include/libyuv/cpu_id.h +0 -147
- package/android/src/main/cpp/libyuv/include/libyuv/cpu_support.h +0 -99
- package/android/src/main/cpp/libyuv/include/libyuv/loongson_intrinsics.h +0 -1949
- package/android/src/main/cpp/libyuv/include/libyuv/mjpeg_decoder.h +0 -195
- package/android/src/main/cpp/libyuv/include/libyuv/planar_functions.h +0 -1131
- package/android/src/main/cpp/libyuv/include/libyuv/rotate.h +0 -296
- package/android/src/main/cpp/libyuv/include/libyuv/rotate_argb.h +0 -37
- package/android/src/main/cpp/libyuv/include/libyuv/rotate_row.h +0 -265
- package/android/src/main/cpp/libyuv/include/libyuv/row.h +0 -6738
- package/android/src/main/cpp/libyuv/include/libyuv/row_sve.h +0 -2154
- package/android/src/main/cpp/libyuv/include/libyuv/scale.h +0 -336
- package/android/src/main/cpp/libyuv/include/libyuv/scale_argb.h +0 -76
- package/android/src/main/cpp/libyuv/include/libyuv/scale_rgb.h +0 -42
- package/android/src/main/cpp/libyuv/include/libyuv/scale_row.h +0 -1726
- package/android/src/main/cpp/libyuv/include/libyuv/scale_uv.h +0 -51
- package/android/src/main/cpp/libyuv/include/libyuv/version.h +0 -16
- package/android/src/main/cpp/libyuv/include/libyuv/video_common.h +0 -222
- package/android/src/main/cpp/libyuv/include/libyuv.h +0 -33
- package/android/src/main/cpp/libyuv/infra/config/OWNERS +0 -3
- package/android/src/main/cpp/libyuv/infra/config/PRESUBMIT.py +0 -17
- package/android/src/main/cpp/libyuv/infra/config/README.md +0 -2
- package/android/src/main/cpp/libyuv/infra/config/codereview.settings +0 -6
- package/android/src/main/cpp/libyuv/infra/config/commit-queue.cfg +0 -144
- package/android/src/main/cpp/libyuv/infra/config/cr-buildbucket.cfg +0 -1185
- package/android/src/main/cpp/libyuv/infra/config/luci-logdog.cfg +0 -9
- package/android/src/main/cpp/libyuv/infra/config/luci-milo.cfg +0 -246
- package/android/src/main/cpp/libyuv/infra/config/luci-scheduler.cfg +0 -385
- package/android/src/main/cpp/libyuv/infra/config/main.star +0 -402
- package/android/src/main/cpp/libyuv/infra/config/project.cfg +0 -16
- package/android/src/main/cpp/libyuv/infra/config/realms.cfg +0 -111
- package/android/src/main/cpp/libyuv/libyuv.gni +0 -34
- package/android/src/main/cpp/libyuv/libyuv.gyp +0 -149
- package/android/src/main/cpp/libyuv/libyuv.gypi +0 -87
- package/android/src/main/cpp/libyuv/linux.mk +0 -96
- package/android/src/main/cpp/libyuv/public.mk +0 -13
- package/android/src/main/cpp/libyuv/pylintrc +0 -49
- package/android/src/main/cpp/libyuv/riscv_script/prepare_toolchain_qemu.sh +0 -74
- package/android/src/main/cpp/libyuv/riscv_script/riscv-clang.cmake +0 -56
- package/android/src/main/cpp/libyuv/riscv_script/run_qemu.sh +0 -15
- package/android/src/main/cpp/libyuv/source/compare.cc +0 -435
- package/android/src/main/cpp/libyuv/source/compare_common.cc +0 -74
- package/android/src/main/cpp/libyuv/source/compare_gcc.cc +0 -362
- package/android/src/main/cpp/libyuv/source/compare_neon.cc +0 -96
- package/android/src/main/cpp/libyuv/source/compare_neon64.cc +0 -223
- package/android/src/main/cpp/libyuv/source/compare_win.cc +0 -241
- package/android/src/main/cpp/libyuv/source/convert.cc +0 -4746
- package/android/src/main/cpp/libyuv/source/convert_argb.cc +0 -9179
- package/android/src/main/cpp/libyuv/source/convert_from.cc +0 -866
- package/android/src/main/cpp/libyuv/source/convert_from_argb.cc +0 -3671
- package/android/src/main/cpp/libyuv/source/convert_jpeg.cc +0 -602
- package/android/src/main/cpp/libyuv/source/convert_to_argb.cc +0 -391
- package/android/src/main/cpp/libyuv/source/convert_to_i420.cc +0 -288
- package/android/src/main/cpp/libyuv/source/cpu_id.cc +0 -496
- package/android/src/main/cpp/libyuv/source/mjpeg_decoder.cc +0 -580
- package/android/src/main/cpp/libyuv/source/mjpeg_validate.cc +0 -71
- package/android/src/main/cpp/libyuv/source/planar_functions.cc +0 -5663
- package/android/src/main/cpp/libyuv/source/rotate.cc +0 -1241
- package/android/src/main/cpp/libyuv/source/rotate_any.cc +0 -76
- package/android/src/main/cpp/libyuv/source/rotate_argb.cc +0 -259
- package/android/src/main/cpp/libyuv/source/rotate_common.cc +0 -208
- package/android/src/main/cpp/libyuv/source/rotate_gcc.cc +0 -505
- package/android/src/main/cpp/libyuv/source/rotate_lsx.cc +0 -233
- package/android/src/main/cpp/libyuv/source/rotate_neon.cc +0 -219
- package/android/src/main/cpp/libyuv/source/rotate_neon64.cc +0 -273
- package/android/src/main/cpp/libyuv/source/rotate_sme.cc +0 -174
- package/android/src/main/cpp/libyuv/source/rotate_win.cc +0 -253
- package/android/src/main/cpp/libyuv/source/row_any.cc +0 -2519
- package/android/src/main/cpp/libyuv/source/row_common.cc +0 -4461
- package/android/src/main/cpp/libyuv/source/row_gcc.cc +0 -9570
- package/android/src/main/cpp/libyuv/source/row_lasx.cc +0 -2343
- package/android/src/main/cpp/libyuv/source/row_lsx.cc +0 -3030
- package/android/src/main/cpp/libyuv/source/row_neon.cc +0 -4026
- package/android/src/main/cpp/libyuv/source/row_neon64.cc +0 -5617
- package/android/src/main/cpp/libyuv/source/row_rvv.cc +0 -2599
- package/android/src/main/cpp/libyuv/source/row_sme.cc +0 -1183
- package/android/src/main/cpp/libyuv/source/row_sve.cc +0 -1088
- package/android/src/main/cpp/libyuv/source/row_win.cc +0 -6453
- package/android/src/main/cpp/libyuv/source/scale.cc +0 -2710
- package/android/src/main/cpp/libyuv/source/scale_any.cc +0 -991
- package/android/src/main/cpp/libyuv/source/scale_argb.cc +0 -1158
- package/android/src/main/cpp/libyuv/source/scale_common.cc +0 -1977
- package/android/src/main/cpp/libyuv/source/scale_gcc.cc +0 -2947
- package/android/src/main/cpp/libyuv/source/scale_lsx.cc +0 -739
- package/android/src/main/cpp/libyuv/source/scale_neon.cc +0 -1449
- package/android/src/main/cpp/libyuv/source/scale_neon64.cc +0 -1552
- package/android/src/main/cpp/libyuv/source/scale_rgb.cc +0 -82
- package/android/src/main/cpp/libyuv/source/scale_rvv.cc +0 -1971
- package/android/src/main/cpp/libyuv/source/scale_sme.cc +0 -555
- package/android/src/main/cpp/libyuv/source/scale_uv.cc +0 -1159
- package/android/src/main/cpp/libyuv/source/scale_win.cc +0 -1392
- package/android/src/main/cpp/libyuv/source/test.sh +0 -35
- package/android/src/main/cpp/libyuv/source/video_common.cc +0 -62
- package/android/src/main/cpp/libyuv/tools_libyuv/OWNERS +0 -4
- package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/roll_deps.py +0 -931
- package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/roll_deps_test.py +0 -164
- package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS +0 -21
- package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.new +0 -13
- package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old +0 -13
- package/android/src/main/cpp/libyuv/tools_libyuv/get_landmines.py +0 -38
- package/android/src/main/cpp/libyuv/tools_libyuv/msan/OWNERS +0 -3
- package/android/src/main/cpp/libyuv/tools_libyuv/msan/blacklist.txt +0 -9
- package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/OWNERS +0 -3
- package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/blacklist.txt +0 -15
- package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/vptr_blacklist.txt +0 -25
- package/android/src/main/cpp/libyuv/unit_test/basictypes_test.cc +0 -43
- package/android/src/main/cpp/libyuv/unit_test/color_test.cc +0 -848
- package/android/src/main/cpp/libyuv/unit_test/compare_test.cc +0 -739
- package/android/src/main/cpp/libyuv/unit_test/convert_argb_test.cc +0 -2867
- package/android/src/main/cpp/libyuv/unit_test/convert_test.cc +0 -2133
- package/android/src/main/cpp/libyuv/unit_test/cpu_test.cc +0 -427
- package/android/src/main/cpp/libyuv/unit_test/cpu_thread_test.cc +0 -63
- package/android/src/main/cpp/libyuv/unit_test/math_test.cc +0 -160
- package/android/src/main/cpp/libyuv/unit_test/planar_test.cc +0 -4731
- package/android/src/main/cpp/libyuv/unit_test/rotate_argb_test.cc +0 -334
- package/android/src/main/cpp/libyuv/unit_test/rotate_test.cc +0 -962
- package/android/src/main/cpp/libyuv/unit_test/scale_argb_test.cc +0 -590
- package/android/src/main/cpp/libyuv/unit_test/scale_plane_test.cc +0 -465
- package/android/src/main/cpp/libyuv/unit_test/scale_rgb_test.cc +0 -280
- package/android/src/main/cpp/libyuv/unit_test/scale_test.cc +0 -1135
- package/android/src/main/cpp/libyuv/unit_test/scale_uv_test.cc +0 -249
- package/android/src/main/cpp/libyuv/unit_test/testdata/arm_v7.txt +0 -12
- package/android/src/main/cpp/libyuv/unit_test/testdata/mips.txt +0 -7
- package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson2k.txt +0 -5
- package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson3.txt +0 -10
- package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson_mmi.txt +0 -7
- package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64.txt +0 -4
- package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv.txt +0 -4
- package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv_zvfh.txt +0 -4
- package/android/src/main/cpp/libyuv/unit_test/testdata/tegra3.txt +0 -23
- package/android/src/main/cpp/libyuv/unit_test/testdata/test0.jpg +0 -0
- package/android/src/main/cpp/libyuv/unit_test/testdata/test1.jpg +0 -0
- package/android/src/main/cpp/libyuv/unit_test/testdata/test2.jpg +0 -0
- package/android/src/main/cpp/libyuv/unit_test/testdata/test3.jpg +0 -0
- package/android/src/main/cpp/libyuv/unit_test/testdata/test4.jpg +0 -0
- package/android/src/main/cpp/libyuv/unit_test/unit_test.cc +0 -581
- package/android/src/main/cpp/libyuv/unit_test/unit_test.h +0 -232
- package/android/src/main/cpp/libyuv/unit_test/video_common_test.cc +0 -112
- package/android/src/main/cpp/libyuv/util/Makefile +0 -9
- package/android/src/main/cpp/libyuv/util/color.cc +0 -120
- package/android/src/main/cpp/libyuv/util/compare.cc +0 -67
- package/android/src/main/cpp/libyuv/util/cpuid.c +0 -211
- package/android/src/main/cpp/libyuv/util/i444tonv12_eg.cc +0 -28
- package/android/src/main/cpp/libyuv/util/psnr.cc +0 -291
- package/android/src/main/cpp/libyuv/util/psnr.h +0 -47
- package/android/src/main/cpp/libyuv/util/psnr_main.cc +0 -620
- package/android/src/main/cpp/libyuv/util/ssim.cc +0 -364
- package/android/src/main/cpp/libyuv/util/ssim.h +0 -38
- package/android/src/main/cpp/libyuv/util/yuvconstants.c +0 -114
- package/android/src/main/cpp/libyuv/util/yuvconvert.cc +0 -367
- package/android/src/main/cpp/libyuv/winarm.mk +0 -47
- package/android/src/main/java/com/faceantispoof/ByteBufferPool.kt +0 -68
- package/android/src/main/java/com/faceantispoof/FastYuv.kt +0 -51
- package/android/src/main/java/com/faceantispoof/YuvToFloatArrayConverter.kt +0 -584
- package/android/src/main/java/com/faceantispoof/YuvToRgbConverter.kt +0 -73
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2013 The LibYuv Project Authors. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed by a BSD-style license
|
|
5
|
-
* that can be found in the LICENSE file in the root of the source
|
|
6
|
-
* tree. An additional intellectual property rights grant can be found
|
|
7
|
-
* in the file PATENTS. All contributing project authors may
|
|
8
|
-
* be found in the AUTHORS file in the root of the source tree.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// Get PSNR or SSIM for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format
|
|
12
|
-
// To build: g++ -O3 -o psnr psnr.cc ssim.cc psnr_main.cc
|
|
13
|
-
// or VisualC: cl /Ox psnr.cc ssim.cc psnr_main.cc
|
|
14
|
-
//
|
|
15
|
-
// To enable OpenMP and SSE2
|
|
16
|
-
// gcc: g++ -msse2 -O3 -fopenmp -o psnr psnr.cc ssim.cc psnr_main.cc
|
|
17
|
-
// vc: cl /arch:SSE2 /Ox /openmp psnr.cc ssim.cc psnr_main.cc
|
|
18
|
-
//
|
|
19
|
-
// Usage: psnr org_seq rec_seq -s width height [-skip skip_org skip_rec]
|
|
20
|
-
|
|
21
|
-
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
22
|
-
#define _CRT_SECURE_NO_WARNINGS
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
|
-
#include <stddef.h>
|
|
26
|
-
#include <stdio.h>
|
|
27
|
-
#include <stdlib.h>
|
|
28
|
-
#include <string.h>
|
|
29
|
-
#ifdef _OPENMP
|
|
30
|
-
#include <omp.h>
|
|
31
|
-
#endif
|
|
32
|
-
|
|
33
|
-
#include "./psnr.h"
|
|
34
|
-
#include "./ssim.h"
|
|
35
|
-
#ifdef HAVE_JPEG
|
|
36
|
-
#include "libyuv/compare.h"
|
|
37
|
-
#include "libyuv/convert.h"
|
|
38
|
-
#endif
|
|
39
|
-
|
|
40
|
-
struct metric {
|
|
41
|
-
double y, u, v, all;
|
|
42
|
-
double min_y, min_u, min_v, min_all;
|
|
43
|
-
double global_y, global_u, global_v, global_all;
|
|
44
|
-
int min_frame;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// options
|
|
48
|
-
bool verbose = false;
|
|
49
|
-
bool quiet = false;
|
|
50
|
-
bool show_name = false;
|
|
51
|
-
bool do_swap_uv = false;
|
|
52
|
-
bool do_psnr = false;
|
|
53
|
-
bool do_ssim = false;
|
|
54
|
-
bool do_mse = false;
|
|
55
|
-
bool do_lssim = false;
|
|
56
|
-
int image_width = 0, image_height = 0;
|
|
57
|
-
int fileindex_org = 0; // argv argument contains the source file name.
|
|
58
|
-
int fileindex_rec = 0; // argv argument contains the destination file name.
|
|
59
|
-
int num_rec = 0;
|
|
60
|
-
int num_skip_org = 0;
|
|
61
|
-
int num_skip_rec = 0;
|
|
62
|
-
int num_frames = 0;
|
|
63
|
-
#ifdef _OPENMP
|
|
64
|
-
int num_threads = 0;
|
|
65
|
-
#endif
|
|
66
|
-
|
|
67
|
-
// Parse PYUV format. ie name.1920x800_24Hz_P420.yuv
|
|
68
|
-
static bool ExtractResolutionFromFilename(const char* name,
|
|
69
|
-
int* width_ptr,
|
|
70
|
-
int* height_ptr) {
|
|
71
|
-
// Isolate the .width_height. section of the filename by searching for a
|
|
72
|
-
// dot or underscore followed by a digit.
|
|
73
|
-
for (int i = 0; name[i]; ++i) {
|
|
74
|
-
if ((name[i] == '.' || name[i] == '_') && name[i + 1] >= '0' &&
|
|
75
|
-
name[i + 1] <= '9') {
|
|
76
|
-
int n = sscanf(name + i + 1, "%dx%d", width_ptr, height_ptr); // NOLINT
|
|
77
|
-
if (2 == n) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
#ifdef HAVE_JPEG
|
|
84
|
-
// Try parsing file as a jpeg.
|
|
85
|
-
FILE* const file_org = fopen(name, "rb");
|
|
86
|
-
if (file_org == NULL) {
|
|
87
|
-
fprintf(stderr, "Cannot open %s\n", name);
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
fseek(file_org, 0, SEEK_END);
|
|
91
|
-
size_t total_size = ftell(file_org);
|
|
92
|
-
fseek(file_org, 0, SEEK_SET);
|
|
93
|
-
uint8_t* const ch_org = new uint8_t[total_size];
|
|
94
|
-
memset(ch_org, 0, total_size);
|
|
95
|
-
size_t bytes_org = fread(ch_org, sizeof(uint8_t), total_size, file_org);
|
|
96
|
-
fclose(file_org);
|
|
97
|
-
if (bytes_org == total_size) {
|
|
98
|
-
if (0 == libyuv::MJPGSize(ch_org, total_size, width_ptr, height_ptr)) {
|
|
99
|
-
delete[] ch_org;
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
delete[] ch_org;
|
|
104
|
-
#endif // HAVE_JPEG
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// MSE = Mean Square Error
|
|
109
|
-
static double GetMSE(double sse, double size) {
|
|
110
|
-
return sse / size;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
static void PrintHelp(const char* program) {
|
|
114
|
-
printf("%s [-options] org_seq rec_seq [rec_seq2.. etc]\n", program);
|
|
115
|
-
#ifdef HAVE_JPEG
|
|
116
|
-
printf("jpeg or raw YUV 420 supported.\n");
|
|
117
|
-
#endif
|
|
118
|
-
printf("options:\n");
|
|
119
|
-
printf(
|
|
120
|
-
" -s <width> <height> .... specify YUV size, mandatory if none of the "
|
|
121
|
-
"sequences have the\n");
|
|
122
|
-
printf(
|
|
123
|
-
" resolution embedded in their filename (ie. "
|
|
124
|
-
"name.1920x800_24Hz_P420.yuv)\n");
|
|
125
|
-
printf(" -psnr .................. compute PSNR (default)\n");
|
|
126
|
-
printf(" -ssim .................. compute SSIM\n");
|
|
127
|
-
printf(" -mse ................... compute MSE\n");
|
|
128
|
-
printf(" -swap .................. Swap U and V plane\n");
|
|
129
|
-
printf(" -skip <org> <rec> ...... Number of frame to skip of org and rec\n");
|
|
130
|
-
printf(" -frames <num> .......... Number of frames to compare\n");
|
|
131
|
-
#ifdef _OPENMP
|
|
132
|
-
printf(" -t <num> ............... Number of threads\n");
|
|
133
|
-
#endif
|
|
134
|
-
printf(" -n ..................... Show file name\n");
|
|
135
|
-
printf(" -v ..................... verbose++\n");
|
|
136
|
-
printf(" -q ..................... quiet\n");
|
|
137
|
-
printf(" -h ..................... this help\n");
|
|
138
|
-
exit(0);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
static void ParseOptions(int argc, const char* argv[]) {
|
|
142
|
-
if (argc <= 1) {
|
|
143
|
-
PrintHelp(argv[0]);
|
|
144
|
-
}
|
|
145
|
-
for (int c = 1; c < argc; ++c) {
|
|
146
|
-
if (!strcmp(argv[c], "-v")) {
|
|
147
|
-
verbose = true;
|
|
148
|
-
} else if (!strcmp(argv[c], "-q")) {
|
|
149
|
-
quiet = true;
|
|
150
|
-
} else if (!strcmp(argv[c], "-n")) {
|
|
151
|
-
show_name = true;
|
|
152
|
-
} else if (!strcmp(argv[c], "-psnr")) {
|
|
153
|
-
do_psnr = true;
|
|
154
|
-
} else if (!strcmp(argv[c], "-mse")) {
|
|
155
|
-
do_mse = true;
|
|
156
|
-
} else if (!strcmp(argv[c], "-ssim")) {
|
|
157
|
-
do_ssim = true;
|
|
158
|
-
} else if (!strcmp(argv[c], "-lssim")) {
|
|
159
|
-
do_ssim = true;
|
|
160
|
-
do_lssim = true;
|
|
161
|
-
} else if (!strcmp(argv[c], "-swap")) {
|
|
162
|
-
do_swap_uv = true;
|
|
163
|
-
} else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
|
|
164
|
-
PrintHelp(argv[0]);
|
|
165
|
-
} else if (!strcmp(argv[c], "-s") && c + 2 < argc) {
|
|
166
|
-
image_width = atoi(argv[++c]); // NOLINT
|
|
167
|
-
image_height = atoi(argv[++c]); // NOLINT
|
|
168
|
-
} else if (!strcmp(argv[c], "-skip") && c + 2 < argc) {
|
|
169
|
-
num_skip_org = atoi(argv[++c]); // NOLINT
|
|
170
|
-
num_skip_rec = atoi(argv[++c]); // NOLINT
|
|
171
|
-
} else if (!strcmp(argv[c], "-frames") && c + 1 < argc) {
|
|
172
|
-
num_frames = atoi(argv[++c]); // NOLINT
|
|
173
|
-
#ifdef _OPENMP
|
|
174
|
-
} else if (!strcmp(argv[c], "-t") && c + 1 < argc) {
|
|
175
|
-
num_threads = atoi(argv[++c]); // NOLINT
|
|
176
|
-
#endif
|
|
177
|
-
} else if (argv[c][0] == '-') {
|
|
178
|
-
fprintf(stderr, "Unknown option. %s\n", argv[c]);
|
|
179
|
-
} else if (fileindex_org == 0) {
|
|
180
|
-
fileindex_org = c;
|
|
181
|
-
} else if (fileindex_rec == 0) {
|
|
182
|
-
fileindex_rec = c;
|
|
183
|
-
num_rec = 1;
|
|
184
|
-
} else {
|
|
185
|
-
++num_rec;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (fileindex_org == 0 || fileindex_rec == 0) {
|
|
189
|
-
fprintf(stderr, "Missing filenames\n");
|
|
190
|
-
PrintHelp(argv[0]);
|
|
191
|
-
}
|
|
192
|
-
if (num_skip_org < 0 || num_skip_rec < 0) {
|
|
193
|
-
fprintf(stderr, "Skipped frames incorrect\n");
|
|
194
|
-
PrintHelp(argv[0]);
|
|
195
|
-
}
|
|
196
|
-
if (num_frames < 0) {
|
|
197
|
-
fprintf(stderr, "Number of frames incorrect\n");
|
|
198
|
-
PrintHelp(argv[0]);
|
|
199
|
-
}
|
|
200
|
-
if (image_width == 0 || image_height == 0) {
|
|
201
|
-
int org_width, org_height;
|
|
202
|
-
int rec_width, rec_height;
|
|
203
|
-
bool org_res_avail = ExtractResolutionFromFilename(argv[fileindex_org],
|
|
204
|
-
&org_width, &org_height);
|
|
205
|
-
bool rec_res_avail = ExtractResolutionFromFilename(argv[fileindex_rec],
|
|
206
|
-
&rec_width, &rec_height);
|
|
207
|
-
if (org_res_avail) {
|
|
208
|
-
if (rec_res_avail) {
|
|
209
|
-
if ((org_width == rec_width) && (org_height == rec_height)) {
|
|
210
|
-
image_width = org_width;
|
|
211
|
-
image_height = org_height;
|
|
212
|
-
} else {
|
|
213
|
-
fprintf(stderr, "Sequences have different resolutions.\n");
|
|
214
|
-
PrintHelp(argv[0]);
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
image_width = org_width;
|
|
218
|
-
image_height = org_height;
|
|
219
|
-
}
|
|
220
|
-
} else if (rec_res_avail) {
|
|
221
|
-
image_width = rec_width;
|
|
222
|
-
image_height = rec_height;
|
|
223
|
-
} else {
|
|
224
|
-
fprintf(stderr, "Missing dimensions.\n");
|
|
225
|
-
PrintHelp(argv[0]);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
static bool UpdateMetrics(uint8_t* ch_org,
|
|
231
|
-
uint8_t* ch_rec,
|
|
232
|
-
const int y_size,
|
|
233
|
-
const int uv_size,
|
|
234
|
-
const size_t total_size,
|
|
235
|
-
int number_of_frames,
|
|
236
|
-
metric* cur_distortion_psnr,
|
|
237
|
-
metric* distorted_frame,
|
|
238
|
-
bool compute_psnr) {
|
|
239
|
-
const int uv_offset = (do_swap_uv ? uv_size : 0);
|
|
240
|
-
const uint8_t* const u_org = ch_org + y_size + uv_offset;
|
|
241
|
-
const uint8_t* const u_rec = ch_rec + y_size;
|
|
242
|
-
const uint8_t* const v_org = ch_org + y_size + (uv_size - uv_offset);
|
|
243
|
-
const uint8_t* const v_rec = ch_rec + y_size + uv_size;
|
|
244
|
-
if (compute_psnr) {
|
|
245
|
-
#ifdef HAVE_JPEG
|
|
246
|
-
double y_err = static_cast<double>(
|
|
247
|
-
libyuv::ComputeSumSquareError(ch_org, ch_rec, y_size));
|
|
248
|
-
double u_err = static_cast<double>(
|
|
249
|
-
libyuv::ComputeSumSquareError(u_org, u_rec, uv_size));
|
|
250
|
-
double v_err = static_cast<double>(
|
|
251
|
-
libyuv::ComputeSumSquareError(v_org, v_rec, uv_size));
|
|
252
|
-
#else
|
|
253
|
-
double y_err = ComputeSumSquareError(ch_org, ch_rec, y_size);
|
|
254
|
-
double u_err = ComputeSumSquareError(u_org, u_rec, uv_size);
|
|
255
|
-
double v_err = ComputeSumSquareError(v_org, v_rec, uv_size);
|
|
256
|
-
#endif
|
|
257
|
-
const double total_err = y_err + u_err + v_err;
|
|
258
|
-
cur_distortion_psnr->global_y += y_err;
|
|
259
|
-
cur_distortion_psnr->global_u += u_err;
|
|
260
|
-
cur_distortion_psnr->global_v += v_err;
|
|
261
|
-
cur_distortion_psnr->global_all += total_err;
|
|
262
|
-
distorted_frame->y = ComputePSNR(y_err, static_cast<double>(y_size));
|
|
263
|
-
distorted_frame->u = ComputePSNR(u_err, static_cast<double>(uv_size));
|
|
264
|
-
distorted_frame->v = ComputePSNR(v_err, static_cast<double>(uv_size));
|
|
265
|
-
distorted_frame->all =
|
|
266
|
-
ComputePSNR(total_err, static_cast<double>(total_size));
|
|
267
|
-
} else {
|
|
268
|
-
distorted_frame->y = CalcSSIM(ch_org, ch_rec, image_width, image_height);
|
|
269
|
-
distorted_frame->u =
|
|
270
|
-
CalcSSIM(u_org, u_rec, (image_width + 1) / 2, (image_height + 1) / 2);
|
|
271
|
-
distorted_frame->v =
|
|
272
|
-
CalcSSIM(v_org, v_rec, (image_width + 1) / 2, (image_height + 1) / 2);
|
|
273
|
-
distorted_frame->all =
|
|
274
|
-
(distorted_frame->y + distorted_frame->u + distorted_frame->v) /
|
|
275
|
-
total_size;
|
|
276
|
-
distorted_frame->y /= y_size;
|
|
277
|
-
distorted_frame->u /= uv_size;
|
|
278
|
-
distorted_frame->v /= uv_size;
|
|
279
|
-
|
|
280
|
-
if (do_lssim) {
|
|
281
|
-
distorted_frame->all = CalcLSSIM(distorted_frame->all);
|
|
282
|
-
distorted_frame->y = CalcLSSIM(distorted_frame->y);
|
|
283
|
-
distorted_frame->u = CalcLSSIM(distorted_frame->u);
|
|
284
|
-
distorted_frame->v = CalcLSSIM(distorted_frame->v);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
cur_distortion_psnr->y += distorted_frame->y;
|
|
289
|
-
cur_distortion_psnr->u += distorted_frame->u;
|
|
290
|
-
cur_distortion_psnr->v += distorted_frame->v;
|
|
291
|
-
cur_distortion_psnr->all += distorted_frame->all;
|
|
292
|
-
|
|
293
|
-
bool ismin = false;
|
|
294
|
-
if (distorted_frame->y < cur_distortion_psnr->min_y) {
|
|
295
|
-
cur_distortion_psnr->min_y = distorted_frame->y;
|
|
296
|
-
}
|
|
297
|
-
if (distorted_frame->u < cur_distortion_psnr->min_u) {
|
|
298
|
-
cur_distortion_psnr->min_u = distorted_frame->u;
|
|
299
|
-
}
|
|
300
|
-
if (distorted_frame->v < cur_distortion_psnr->min_v) {
|
|
301
|
-
cur_distortion_psnr->min_v = distorted_frame->v;
|
|
302
|
-
}
|
|
303
|
-
if (distorted_frame->all < cur_distortion_psnr->min_all) {
|
|
304
|
-
cur_distortion_psnr->min_all = distorted_frame->all;
|
|
305
|
-
cur_distortion_psnr->min_frame = number_of_frames;
|
|
306
|
-
ismin = true;
|
|
307
|
-
}
|
|
308
|
-
return ismin;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
int main(int argc, const char* argv[]) {
|
|
312
|
-
ParseOptions(argc, argv);
|
|
313
|
-
if (!do_psnr && !do_ssim) {
|
|
314
|
-
do_psnr = true;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
#ifdef _OPENMP
|
|
318
|
-
if (num_threads) {
|
|
319
|
-
omp_set_num_threads(num_threads);
|
|
320
|
-
}
|
|
321
|
-
if (verbose) {
|
|
322
|
-
printf("OpenMP %d procs\n", omp_get_num_procs());
|
|
323
|
-
}
|
|
324
|
-
#endif
|
|
325
|
-
// Open original file (first file argument)
|
|
326
|
-
FILE* const file_org = fopen(argv[fileindex_org], "rb");
|
|
327
|
-
if (file_org == NULL) {
|
|
328
|
-
fprintf(stderr, "Cannot open %s\n", argv[fileindex_org]);
|
|
329
|
-
exit(1);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Open all files to compare to
|
|
333
|
-
FILE** file_rec = new FILE*[num_rec];
|
|
334
|
-
memset(file_rec, 0, num_rec * sizeof(FILE*)); // NOLINT
|
|
335
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
336
|
-
file_rec[cur_rec] = fopen(argv[fileindex_rec + cur_rec], "rb");
|
|
337
|
-
if (file_rec[cur_rec] == NULL) {
|
|
338
|
-
fprintf(stderr, "Cannot open %s\n", argv[fileindex_rec + cur_rec]);
|
|
339
|
-
fclose(file_org);
|
|
340
|
-
for (int i = 0; i < cur_rec; ++i) {
|
|
341
|
-
fclose(file_rec[i]);
|
|
342
|
-
}
|
|
343
|
-
delete[] file_rec;
|
|
344
|
-
exit(1);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const int y_size = image_width * image_height;
|
|
349
|
-
const int uv_size = ((image_width + 1) / 2) * ((image_height + 1) / 2);
|
|
350
|
-
const size_t total_size = y_size + 2 * uv_size; // NOLINT
|
|
351
|
-
#if defined(_MSC_VER)
|
|
352
|
-
_fseeki64(
|
|
353
|
-
file_org,
|
|
354
|
-
static_cast<__int64>(num_skip_org) * static_cast<__int64>(total_size),
|
|
355
|
-
SEEK_SET);
|
|
356
|
-
#else
|
|
357
|
-
fseek(file_org, num_skip_org * total_size, SEEK_SET);
|
|
358
|
-
#endif
|
|
359
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
360
|
-
#if defined(_MSC_VER)
|
|
361
|
-
_fseeki64(
|
|
362
|
-
file_rec[cur_rec],
|
|
363
|
-
static_cast<__int64>(num_skip_rec) * static_cast<__int64>(total_size),
|
|
364
|
-
SEEK_SET);
|
|
365
|
-
#else
|
|
366
|
-
fseek(file_rec[cur_rec], num_skip_rec * total_size, SEEK_SET);
|
|
367
|
-
#endif
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
uint8_t* const ch_org = new uint8_t[total_size];
|
|
371
|
-
uint8_t* const ch_rec = new uint8_t[total_size];
|
|
372
|
-
if (ch_org == NULL || ch_rec == NULL) {
|
|
373
|
-
fprintf(stderr, "No memory available\n");
|
|
374
|
-
fclose(file_org);
|
|
375
|
-
for (int i = 0; i < num_rec; ++i) {
|
|
376
|
-
fclose(file_rec[i]);
|
|
377
|
-
}
|
|
378
|
-
delete[] ch_org;
|
|
379
|
-
delete[] ch_rec;
|
|
380
|
-
delete[] file_rec;
|
|
381
|
-
exit(1);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
metric* const distortion_psnr = new metric[num_rec];
|
|
385
|
-
metric* const distortion_ssim = new metric[num_rec];
|
|
386
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
387
|
-
metric* cur_distortion_psnr = &distortion_psnr[cur_rec];
|
|
388
|
-
cur_distortion_psnr->y = 0.0;
|
|
389
|
-
cur_distortion_psnr->u = 0.0;
|
|
390
|
-
cur_distortion_psnr->v = 0.0;
|
|
391
|
-
cur_distortion_psnr->all = 0.0;
|
|
392
|
-
cur_distortion_psnr->min_y = kMaxPSNR;
|
|
393
|
-
cur_distortion_psnr->min_u = kMaxPSNR;
|
|
394
|
-
cur_distortion_psnr->min_v = kMaxPSNR;
|
|
395
|
-
cur_distortion_psnr->min_all = kMaxPSNR;
|
|
396
|
-
cur_distortion_psnr->min_frame = 0;
|
|
397
|
-
cur_distortion_psnr->global_y = 0.0;
|
|
398
|
-
cur_distortion_psnr->global_u = 0.0;
|
|
399
|
-
cur_distortion_psnr->global_v = 0.0;
|
|
400
|
-
cur_distortion_psnr->global_all = 0.0;
|
|
401
|
-
distortion_ssim[cur_rec] = cur_distortion_psnr[cur_rec];
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
if (verbose) {
|
|
405
|
-
printf("Size: %dx%d\n", image_width, image_height);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (!quiet) {
|
|
409
|
-
printf("Frame");
|
|
410
|
-
if (do_psnr) {
|
|
411
|
-
printf("\t PSNR-Y \t PSNR-U \t PSNR-V \t PSNR-All \t Frame");
|
|
412
|
-
}
|
|
413
|
-
if (do_ssim) {
|
|
414
|
-
printf("\t SSIM-Y\t SSIM-U\t SSIM-V\t SSIM-All\t Frame");
|
|
415
|
-
}
|
|
416
|
-
if (show_name) {
|
|
417
|
-
printf("\tName\n");
|
|
418
|
-
} else {
|
|
419
|
-
printf("\n");
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
int number_of_frames;
|
|
424
|
-
for (number_of_frames = 0;; ++number_of_frames) {
|
|
425
|
-
if (num_frames && number_of_frames >= num_frames) {
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
size_t bytes_org = fread(ch_org, sizeof(uint8_t), total_size, file_org);
|
|
430
|
-
if (bytes_org < total_size) {
|
|
431
|
-
#ifdef HAVE_JPEG
|
|
432
|
-
// Try parsing file as a jpeg.
|
|
433
|
-
uint8_t* const ch_jpeg = new uint8_t[bytes_org];
|
|
434
|
-
memcpy(ch_jpeg, ch_org, bytes_org);
|
|
435
|
-
memset(ch_org, 0, total_size);
|
|
436
|
-
|
|
437
|
-
if (0 != libyuv::MJPGToI420(ch_jpeg, bytes_org, ch_org, image_width,
|
|
438
|
-
ch_org + y_size, (image_width + 1) / 2,
|
|
439
|
-
ch_org + y_size + uv_size,
|
|
440
|
-
(image_width + 1) / 2, image_width,
|
|
441
|
-
image_height, image_width, image_height)) {
|
|
442
|
-
delete[] ch_jpeg;
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
delete[] ch_jpeg;
|
|
446
|
-
#else
|
|
447
|
-
break;
|
|
448
|
-
#endif // HAVE_JPEG
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
452
|
-
size_t bytes_rec =
|
|
453
|
-
fread(ch_rec, sizeof(uint8_t), total_size, file_rec[cur_rec]);
|
|
454
|
-
if (bytes_rec < total_size) {
|
|
455
|
-
#ifdef HAVE_JPEG
|
|
456
|
-
// Try parsing file as a jpeg.
|
|
457
|
-
uint8_t* const ch_jpeg = new uint8_t[bytes_rec];
|
|
458
|
-
memcpy(ch_jpeg, ch_rec, bytes_rec);
|
|
459
|
-
memset(ch_rec, 0, total_size);
|
|
460
|
-
|
|
461
|
-
if (0 != libyuv::MJPGToI420(ch_jpeg, bytes_rec, ch_rec, image_width,
|
|
462
|
-
ch_rec + y_size, (image_width + 1) / 2,
|
|
463
|
-
ch_rec + y_size + uv_size,
|
|
464
|
-
(image_width + 1) / 2, image_width,
|
|
465
|
-
image_height, image_width, image_height)) {
|
|
466
|
-
delete[] ch_jpeg;
|
|
467
|
-
break;
|
|
468
|
-
}
|
|
469
|
-
delete[] ch_jpeg;
|
|
470
|
-
#else
|
|
471
|
-
break;
|
|
472
|
-
#endif // HAVE_JPEG
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
if (verbose) {
|
|
476
|
-
printf("%5d", number_of_frames);
|
|
477
|
-
}
|
|
478
|
-
if (do_psnr) {
|
|
479
|
-
metric distorted_frame = {};
|
|
480
|
-
metric* cur_distortion_psnr = &distortion_psnr[cur_rec];
|
|
481
|
-
bool ismin = UpdateMetrics(ch_org, ch_rec, y_size, uv_size, total_size,
|
|
482
|
-
number_of_frames, cur_distortion_psnr,
|
|
483
|
-
&distorted_frame, true);
|
|
484
|
-
if (verbose) {
|
|
485
|
-
printf("\t%10.6f", distorted_frame.y);
|
|
486
|
-
printf("\t%10.6f", distorted_frame.u);
|
|
487
|
-
printf("\t%10.6f", distorted_frame.v);
|
|
488
|
-
printf("\t%10.6f", distorted_frame.all);
|
|
489
|
-
printf("\t%5s", ismin ? "min" : "");
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
if (do_ssim) {
|
|
493
|
-
metric distorted_frame = {};
|
|
494
|
-
metric* cur_distortion_ssim = &distortion_ssim[cur_rec];
|
|
495
|
-
bool ismin = UpdateMetrics(ch_org, ch_rec, y_size, uv_size, total_size,
|
|
496
|
-
number_of_frames, cur_distortion_ssim,
|
|
497
|
-
&distorted_frame, false);
|
|
498
|
-
if (verbose) {
|
|
499
|
-
printf("\t%10.6f", distorted_frame.y);
|
|
500
|
-
printf("\t%10.6f", distorted_frame.u);
|
|
501
|
-
printf("\t%10.6f", distorted_frame.v);
|
|
502
|
-
printf("\t%10.6f", distorted_frame.all);
|
|
503
|
-
printf("\t%5s", ismin ? "min" : "");
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
if (verbose) {
|
|
507
|
-
if (show_name) {
|
|
508
|
-
printf("\t%s", argv[fileindex_rec + cur_rec]);
|
|
509
|
-
}
|
|
510
|
-
printf("\n");
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// Final PSNR computation.
|
|
516
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
517
|
-
metric* cur_distortion_psnr = &distortion_psnr[cur_rec];
|
|
518
|
-
metric* cur_distortion_ssim = &distortion_ssim[cur_rec];
|
|
519
|
-
if (number_of_frames > 0) {
|
|
520
|
-
const double norm = 1. / static_cast<double>(number_of_frames);
|
|
521
|
-
cur_distortion_psnr->y *= norm;
|
|
522
|
-
cur_distortion_psnr->u *= norm;
|
|
523
|
-
cur_distortion_psnr->v *= norm;
|
|
524
|
-
cur_distortion_psnr->all *= norm;
|
|
525
|
-
cur_distortion_ssim->y *= norm;
|
|
526
|
-
cur_distortion_ssim->u *= norm;
|
|
527
|
-
cur_distortion_ssim->v *= norm;
|
|
528
|
-
cur_distortion_ssim->all *= norm;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (do_psnr) {
|
|
532
|
-
const double global_psnr_y =
|
|
533
|
-
ComputePSNR(cur_distortion_psnr->global_y,
|
|
534
|
-
static_cast<double>(y_size) * number_of_frames);
|
|
535
|
-
const double global_psnr_u =
|
|
536
|
-
ComputePSNR(cur_distortion_psnr->global_u,
|
|
537
|
-
static_cast<double>(uv_size) * number_of_frames);
|
|
538
|
-
const double global_psnr_v =
|
|
539
|
-
ComputePSNR(cur_distortion_psnr->global_v,
|
|
540
|
-
static_cast<double>(uv_size) * number_of_frames);
|
|
541
|
-
const double global_psnr_all =
|
|
542
|
-
ComputePSNR(cur_distortion_psnr->global_all,
|
|
543
|
-
static_cast<double>(total_size) * number_of_frames);
|
|
544
|
-
printf("Global:\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d", global_psnr_y,
|
|
545
|
-
global_psnr_u, global_psnr_v, global_psnr_all, number_of_frames);
|
|
546
|
-
if (show_name) {
|
|
547
|
-
printf("\t%s", argv[fileindex_rec + cur_rec]);
|
|
548
|
-
}
|
|
549
|
-
printf("\n");
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
if (!quiet) {
|
|
553
|
-
printf("Avg:");
|
|
554
|
-
if (do_psnr) {
|
|
555
|
-
printf("\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d", cur_distortion_psnr->y,
|
|
556
|
-
cur_distortion_psnr->u, cur_distortion_psnr->v,
|
|
557
|
-
cur_distortion_psnr->all, number_of_frames);
|
|
558
|
-
}
|
|
559
|
-
if (do_ssim) {
|
|
560
|
-
printf("\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d", cur_distortion_ssim->y,
|
|
561
|
-
cur_distortion_ssim->u, cur_distortion_ssim->v,
|
|
562
|
-
cur_distortion_ssim->all, number_of_frames);
|
|
563
|
-
}
|
|
564
|
-
if (show_name) {
|
|
565
|
-
printf("\t%s", argv[fileindex_rec + cur_rec]);
|
|
566
|
-
}
|
|
567
|
-
printf("\n");
|
|
568
|
-
}
|
|
569
|
-
if (!quiet) {
|
|
570
|
-
printf("Min:");
|
|
571
|
-
if (do_psnr) {
|
|
572
|
-
printf("\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d",
|
|
573
|
-
cur_distortion_psnr->min_y, cur_distortion_psnr->min_u,
|
|
574
|
-
cur_distortion_psnr->min_v, cur_distortion_psnr->min_all,
|
|
575
|
-
cur_distortion_psnr->min_frame);
|
|
576
|
-
}
|
|
577
|
-
if (do_ssim) {
|
|
578
|
-
printf("\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d",
|
|
579
|
-
cur_distortion_ssim->min_y, cur_distortion_ssim->min_u,
|
|
580
|
-
cur_distortion_ssim->min_v, cur_distortion_ssim->min_all,
|
|
581
|
-
cur_distortion_ssim->min_frame);
|
|
582
|
-
}
|
|
583
|
-
if (show_name) {
|
|
584
|
-
printf("\t%s", argv[fileindex_rec + cur_rec]);
|
|
585
|
-
}
|
|
586
|
-
printf("\n");
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (do_mse) {
|
|
590
|
-
double global_mse_y =
|
|
591
|
-
GetMSE(cur_distortion_psnr->global_y,
|
|
592
|
-
static_cast<double>(y_size) * number_of_frames);
|
|
593
|
-
double global_mse_u =
|
|
594
|
-
GetMSE(cur_distortion_psnr->global_u,
|
|
595
|
-
static_cast<double>(uv_size) * number_of_frames);
|
|
596
|
-
double global_mse_v =
|
|
597
|
-
GetMSE(cur_distortion_psnr->global_v,
|
|
598
|
-
static_cast<double>(uv_size) * number_of_frames);
|
|
599
|
-
double global_mse_all =
|
|
600
|
-
GetMSE(cur_distortion_psnr->global_all,
|
|
601
|
-
static_cast<double>(total_size) * number_of_frames);
|
|
602
|
-
printf("MSE:\t%10.6f\t%10.6f\t%10.6f\t%10.6f\t%5d", global_mse_y,
|
|
603
|
-
global_mse_u, global_mse_v, global_mse_all, number_of_frames);
|
|
604
|
-
if (show_name) {
|
|
605
|
-
printf("\t%s", argv[fileindex_rec + cur_rec]);
|
|
606
|
-
}
|
|
607
|
-
printf("\n");
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
fclose(file_org);
|
|
611
|
-
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
|
612
|
-
fclose(file_rec[cur_rec]);
|
|
613
|
-
}
|
|
614
|
-
delete[] distortion_psnr;
|
|
615
|
-
delete[] distortion_ssim;
|
|
616
|
-
delete[] ch_org;
|
|
617
|
-
delete[] ch_rec;
|
|
618
|
-
delete[] file_rec;
|
|
619
|
-
return 0;
|
|
620
|
-
}
|