From cb061d0378825bfa5c1ff6c75869c3f65d2f21bc Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Mon, 11 May 2026 18:53:06 -0700 Subject: [PATCH] Unittests use ASSERT instead of EXPECT Bug: libyuv:508639302 Change-Id: I22c35e08f3b6db1a656192877c1fb1bf4e96d6f5 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7838659 Reviewed-by: richard winterton Commit-Queue: Frank Barchard --- README.chromium | 2 +- include/libyuv/convert.h | 20 +- include/libyuv/convert_from_argb.h | 2 +- include/libyuv/row.h | 14 + include/libyuv/version.h | 2 +- source/convert.cc | 71 +- source/row_gcc.cc | 154 ++--- source/scale_gcc.cc | 55 +- unit_test/basictypes_test.cc | 32 +- unit_test/color_test.cc | 234 +++---- unit_test/compare_test.cc | 102 +-- unit_test/convert_argb_test.cc | 180 ++--- unit_test/convert_test.cc | 264 ++++---- unit_test/cpu_test.cc | 28 +- unit_test/cpu_thread_test.cc | 6 +- unit_test/math_test.cc | 72 +- unit_test/planar_test.cc | 1014 ++++++++++++++-------------- unit_test/rotate_argb_test.cc | 20 +- unit_test/rotate_test.cc | 26 +- unit_test/scale_argb_test.cc | 86 +-- unit_test/scale_plane_test.cc | 86 +-- unit_test/scale_rgb_test.cc | 24 +- unit_test/scale_test.cc | 52 +- unit_test/scale_uv_test.cc | 24 +- unit_test/video_common_test.cc | 136 ++-- 25 files changed, 1347 insertions(+), 1359 deletions(-) diff --git a/README.chromium b/README.chromium index 3e36b6704..92d44bc8c 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: https://chromium.googlesource.com/libyuv/libyuv/ -Version: 1938 +Version: 1937 Revision: DEPS License: BSD-3-Clause License File: LICENSE diff --git a/include/libyuv/convert.h b/include/libyuv/convert.h index 4ca5ed3a4..4c4f8f1f9 100644 --- a/include/libyuv/convert.h +++ b/include/libyuv/convert.h @@ -875,10 +875,10 @@ int BGRAToI420(const uint8_t* src_bgra, int width, int height); -// BGRA little endian (argb in memory) to I422. +// ABGR little endian (rgba in memory) to I420. LIBYUV_API -int BGRAToI422(const uint8_t* src_bgra, - int src_stride_bgra, +int ABGRToI420(const uint8_t* src_abgr, + int src_stride_abgr, uint8_t* dst_y, int dst_stride_y, uint8_t* dst_u, @@ -888,10 +888,10 @@ int BGRAToI422(const uint8_t* src_bgra, int width, int height); -// ABGR little endian (rgba in memory) to I420. +// BGRA little endian (argb in memory) to I422. LIBYUV_API -int ABGRToI420(const uint8_t* src_abgr, - int src_stride_abgr, +int BGRAToI422(const uint8_t* src_bgra, + int src_stride_bgra, uint8_t* dst_y, int dst_stride_y, uint8_t* dst_u, @@ -914,9 +914,9 @@ int ABGRToI422(const uint8_t* src_abgr, int width, int height); -// RGBA little endian (abgr in memory) to I420. +// RGBA little endian (abgr in memory) to I422. LIBYUV_API -int RGBAToI420(const uint8_t* src_rgba, +int RGBAToI422(const uint8_t* src_rgba, int src_stride_rgba, uint8_t* dst_y, int dst_stride_y, @@ -927,9 +927,9 @@ int RGBAToI420(const uint8_t* src_rgba, int width, int height); -// RGBA little endian (abgr in memory) to I422. +// RGBA little endian (abgr in memory) to I420. LIBYUV_API -int RGBAToI422(const uint8_t* src_rgba, +int RGBAToI420(const uint8_t* src_rgba, int src_stride_rgba, uint8_t* dst_y, int dst_stride_y, diff --git a/include/libyuv/convert_from_argb.h b/include/libyuv/convert_from_argb.h index 5786c5aae..d9fac50c9 100644 --- a/include/libyuv/convert_from_argb.h +++ b/include/libyuv/convert_from_argb.h @@ -471,7 +471,7 @@ int ARGBToUYVY(const uint8_t* src_argb, // RAW to NV21 with Matrix LIBYUV_API -int RAWToNV21Matrix(const uint8_t* src_raw, +int RGBToNV21Matrix(const uint8_t* src_raw, int src_stride_raw, uint8_t* dst_y, int dst_stride_y, diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 3072d8ff9..5a135133e 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -391,6 +391,8 @@ extern "C" { #if !defined(LIBYUV_DISABLE_X86) && defined(__x86_64__) && \ (defined(CLANG_HAS_AVX512)) #define HAS_I422TOARGBROW_AVX512BW +#define HAS_I444TOARGBROW_AVX512BW +#define HAS_I444TORGB24ROW_AVX512BW #define HAS_ARGBTOUV444ROW_AVX512BW #define HAS_ARGBTOUV444MATRIXROW_AVX512BW #define HAS_ARGBTOYROW_AVX512BW @@ -4602,6 +4604,12 @@ void I444ToARGBRow_AVX2(const uint8_t* y_buf, uint8_t* dst_argb, const struct YuvConstants* yuvconstants, int width); +void I444ToARGBRow_AVX512BW(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* dst_argb, + const struct YuvConstants* yuvconstants, + int width); void I444ToRGB24Row_SSSE3(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, @@ -4967,6 +4975,12 @@ void I444ToARGBRow_Any_AVX2(const uint8_t* y_buf, uint8_t* dst_ptr, const struct YuvConstants* yuvconstants, int width); +void I444ToARGBRow_Any_AVX512BW(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* dst_ptr, + const struct YuvConstants* yuvconstants, + int width); void I444ToRGB24Row_Any_AVX2(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 1a7808bc2..f384c1efb 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1938 +#define LIBYUV_VERSION 1937 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/convert.cc b/source/convert.cc index 079fb650c..003538885 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -2426,23 +2426,6 @@ int BGRAToI422(const uint8_t* src_bgra, width, height); } -// Convert ABGR to I420. -LIBYUV_API -int ABGRToI420(const uint8_t* src_abgr, - int src_stride_abgr, - uint8_t* dst_y, - int dst_stride_y, - uint8_t* dst_u, - int dst_stride_u, - uint8_t* dst_v, - int dst_stride_v, - int width, - int height) { - return ARGBToI420Matrix(src_abgr, src_stride_abgr, dst_y, dst_stride_y, dst_u, - dst_stride_u, dst_v, dst_stride_v, &kAbgrI601Constants, - width, height); -} - // Convert ABGR to I422. LIBYUV_API int ABGRToI422(const uint8_t* src_abgr, @@ -2460,23 +2443,6 @@ int ABGRToI422(const uint8_t* src_abgr, width, height); } -// Convert RGBA to I420. -LIBYUV_API -int RGBAToI420(const uint8_t* src_rgba, - int src_stride_rgba, - uint8_t* dst_y, - int dst_stride_y, - uint8_t* dst_u, - int dst_stride_u, - uint8_t* dst_v, - int dst_stride_v, - int width, - int height) { - return ARGBToI420Matrix(src_rgba, src_stride_rgba, dst_y, dst_stride_y, dst_u, - dst_stride_u, dst_v, dst_stride_v, &kRgbaI601Constants, - width, height); -} - // Convert RGBA to I422. LIBYUV_API int RGBAToI422(const uint8_t* src_rgba, @@ -2494,6 +2460,40 @@ int RGBAToI422(const uint8_t* src_rgba, width, height); } +// Convert ABGR to I420. +LIBYUV_API +int ABGRToI420(const uint8_t* src_abgr, + int src_stride_abgr, + uint8_t* dst_y, + int dst_stride_y, + uint8_t* dst_u, + int dst_stride_u, + uint8_t* dst_v, + int dst_stride_v, + int width, + int height) { + return ARGBToI420Matrix(src_abgr, src_stride_abgr, dst_y, dst_stride_y, dst_u, + dst_stride_u, dst_v, dst_stride_v, &kAbgrI601Constants, + width, height); +} + +// Convert RGBA to I420. +LIBYUV_API +int RGBAToI420(const uint8_t* src_rgba, + int src_stride_rgba, + uint8_t* dst_y, + int dst_stride_y, + uint8_t* dst_u, + int dst_stride_u, + uint8_t* dst_v, + int dst_stride_v, + int width, + int height) { + return ARGBToI420Matrix(src_rgba, src_stride_rgba, dst_y, dst_stride_y, dst_u, + dst_stride_u, dst_v, dst_stride_v, &kRgbaI601Constants, + width, height); +} + // Enabled if 1 pass is available #if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_LSX) || \ defined(HAS_RGB24TOYROW_RVV)) @@ -2582,7 +2582,6 @@ int RGB24ToI420(const uint8_t* src_rgb24, } #endif - if (!src_rgb24 || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { return -1; } @@ -3018,7 +3017,6 @@ int RAWToI420(const uint8_t* src_raw, } #endif - if (!src_raw || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { return -1; } @@ -4642,7 +4640,6 @@ int RAWToJ400(const uint8_t* src_raw, } #endif - if (!src_raw || !dst_yj || width <= 0 || height == 0) { return -1; } diff --git a/source/row_gcc.cc b/source/row_gcc.cc index 6b44ed666..c4c3107f3 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -268,11 +268,11 @@ static const uint32_t kPermdRAWToARGB_AVX512BW[16] = { void RGBToARGBRow_AVX512BW(const uint8_t* src_raw, uint8_t* dst_argb, const uint32_t* shuffler, int width) { asm volatile( - "vpternlogd $0xff,%%zmm6,%%zmm6,%%zmm6 \n" // 0xffffffff - "vpslld $0x18,%%zmm6,%%zmm6 \n" // 0xff000000 + "vpternlogd $0xff,%%zmm22,%%zmm22,%%zmm22 \n" // 0xffffffff + "vpslld $0x18,%%zmm22,%%zmm22 \n" // 0xff000000 "movabs $0xffffffffffff,%%rax \n" // 48 bytes mask "kmovq %%rax,%%k1 \n" - "vmovdqu32 %3,%%zmm5 \n" + "vmovdqu32 %3,%%zmm21 \n" "vbroadcasti32x4 %4,%%zmm4 \n" LABELALIGN // @@ -282,18 +282,18 @@ void RGBToARGBRow_AVX512BW(const uint8_t* src_raw, uint8_t* dst_argb, const uint "vmovdqu8 96(%0),%%zmm2%{%%k1%}%{z%} \n" "vmovdqu8 144(%0),%%zmm3%{%%k1%}%{z%} \n" "lea 192(%0),%0 \n" - "vpermd %%zmm0,%%zmm5,%%zmm0 \n" - "vpermd %%zmm1,%%zmm5,%%zmm1 \n" - "vpermd %%zmm2,%%zmm5,%%zmm2 \n" - "vpermd %%zmm3,%%zmm5,%%zmm3 \n" + "vpermd %%zmm0,%%zmm21,%%zmm0 \n" + "vpermd %%zmm1,%%zmm21,%%zmm1 \n" + "vpermd %%zmm2,%%zmm21,%%zmm2 \n" + "vpermd %%zmm3,%%zmm21,%%zmm3 \n" "vpshufb %%zmm4,%%zmm0,%%zmm0 \n" "vpshufb %%zmm4,%%zmm1,%%zmm1 \n" "vpshufb %%zmm4,%%zmm2,%%zmm2 \n" "vpshufb %%zmm4,%%zmm3,%%zmm3 \n" - "vpord %%zmm6,%%zmm0,%%zmm0 \n" - "vpord %%zmm6,%%zmm1,%%zmm1 \n" - "vpord %%zmm6,%%zmm2,%%zmm2 \n" - "vpord %%zmm6,%%zmm3,%%zmm3 \n" + "vpord %%zmm22,%%zmm0,%%zmm0 \n" + "vpord %%zmm22,%%zmm1,%%zmm1 \n" + "vpord %%zmm22,%%zmm2,%%zmm2 \n" + "vpord %%zmm22,%%zmm3,%%zmm3 \n" "vmovdqu32 %%zmm0,(%1) \n" "vmovdqu32 %%zmm1,0x40(%1) \n" "vmovdqu32 %%zmm2,0x80(%1) \n" @@ -307,7 +307,7 @@ void RGBToARGBRow_AVX512BW(const uint8_t* src_raw, uint8_t* dst_argb, const uint "+r"(width) // %2 : "m"(kPermdRAWToARGB_AVX512BW), // %3 "m"(*shuffler) // %4 - : "memory", "cc", "rax", "k1", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6"); + : "memory", "cc", "rax", "k1", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm21", "xmm22"); } void RAWToARGBRow_AVX512BW(const uint8_t* src_raw, uint8_t* dst_argb, int width) { @@ -1568,26 +1568,26 @@ void ARGBToYMatrixRow_AVX512BW(const uint8_t* src_argb, const struct ArgbConstants* c) { asm volatile( "vpternlogd $0xff,%%zmm16,%%zmm16,%%zmm16 \n" - "vpsllw $15,%%zmm16,%%zmm5 \n" - "vpacksswb %%zmm5,%%zmm5,%%zmm5 \n" + "vpsllw $15,%%zmm16,%%zmm21 \n" + "vpacksswb %%zmm21,%%zmm21,%%zmm21 \n" "vpsrlw $15,%%zmm16,%%zmm16 \n" // zmm16 = 1 "vbroadcasti64x4 0(%3),%%zmm4 \n" - "vbroadcasti64x4 0x60(%3),%%zmm7 \n" - "vpmaddubsw %%zmm5,%%zmm4,%%zmm6 \n" - "vpmaddwd %%zmm16,%%zmm6,%%zmm6 \n" - "vpackssdw %%zmm6,%%zmm6,%%zmm6 \n" - "vpsubw %%zmm6,%%zmm7,%%zmm7 \n" - "vmovups %4,%%zmm6 \n" + "vbroadcasti64x4 0x60(%3),%%zmm23 \n" + "vpmaddubsw %%zmm21,%%zmm4,%%zmm22 \n" + "vpmaddwd %%zmm16,%%zmm22,%%zmm22 \n" + "vpackssdw %%zmm22,%%zmm22,%%zmm22 \n" + "vpsubw %%zmm22,%%zmm23,%%zmm23 \n" + "vmovups %4,%%zmm22 \n" LABELALIGN "1: \n" "vmovups (%0),%%zmm0 \n" "vmovups 0x40(%0),%%zmm1 \n" "vmovups 0x80(%0),%%zmm2 \n" "vmovups 0xc0(%0),%%zmm3 \n" - "vpsubb %%zmm5,%%zmm0,%%zmm0 \n" - "vpsubb %%zmm5,%%zmm1,%%zmm1 \n" - "vpsubb %%zmm5,%%zmm2,%%zmm2 \n" - "vpsubb %%zmm5,%%zmm3,%%zmm3 \n" + "vpsubb %%zmm21,%%zmm0,%%zmm0 \n" + "vpsubb %%zmm21,%%zmm1,%%zmm1 \n" + "vpsubb %%zmm21,%%zmm2,%%zmm2 \n" + "vpsubb %%zmm21,%%zmm3,%%zmm3 \n" "vpmaddubsw %%zmm0,%%zmm4,%%zmm0 \n" "vpmaddubsw %%zmm1,%%zmm4,%%zmm1 \n" "vpmaddubsw %%zmm2,%%zmm4,%%zmm2 \n" @@ -1599,12 +1599,12 @@ void ARGBToYMatrixRow_AVX512BW(const uint8_t* src_argb, "vpmaddwd %%zmm16,%%zmm2,%%zmm2 \n" "vpmaddwd %%zmm16,%%zmm3,%%zmm3 \n" "vpackssdw %%zmm3,%%zmm2,%%zmm2 \n" - "vpaddw %%zmm7,%%zmm0,%%zmm0 \n" - "vpaddw %%zmm7,%%zmm2,%%zmm2 \n" + "vpaddw %%zmm23,%%zmm0,%%zmm0 \n" + "vpaddw %%zmm23,%%zmm2,%%zmm2 \n" "vpsrlw $0x8,%%zmm0,%%zmm0 \n" "vpsrlw $0x8,%%zmm2,%%zmm2 \n" "vpackuswb %%zmm2,%%zmm0,%%zmm0 \n" - "vpermd %%zmm0,%%zmm6,%%zmm0 \n" + "vpermd %%zmm0,%%zmm22,%%zmm0 \n" "vmovups %%zmm0,(%1) \n" "lea 0x40(%1),%1 \n" "sub $0x40,%2 \n" @@ -1615,8 +1615,8 @@ void ARGBToYMatrixRow_AVX512BW(const uint8_t* src_argb, "+r"(width) // %2 : "r"(c), // %3 "m"(kPermdARGBToY_AVX512BW) // %4 - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", - "xmm7", "xmm16"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm16", "xmm21", + "xmm22", "xmm23"); } #endif @@ -1773,8 +1773,8 @@ void ARGBToUV444MatrixRow_AVX512BW(const uint8_t* src_argb, "vbroadcasti64x4 0x20(%4),%%zmm3 \n" // kRGBToU "vbroadcasti64x4 0x40(%4),%%zmm4 \n" // kRGBToV "vpternlogd $0xff,%%zmm16,%%zmm16,%%zmm16 \n" // -1 - "vpsllw $15,%%zmm16,%%zmm5 \n" // 0x8000 - "vmovups %5,%%zmm7 \n" + "vpsllw $15,%%zmm16,%%zmm21 \n" // 0x8000 + "vmovups %5,%%zmm23 \n" "sub %1,%2 \n" LABELALIGN @@ -1782,45 +1782,45 @@ void ARGBToUV444MatrixRow_AVX512BW(const uint8_t* src_argb, "vmovups (%0),%%zmm0 \n" "vmovups 0x40(%0),%%zmm1 \n" "vmovups 0x80(%0),%%zmm2 \n" - "vmovups 0xc0(%0),%%zmm6 \n" + "vmovups 0xc0(%0),%%zmm22 \n" "vpmaddubsw %%zmm3,%%zmm0,%%zmm0 \n" "vpmaddubsw %%zmm3,%%zmm1,%%zmm1 \n" "vpmaddubsw %%zmm3,%%zmm2,%%zmm2 \n" - "vpmaddubsw %%zmm3,%%zmm6,%%zmm6 \n" + "vpmaddubsw %%zmm3,%%zmm22,%%zmm22 \n" "vpmaddwd %%zmm16,%%zmm0,%%zmm0 \n" "vpmaddwd %%zmm16,%%zmm1,%%zmm1 \n" "vpmaddwd %%zmm16,%%zmm2,%%zmm2 \n" - "vpmaddwd %%zmm16,%%zmm6,%%zmm6 \n" + "vpmaddwd %%zmm16,%%zmm22,%%zmm22 \n" "vpackssdw %%zmm1,%%zmm0,%%zmm0 \n" // mutates - "vpackssdw %%zmm6,%%zmm2,%%zmm2 \n" - "vpsubw %%zmm5,%%zmm0,%%zmm0 \n" - "vpsubw %%zmm5,%%zmm2,%%zmm2 \n" + "vpackssdw %%zmm22,%%zmm2,%%zmm2 \n" + "vpsubw %%zmm21,%%zmm0,%%zmm0 \n" + "vpsubw %%zmm21,%%zmm2,%%zmm2 \n" "vpsrlw $0x8,%%zmm0,%%zmm0 \n" "vpsrlw $0x8,%%zmm2,%%zmm2 \n" "vpackuswb %%zmm2,%%zmm0,%%zmm0 \n" // mutates - "vpermd %%zmm0,%%zmm7,%%zmm0 \n" // unmutate. + "vpermd %%zmm0,%%zmm23,%%zmm0 \n" // unmutate. "vmovups %%zmm0,(%1) \n" "vmovups (%0),%%zmm0 \n" "vmovups 0x40(%0),%%zmm1 \n" "vmovups 0x80(%0),%%zmm2 \n" - "vmovups 0xc0(%0),%%zmm6 \n" + "vmovups 0xc0(%0),%%zmm22 \n" "vpmaddubsw %%zmm4,%%zmm0,%%zmm0 \n" "vpmaddubsw %%zmm4,%%zmm1,%%zmm1 \n" "vpmaddubsw %%zmm4,%%zmm2,%%zmm2 \n" - "vpmaddubsw %%zmm4,%%zmm6,%%zmm6 \n" + "vpmaddubsw %%zmm4,%%zmm22,%%zmm22 \n" "vpmaddwd %%zmm16,%%zmm0,%%zmm0 \n" "vpmaddwd %%zmm16,%%zmm1,%%zmm1 \n" "vpmaddwd %%zmm16,%%zmm2,%%zmm2 \n" - "vpmaddwd %%zmm16,%%zmm6,%%zmm6 \n" + "vpmaddwd %%zmm16,%%zmm22,%%zmm22 \n" "vpackssdw %%zmm1,%%zmm0,%%zmm0 \n" // mutates - "vpackssdw %%zmm6,%%zmm2,%%zmm2 \n" - "vpsubw %%zmm5,%%zmm0,%%zmm0 \n" - "vpsubw %%zmm5,%%zmm2,%%zmm2 \n" + "vpackssdw %%zmm22,%%zmm2,%%zmm2 \n" + "vpsubw %%zmm21,%%zmm0,%%zmm0 \n" + "vpsubw %%zmm21,%%zmm2,%%zmm2 \n" "vpsrlw $0x8,%%zmm0,%%zmm0 \n" "vpsrlw $0x8,%%zmm2,%%zmm2 \n" "vpackuswb %%zmm2,%%zmm0,%%zmm0 \n" // mutates - "vpermd %%zmm0,%%zmm7,%%zmm0 \n" // unmutate. + "vpermd %%zmm0,%%zmm23,%%zmm0 \n" // unmutate. "vmovups %%zmm0,(%1,%2,1) \n" "lea 0x100(%0),%0 \n" "lea 0x40(%1),%1 \n" @@ -1837,8 +1837,8 @@ void ARGBToUV444MatrixRow_AVX512BW(const uint8_t* src_argb, #endif : "r"(c), // %4 "m"(kPermdARGBToY_AVX512BW) // %5 - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", - "xmm7", "xmm16"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm16", "xmm21", + "xmm22", "xmm23"); } #endif // HAS_ARGBTOUV444ROW_AVX512BW @@ -2233,11 +2233,11 @@ void ARGBToUVMatrixRow_AVX512BW(const uint8_t* src_argb, const struct ArgbConstants* c) { asm volatile( "vbroadcasti64x4 0x20(%5),%%zmm4 \n" // RGBToU - "vbroadcasti64x4 0x40(%5),%%zmm5 \n" // RGBToV + "vbroadcasti64x4 0x40(%5),%%zmm21 \n" // RGBToV "vpternlogd $0xff,%%zmm16,%%zmm16,%%zmm16 \n" - "vpabsb %%zmm16,%%zmm6 \n" // 0x0101 + "vpabsb %%zmm16,%%zmm22 \n" // 0x0101 "vpsllw $15,%%zmm16,%%zmm17 \n" // 0x8000 - "vbroadcasti64x4 %6,%%zmm7 \n" // kShuffleAARRGGBB + "vbroadcasti64x4 %6,%%zmm23 \n" // kShuffleAARRGGBB "vmovups %7,%%zmm18 \n" // kPermdARGBToY_AVX512BW "vmovups %8,%%zmm19 \n" // kPermdARGBToUV_AVX512BW "sub %1,%2 \n" @@ -2248,14 +2248,14 @@ void ARGBToUVMatrixRow_AVX512BW(const uint8_t* src_argb, "vmovups 0x40(%0),%%zmm1 \n" "vmovups 0x00(%0,%4,1),%%zmm2 \n" "vmovups 0x40(%0,%4,1),%%zmm3 \n" - "vpshufb %%zmm7,%%zmm0,%%zmm0 \n" // aarrggbb - "vpshufb %%zmm7,%%zmm1,%%zmm1 \n" - "vpshufb %%zmm7,%%zmm2,%%zmm2 \n" - "vpshufb %%zmm7,%%zmm3,%%zmm3 \n" - "vpmaddubsw %%zmm6,%%zmm0,%%zmm0 \n" // 32x2 -> 16x2 - "vpmaddubsw %%zmm6,%%zmm1,%%zmm1 \n" - "vpmaddubsw %%zmm6,%%zmm2,%%zmm2 \n" - "vpmaddubsw %%zmm6,%%zmm3,%%zmm3 \n" + "vpshufb %%zmm23,%%zmm0,%%zmm0 \n" // aarrggbb + "vpshufb %%zmm23,%%zmm1,%%zmm1 \n" + "vpshufb %%zmm23,%%zmm2,%%zmm2 \n" + "vpshufb %%zmm23,%%zmm3,%%zmm3 \n" + "vpmaddubsw %%zmm22,%%zmm0,%%zmm0 \n" // 32x2 -> 16x2 + "vpmaddubsw %%zmm22,%%zmm1,%%zmm1 \n" + "vpmaddubsw %%zmm22,%%zmm2,%%zmm2 \n" + "vpmaddubsw %%zmm22,%%zmm3,%%zmm3 \n" "vpaddw %%zmm0,%%zmm2,%%zmm0 \n" // 16x2 -> 16x1 "vpaddw %%zmm1,%%zmm3,%%zmm1 \n" "vpxorq %%zmm2,%%zmm2,%%zmm2 \n" // 0 for vpavgw @@ -2267,7 +2267,7 @@ void ARGBToUVMatrixRow_AVX512BW(const uint8_t* src_argb, "vpermd %%zmm0,%%zmm19,%%zmm0 \n" // unscramble pixels "vpmaddubsw %%zmm4,%%zmm0,%%zmm1 \n" // 16 U - "vpmaddubsw %%zmm5,%%zmm0,%%zmm0 \n" // 16 V + "vpmaddubsw %%zmm21,%%zmm0,%%zmm0 \n" // 16 V "vpmaddwd %%zmm16,%%zmm1,%%zmm1 \n" "vpmaddwd %%zmm16,%%zmm0,%%zmm0 \n" "vpackssdw %%zmm0,%%zmm1,%%zmm0 \n" // mutates (U in lower, V in upper) @@ -2298,8 +2298,8 @@ void ARGBToUVMatrixRow_AVX512BW(const uint8_t* src_argb, "m"(kShuffleAARRGGBB), // %6 "m"(kPermdARGBToY_AVX512BW), // %7 "m"(kPermdARGBToUV_AVX512BW) // %8 - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", - "xmm7", "xmm16", "xmm17", "xmm18", "xmm19"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm16", "xmm17", + "xmm18", "xmm19", "xmm21", "xmm22", "xmm23"); } void ARGBToUVRow_AVX512BW(const uint8_t* src_argb, @@ -3626,14 +3626,14 @@ void OMITFP I422ToRGBARow_SSSE3(const uint8_t* y_buf, "vmovdqa 128(%[yuvconstants]),%%ymm12 \n" #define YUVTORGB_SETUP_AVX512BW(yuvconstants) \ - "vpternlogd $0xff,%%zmm13,%%zmm13,%%zmm13 \n" \ - "vpbroadcastq (%[yuvconstants]),%%zmm8 \n" \ - "vpabsb %%zmm13,%%zmm13 \n" \ - "vpsllw $7,%%zmm13,%%zmm13 \n" \ - "vpbroadcastq 32(%[yuvconstants]),%%zmm9 \n" \ - "vpbroadcastq 64(%[yuvconstants]),%%zmm10 \n" \ - "vpbroadcastq 96(%[yuvconstants]),%%zmm11 \n" \ - "vpbroadcastq 128(%[yuvconstants]),%%zmm12 \n" \ + "vpternlogd $0xff,%%zmm29,%%zmm29,%%zmm29 \n" \ + "vpbroadcastq (%[yuvconstants]),%%zmm24 \n" \ + "vpabsb %%zmm29,%%zmm29 \n" \ + "vpsllw $7,%%zmm29,%%zmm29 \n" \ + "vpbroadcastq 32(%[yuvconstants]),%%zmm25 \n" \ + "vpbroadcastq 64(%[yuvconstants]),%%zmm26 \n" \ + "vpbroadcastq 96(%[yuvconstants]),%%zmm27 \n" \ + "vpbroadcastq 128(%[yuvconstants]),%%zmm28 \n" \ "vmovups (%[quadsplitperm]),%%zmm16 \n" \ "vmovups (%[dquadsplitperm]),%%zmm17 \n" \ "vmovups (%[unperm]),%%zmm18 \n" @@ -3650,12 +3650,12 @@ void OMITFP I422ToRGBARow_SSSE3(const uint8_t* y_buf, "vpaddsw %%ymm4,%%ymm2,%%ymm2 \n" #define YUVTORGB16_AVX512BW(yuvconstants) \ - "vpsubb %%zmm13,%%zmm3,%%zmm3 \n" \ - "vpmulhuw %%zmm11,%%zmm4,%%zmm4 \n" \ - "vpmaddubsw %%zmm3,%%zmm8,%%zmm0 \n" \ - "vpmaddubsw %%zmm3,%%zmm9,%%zmm1 \n" \ - "vpmaddubsw %%zmm3,%%zmm10,%%zmm2 \n" \ - "vpaddw %%zmm4,%%zmm12,%%zmm4 \n" \ + "vpsubb %%zmm29,%%zmm3,%%zmm3 \n" \ + "vpmulhuw %%zmm27,%%zmm4,%%zmm4 \n" \ + "vpmaddubsw %%zmm3,%%zmm24,%%zmm0 \n" \ + "vpmaddubsw %%zmm3,%%zmm25,%%zmm1 \n" \ + "vpmaddubsw %%zmm3,%%zmm26,%%zmm2 \n" \ + "vpaddw %%zmm4,%%zmm28,%%zmm4 \n" \ "vpaddsw %%zmm4,%%zmm0,%%zmm0 \n" \ "vpsubsw %%zmm1,%%zmm4,%%zmm1 \n" \ "vpaddsw %%zmm4,%%zmm2,%%zmm2 \n" @@ -3722,7 +3722,7 @@ void OMITFP I422ToRGBARow_SSSE3(const uint8_t* y_buf, #define STOREARGB_AVX512BW \ "vpunpcklbw %%zmm1,%%zmm0,%%zmm0 \n" \ "vpermq %%zmm0,%%zmm18,%%zmm0 \n" \ - "vpunpcklbw %%zmm5,%%zmm2,%%zmm2 \n" \ + "vpunpcklbw %%zmm21,%%zmm2,%%zmm2 \n" \ "vpermq %%zmm2,%%zmm18,%%zmm2 \n" \ "vpunpcklwd %%zmm2,%%zmm0,%%zmm1 \n" \ "vpunpckhwd %%zmm2,%%zmm0,%%zmm0 \n" \ @@ -3844,7 +3844,7 @@ void OMITFP I422ToARGBRow_AVX512BW(const uint8_t* y_buf, YUVTORGB_SETUP_AVX512BW(yuvconstants) "sub %[u_buf],%[v_buf] \n" "vpcmpeqb %%xmm5,%%xmm5,%%xmm5 \n" - "vpbroadcastq %%xmm5,%%zmm5 \n" + "vpbroadcastq %%xmm5,%%zmm21 \n" LABELALIGN "1: \n" diff --git a/source/scale_gcc.cc b/source/scale_gcc.cc index 6a2524230..5338482c5 100644 --- a/source/scale_gcc.cc +++ b/source/scale_gcc.cc @@ -1815,14 +1815,8 @@ void ScaleAddRow_AVX2(const uint8_t* src_ptr, } #endif // HAS_SCALEADDROW_AVX2 -// Constant for making pixels signed to avoid pmaddubsw -// saturation. -static const uvec8 kFsub80 = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}; - -// Constant for making pixels unsigned and adding .5 for rounding. -static const uvec16 kFadd40 = {0x4040, 0x4040, 0x4040, 0x4040, - 0x4040, 0x4040, 0x4040, 0x4040}; +static const uvec16 kFadd40 = {0x0040, 0x0040, 0x0040, 0x0040, + 0x0040, 0x0040, 0x0040, 0x0040}; // Bilinear column filtering. SSSE3 version. void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, @@ -1838,8 +1832,9 @@ void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, "movd %k2,%%xmm5 \n" "pcmpeqb %%xmm6,%%xmm6 \n" "psrlw $0x9,%%xmm6 \n" // 0x007f007f - "pcmpeqb %%xmm7,%%xmm7 \n" - "psrlw $15,%%xmm7 \n" // 0x00010001 + "pcmpeqb %%xmm7,%%xmm7 \n" // 0x00ff mask for + // extracting 'a' + "psrlw $8,%%xmm7 \n" "pextrw $0x1,%%xmm2,%k3 \n" "subl $0x2,%5 \n" @@ -1862,17 +1857,18 @@ void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, "movd %k2,%%xmm4 \n" "pshufb %%xmm5,%%xmm1 \n" "punpcklwd %%xmm4,%%xmm0 \n" - "psubb %8,%%xmm0 \n" // make pixels signed. - "pxor %%xmm6,%%xmm1 \n" // 128 - f = (f ^ 127 ) + - // 1 - "paddusb %%xmm7,%%xmm1 \n" - "pmaddubsw %%xmm0,%%xmm1 \n" + "pxor %%xmm6,%%xmm1 \n" + "movdqa %%xmm0,%%xmm4 \n" // Copy pixels. + "pmaddubsw %%xmm1,%%xmm0 \n" // a * (127 - f) + b * f + "pand %%xmm7,%%xmm4 \n" // Extract left pixels + // 'a'. + "paddw %%xmm4,%%xmm0 \n" // a * 128 + f * (b - a) "pextrw $0x1,%%xmm2,%k3 \n" + "paddw %8,%%xmm0 \n" // add rounding bias 64. "pextrw $0x3,%%xmm2,%k4 \n" - "paddw %9,%%xmm1 \n" // make pixels unsigned. - "psrlw $0x7,%%xmm1 \n" - "packuswb %%xmm1,%%xmm1 \n" - "movd %%xmm1,%k2 \n" + "psrlw $0x7,%%xmm0 \n" + "packuswb %%xmm0,%%xmm0 \n" + "movd %%xmm0,%k2 \n" "mov %w2,(%0) \n" "lea 0x2(%0),%0 \n" "subl $0x2,%5 \n" @@ -1886,14 +1882,15 @@ void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, "movd %k2,%%xmm0 \n" "psrlw $0x9,%%xmm2 \n" "pshufb %%xmm5,%%xmm2 \n" - "psubb %8,%%xmm0 \n" // make pixels signed. "pxor %%xmm6,%%xmm2 \n" - "paddusb %%xmm7,%%xmm2 \n" - "pmaddubsw %%xmm0,%%xmm2 \n" - "paddw %9,%%xmm2 \n" // make pixels unsigned. - "psrlw $0x7,%%xmm2 \n" - "packuswb %%xmm2,%%xmm2 \n" - "movd %%xmm2,%k2 \n" + "movdqa %%xmm0,%%xmm4 \n" // Copy pixels. + "pmaddubsw %%xmm2,%%xmm0 \n" // a * (127 - f) + b * f + "pand %%xmm7,%%xmm4 \n" // Extract left pixel 'a'. + "paddw %%xmm4,%%xmm0 \n" // a * 128 + f * (b - a) + "paddw %8,%%xmm0 \n" // add rounding bias 64. + "psrlw $0x7,%%xmm0 \n" + "packuswb %%xmm0,%%xmm0 \n" + "movd %%xmm0,%k2 \n" "mov %b2,(%0) \n" "99: \n" : "+r"(dst_ptr), // %0 @@ -1909,11 +1906,9 @@ void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, : "rm"(x), // %6 "rm"(dx), // %7 #if defined(__x86_64__) - "x"(kFsub80), // %8 - "x"(kFadd40) // %9 + "x"(kFadd40) // %8 #else - "m"(kFsub80), // %8 - "m"(kFadd40) // %9 + "m"(kFadd40) // %8 #endif : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); diff --git a/unit_test/basictypes_test.cc b/unit_test/basictypes_test.cc index 9aaa2dcd9..421b56f85 100644 --- a/unit_test/basictypes_test.cc +++ b/unit_test/basictypes_test.cc @@ -22,22 +22,22 @@ TEST_F(LibYUVBaseTest, SizeOfTypes) { uint32_t u32 = 1u; int64_t i64 = -1; uint64_t u64 = 1u; - EXPECT_EQ(1u, sizeof(i8)); - EXPECT_EQ(1u, sizeof(u8)); - EXPECT_EQ(2u, sizeof(i16)); - EXPECT_EQ(2u, sizeof(u16)); - EXPECT_EQ(4u, sizeof(i32)); - EXPECT_EQ(4u, sizeof(u32)); - EXPECT_EQ(8u, sizeof(i64)); - EXPECT_EQ(8u, sizeof(u64)); - EXPECT_GT(0, i8); - EXPECT_LT(0u, u8); - EXPECT_GT(0, i16); - EXPECT_LT(0u, u16); - EXPECT_GT(0, i32); - EXPECT_LT(0u, u32); - EXPECT_GT(0, i64); - EXPECT_LT(0u, u64); + ASSERT_EQ(1u, sizeof(i8)); + ASSERT_EQ(1u, sizeof(u8)); + ASSERT_EQ(2u, sizeof(i16)); + ASSERT_EQ(2u, sizeof(u16)); + ASSERT_EQ(4u, sizeof(i32)); + ASSERT_EQ(4u, sizeof(u32)); + ASSERT_EQ(8u, sizeof(i64)); + ASSERT_EQ(8u, sizeof(u64)); + ASSERT_GT(0, i8); + ASSERT_LT(0u, u8); + ASSERT_GT(0, i16); + ASSERT_LT(0u, u16); + ASSERT_GT(0, i32); + ASSERT_LT(0u, u32); + ASSERT_GT(0, i64); + ASSERT_LT(0u, u64); } } // namespace libyuv diff --git a/unit_test/color_test.cc b/unit_test/color_test.cc index 01267ff1e..9ed0b8344 100644 --- a/unit_test/color_test.cc +++ b/unit_test/color_test.cc @@ -119,11 +119,11 @@ namespace libyuv { } \ /* Test C and SIMD match. */ \ for (int i = 0; i < kPixels * 4; ++i) { \ - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ } \ /* Test SIMD is close to original. */ \ for (int i = 0; i < kPixels * 4; ++i) { \ - EXPECT_NEAR(static_cast(orig_pixels[i]), \ + ASSERT_NEAR(static_cast(orig_pixels[i]), \ static_cast(dst_pixels_opt[i]), DIFF); \ } \ \ @@ -431,15 +431,16 @@ TEST_F(LibYUVColorTest, TestRoundToByte) { allb |= b; } } - EXPECT_GE(allb, 0); - EXPECT_LE(allb, 255); + ASSERT_GE(allb, 0); + ASSERT_LE(allb, 255); } // BT.601 limited range YUV to RGB reference static void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) { - *r = RoundToByte((y - 16) * 1.164 - (v - 128) * -1.596); - *g = RoundToByte((y - 16) * 1.164 - (u - 128) * 0.391 - (v - 128) * 0.813); - *b = RoundToByte((y - 16) * 1.164 - (u - 128) * -2.018); + double y1 = (y - 16) * 1.164; + *r = RoundToByte(y1 - (v - 128) * -1.596); + *g = RoundToByte(y1 - (u - 128) * 0.391 - (v - 128) * 0.813); + *b = RoundToByte(y1 - (u - 128) * -2.018); } // BT.601 full range YUV to RGB reference (aka JPEG) @@ -452,9 +453,10 @@ static void YUVJToRGBReference(int y, int u, int v, int* r, int* g, int* b) { // BT.709 limited range YUV to RGB reference // See also http://www.equasys.de/colorconversion.html static void YUVHToRGBReference(int y, int u, int v, int* r, int* g, int* b) { - *r = RoundToByte((y - 16) * 1.164 - (v - 128) * -1.793); - *g = RoundToByte((y - 16) * 1.164 - (u - 128) * 0.213 - (v - 128) * 0.533); - *b = RoundToByte((y - 16) * 1.164 - (u - 128) * -2.112); + double y1 = (y - 16) * 1.164; + *r = RoundToByte(y1 - (v - 128) * -1.793); + *g = RoundToByte(y1 - (u - 128) * 0.213 - (v - 128) * 0.533); + *b = RoundToByte(y1 - (u - 128) * -2.112); } // BT.709 full range YUV to RGB reference @@ -466,10 +468,11 @@ static void YUVFToRGBReference(int y, int u, int v, int* r, int* g, int* b) { // BT.2020 limited range YUV to RGB reference static void YUVUToRGBReference(int y, int u, int v, int* r, int* g, int* b) { - *r = RoundToByte((y - 16) * 1.164384 - (v - 128) * -1.67867); - *g = RoundToByte((y - 16) * 1.164384 - (u - 128) * 0.187326 - + double y1 = (y - 16) * 1.164384; + *r = RoundToByte(y1 - (v - 128) * -1.67867); + *g = RoundToByte(y1 - (u - 128) * 0.187326 - (v - 128) * 0.65042); - *b = RoundToByte((y - 16) * 1.164384 - (u - 128) * -2.14177); + *b = RoundToByte(y1 - (u - 128) * -2.14177); } // BT.2020 full range YUV to RGB reference @@ -484,48 +487,48 @@ TEST_F(LibYUVColorTest, TestYUV) { // cyan (less red) YUVToRGBReference(240, 255, 0, &r0, &g0, &b0); - EXPECT_EQ(56, r0); - EXPECT_EQ(255, g0); - EXPECT_EQ(255, b0); + ASSERT_EQ(56, r0); + ASSERT_EQ(255, g0); + ASSERT_EQ(255, b0); YUVToRGB(240, 255, 0, &r1, &g1, &b1); - EXPECT_EQ(57, r1); - EXPECT_EQ(255, g1); - EXPECT_EQ(255, b1); + ASSERT_EQ(57, r1); + ASSERT_EQ(255, g1); + ASSERT_EQ(255, b1); // green (less red and blue) YUVToRGBReference(240, 0, 0, &r0, &g0, &b0); - EXPECT_EQ(56, r0); - EXPECT_EQ(255, g0); - EXPECT_EQ(2, b0); + ASSERT_EQ(56, r0); + ASSERT_EQ(255, g0); + ASSERT_EQ(2, b0); YUVToRGB(240, 0, 0, &r1, &g1, &b1); - EXPECT_EQ(57, r1); - EXPECT_EQ(255, g1); + ASSERT_EQ(57, r1); + ASSERT_EQ(255, g1); #ifdef LIBYUV_UNLIMITED_DATA - EXPECT_EQ(3, b1); + ASSERT_EQ(3, b1); #else - EXPECT_EQ(5, b1); + ASSERT_EQ(5, b1); #endif for (int i = 0; i < 256; ++i) { YUVToRGBReference(i, 128, 128, &r0, &g0, &b0); YUVToRGB(i, 128, 128, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); YUVToRGBReference(i, 0, 0, &r0, &g0, &b0); YUVToRGB(i, 0, 0, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); YUVToRGBReference(i, 0, 255, &r0, &g0, &b0); YUVToRGB(i, 0, 255, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); } } @@ -534,47 +537,47 @@ TEST_F(LibYUVColorTest, TestGreyYUV) { // black YUVToRGBReference(16, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(0, r0); - EXPECT_EQ(0, g0); - EXPECT_EQ(0, b0); + ASSERT_EQ(0, r0); + ASSERT_EQ(0, g0); + ASSERT_EQ(0, b0); YUVToRGB(16, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(0, r1); - EXPECT_EQ(0, g1); - EXPECT_EQ(0, b1); + ASSERT_EQ(0, r1); + ASSERT_EQ(0, g1); + ASSERT_EQ(0, b1); // white YUVToRGBReference(240, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(255, r0); - EXPECT_EQ(255, g0); - EXPECT_EQ(255, b0); + ASSERT_EQ(255, r0); + ASSERT_EQ(255, g0); + ASSERT_EQ(255, b0); YUVToRGB(240, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(255, r1); - EXPECT_EQ(255, g1); - EXPECT_EQ(255, b1); + ASSERT_EQ(255, r1); + ASSERT_EQ(255, g1); + ASSERT_EQ(255, b1); // grey YUVToRGBReference(128, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(130, r0); - EXPECT_EQ(130, g0); - EXPECT_EQ(130, b0); + ASSERT_EQ(130, r0); + ASSERT_EQ(130, g0); + ASSERT_EQ(130, b0); YUVToRGB(128, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(130, r1); - EXPECT_EQ(130, g1); - EXPECT_EQ(130, b1); + ASSERT_EQ(130, r1); + ASSERT_EQ(130, g1); + ASSERT_EQ(130, b1); for (int y = 0; y < 256; ++y) { YUVToRGBReference(y, 128, 128, &r0, &g0, &b0); YUVToRGB(y, 128, 128, &r1, &g1, &b1); YToRGB(y, &r2, &g2, &b2); - EXPECT_EQ(r0, r1); - EXPECT_EQ(g0, g1); - EXPECT_EQ(b0, b1); - EXPECT_EQ(r0, r2); - EXPECT_EQ(g0, g2); - EXPECT_EQ(b0, b2); + ASSERT_EQ(r0, r1); + ASSERT_EQ(g0, g1); + ASSERT_EQ(b0, b1); + ASSERT_EQ(r0, r2); + ASSERT_EQ(g0, g2); + ASSERT_EQ(b0, b2); } } @@ -612,10 +615,11 @@ static void PrintHistogram(int rh[256], int gh[256], int bh[256]) { #ifdef DISABLE_SLOW_TESTS #define FASTSTEP 5 #else -#define FASTSTEP 1 +#define FASTSTEP 3 #endif // BT.601 limited range. +#ifndef DISABLE_SLOW_TESTS TEST_F(LibYUVColorTest, TestFullYUV) { int rh[256] = { 0, @@ -626,16 +630,16 @@ TEST_F(LibYUVColorTest, TestFullYUV) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVToRGBReference(y, u, v, &r0, &g0, &b0); YUVToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -656,16 +660,16 @@ TEST_F(LibYUVColorTest, TestFullYUVJ) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVJToRGBReference(y, u, v, &r0, &g0, &b0); YUVJToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -686,16 +690,16 @@ TEST_F(LibYUVColorTest, TestFullYUVH) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVHToRGBReference(y, u, v, &r0, &g0, &b0); YUVHToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -716,16 +720,16 @@ TEST_F(LibYUVColorTest, TestFullYUVF) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVFToRGBReference(y, u, v, &r0, &g0, &b0); YUVFToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -746,16 +750,16 @@ TEST_F(LibYUVColorTest, TestFullYUVU) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVUToRGBReference(y, u, v, &r0, &g0, &b0); YUVUToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, ERROR_G); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, ERROR_G); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -776,16 +780,16 @@ TEST_F(LibYUVColorTest, TestFullYUVV) { int bh[256] = { 0, }; - for (int u = 0; u < 256; ++u) { - for (int v = 0; v < 256; ++v) { + for (int u = 0; u < 256; u += FASTSTEP) { + for (int v = 0; v < 256; v += FASTSTEP) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) { int r0, g0, b0, r1, g1, b1; int y = RANDOM256(y2); YUVVToRGBReference(y, u, v, &r0, &g0, &b0); YUVVToRGB(y, u, v, &r1, &g1, &b1); - EXPECT_NEAR(r0, r1, ERROR_R); - EXPECT_NEAR(g0, g1, 2); - EXPECT_NEAR(b0, b1, ERROR_B); + ASSERT_NEAR(r0, r1, ERROR_R); + ASSERT_NEAR(g0, g1, 2); + ASSERT_NEAR(b0, b1, ERROR_B); ++rh[r1 - r0 + 128]; ++gh[g1 - g0 + 128]; ++bh[b1 - b0 + 128]; @@ -794,6 +798,8 @@ TEST_F(LibYUVColorTest, TestFullYUVV) { } PrintHistogram(rh, gh, bh); } +#endif // DISABLE_SLOW_TESTS + #undef FASTSTEP TEST_F(LibYUVColorTest, TestGreyYUVJ) { @@ -801,47 +807,47 @@ TEST_F(LibYUVColorTest, TestGreyYUVJ) { // black YUVJToRGBReference(0, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(0, r0); - EXPECT_EQ(0, g0); - EXPECT_EQ(0, b0); + ASSERT_EQ(0, r0); + ASSERT_EQ(0, g0); + ASSERT_EQ(0, b0); YUVJToRGB(0, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(0, r1); - EXPECT_EQ(0, g1); - EXPECT_EQ(0, b1); + ASSERT_EQ(0, r1); + ASSERT_EQ(0, g1); + ASSERT_EQ(0, b1); // white YUVJToRGBReference(255, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(255, r0); - EXPECT_EQ(255, g0); - EXPECT_EQ(255, b0); + ASSERT_EQ(255, r0); + ASSERT_EQ(255, g0); + ASSERT_EQ(255, b0); YUVJToRGB(255, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(255, r1); - EXPECT_EQ(255, g1); - EXPECT_EQ(255, b1); + ASSERT_EQ(255, r1); + ASSERT_EQ(255, g1); + ASSERT_EQ(255, b1); // grey YUVJToRGBReference(128, 128, 128, &r0, &g0, &b0); - EXPECT_EQ(128, r0); - EXPECT_EQ(128, g0); - EXPECT_EQ(128, b0); + ASSERT_EQ(128, r0); + ASSERT_EQ(128, g0); + ASSERT_EQ(128, b0); YUVJToRGB(128, 128, 128, &r1, &g1, &b1); - EXPECT_EQ(128, r1); - EXPECT_EQ(128, g1); - EXPECT_EQ(128, b1); + ASSERT_EQ(128, r1); + ASSERT_EQ(128, g1); + ASSERT_EQ(128, b1); for (int y = 0; y < 256; ++y) { YUVJToRGBReference(y, 128, 128, &r0, &g0, &b0); YUVJToRGB(y, 128, 128, &r1, &g1, &b1); YJToRGB(y, &r2, &g2, &b2); - EXPECT_EQ(r0, r1); - EXPECT_EQ(g0, g1); - EXPECT_EQ(b0, b1); - EXPECT_EQ(r0, r2); - EXPECT_EQ(g0, g2); - EXPECT_EQ(b0, b2); + ASSERT_EQ(r0, r1); + ASSERT_EQ(g0, g1); + ASSERT_EQ(b0, b1); + ASSERT_EQ(r0, r2); + ASSERT_EQ(g0, g2); + ASSERT_EQ(b0, b2); } } diff --git a/unit_test/compare_test.cc b/unit_test/compare_test.cc index c29562cb8..8ae17f545 100644 --- a/unit_test/compare_test.cc +++ b/unit_test/compare_test.cc @@ -48,7 +48,7 @@ TEST_F(LibYUVCompareTest, Djb2_Test) { " together with Hermann Zapf"; uint32_t foxhash = HashDjb2(reinterpret_cast(fox), 131, 5381); const uint32_t kExpectedFoxHash = 2611006483u; - EXPECT_EQ(kExpectedFoxHash, foxhash); + ASSERT_EQ(kExpectedFoxHash, foxhash); for (int i = 0; i < kMaxTest; ++i) { src_a[i] = (fastrand() & 0xff); @@ -57,13 +57,13 @@ TEST_F(LibYUVCompareTest, Djb2_Test) { // Compare different buffers. Expect hash is different. uint32_t h1 = HashDjb2(src_a, kMaxTest, 5381); uint32_t h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make last half same. Expect hash is different. memcpy(src_a + kMaxTest / 2, src_b + kMaxTest / 2, kMaxTest / 2); h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make first half same. Expect hash is different. memcpy(src_a + kMaxTest / 2, src_a, kMaxTest / 2); @@ -71,52 +71,52 @@ TEST_F(LibYUVCompareTest, Djb2_Test) { memcpy(src_a, src_b, kMaxTest / 2); h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make same. Expect hash is same. memcpy(src_a, src_b, kMaxTest); h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_EQ(h1, h2); + ASSERT_EQ(h1, h2); // Mask seed different. Expect hash is different. memcpy(src_a, src_b, kMaxTest); h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 1234); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make one byte different in middle. Expect hash is different. memcpy(src_a, src_b, kMaxTest); ++src_b[kMaxTest / 2]; h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make first byte different. Expect hash is different. memcpy(src_a, src_b, kMaxTest); ++src_b[0]; h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make last byte different. Expect hash is different. memcpy(src_a, src_b, kMaxTest); ++src_b[kMaxTest - 1]; h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_b, kMaxTest, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make a zeros. Test different lengths. Expect hash is different. memset(src_a, 0, kMaxTest); h1 = HashDjb2(src_a, kMaxTest, 5381); h2 = HashDjb2(src_a, kMaxTest / 2, 5381); - EXPECT_NE(h1, h2); + ASSERT_NE(h1, h2); // Make a zeros and seed of zero. Test different lengths. Expect hash is same. memset(src_a, 0, kMaxTest); h1 = HashDjb2(src_a, kMaxTest, 0); h2 = HashDjb2(src_a, kMaxTest / 2, 0); - EXPECT_EQ(h1, h2); + ASSERT_EQ(h1, h2); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -134,7 +134,7 @@ TEST_F(LibYUVCompareTest, BenchmarkDjb2_Opt) { for (int i = 0; i < benchmark_iterations_; ++i) { h1 = HashDjb2(src_a, kMaxTest, 5381); } - EXPECT_EQ(h1, h2); + ASSERT_EQ(h1, h2); free_aligned_buffer_page_end(src_a); } @@ -149,7 +149,7 @@ TEST_F(LibYUVCompareTest, BenchmarkDjb2_Unaligned) { for (int i = 0; i < benchmark_iterations_; ++i) { h1 = HashDjb2(src_a + 1, kMaxTest, 5381); } - EXPECT_EQ(h1, h2); + ASSERT_EQ(h1, h2); free_aligned_buffer_page_end(src_a); } @@ -164,19 +164,19 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Opt) { src_a[0] = 0; fourcc = ARGBDetect(src_a, benchmark_width_ * 4, benchmark_width_, benchmark_height_); - EXPECT_EQ(static_cast(libyuv::FOURCC_BGRA), fourcc); + ASSERT_EQ(static_cast(libyuv::FOURCC_BGRA), fourcc); src_a[0] = 255; src_a[3] = 0; fourcc = ARGBDetect(src_a, benchmark_width_ * 4, benchmark_width_, benchmark_height_); - EXPECT_EQ(static_cast(libyuv::FOURCC_ARGB), fourcc); + ASSERT_EQ(static_cast(libyuv::FOURCC_ARGB), fourcc); src_a[3] = 255; for (int i = 0; i < benchmark_iterations_; ++i) { fourcc = ARGBDetect(src_a, benchmark_width_ * 4, benchmark_width_, benchmark_height_); } - EXPECT_EQ(0u, fourcc); + ASSERT_EQ(0u, fourcc); free_aligned_buffer_page_end(src_a); } @@ -192,19 +192,19 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Unaligned) { src_a[0 + 1] = 0; fourcc = ARGBDetect(src_a + 1, benchmark_width_ * 4, benchmark_width_, benchmark_height_); - EXPECT_EQ(static_cast(libyuv::FOURCC_BGRA), fourcc); + ASSERT_EQ(static_cast(libyuv::FOURCC_BGRA), fourcc); src_a[0 + 1] = 255; src_a[3 + 1] = 0; fourcc = ARGBDetect(src_a + 1, benchmark_width_ * 4, benchmark_width_, benchmark_height_); - EXPECT_EQ(static_cast(libyuv::FOURCC_ARGB), fourcc); + ASSERT_EQ(static_cast(libyuv::FOURCC_ARGB), fourcc); src_a[3 + 1] = 255; for (int i = 0; i < benchmark_iterations_; ++i) { fourcc = ARGBDetect(src_a + 1, benchmark_width_ * 4, benchmark_width_, benchmark_height_); } - EXPECT_EQ(0u, fourcc); + ASSERT_EQ(0u, fourcc); free_aligned_buffer_page_end(src_a); } @@ -221,7 +221,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) { memcpy(src_a, "test0123test4567", 16); memcpy(src_b, "tick0123tock4567", 16); uint32_t h1 = HammingDistance_C(src_a, src_b, 16); - EXPECT_EQ(16u, h1); + ASSERT_EQ(16u, h1); // Test C vs OPT on random buffer MemRandomize(src_a, kMaxWidth); @@ -263,7 +263,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) { h1 = HammingDistance_C(src_a, src_b, kMaxWidth); #endif } - EXPECT_EQ(h0, h1); + ASSERT_EQ(h0, h1); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -280,7 +280,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_C) { memcpy(src_a, "test0123test4567", 16); memcpy(src_b, "tick0123tock4567", 16); uint32_t h1 = HammingDistance_C(src_a, src_b, 16); - EXPECT_EQ(16u, h1); + ASSERT_EQ(16u, h1); // Test C vs OPT on random buffer MemRandomize(src_a, kMaxWidth); @@ -295,7 +295,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_C) { h1 = HammingDistance_C(src_a, src_b, kMaxWidth); } - EXPECT_EQ(h0, h1); + ASSERT_EQ(h0, h1); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -311,7 +311,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance) { memcpy(src_a, "test0123test4567", 16); memcpy(src_b, "tick0123tock4567", 16); uint64_t h1 = ComputeHammingDistance(src_a, src_b, 16); - EXPECT_EQ(16u, h1); + ASSERT_EQ(16u, h1); // Test C vs OPT on random buffer MemRandomize(src_a, kMaxWidth); @@ -326,7 +326,7 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance) { h1 = ComputeHammingDistance(src_a, src_b, kMaxWidth); } - EXPECT_EQ(h0, h1); + ASSERT_EQ(h0, h1); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -351,7 +351,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance_Opt) { memset(src_b, 0u, kMaxWidth); uint64_t h0 = ComputeHammingDistance(src_a, src_b, kMaxWidth); - EXPECT_EQ(kMaxWidth * 8ULL, h0); + ASSERT_EQ(kMaxWidth * 8ULL, h0); for (int i = 0; i < benchmark_iterations_; ++i) { #if defined(HAS_HAMMINGDISTANCE_NEON) @@ -389,7 +389,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance_Opt) { // result can not be expected to be correct. // TODO(fbarchard): Consider expecting the low 16 bits to match. if (kMaxWidth <= kMaxOptCount) { - EXPECT_EQ(kMaxWidth * 8U, h1); + ASSERT_EQ(kMaxWidth * 8U, h1); } else { if (kMaxWidth * 8ULL != static_cast(h1)) { printf( @@ -420,7 +420,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance) { h1 = ComputeHammingDistance(src_a, src_b, benchmark_width_ * benchmark_height_); } - EXPECT_EQ(benchmark_width_ * benchmark_height_ * 8ULL, h1); + ASSERT_EQ(benchmark_width_ * benchmark_height_ * 8ULL, h1); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -436,7 +436,7 @@ TEST_F(LibYUVCompareTest, BenchmarkSumSquareError_Opt) { memcpy(src_a, "test0123test4567", 16); memcpy(src_b, "tick0123tock4567", 16); uint64_t h1 = ComputeSumSquareError(src_a, src_b, 16); - EXPECT_EQ(790u, h1); + ASSERT_EQ(790u, h1); for (int i = 0; i < kMaxWidth; ++i) { src_a[i] = i; @@ -452,7 +452,7 @@ TEST_F(LibYUVCompareTest, BenchmarkSumSquareError_Opt) { h1 = ComputeSumSquareError(src_a, src_b, kMaxWidth); } - EXPECT_EQ(0u, h1); + ASSERT_EQ(0u, h1); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -468,18 +468,18 @@ TEST_F(LibYUVCompareTest, SumSquareError) { uint64_t err; err = ComputeSumSquareError(src_a, src_b, kMaxWidth); - EXPECT_EQ(0u, err); + ASSERT_EQ(0u, err); memset(src_a, 1, kMaxWidth); err = ComputeSumSquareError(src_a, src_b, kMaxWidth); - EXPECT_EQ(static_cast(err), kMaxWidth); + ASSERT_EQ(static_cast(err), kMaxWidth); memset(src_a, 190, kMaxWidth); memset(src_b, 193, kMaxWidth); err = ComputeSumSquareError(src_a, src_b, kMaxWidth); - EXPECT_EQ(static_cast(err), kMaxWidth * 3 * 3); + ASSERT_EQ(static_cast(err), kMaxWidth * 3 * 3); for (int i = 0; i < kMaxWidth; ++i) { src_a[i] = (fastrand() & 0xff); @@ -492,7 +492,7 @@ TEST_F(LibYUVCompareTest, SumSquareError) { MaskCpuFlags(benchmark_cpu_info_); uint64_t opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth); - EXPECT_EQ(c_err, opt_err); + ASSERT_EQ(c_err, opt_err); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -517,7 +517,7 @@ TEST_F(LibYUVCompareTest, BenchmarkPsnr_Opt) { opt_time = (get_time() - opt_time) / benchmark_iterations_; printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6); - EXPECT_EQ(0, 0); + ASSERT_EQ(0, 0); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -542,7 +542,7 @@ TEST_F(LibYUVCompareTest, BenchmarkPsnr_Unaligned) { opt_time = (get_time() - opt_time) / benchmark_iterations_; printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6); - EXPECT_EQ(0, 0); + ASSERT_EQ(0, 0); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -564,7 +564,7 @@ TEST_F(LibYUVCompareTest, Psnr) { src_b + kSrcStride * b + b, kSrcStride, kSrcWidth, kSrcHeight); - EXPECT_EQ(err, kMaxPsnr); + ASSERT_EQ(err, kMaxPsnr); memset(src_a, 255, kSrcPlaneSize); @@ -572,7 +572,7 @@ TEST_F(LibYUVCompareTest, Psnr) { src_b + kSrcStride * b + b, kSrcStride, kSrcWidth, kSrcHeight); - EXPECT_EQ(err, 0.0); + ASSERT_EQ(err, 0.0); memset(src_a, 1, kSrcPlaneSize); @@ -580,8 +580,8 @@ TEST_F(LibYUVCompareTest, Psnr) { src_b + kSrcStride * b + b, kSrcStride, kSrcWidth, kSrcHeight); - EXPECT_GT(err, 48.0); - EXPECT_LT(err, 49.0); + ASSERT_GT(err, 48.0); + ASSERT_LT(err, 49.0); for (int i = 0; i < kSrcPlaneSize; ++i) { src_a[i] = i; @@ -591,9 +591,9 @@ TEST_F(LibYUVCompareTest, Psnr) { src_b + kSrcStride * b + b, kSrcStride, kSrcWidth, kSrcHeight); - EXPECT_GT(err, 2.0); + ASSERT_GT(err, 2.0); if (kSrcWidth * kSrcHeight >= 256) { - EXPECT_LT(err, 6.0); + ASSERT_LT(err, 6.0); } memset(src_a, 0, kSrcPlaneSize); @@ -619,7 +619,7 @@ TEST_F(LibYUVCompareTest, Psnr) { src_b + kSrcStride * b + b, kSrcStride, kSrcWidth, kSrcHeight); - EXPECT_EQ(opt_err, c_err); + ASSERT_EQ(opt_err, c_err); free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -644,7 +644,7 @@ TEST_F(LibYUVCompareTest, DISABLED_BenchmarkSsim_Opt) { opt_time = (get_time() - opt_time) / benchmark_iterations_; printf("BenchmarkSsim_Opt - %8.2f us opt\n", opt_time * 1e6); - EXPECT_EQ(0, 0); // Pass if we get this far. + ASSERT_EQ(0, 0); // Pass if we get this far. free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); @@ -671,7 +671,7 @@ TEST_F(LibYUVCompareTest, Ssim) { kSrcHeight); if (kSrcWidth > 8 && kSrcHeight > 8) { - EXPECT_EQ(err, 1.0); + ASSERT_EQ(err, 1.0); } memset(src_a, 255, kSrcPlaneSize); @@ -681,7 +681,7 @@ TEST_F(LibYUVCompareTest, Ssim) { kSrcHeight); if (kSrcWidth > 8 && kSrcHeight > 8) { - EXPECT_LT(err, 0.0001); + ASSERT_LT(err, 0.0001); } memset(src_a, 1, kSrcPlaneSize); @@ -691,8 +691,8 @@ TEST_F(LibYUVCompareTest, Ssim) { kSrcHeight); if (kSrcWidth > 8 && kSrcHeight > 8) { - EXPECT_GT(err, 0.0001); - EXPECT_LT(err, 0.9); + ASSERT_GT(err, 0.0001); + ASSERT_LT(err, 0.9); } for (int i = 0; i < kSrcPlaneSize; ++i) { @@ -704,8 +704,8 @@ TEST_F(LibYUVCompareTest, Ssim) { kSrcHeight); if (kSrcWidth > 8 && kSrcHeight > 8) { - EXPECT_GT(err, 0.0); - EXPECT_LT(err, 0.01); + ASSERT_GT(err, 0.0); + ASSERT_LT(err, 0.01); } for (int i = b; i < (kSrcHeight + b); ++i) { @@ -729,7 +729,7 @@ TEST_F(LibYUVCompareTest, Ssim) { kSrcHeight); if (kSrcWidth > 8 && kSrcHeight > 8) { - EXPECT_EQ(opt_err, c_err); + ASSERT_EQ(opt_err, c_err); } free_aligned_buffer_page_end(src_a); diff --git a/unit_test/convert_argb_test.cc b/unit_test/convert_argb_test.cc index e309b38bb..d7776c479 100644 --- a/unit_test/convert_argb_test.cc +++ b/unit_test/convert_argb_test.cc @@ -124,11 +124,11 @@ namespace libyuv { NEG kHeight); \ } \ for (int i = 0; i < kHeight * kWidth * DST_BPC; ++i) { \ - EXPECT_EQ(dst_y_c[i], dst_y_opt[i]); \ + ASSERT_EQ(dst_y_c[i], dst_y_opt[i]); \ } \ for (int i = 0; i < kDstHalfWidth * kDstHalfHeight * DST_BPC; ++i) { \ - EXPECT_EQ(dst_u_c[i], dst_u_opt[i]); \ - EXPECT_EQ(dst_v_c[i], dst_v_opt[i]); \ + ASSERT_EQ(dst_u_c[i], dst_u_opt[i]); \ + ASSERT_EQ(dst_v_c[i], dst_v_opt[i]); \ } \ free_aligned_buffer_page_end(dst_y_c); \ free_aligned_buffer_page_end(dst_u_c); \ @@ -254,7 +254,7 @@ TESTBPTOP(P012, uint16_t, 2, 2, 2, I012, uint16_t, 2, 2, 2, 12, 1, 1) static_cast((time1 - time0) * 1e6), \ static_cast((time2 - time1) * 1e6 / benchmark_iterations_)); \ for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ + ASSERT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -423,7 +423,7 @@ TESTPLANARTOB(I444, 1, 1, ARGB, 4, 4, 1) kHeight); \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth * 4; ++j) { \ - EXPECT_EQ(dst_argb32_c[i * kWidth * 4 + j], \ + ASSERT_EQ(dst_argb32_c[i * kWidth * 4 + j], \ dst_argb32_opt[i * kWidth * 4 + j]); \ } \ } \ @@ -525,7 +525,7 @@ TESTBPTOB(NV12, 2, 2, RGB565, RGB565, 2) (TYPE_B*)dst_argb_opt, kStrideB, kWidth, NEG kHeight); \ } \ for (int i = 0; i < kStrideB * kHeightB * (int)sizeof(TYPE_B); ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -561,7 +561,7 @@ TESTBPTOB(NV12, 2, 2, RGB565, RGB565, 2) FMT_A##To##FMT_B((TYPE_A*)src_argb, kStrideA, (TYPE_B*)dst_argb_opt, \ kStrideB, kWidth, kHeight); \ for (int i = 0; i < kStrideB * kHeightB * (int)sizeof(TYPE_B); ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -697,7 +697,7 @@ TESTATOB(AB64, uint16_t, 4, 4, 1, AR64, uint16_t, 4, 4, 1) FMT_A##To##FMT_B((TYPE_A*)(dst_argb_opt /* src */ + OFF), kStrideA, \ (TYPE_B*)dst_argb_opt, kStrideB, kWidth, NEG kHeight); \ for (int i = 0; i < kStrideB * kHeightB * (int)sizeof(TYPE_B); ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -808,7 +808,7 @@ TESTATOA(AB64, uint16_t, 4, 4, 1, AR64, uint16_t, 4, 4, 1) kStrideB, NULL, kWidth, NEG kHeight); \ } \ for (int i = 0; i < kStrideB * kHeightB; ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -842,7 +842,7 @@ TESTATOA(AB64, uint16_t, 4, 4, 1, AR64, uint16_t, 4, 4, 1) FMT_A##To##FMT_B##Dither(src_argb, kStrideA, dst_argb_opt, kStrideB, \ NULL, kWidth, kHeight); \ for (int i = 0; i < kStrideB * kHeightB; ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -909,8 +909,8 @@ TESTATOBD(ARGB, 4, 4, 1, RGB565, 2, 2, 1) FMT_ATOB((TYPE_A*)dst_argb_opt, kStrideA, (TYPE_A*)dst_argb_opt, kStrideA, \ kWidth, NEG kHeight); \ for (int i = 0; i < kStrideA * kHeightA * (int)sizeof(TYPE_A); ++i) { \ - EXPECT_EQ(src_argb[i + OFF], dst_argb_opt[i]); \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(src_argb[i + OFF], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_argb_c); \ @@ -974,7 +974,7 @@ TESTEND(AB64ToAR64, uint16_t, 4, 4, 1) ATTEN); \ } \ for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ + ASSERT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -1164,7 +1164,7 @@ TEST_F(LibYUVConvertTest, TestYToARGB) { argb[i * 4 + 0], argb[i * 4 + 1], argb[i * 4 + 2], argb[i * 4 + 3]); } for (int i = 0; i < 32; ++i) { - EXPECT_EQ(expectedg[i], argb[i * 4 + 0]); + ASSERT_EQ(expectedg[i], argb[i * 4 + 0]); } } @@ -1186,7 +1186,7 @@ TEST_F(LibYUVConvertTest, TestNoDither) { benchmark_width_ * 2, kNoDither4x4, benchmark_width_, benchmark_height_); for (int i = 0; i < benchmark_width_ * benchmark_height_ * 2; ++i) { - EXPECT_EQ(dst_rgb565[i], dst_rgb565dither[i]); + ASSERT_EQ(dst_rgb565[i], dst_rgb565dither[i]); } free_aligned_buffer_page_end(src_argb); @@ -1223,7 +1223,7 @@ TEST_F(LibYUVConvertTest, TestDither) { benchmark_width_ * 4, benchmark_width_, benchmark_height_); for (int i = 0; i < benchmark_width_ * benchmark_height_ * 4; ++i) { - EXPECT_NEAR(dst_argb[i], dst_argbdither[i], 9); + ASSERT_NEAR(dst_argb[i], dst_argbdither[i], 9); } free_aligned_buffer_page_end(src_argb); free_aligned_buffer_page_end(dst_rgb565); @@ -1274,7 +1274,7 @@ TEST_F(LibYUVConvertTest, TestDither) { FMT_B##To##FMT_C(dst_argb_opt + OFF, kStrideB, dst_argb32_opt, \ kWidth * BPP_C, kWidth, kHeight); \ for (int i = 0; i < kWidth * BPP_C * kHeight; ++i) { \ - EXPECT_EQ(dst_argb32_c[i], dst_argb32_opt[i]); \ + ASSERT_EQ(dst_argb32_c[i], dst_argb32_opt[i]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -1347,7 +1347,7 @@ TESTPLANARTOBD(I420, 2, 2, RGB565, 2, 2, 1, ARGB, 4) kStrideC, kWidth, kHeight); \ } \ for (int i = 0; i < kStrideC * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + OFF], dst_argb_bc[i + OFF]); \ + ASSERT_EQ(dst_argb_c[i + OFF], dst_argb_bc[i + OFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -1499,7 +1499,7 @@ TESTPLANARTOE(I444, 1, 1, ABGR, 1, 4, ARGB, 4) src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), src_a + OFF, kWidth, \ dst_argb_c + OFF, kStrideC, kWidth, NEG kHeight, ATTEN); \ for (int i = 0; i < kStrideC * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + OFF], dst_argb_bc[i + OFF]); \ + ASSERT_EQ(dst_argb_c[i + OFF], dst_argb_bc[i + OFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -1598,10 +1598,10 @@ TESTQPLANARTOE(I444Alpha, 1, 1, ABGR, 1, 4, ARGB, 4) kStrideC, kWidth, kHeight); \ } \ for (int i = 0; i < kStrideC * kHeight; i += 4) { \ - EXPECT_EQ(dst_argb_c[i + OFF + 0], dst_argb_bc[i + OFF + 0]); \ - EXPECT_EQ(dst_argb_c[i + OFF + 1], dst_argb_bc[i + OFF + 1]); \ - EXPECT_EQ(dst_argb_c[i + OFF + 2], dst_argb_bc[i + OFF + 2]); \ - EXPECT_NEAR(dst_argb_c[i + OFF + 3], dst_argb_bc[i + OFF + 3], 64); \ + ASSERT_EQ(dst_argb_c[i + OFF + 0], dst_argb_bc[i + OFF + 0]); \ + ASSERT_EQ(dst_argb_c[i + OFF + 1], dst_argb_bc[i + OFF + 1]); \ + ASSERT_EQ(dst_argb_c[i + OFF + 2], dst_argb_bc[i + OFF + 2]); \ + ASSERT_NEAR(dst_argb_c[i + OFF + 3], dst_argb_bc[i + OFF + 3], 64); \ } \ free_aligned_buffer_page_end(src_argb_a); \ free_aligned_buffer_page_end(dst_argb_b); \ @@ -1664,12 +1664,12 @@ TEST_F(LibYUVConvertTest, RotateWithARGBSource) { 2, // crop height kRotate90, FOURCC_ARGB); - EXPECT_EQ(r, 0); + ASSERT_EQ(r, 0); // 90 degrees rotation, no conversion - EXPECT_EQ(dst[0], src[2]); - EXPECT_EQ(dst[1], src[0]); - EXPECT_EQ(dst[2], src[3]); - EXPECT_EQ(dst[3], src[1]); + ASSERT_EQ(dst[0], src[2]); + ASSERT_EQ(dst[1], src[0]); + ASSERT_EQ(dst[2], src[3]); + ASSERT_EQ(dst[3], src[1]); } #ifdef HAS_ARGBTOAR30ROW_AVX2 @@ -1697,7 +1697,7 @@ TEST_F(LibYUVConvertTest, ARGBToAR30Row_Opt) { } } for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_opt[i], dst_c[i]); + ASSERT_EQ(dst_opt[i], dst_c[i]); } free_aligned_buffer_page_end(src); @@ -1731,7 +1731,7 @@ TEST_F(LibYUVConvertTest, ABGRToAR30Row_Opt) { } } for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_opt[i], dst_c[i]); + ASSERT_EQ(dst_opt[i], dst_c[i]); } free_aligned_buffer_page_end(src); @@ -1827,7 +1827,7 @@ TEST_F(LibYUVConvertTest, ABGRToAR30Row_Opt) { dst_argb_opt + DOFF, kStrideB, kWidth, NEG kHeight); \ } \ for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + DOFF], dst_argb_opt[i + DOFF]); \ + ASSERT_EQ(dst_argb_c[i + DOFF], dst_argb_opt[i + DOFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -1950,7 +1950,7 @@ TESTPLANAR16TOB(I210, 2, 1, 0x3ff, AR30Filter, 4, 4, 1) dst_argb_opt + OFF, kStrideB, kWidth, NEG kHeight, ATTEN); \ } \ for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ + ASSERT_EQ(dst_argb_c[i + OFF], dst_argb_opt[i + OFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_u); \ @@ -2173,7 +2173,7 @@ TESTQPLANAR16TOB(I210Alpha, 2, 1, ARGBFilter, 4, 4, 1, 10) NEG kHeight); \ } \ for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i + DOFF], dst_argb_opt[i + DOFF]); \ + ASSERT_EQ(dst_argb_c[i + DOFF], dst_argb_opt[i + DOFF]); \ } \ free_aligned_buffer_page_end(src_y); \ free_aligned_buffer_page_end(src_uv); \ @@ -2316,10 +2316,10 @@ TEST_F(LibYUVConvertTest, TestH420ToARGB) { ++histogram_r[r]; // Reference formula for Y channel contribution in YUV to RGB conversions: int expected_y = Clamp(static_cast((i - 16) * 1.164f + 0.5f)); - EXPECT_EQ(b, expected_y); - EXPECT_EQ(g, expected_y); - EXPECT_EQ(r, expected_y); - EXPECT_EQ(a, 255); + ASSERT_EQ(b, expected_y); + ASSERT_EQ(g, expected_y); + ASSERT_EQ(r, expected_y); + ASSERT_EQ(a, 255); } int count_b = 0; @@ -2377,10 +2377,10 @@ TEST_F(LibYUVConvertTest, TestH010ToARGB) { ++histogram_g[g]; ++histogram_r[r]; int expected_y = Clamp(static_cast((i - 64) * 1.164f / 4)); - EXPECT_NEAR(b, expected_y, 1); - EXPECT_NEAR(g, expected_y, 1); - EXPECT_NEAR(r, expected_y, 1); - EXPECT_EQ(a, 255); + ASSERT_NEAR(b, expected_y, 1); + ASSERT_NEAR(g, expected_y, 1); + ASSERT_NEAR(r, expected_y, 1); + ASSERT_EQ(a, 255); } int count_b = 0; @@ -2441,10 +2441,10 @@ TEST_F(LibYUVConvertTest, TestH010ToAR30) { ++histogram_g[g10]; ++histogram_r[r10]; int expected_y = Clamp10(static_cast((i - 64) * 1.164f + 0.5)); - EXPECT_NEAR(b10, expected_y, 4); - EXPECT_NEAR(g10, expected_y, 4); - EXPECT_NEAR(r10, expected_y, 4); - EXPECT_EQ(a2, 3); + ASSERT_NEAR(b10, expected_y, 4); + ASSERT_NEAR(g10, expected_y, 4); + ASSERT_NEAR(r10, expected_y, 4); + ASSERT_EQ(a2, 3); } int count_b = 0; @@ -2505,10 +2505,10 @@ TEST_F(LibYUVConvertTest, TestH010ToAB30) { ++histogram_g[g10]; ++histogram_r[r10]; int expected_y = Clamp10(static_cast((i - 64) * 1.164f)); - EXPECT_NEAR(b10, expected_y, 4); - EXPECT_NEAR(g10, expected_y, 4); - EXPECT_NEAR(r10, expected_y, 4); - EXPECT_EQ(a2, 3); + ASSERT_NEAR(b10, expected_y, 4); + ASSERT_NEAR(g10, expected_y, 4); + ASSERT_NEAR(r10, expected_y, 4); + ASSERT_EQ(a2, 3); } int count_b = 0; @@ -2567,10 +2567,10 @@ TEST_F(LibYUVConvertTest, TestH420ToAR30) { ++histogram_g[g10]; ++histogram_r[r10]; int expected_y = Clamp10(static_cast((i - 16) * 1.164f * 4.f)); - EXPECT_NEAR(b10, expected_y, 4); - EXPECT_NEAR(g10, expected_y, 4); - EXPECT_NEAR(r10, expected_y, 4); - EXPECT_EQ(a2, 3); + ASSERT_NEAR(b10, expected_y, 4); + ASSERT_NEAR(g10, expected_y, 4); + ASSERT_NEAR(r10, expected_y, 4); + ASSERT_EQ(a2, 3); } int count_b = 0; @@ -2617,34 +2617,34 @@ TEST_F(LibYUVConvertTest, TestI400) { I400ToARGBMatrix(orig_i400, 0, argb_pixels_2020_i400, 0, &kYuv2020Constants, kSize, 1); - EXPECT_EQ(0, argb_pixels_i400[0]); - EXPECT_EQ(0, argb_pixels_j400[0]); - EXPECT_EQ(0, argb_pixels_jpeg_i400[0]); - EXPECT_EQ(0, argb_pixels_h709_i400[0]); - EXPECT_EQ(0, argb_pixels_2020_i400[0]); - EXPECT_EQ(0, argb_pixels_i400[16 * 4]); - EXPECT_EQ(16, argb_pixels_j400[16 * 4]); - EXPECT_EQ(16, argb_pixels_jpeg_i400[16 * 4]); - EXPECT_EQ(0, argb_pixels_h709_i400[16 * 4]); - EXPECT_EQ(0, argb_pixels_2020_i400[16 * 4]); - EXPECT_EQ(130, argb_pixels_i400[128 * 4]); - EXPECT_EQ(128, argb_pixels_j400[128 * 4]); - EXPECT_EQ(128, argb_pixels_jpeg_i400[128 * 4]); - EXPECT_EQ(130, argb_pixels_h709_i400[128 * 4]); - EXPECT_EQ(130, argb_pixels_2020_i400[128 * 4]); - EXPECT_EQ(255, argb_pixels_i400[255 * 4]); - EXPECT_EQ(255, argb_pixels_j400[255 * 4]); - EXPECT_EQ(255, argb_pixels_jpeg_i400[255 * 4]); - EXPECT_EQ(255, argb_pixels_h709_i400[255 * 4]); - EXPECT_EQ(255, argb_pixels_2020_i400[255 * 4]); + ASSERT_EQ(0, argb_pixels_i400[0]); + ASSERT_EQ(0, argb_pixels_j400[0]); + ASSERT_EQ(0, argb_pixels_jpeg_i400[0]); + ASSERT_EQ(0, argb_pixels_h709_i400[0]); + ASSERT_EQ(0, argb_pixels_2020_i400[0]); + ASSERT_EQ(0, argb_pixels_i400[16 * 4]); + ASSERT_EQ(16, argb_pixels_j400[16 * 4]); + ASSERT_EQ(16, argb_pixels_jpeg_i400[16 * 4]); + ASSERT_EQ(0, argb_pixels_h709_i400[16 * 4]); + ASSERT_EQ(0, argb_pixels_2020_i400[16 * 4]); + ASSERT_EQ(130, argb_pixels_i400[128 * 4]); + ASSERT_EQ(128, argb_pixels_j400[128 * 4]); + ASSERT_EQ(128, argb_pixels_jpeg_i400[128 * 4]); + ASSERT_EQ(130, argb_pixels_h709_i400[128 * 4]); + ASSERT_EQ(130, argb_pixels_2020_i400[128 * 4]); + ASSERT_EQ(255, argb_pixels_i400[255 * 4]); + ASSERT_EQ(255, argb_pixels_j400[255 * 4]); + ASSERT_EQ(255, argb_pixels_jpeg_i400[255 * 4]); + ASSERT_EQ(255, argb_pixels_h709_i400[255 * 4]); + ASSERT_EQ(255, argb_pixels_2020_i400[255 * 4]); for (int i = 0; i < kSize * 4; ++i) { if ((i & 3) == 3) { - EXPECT_EQ(255, argb_pixels_j400[i]); + ASSERT_EQ(255, argb_pixels_j400[i]); } else { - EXPECT_EQ(i / 4, argb_pixels_j400[i]); + ASSERT_EQ(i / 4, argb_pixels_j400[i]); } - EXPECT_EQ(argb_pixels_jpeg_i400[i], argb_pixels_j400[i]); + ASSERT_EQ(argb_pixels_jpeg_i400[i], argb_pixels_j400[i]); } free_aligned_buffer_page_end(orig_i400); @@ -2671,7 +2671,7 @@ TEST_F(LibYUVConvertTest, TestARGBToRGB24) { ARGBToRGB24(argb_pixels, 0, dest_rgb24, 0, kSize, 1); for (int i = 0; i < kSize * 3; ++i) { - EXPECT_EQ(orig_rgb24[i], dest_rgb24[i]); + ASSERT_EQ(orig_rgb24[i], dest_rgb24[i]); } free_aligned_buffer_page_end(orig_rgb24); @@ -2690,7 +2690,7 @@ TEST_F(LibYUVConvertTest, TestARGBToRGB565) { } ARGBToRGB565(&orig_pixels[0][0], 0, &dest_rgb565[0][0], 0, 256, 1); uint32_t checksum = HashDjb2(&dest_rgb565[0][0], sizeof(dest_rgb565), 5381); - EXPECT_EQ(610919429u, checksum); + ASSERT_EQ(610919429u, checksum); } TEST_F(LibYUVConvertTest, TestYUY2ToARGB) { @@ -2705,9 +2705,9 @@ TEST_F(LibYUVConvertTest, TestYUY2ToARGB) { YUY2ToARGB(&orig_pixels[0][0], 0, &dest_argb[0][0], 0, 256, 1); uint32_t checksum = HashDjb2(&dest_argb[0][0], sizeof(dest_argb), 5381); #if defined(LIBYUV_UNLIMITED_DATA) - EXPECT_EQ(10343289u, checksum); + ASSERT_EQ(10343289u, checksum); #else - EXPECT_EQ(3486643515u, checksum); + ASSERT_EQ(3486643515u, checksum); #endif } @@ -2723,9 +2723,9 @@ TEST_F(LibYUVConvertTest, TestUYVYToARGB) { UYVYToARGB(&orig_pixels[0][0], 0, &dest_argb[0][0], 0, 256, 1); uint32_t checksum = HashDjb2(&dest_argb[0][0], sizeof(dest_argb), 5381); #if defined(LIBYUV_UNLIMITED_DATA) - EXPECT_EQ(10343289u, checksum); + ASSERT_EQ(10343289u, checksum); #else - EXPECT_EQ(3486643515u, checksum); + ASSERT_EQ(3486643515u, checksum); #endif } @@ -2803,9 +2803,9 @@ TEST_F(LibYUVConvertTest, TestARGBToUVRow) { printf("\n"); uint32_t checksum_u = HashDjb2(&dest_u[0], sizeof(dest_u), 5381); - EXPECT_EQ(192508756u, checksum_u); + ASSERT_EQ(192508756u, checksum_u); uint32_t checksum_v = HashDjb2(&dest_v[0], sizeof(dest_v), 5381); - EXPECT_EQ(2590663990u, checksum_v); + ASSERT_EQ(2590663990u, checksum_v); } #endif @@ -2839,8 +2839,8 @@ TEST_F(LibYUVConvertTest, TestARGBToUVMatrixRow_Opt) { int half_width = (width + 1) / 2; for (int i = 0; i < half_width; ++i) { - EXPECT_EQ(dest_u_c[i], dest_u_opt[i]) << "u mismatch at " << i << " width " << width << " height " << height; - EXPECT_EQ(dest_v_c[i], dest_v_opt[i]) << "v mismatch at " << i << " width " << width << " height " << height; + ASSERT_EQ(dest_u_c[i], dest_u_opt[i]) << "u mismatch at " << i << " width " << width << " height " << height; + ASSERT_EQ(dest_v_c[i], dest_v_opt[i]) << "v mismatch at " << i << " width " << width << " height " << height; } } } @@ -2853,6 +2853,7 @@ TEST_F(LibYUVConvertTest, TestARGBToUVMatrixRow_Opt) { (defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__)) // TODO(fbarchard): Consider _set_new_mode(0) to make malloc return NULL +#ifndef DISABLE_SLOW_TESTS TEST_F(LibYUVConvertTest, TestI400LargeSize) { // The width and height are chosen as follows: // - kWidth * kHeight is not a multiple of 8: This lets us to use the Any @@ -2896,12 +2897,13 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) { for (int i = 0; i < kWidth * kHeight; ++i) { orig_i400[i] = i % 256; } - EXPECT_EQ(I400ToARGBMatrix(orig_i400, kStride, dest_argb, kWidth, + ASSERT_EQ(I400ToARGBMatrix(orig_i400, kStride, dest_argb, kWidth, &kYuvJPEGConstants, kWidth, kHeight), 0); free_aligned_buffer_page_end(dest_argb); free_aligned_buffer_page_end(orig_i400); } +#endif // DISABLE_SLOW_TESTS #endif // !defined(DISABLE_SLOW_TESTS) && \ // (defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__)) @@ -2941,10 +2943,10 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) { kStrideY, dst_uv_opt, kStrideUV, kWidth, NEG kHeight); \ } \ for (int i = 0; i < kStrideY * kHeight; ++i) { \ - EXPECT_EQ(dst_y_c[i], dst_y_opt[i]); \ + ASSERT_EQ(dst_y_c[i], dst_y_opt[i]); \ } \ for (int i = 0; i < kSizeUV; ++i) { \ - EXPECT_EQ(dst_uv_c[i], dst_uv_opt[i]); \ + ASSERT_EQ(dst_uv_c[i], dst_uv_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb); \ free_aligned_buffer_page_end(dst_y_c); \ diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 3d5ce3799..481fe1272 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -125,11 +125,11 @@ namespace libyuv { NEG kHeight); \ } \ for (int i = 0; i < kHeight * kWidth * DST_BPC; ++i) { \ - EXPECT_EQ(dst_y_c[i], dst_y_opt[i]); \ + ASSERT_EQ(dst_y_c[i], dst_y_opt[i]); \ } \ for (int i = 0; i < kDstHalfWidth * kDstHalfHeight * DST_BPC; ++i) { \ - EXPECT_EQ(dst_u_c[i], dst_u_opt[i]); \ - EXPECT_EQ(dst_v_c[i], dst_v_opt[i]); \ + ASSERT_EQ(dst_u_c[i], dst_u_opt[i]); \ + ASSERT_EQ(dst_v_c[i], dst_v_opt[i]); \ } \ free_aligned_buffer_page_end(dst_y_c); \ free_aligned_buffer_page_end(dst_u_c); \ @@ -265,18 +265,18 @@ TESTPLANARTOP(I412, uint16_t, 2, 1, 1, I444, uint8_t, 1, 1, 1, 12) } \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ - EXPECT_EQ(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ + ASSERT_EQ(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ dst_u_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ - EXPECT_EQ(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ + ASSERT_EQ(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ dst_v_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]); \ } \ } \ @@ -402,10 +402,10 @@ static int I400ToNV21(const uint8_t* src_y, NEG kHeight); \ } \ for (int i = 0; i < kHeight * kWidth * DST_BPC; ++i) { \ - EXPECT_EQ(dst_y_c[i], dst_y_opt[i]); \ + ASSERT_EQ(dst_y_c[i], dst_y_opt[i]); \ } \ for (int i = 0; i < kDstHalfWidth * kDstHalfHeight * DST_BPC * 2; ++i) { \ - EXPECT_EQ(dst_uv_c[i], dst_uv_opt[i]); \ + ASSERT_EQ(dst_uv_c[i], dst_uv_opt[i]); \ } \ free_aligned_buffer_page_end(dst_y_c); \ free_aligned_buffer_page_end(dst_uv_c); \ @@ -525,13 +525,13 @@ TESTPLANARTOBP(I212, uint16_t, 2, 2, 1, P212, uint16_t, 2, 2, 1, 12) if (DOY) { \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ } \ } \ } \ for (int i = 0; i < kDstHalfHeight; ++i) { \ for (int j = 0; j < 2 * kDstHalfWidth; ++j) { \ - EXPECT_EQ(dst_uv_c[i * 2 * kDstHalfWidth + j], \ + ASSERT_EQ(dst_uv_c[i * 2 * kDstHalfWidth + j], \ dst_uv_opt[i * 2 * kDstHalfWidth + j]); \ } \ } \ @@ -624,12 +624,12 @@ TESTBPTOBP(P010, uint16_t, 2, 2, 2, NV12, uint8_t, 1, 2, 2, 8, 1, 1) } \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y) * 2; ++i) { \ for (int j = 0; j < kStrideUV; ++j) { \ - EXPECT_EQ(dst_uv_c[i * kStrideUV + j], dst_uv_opt[i * kStrideUV + j]); \ + ASSERT_EQ(dst_uv_c[i * kStrideUV + j], dst_uv_opt[i * kStrideUV + j]); \ } \ } \ free_aligned_buffer_page_end(dst_y_c); \ @@ -722,13 +722,13 @@ TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1) } \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ - EXPECT_EQ(dst_a_c[i * kWidth + j], dst_a_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_a_c[i * kWidth + j], dst_a_opt[i * kWidth + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y) * 2; ++i) { \ for (int j = 0; j < kStrideUV; ++j) { \ - EXPECT_EQ(dst_uv_c[i * kStrideUV + j], dst_uv_opt[i * kStrideUV + j]); \ + ASSERT_EQ(dst_uv_c[i * kStrideUV + j], dst_uv_opt[i * kStrideUV + j]); \ } \ } \ free_aligned_buffer_page_end(dst_a_c); \ @@ -789,12 +789,12 @@ TESTATOPLANARA(ARGB, 4, 1, I420Alpha, 2, 2) } \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ for (int j = 0; j < kStrideUV * 2; ++j) { \ - EXPECT_EQ(dst_uv_c[i * kStrideUV * 2 + j], \ + ASSERT_EQ(dst_uv_c[i * kStrideUV * 2 + j], \ dst_uv_opt[i * kStrideUV * 2 + j]); \ } \ } \ @@ -844,11 +844,11 @@ TEST_F(LibYUVConvertTest, ValidateJpeg) { // No SOI or EOI. Expect fail. memset(orig_pixels, 0, kSize); - EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kSize)); // Test special value that matches marker start. memset(orig_pixels, 0xff, kSize); - EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kSize)); // EOI, SOI. Expect pass. orig_pixels[0] = 0xff; @@ -857,7 +857,7 @@ TEST_F(LibYUVConvertTest, ValidateJpeg) { orig_pixels[kSize - kOff + 0] = 0xff; orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. for (int times = 0; times < benchmark_iterations_; ++times) { - EXPECT_TRUE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_TRUE(ValidateJpeg(orig_pixels, kSize)); } free_aligned_buffer_page_end(orig_pixels); } @@ -875,7 +875,7 @@ TEST_F(LibYUVConvertTest, ValidateJpegLarge) { // No SOI or EOI. Expect fail. memset(orig_pixels, 0, kBufSize); - EXPECT_FALSE(ValidateJpeg(orig_pixels, kBufSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kBufSize)); // EOI, SOI. Expect pass. orig_pixels[0] = 0xff; @@ -884,7 +884,7 @@ TEST_F(LibYUVConvertTest, ValidateJpegLarge) { orig_pixels[kSize - kOff + 0] = 0xff; orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. for (int times = 0; times < benchmark_iterations_; ++times) { - EXPECT_TRUE(ValidateJpeg(orig_pixels, kBufSize)); + ASSERT_TRUE(ValidateJpeg(orig_pixels, kBufSize)); } free_aligned_buffer_page_end(orig_pixels); } @@ -899,24 +899,24 @@ TEST_F(LibYUVConvertTest, InvalidateJpeg) { align_buffer_page_end(orig_pixels, kSize); // NULL pointer. Expect fail. - EXPECT_FALSE(ValidateJpeg(NULL, kSize)); + ASSERT_FALSE(ValidateJpeg(NULL, kSize)); // Negative size. Expect fail. - EXPECT_FALSE(ValidateJpeg(orig_pixels, -1)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, -1)); // Too large size. Expect fail. - EXPECT_FALSE(ValidateJpeg(orig_pixels, 0xfb000000ull)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, 0xfb000000ull)); // No SOI or EOI. Expect fail. memset(orig_pixels, 0, kSize); - EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kSize)); // SOI but no EOI. Expect fail. orig_pixels[0] = 0xff; orig_pixels[1] = 0xd8; // SOI. orig_pixels[2] = 0xff; for (int times = 0; times < benchmark_iterations_; ++times) { - EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kSize)); } // EOI but no SOI. Expect fail. @@ -924,7 +924,7 @@ TEST_F(LibYUVConvertTest, InvalidateJpeg) { orig_pixels[1] = 0; orig_pixels[kSize - kOff + 0] = 0xff; orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. - EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); + ASSERT_FALSE(ValidateJpeg(orig_pixels, kSize)); free_aligned_buffer_page_end(orig_pixels); } @@ -1248,7 +1248,7 @@ TEST_F(LibYUVConvertTest, TestMJPGSize) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); printf("test jpeg size %d x %d\n", width, height); } @@ -1257,7 +1257,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1275,15 +1275,15 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420) { dst_v, half_width, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); uint32_t dst_u_hash = HashDjb2(dst_u, half_width * half_height, 5381); uint32_t dst_v_hash = HashDjb2(dst_v, half_width * half_height, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_u_hash, 2501859930u); - EXPECT_EQ(dst_v_hash, 2126459123u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_u_hash, 2501859930u); + ASSERT_EQ(dst_v_hash, 2126459123u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_u); @@ -1294,7 +1294,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV21) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1313,7 +1313,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV21) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Convert to I420 align_buffer_page_end(dst2_y, width * height); @@ -1324,7 +1324,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV21) { dst2_v, half_width, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Convert I420 to NV21 align_buffer_page_end(dst3_y, width * height); @@ -1334,11 +1334,11 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV21) { width, dst3_vu, half_width * 2, width, height); for (int i = 0; i < width * height; ++i) { - EXPECT_EQ(dst_y[i], dst3_y[i]); + ASSERT_EQ(dst_y[i], dst3_y[i]); } for (int i = 0; i < half_width * half_height * 2; ++i) { - EXPECT_EQ(dst_vu[i], dst3_vu[i]); - EXPECT_EQ(dst_vu[i], dst3_vu[i]); + ASSERT_EQ(dst_vu[i], dst3_vu[i]); + ASSERT_EQ(dst_vu[i], dst3_vu[i]); } free_aligned_buffer_page_end(dst3_y); @@ -1356,7 +1356,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV12) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1375,7 +1375,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV12) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Convert to I420 align_buffer_page_end(dst2_y, width * height); @@ -1386,7 +1386,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV12) { dst2_v, half_width, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Convert I420 to NV12 align_buffer_page_end(dst3_y, width * height); @@ -1396,11 +1396,11 @@ TEST_F(LibYUVConvertTest, TestMJPGToI420_NV12) { width, dst3_uv, half_width * 2, width, height); for (int i = 0; i < width * height; ++i) { - EXPECT_EQ(dst_y[i], dst3_y[i]); + ASSERT_EQ(dst_y[i], dst3_y[i]); } for (int i = 0; i < half_width * half_height * 2; ++i) { - EXPECT_EQ(dst_uv[i], dst3_uv[i]); - EXPECT_EQ(dst_uv[i], dst3_uv[i]); + ASSERT_EQ(dst_uv[i], dst3_uv[i]); + ASSERT_EQ(dst_uv[i], dst3_uv[i]); } free_aligned_buffer_page_end(dst3_y); @@ -1418,7 +1418,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_420) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1435,13 +1435,13 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_420) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); uint32_t dst_uv_hash = HashDjb2(dst_uv, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_uv_hash, 1069662856u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_uv_hash, 1069662856u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1451,7 +1451,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_420) { int width = 0; int height = 0; int ret = MJPGSize(kTest2Jpg, kTest2JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1468,7 +1468,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_420) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. Hashes are for VU so flip the plane. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); @@ -1476,8 +1476,8 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_420) { SwapUVPlane(dst_uv, half_width * 2, dst_vu, half_width * 2, half_width, half_height); uint32_t dst_vu_hash = HashDjb2(dst_vu, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_vu_hash, 1069662856u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_vu_hash, 1069662856u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1489,7 +1489,7 @@ TEST_F(LibYUVConvertTest, DISABLED_TestMJPGToNV21_422) { int width = 0; int height = 0; int ret = MJPGSize(kTest3Jpg, kTest3JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1506,13 +1506,13 @@ TEST_F(LibYUVConvertTest, DISABLED_TestMJPGToNV21_422) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); uint32_t dst_uv_hash = HashDjb2(dst_uv, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_uv_hash, 493520167u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_uv_hash, 493520167u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1522,7 +1522,7 @@ TEST_F(LibYUVConvertTest, DISABLED_TestMJPGToNV12_422) { int width = 0; int height = 0; int ret = MJPGSize(kTest3Jpg, kTest3JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1539,7 +1539,7 @@ TEST_F(LibYUVConvertTest, DISABLED_TestMJPGToNV12_422) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. Hashes are for VU so flip the plane. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); @@ -1547,8 +1547,8 @@ TEST_F(LibYUVConvertTest, DISABLED_TestMJPGToNV12_422) { SwapUVPlane(dst_uv, half_width * 2, dst_vu, half_width * 2, half_width, half_height); uint32_t dst_vu_hash = HashDjb2(dst_vu, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_vu_hash, 493520167u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_vu_hash, 493520167u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1559,7 +1559,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_400) { int width = 0; int height = 0; int ret = MJPGSize(kTest0Jpg, kTest0JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1576,13 +1576,13 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_400) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); uint32_t dst_uv_hash = HashDjb2(dst_uv, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 330644005u); - EXPECT_EQ(dst_uv_hash, 135214341u); + ASSERT_EQ(dst_y_hash, 330644005u); + ASSERT_EQ(dst_uv_hash, 135214341u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1592,7 +1592,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_400) { int width = 0; int height = 0; int ret = MJPGSize(kTest0Jpg, kTest0JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1609,7 +1609,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_400) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. Hashes are for VU so flip the plane. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); @@ -1617,8 +1617,8 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_400) { SwapUVPlane(dst_uv, half_width * 2, dst_vu, half_width * 2, half_width, half_height); uint32_t dst_vu_hash = HashDjb2(dst_vu, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 330644005u); - EXPECT_EQ(dst_vu_hash, 135214341u); + ASSERT_EQ(dst_y_hash, 330644005u); + ASSERT_EQ(dst_vu_hash, 135214341u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1629,7 +1629,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_444) { int width = 0; int height = 0; int ret = MJPGSize(kTest1Jpg, kTest1JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1646,13 +1646,13 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV21_444) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); uint32_t dst_uv_hash = HashDjb2(dst_uv, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_uv_hash, 506143297u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_uv_hash, 506143297u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1662,7 +1662,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_444) { int width = 0; int height = 0; int ret = MJPGSize(kTest1Jpg, kTest1JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; @@ -1679,7 +1679,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_444) { half_width * 2, width, height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. Hashes are for VU so flip the plane. uint32_t dst_y_hash = HashDjb2(dst_y, width * height, 5381); @@ -1687,8 +1687,8 @@ TEST_F(LibYUVConvertTest, TestMJPGToNV12_444) { SwapUVPlane(dst_uv, half_width * 2, dst_vu, half_width * 2, half_width, half_height); uint32_t dst_vu_hash = HashDjb2(dst_vu, half_width * half_height * 2, 5381); - EXPECT_EQ(dst_y_hash, 2682851208u); - EXPECT_EQ(dst_vu_hash, 506143297u); + ASSERT_EQ(dst_y_hash, 2682851208u); + ASSERT_EQ(dst_vu_hash, 506143297u); free_aligned_buffer_page_end(dst_y); free_aligned_buffer_page_end(dst_uv); @@ -1699,7 +1699,7 @@ TEST_F(LibYUVConvertTest, TestMJPGToARGB) { int width = 0; int height = 0; int ret = MJPGSize(kTest3Jpg, kTest3JpgLen, &width, &height); - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); int benchmark_iterations = benchmark_iterations_ * benchmark_width_ * benchmark_height_ / (width * height); @@ -1713,14 +1713,14 @@ TEST_F(LibYUVConvertTest, TestMJPGToARGB) { height, width, height); } // Expect sucesss - EXPECT_EQ(0, ret); + ASSERT_EQ(0, ret); // Test result matches known hash value. uint32_t dst_argb_hash = HashDjb2(dst_argb, width * height, 5381); #ifdef LIBYUV_UNLIMITED_DATA - EXPECT_EQ(dst_argb_hash, 3900633302u); + ASSERT_EQ(dst_argb_hash, 3900633302u); #else - EXPECT_EQ(dst_argb_hash, 2355976473u); + ASSERT_EQ(dst_argb_hash, 2355976473u); #endif free_aligned_buffer_page_end(dst_argb); @@ -1783,11 +1783,11 @@ static int ShowJPegInfo(const uint8_t* sample, size_t sample_size) { } TEST_F(LibYUVConvertTest, TestMJPGInfo) { - EXPECT_EQ(1, ShowJPegInfo(kTest0Jpg, kTest0JpgLen)); - EXPECT_EQ(1, ShowJPegInfo(kTest1Jpg, kTest1JpgLen)); - EXPECT_EQ(1, ShowJPegInfo(kTest2Jpg, kTest2JpgLen)); - EXPECT_EQ(1, ShowJPegInfo(kTest3Jpg, kTest3JpgLen)); - EXPECT_EQ(1, ShowJPegInfo(kTest4Jpg, + ASSERT_EQ(1, ShowJPegInfo(kTest0Jpg, kTest0JpgLen)); + ASSERT_EQ(1, ShowJPegInfo(kTest1Jpg, kTest1JpgLen)); + ASSERT_EQ(1, ShowJPegInfo(kTest2Jpg, kTest2JpgLen)); + ASSERT_EQ(1, ShowJPegInfo(kTest3Jpg, kTest3JpgLen)); + ASSERT_EQ(1, ShowJPegInfo(kTest4Jpg, kTest4JpgLen)); // Valid but unsupported. } #endif // HAVE_JPEG @@ -1848,18 +1848,18 @@ TEST_F(LibYUVConvertTest, NV12Crop) { for (int i = 0; i < kDestHeight; ++i) { for (int j = 0; j < kDestWidth; ++j) { - EXPECT_EQ(dst_y[i * kWidth + j], dst_y_2[i * kWidth + j]); + ASSERT_EQ(dst_y[i * kWidth + j], dst_y_2[i * kWidth + j]); } } for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) { for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) { - EXPECT_EQ(dst_u[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j], + ASSERT_EQ(dst_u[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j], dst_u_2[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]); } } for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) { for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) { - EXPECT_EQ(dst_v[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j], + ASSERT_EQ(dst_v[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j], dst_v_2[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]); } } @@ -1921,19 +1921,19 @@ TEST_F(LibYUVConvertTest, I420CropOddY) { for (int i = 0; i < kDestHeight; ++i) { for (int j = 0; j < kDestWidth; ++j) { - EXPECT_EQ(src_y[crop_y * kWidth + i * kWidth + j], + ASSERT_EQ(src_y[crop_y * kWidth + i * kWidth + j], dst_y[i * kDestWidth + j]); } } for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) { for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) { - EXPECT_EQ(src_u[(crop_y / 2 + i) * kStrideU + j], + ASSERT_EQ(src_u[(crop_y / 2 + i) * kStrideU + j], dst_u[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]); } } for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) { for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) { - EXPECT_EQ(src_v[(crop_y / 2 + i) * kStrideV + j], + ASSERT_EQ(src_v[(crop_y / 2 + i) * kStrideV + j], dst_v[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]); } } @@ -1981,14 +1981,14 @@ TEST_F(LibYUVConvertTest, I420CropOddY) { } \ \ for (int i = 0; i < kWidth * kHeight; ++i) { \ - EXPECT_EQ(orig_y[i], dst_y[i]); \ + ASSERT_EQ(orig_y[i], dst_y[i]); \ } \ for (int i = 0; i < kWidth * kHeight; ++i) { \ - EXPECT_EQ(dst_y_orig[i], dst_y[i]); \ + ASSERT_EQ(dst_y_orig[i], dst_y[i]); \ } \ for (int i = 0; i < 2 * SUBSAMPLE(kWidth, 2) * SUBSAMPLE(kHeight, 2); \ ++i) { \ - EXPECT_EQ(dst_uv_orig[i], dst_uv[i]); \ + ASSERT_EQ(dst_uv_orig[i], dst_uv[i]); \ } \ \ free_aligned_buffer_page_end(orig_uyvy); \ @@ -2037,7 +2037,7 @@ TEST_F(LibYUVConvertTest, MM21ToYUY2) { } for (int i = 0; i < 4 * SUBSAMPLE(kWidth, 2) * kHeight; ++i) { - EXPECT_EQ(dst_yuyv[i], golden_yuyv[i]); + ASSERT_EQ(dst_yuyv[i], golden_yuyv[i]); } free_aligned_buffer_page_end(orig_y); @@ -2070,7 +2070,7 @@ TEST_F(LibYUVConvertTest, TestRGB24ToJ420) { } uint32_t checksum = HashDjb2(dest_j420, kSize * 3 / 2 * 2, 5381); - EXPECT_EQ(223551344u, checksum); + ASSERT_EQ(223551344u, checksum); free_aligned_buffer_page_end(orig_rgb24); free_aligned_buffer_page_end(dest_j420); @@ -2098,7 +2098,7 @@ TEST_F(LibYUVConvertTest, TestRGB24ToI420) { } uint32_t checksum = HashDjb2(dest_i420, kSize * 3 / 2 * 2, 5381); - EXPECT_EQ(4197774805u, checksum); + ASSERT_EQ(4197774805u, checksum); free_aligned_buffer_page_end(orig_rgb24); free_aligned_buffer_page_end(dest_i420); @@ -2116,15 +2116,15 @@ TEST_F(LibYUVConvertTest, TestJ420ToI420) { ASSERT_EQ(J420ToI420(src_y, 6, src_u, 3, src_v, 3, dst_y, 6, dst_u, 3, dst_v, 3, 6, 2), 0); - EXPECT_EQ(dst_y[0], 16); - EXPECT_EQ(dst_y[2], 126); - EXPECT_EQ(dst_y[4], 235); - EXPECT_EQ(dst_u[0], 16); - EXPECT_EQ(dst_u[1], 128); - EXPECT_EQ(dst_u[2], 240); - EXPECT_EQ(dst_v[0], 16); - EXPECT_EQ(dst_v[1], 128); - EXPECT_EQ(dst_v[2], 240); + ASSERT_EQ(dst_y[0], 16); + ASSERT_EQ(dst_y[2], 126); + ASSERT_EQ(dst_y[4], 235); + ASSERT_EQ(dst_u[0], 16); + ASSERT_EQ(dst_u[1], 128); + ASSERT_EQ(dst_u[2], 240); + ASSERT_EQ(dst_v[0], 16); + ASSERT_EQ(dst_v[1], 128); + ASSERT_EQ(dst_v[2], 240); } TEST_F(LibYUVConvertTest, TestABGRToI420Matrix) { @@ -2177,42 +2177,6 @@ TEST_F(LibYUVConvertTest, TestABGRToI420Matrix) { free_aligned_buffer_page_end(ref_v); } -TEST_F(LibYUVConvertTest, TestABGRToI422Matrix) { - const int kWidth = 16; - const int kHeight = 16; - align_buffer_page_end(src_abgr, kWidth * kHeight * 4); - align_buffer_page_end(dst_y, kWidth * kHeight); - align_buffer_page_end(dst_u, kWidth / 2 * kHeight); - align_buffer_page_end(dst_v, kWidth / 2 * kHeight); - - MemRandomize(src_abgr, kWidth * kHeight * 4); - - // JPEG - ARGBToI422Matrix(src_abgr, kWidth * 4, dst_y, kWidth, dst_u, kWidth / 2, - dst_v, kWidth / 2, &kAbgrJPEGConstants, kWidth, kHeight); - // Verify against non-matrix version - align_buffer_page_end(ref_y, kWidth * kHeight); - align_buffer_page_end(ref_u, kWidth / 2 * kHeight); - align_buffer_page_end(ref_v, kWidth / 2 * kHeight); - ABGRToJ422(src_abgr, kWidth * 4, ref_y, kWidth, ref_u, kWidth / 2, ref_v, - kWidth / 2, kWidth, kHeight); - for (int i = 0; i < kWidth * kHeight; ++i) { - ASSERT_EQ(dst_y[i], ref_y[i]); - } - for (int i = 0; i < kWidth / 2 * kHeight; ++i) { - ASSERT_EQ(dst_u[i], ref_u[i]); - ASSERT_EQ(dst_v[i], ref_v[i]); - } - - free_aligned_buffer_page_end(src_abgr); - free_aligned_buffer_page_end(dst_y); - free_aligned_buffer_page_end(dst_u); - free_aligned_buffer_page_end(dst_v); - free_aligned_buffer_page_end(ref_y); - free_aligned_buffer_page_end(ref_u); - free_aligned_buffer_page_end(ref_v); -} - TEST_F(LibYUVConvertTest, TestARGBToNV12Matrix) { const int kWidth = 16; const int kHeight = 16; @@ -2335,9 +2299,9 @@ TEST_F(LibYUVConvertTest, TestARGBToI420Matrix) { for (int i = 0; i < kWidth * kHeight * 4; ++i) src_argb[i] = 255; ARGBToI420Matrix(src_argb, kWidth * 4, dst_y, kWidth, dst_u, kWidth / 2, dst_v, kWidth / 2, &kArgbH709Constants, kWidth, kHeight); - EXPECT_EQ(dst_y[0], 235); - EXPECT_EQ(dst_u[0], 128); - EXPECT_EQ(dst_v[0], 128); + ASSERT_EQ(dst_y[0], 235); + ASSERT_EQ(dst_u[0], 128); + ASSERT_EQ(dst_v[0], 128); for (int i = 0; i < kWidth * kHeight * 4; i += 4) { src_argb[i + 0] = 0; // B @@ -2348,11 +2312,11 @@ TEST_F(LibYUVConvertTest, TestARGBToI420Matrix) { ARGBToI420Matrix(src_argb, kWidth * 4, dst_y, kWidth, dst_u, kWidth / 2, dst_v, kWidth / 2, &kArgbH709Constants, kWidth, kHeight); // Y = 47 * 255 + 4224 = 11985 + 4224 = 16209. 16209 / 256 = 63.3 -> 63. - EXPECT_EQ(dst_y[0], 63); + ASSERT_EQ(dst_y[0], 63); // U = -26 * 255 + 32768 = -6630 + 32768 = 26138. 26138 / 256 = 102.1 -> 102. - EXPECT_EQ(dst_u[0], 102); + ASSERT_EQ(dst_u[0], 102); // V = 112 * 255 + 32768 = 28560 + 32768 = 61328. 61328 / 256 = 239.5 -> 239. - EXPECT_EQ(dst_v[0], 239); + ASSERT_EQ(dst_v[0], 239); free_aligned_buffer_page_end(src_argb); free_aligned_buffer_page_end(dst_y); diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 80186de7a..b24f3e250 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -48,7 +48,7 @@ TEST_F(LibYUVBaseTest, TestCpuId) { printf("Cpu Vendor: %s 0x%x 0x%x 0x%x\n", reinterpret_cast(&cpu_info[0]), cpu_info[0], cpu_info[1], cpu_info[2]); - EXPECT_EQ(12u, strlen(reinterpret_cast(&cpu_info[0]))); + ASSERT_EQ(12u, strlen(reinterpret_cast(&cpu_info[0]))); // CPU Family and Model // 3:0 - Stepping @@ -327,8 +327,8 @@ TEST_F(LibYUVBaseTest, DISABLED_TestLinuxArm) { if (FileExists("../../unit_test/testdata/arm_v7.txt")) { printf("Note: testing to load \"../../unit_test/testdata/arm_v7.txt\"\n"); - EXPECT_EQ(0, ArmCpuCaps("../../unit_test/testdata/arm_v7.txt")); - EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("../../unit_test/testdata/tegra3.txt")); + ASSERT_EQ(0, ArmCpuCaps("../../unit_test/testdata/arm_v7.txt")); + ASSERT_EQ(kCpuHasNEON, ArmCpuCaps("../../unit_test/testdata/tegra3.txt")); } else { printf("WARNING: unable to load \"../../unit_test/testdata/arm_v7.txt\"\n"); } @@ -347,23 +347,23 @@ TEST_F(LibYUVBaseTest, DISABLED_TestLinuxArm) { #if defined(__linux__) && defined(__aarch64__) TEST_F(LibYUVBaseTest, TestLinuxAArch64) { // Values taken from a Cortex-A57 machine, only Neon available. - EXPECT_EQ(kCpuHasNEON, AArch64CpuCaps(0xffU, 0x0U)); + ASSERT_EQ(kCpuHasNEON, AArch64CpuCaps(0xffU, 0x0U)); // Values taken from a Google Pixel 7. int expected = kCpuHasNEON | kCpuHasNeonDotProd; - EXPECT_EQ(expected, AArch64CpuCaps(0x119fffU, 0x0U)); + ASSERT_EQ(expected, AArch64CpuCaps(0x119fffU, 0x0U)); // Values taken from a Google Pixel 8. expected = kCpuHasNEON | kCpuHasNeonDotProd | kCpuHasNeonI8MM | kCpuHasSVE | kCpuHasSVE2; - EXPECT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x2f33fU)); + ASSERT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x2f33fU)); // Values taken from a Neoverse N2 machine. - EXPECT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x2f3ffU)); + ASSERT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x2f3ffU)); // Check for SME feature detection. expected |= kCpuHasSME; - EXPECT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x82f3ffU)); + ASSERT_EQ(expected, AArch64CpuCaps(0x3fffffffU, 0x82f3ffU)); // TODO: Check for SME2 feature detection from Apple M4 } @@ -373,10 +373,10 @@ TEST_F(LibYUVBaseTest, DISABLED_TestLinuxRVV) { if (FileExists("../../unit_test/testdata/riscv64.txt")) { printf("Note: testing to load \"../../unit_test/testdata/riscv64.txt\"\n"); - EXPECT_EQ(0, RiscvCpuCaps("../../unit_test/testdata/riscv64.txt")); - EXPECT_EQ(kCpuHasRVV, + ASSERT_EQ(0, RiscvCpuCaps("../../unit_test/testdata/riscv64.txt")); + ASSERT_EQ(kCpuHasRVV, RiscvCpuCaps("../../unit_test/testdata/riscv64_rvv.txt")); - EXPECT_EQ(kCpuHasRVV | kCpuHasRVVZVFH, + ASSERT_EQ(kCpuHasRVV | kCpuHasRVVZVFH, RiscvCpuCaps("../../unit_test/testdata/riscv64_rvv_zvfh.txt")); } else { printf( @@ -410,15 +410,15 @@ TEST_F(LibYUVBaseTest, MAYBE_TestSetCpuFlags) { // Test setting different CPU configurations. int cpu_flags = kCpuHasARM | kCpuHasNEON | kCpuInitialized; SetCpuFlags(cpu_flags); - EXPECT_EQ(cpu_flags, TestCpuFlag(-1)); + ASSERT_EQ(cpu_flags, TestCpuFlag(-1)); cpu_flags = kCpuHasX86 | kCpuInitialized; SetCpuFlags(cpu_flags); - EXPECT_EQ(cpu_flags, TestCpuFlag(-1)); + ASSERT_EQ(cpu_flags, TestCpuFlag(-1)); // Test that setting 0 turns auto-init back on. SetCpuFlags(0); - EXPECT_EQ(original_cpu_flags, TestCpuFlag(-1)); + ASSERT_EQ(original_cpu_flags, TestCpuFlag(-1)); // Restore the CPU flag mask. MaskCpuFlags(benchmark_cpu_info_); diff --git a/unit_test/cpu_thread_test.cc b/unit_test/cpu_thread_test.cc index b6c0fa066..572074d73 100644 --- a/unit_test/cpu_thread_test.cc +++ b/unit_test/cpu_thread_test.cc @@ -51,10 +51,10 @@ TEST(LibYUVCpuThreadTest, TestCpuFlagMultipleThreads) { ret = pthread_create(&thread2, nullptr, ThreadMain, &cpu_flags2); ASSERT_EQ(ret, 0); ret = pthread_join(thread1, nullptr); - EXPECT_EQ(ret, 0); + ASSERT_EQ(ret, 0); ret = pthread_join(thread2, nullptr); - EXPECT_EQ(ret, 0); - EXPECT_EQ(cpu_flags1, cpu_flags2); + ASSERT_EQ(ret, 0); + ASSERT_EQ(cpu_flags1, cpu_flags2); #else printf("pthread unavailable; Test skipped."); #endif // LIBYUV_HAVE_PTHREAD diff --git a/unit_test/math_test.cc b/unit_test/math_test.cc index a1544c122..4767f8b46 100644 --- a/unit_test/math_test.cc +++ b/unit_test/math_test.cc @@ -30,44 +30,44 @@ TEST_F(LibYUVBaseTest, TestFixedDiv) { int result_opt[1280]; int result_c[1280]; - EXPECT_EQ(0x10000, libyuv::FixedDiv(1, 1)); - EXPECT_EQ(0x7fff0000, libyuv::FixedDiv(0x7fff, 1)); + ASSERT_EQ(0x10000, libyuv::FixedDiv(1, 1)); + ASSERT_EQ(0x7fff0000, libyuv::FixedDiv(0x7fff, 1)); // TODO(fbarchard): Avoid the following that throw exceptions. - // EXPECT_EQ(0x100000000, libyuv::FixedDiv(0x10000, 1)); - // EXPECT_EQ(0x80000000, libyuv::FixedDiv(0x8000, 1)); + // ASSERT_EQ(0x100000000, libyuv::FixedDiv(0x10000, 1)); + // ASSERT_EQ(0x80000000, libyuv::FixedDiv(0x8000, 1)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(640 * 2, 640)); - EXPECT_EQ(0x30000, libyuv::FixedDiv(640 * 3, 640)); - EXPECT_EQ(0x40000, libyuv::FixedDiv(640 * 4, 640)); - EXPECT_EQ(0x50000, libyuv::FixedDiv(640 * 5, 640)); - EXPECT_EQ(0x60000, libyuv::FixedDiv(640 * 6, 640)); - EXPECT_EQ(0x70000, libyuv::FixedDiv(640 * 7, 640)); - EXPECT_EQ(0x80000, libyuv::FixedDiv(640 * 8, 640)); - EXPECT_EQ(0xa0000, libyuv::FixedDiv(640 * 10, 640)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(960 * 2, 960)); - EXPECT_EQ(0x08000, libyuv::FixedDiv(640 / 2, 640)); - EXPECT_EQ(0x04000, libyuv::FixedDiv(640 / 4, 640)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(1080 * 2, 1080)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(200000, 100000)); - EXPECT_EQ(0x18000, libyuv::FixedDiv(150000, 100000)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(40000, 20000)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(-40000, -20000)); - EXPECT_EQ(-0x20000, libyuv::FixedDiv(40000, -20000)); - EXPECT_EQ(-0x20000, libyuv::FixedDiv(-40000, 20000)); - EXPECT_EQ(0x10000, libyuv::FixedDiv(4095, 4095)); - EXPECT_EQ(0x10000, libyuv::FixedDiv(4096, 4096)); - EXPECT_EQ(0x10000, libyuv::FixedDiv(4097, 4097)); - EXPECT_EQ(123 * 65536, libyuv::FixedDiv(123, 1)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(640 * 2, 640)); + ASSERT_EQ(0x30000, libyuv::FixedDiv(640 * 3, 640)); + ASSERT_EQ(0x40000, libyuv::FixedDiv(640 * 4, 640)); + ASSERT_EQ(0x50000, libyuv::FixedDiv(640 * 5, 640)); + ASSERT_EQ(0x60000, libyuv::FixedDiv(640 * 6, 640)); + ASSERT_EQ(0x70000, libyuv::FixedDiv(640 * 7, 640)); + ASSERT_EQ(0x80000, libyuv::FixedDiv(640 * 8, 640)); + ASSERT_EQ(0xa0000, libyuv::FixedDiv(640 * 10, 640)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(960 * 2, 960)); + ASSERT_EQ(0x08000, libyuv::FixedDiv(640 / 2, 640)); + ASSERT_EQ(0x04000, libyuv::FixedDiv(640 / 4, 640)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(1080 * 2, 1080)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(200000, 100000)); + ASSERT_EQ(0x18000, libyuv::FixedDiv(150000, 100000)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(40000, 20000)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(-40000, -20000)); + ASSERT_EQ(-0x20000, libyuv::FixedDiv(40000, -20000)); + ASSERT_EQ(-0x20000, libyuv::FixedDiv(-40000, 20000)); + ASSERT_EQ(0x10000, libyuv::FixedDiv(4095, 4095)); + ASSERT_EQ(0x10000, libyuv::FixedDiv(4096, 4096)); + ASSERT_EQ(0x10000, libyuv::FixedDiv(4097, 4097)); + ASSERT_EQ(123 * 65536, libyuv::FixedDiv(123, 1)); for (int i = 1; i < 4100; ++i) { - EXPECT_EQ(0x10000, libyuv::FixedDiv(i, i)); - EXPECT_EQ(0x20000, libyuv::FixedDiv(i * 2, i)); - EXPECT_EQ(0x30000, libyuv::FixedDiv(i * 3, i)); - EXPECT_EQ(0x40000, libyuv::FixedDiv(i * 4, i)); - EXPECT_EQ(0x08000, libyuv::FixedDiv(i, i * 2)); - EXPECT_NEAR(16384 * 65536 / i, libyuv::FixedDiv(16384, i), 1); + ASSERT_EQ(0x10000, libyuv::FixedDiv(i, i)); + ASSERT_EQ(0x20000, libyuv::FixedDiv(i * 2, i)); + ASSERT_EQ(0x30000, libyuv::FixedDiv(i * 3, i)); + ASSERT_EQ(0x40000, libyuv::FixedDiv(i * 4, i)); + ASSERT_EQ(0x08000, libyuv::FixedDiv(i, i * 2)); + ASSERT_NEAR(16384 * 65536 / i, libyuv::FixedDiv(16384, i), 1); } - EXPECT_EQ(123 * 65536, libyuv::FixedDiv(123, 1)); + ASSERT_EQ(123 * 65536, libyuv::FixedDiv(123, 1)); MemRandomize(reinterpret_cast(&num[0]), sizeof(num)); MemRandomize(reinterpret_cast(&div[0]), sizeof(div)); @@ -84,7 +84,7 @@ TEST_F(LibYUVBaseTest, TestFixedDiv) { } for (int j = 0; j < 1280; ++j) { result_c[j] = libyuv::FixedDiv_C(num[j], div[j]); - EXPECT_NEAR(result_c[j], result_opt[j], 1); + ASSERT_NEAR(result_c[j], result_opt[j], 1); } } @@ -118,7 +118,7 @@ TEST_F(LibYUVBaseTest, TestFixedDiv_Opt) { } for (int j = 0; j < 1280; ++j) { result_c[j] = libyuv::FixedDiv_C(num[j], div[j]); - EXPECT_NEAR(result_c[j], result_opt[j], 1); + ASSERT_NEAR(result_c[j], result_opt[j], 1); } } @@ -152,7 +152,7 @@ TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) { } for (int j = 0; j < 1280; ++j) { result_c[j] = libyuv::FixedDiv1_C(num[j], div[j]); - EXPECT_NEAR(result_c[j], result_opt[j], 1); + ASSERT_NEAR(result_c[j], result_opt[j], 1); } } #endif // ENABLE_ROW_TESTS diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index 2e26b4cf6..672658c9c 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -68,48 +68,48 @@ TEST_F(LibYUVPlanarTest, TestAttenuate) { orig_pixels[4 * 4 + 3] = 255u; ARGBUnattenuate(orig_pixels, 0, unatten_pixels, 0, 5, 1); - EXPECT_EQ(255u, unatten_pixels[0 * 4 + 0]); - EXPECT_EQ(255u, unatten_pixels[0 * 4 + 1]); - EXPECT_EQ(254u, unatten_pixels[0 * 4 + 2]); - EXPECT_EQ(128u, unatten_pixels[0 * 4 + 3]); - EXPECT_EQ(0u, unatten_pixels[1 * 4 + 0]); - EXPECT_EQ(0u, unatten_pixels[1 * 4 + 1]); - EXPECT_EQ(0u, unatten_pixels[1 * 4 + 2]); - EXPECT_EQ(0u, unatten_pixels[1 * 4 + 3]); - EXPECT_EQ(32u, unatten_pixels[2 * 4 + 0]); - EXPECT_EQ(128u, unatten_pixels[2 * 4 + 1]); - EXPECT_EQ(255u, unatten_pixels[2 * 4 + 2]); - EXPECT_EQ(128u, unatten_pixels[2 * 4 + 3]); - EXPECT_EQ(16u, unatten_pixels[3 * 4 + 0]); - EXPECT_EQ(64u, unatten_pixels[3 * 4 + 1]); - EXPECT_EQ(192u, unatten_pixels[3 * 4 + 2]); - EXPECT_EQ(255u, unatten_pixels[3 * 4 + 3]); - EXPECT_EQ(255u, unatten_pixels[4 * 4 + 0]); - EXPECT_EQ(255u, unatten_pixels[4 * 4 + 1]); - EXPECT_EQ(255u, unatten_pixels[4 * 4 + 2]); - EXPECT_EQ(255u, unatten_pixels[4 * 4 + 3]); + ASSERT_EQ(255u, unatten_pixels[0 * 4 + 0]); + ASSERT_EQ(255u, unatten_pixels[0 * 4 + 1]); + ASSERT_EQ(254u, unatten_pixels[0 * 4 + 2]); + ASSERT_EQ(128u, unatten_pixels[0 * 4 + 3]); + ASSERT_EQ(0u, unatten_pixels[1 * 4 + 0]); + ASSERT_EQ(0u, unatten_pixels[1 * 4 + 1]); + ASSERT_EQ(0u, unatten_pixels[1 * 4 + 2]); + ASSERT_EQ(0u, unatten_pixels[1 * 4 + 3]); + ASSERT_EQ(32u, unatten_pixels[2 * 4 + 0]); + ASSERT_EQ(128u, unatten_pixels[2 * 4 + 1]); + ASSERT_EQ(255u, unatten_pixels[2 * 4 + 2]); + ASSERT_EQ(128u, unatten_pixels[2 * 4 + 3]); + ASSERT_EQ(16u, unatten_pixels[3 * 4 + 0]); + ASSERT_EQ(64u, unatten_pixels[3 * 4 + 1]); + ASSERT_EQ(192u, unatten_pixels[3 * 4 + 2]); + ASSERT_EQ(255u, unatten_pixels[3 * 4 + 3]); + ASSERT_EQ(255u, unatten_pixels[4 * 4 + 0]); + ASSERT_EQ(255u, unatten_pixels[4 * 4 + 1]); + ASSERT_EQ(255u, unatten_pixels[4 * 4 + 2]); + ASSERT_EQ(255u, unatten_pixels[4 * 4 + 3]); ARGBAttenuate(orig_pixels, 0, atten_pixels, 0, 5, 1); - EXPECT_EQ(100u, atten_pixels[0 * 4 + 0]); - EXPECT_EQ(65u, atten_pixels[0 * 4 + 1]); - EXPECT_EQ(64u, atten_pixels[0 * 4 + 2]); - EXPECT_EQ(128u, atten_pixels[0 * 4 + 3]); - EXPECT_EQ(0u, atten_pixels[1 * 4 + 0]); - EXPECT_EQ(0u, atten_pixels[1 * 4 + 1]); - EXPECT_EQ(0u, atten_pixels[1 * 4 + 2]); - EXPECT_EQ(0u, atten_pixels[1 * 4 + 3]); - EXPECT_EQ(8u, atten_pixels[2 * 4 + 0]); - EXPECT_EQ(32u, atten_pixels[2 * 4 + 1]); - EXPECT_EQ(96u, atten_pixels[2 * 4 + 2]); - EXPECT_EQ(128u, atten_pixels[2 * 4 + 3]); - EXPECT_EQ(16u, atten_pixels[3 * 4 + 0]); - EXPECT_EQ(64u, atten_pixels[3 * 4 + 1]); - EXPECT_EQ(192u, atten_pixels[3 * 4 + 2]); - EXPECT_EQ(255u, atten_pixels[3 * 4 + 3]); - EXPECT_EQ(255u, atten_pixels[4 * 4 + 0]); - EXPECT_EQ(255u, atten_pixels[4 * 4 + 1]); - EXPECT_EQ(255u, atten_pixels[4 * 4 + 2]); - EXPECT_EQ(255u, atten_pixels[4 * 4 + 3]); + ASSERT_EQ(100u, atten_pixels[0 * 4 + 0]); + ASSERT_EQ(65u, atten_pixels[0 * 4 + 1]); + ASSERT_EQ(64u, atten_pixels[0 * 4 + 2]); + ASSERT_EQ(128u, atten_pixels[0 * 4 + 3]); + ASSERT_EQ(0u, atten_pixels[1 * 4 + 0]); + ASSERT_EQ(0u, atten_pixels[1 * 4 + 1]); + ASSERT_EQ(0u, atten_pixels[1 * 4 + 2]); + ASSERT_EQ(0u, atten_pixels[1 * 4 + 3]); + ASSERT_EQ(8u, atten_pixels[2 * 4 + 0]); + ASSERT_EQ(32u, atten_pixels[2 * 4 + 1]); + ASSERT_EQ(96u, atten_pixels[2 * 4 + 2]); + ASSERT_EQ(128u, atten_pixels[2 * 4 + 3]); + ASSERT_EQ(16u, atten_pixels[3 * 4 + 0]); + ASSERT_EQ(64u, atten_pixels[3 * 4 + 1]); + ASSERT_EQ(192u, atten_pixels[3 * 4 + 2]); + ASSERT_EQ(255u, atten_pixels[3 * 4 + 3]); + ASSERT_EQ(255u, atten_pixels[4 * 4 + 0]); + ASSERT_EQ(255u, atten_pixels[4 * 4 + 1]); + ASSERT_EQ(255u, atten_pixels[4 * 4 + 2]); + ASSERT_EQ(255u, atten_pixels[4 * 4 + 3]); // test 255 for (int i = 0; i < 256; ++i) { @@ -120,10 +120,10 @@ TEST_F(LibYUVPlanarTest, TestAttenuate) { } ARGBAttenuate(orig_pixels, 0, atten_pixels, 0, 256, 1); for (int i = 0; i < 256; ++i) { - EXPECT_EQ(orig_pixels[i * 4 + 0], atten_pixels[i * 4 + 0]); - EXPECT_EQ(0, atten_pixels[i * 4 + 1]); - EXPECT_EQ(0, atten_pixels[i * 4 + 2]); - EXPECT_EQ(255, atten_pixels[i * 4 + 3]); + ASSERT_EQ(orig_pixels[i * 4 + 0], atten_pixels[i * 4 + 0]); + ASSERT_EQ(0, atten_pixels[i * 4 + 1]); + ASSERT_EQ(0, atten_pixels[i * 4 + 2]); + ASSERT_EQ(255, atten_pixels[i * 4 + 3]); } for (int i = 0; i < 1280; ++i) { @@ -138,24 +138,24 @@ TEST_F(LibYUVPlanarTest, TestAttenuate) { ARGBAttenuate(unatten_pixels, 0, atten2_pixels, 0, 1280, 1); } for (int i = 0; i < 1280; ++i) { - EXPECT_NEAR(atten_pixels[i * 4 + 0], atten2_pixels[i * 4 + 0], 1); - EXPECT_NEAR(atten_pixels[i * 4 + 1], atten2_pixels[i * 4 + 1], 1); - EXPECT_NEAR(atten_pixels[i * 4 + 2], atten2_pixels[i * 4 + 2], 1); - EXPECT_NEAR(atten_pixels[i * 4 + 3], atten2_pixels[i * 4 + 3], 1); + ASSERT_NEAR(atten_pixels[i * 4 + 0], atten2_pixels[i * 4 + 0], 1); + ASSERT_NEAR(atten_pixels[i * 4 + 1], atten2_pixels[i * 4 + 1], 1); + ASSERT_NEAR(atten_pixels[i * 4 + 2], atten2_pixels[i * 4 + 2], 1); + ASSERT_NEAR(atten_pixels[i * 4 + 3], atten2_pixels[i * 4 + 3], 1); } // Make sure transparent, 50% and opaque are fully accurate. - EXPECT_EQ(0, atten_pixels[0 * 4 + 0]); - EXPECT_EQ(0, atten_pixels[0 * 4 + 1]); - EXPECT_EQ(0, atten_pixels[0 * 4 + 2]); - EXPECT_EQ(0, atten_pixels[0 * 4 + 3]); - EXPECT_EQ(64, atten_pixels[128 * 4 + 0]); - EXPECT_EQ(32, atten_pixels[128 * 4 + 1]); - EXPECT_EQ(21, atten_pixels[128 * 4 + 2]); - EXPECT_EQ(128, atten_pixels[128 * 4 + 3]); - EXPECT_EQ(255, atten_pixels[255 * 4 + 0]); - EXPECT_EQ(127, atten_pixels[255 * 4 + 1]); - EXPECT_EQ(85, atten_pixels[255 * 4 + 2]); - EXPECT_EQ(255, atten_pixels[255 * 4 + 3]); + ASSERT_EQ(0, atten_pixels[0 * 4 + 0]); + ASSERT_EQ(0, atten_pixels[0 * 4 + 1]); + ASSERT_EQ(0, atten_pixels[0 * 4 + 2]); + ASSERT_EQ(0, atten_pixels[0 * 4 + 3]); + ASSERT_EQ(64, atten_pixels[128 * 4 + 0]); + ASSERT_EQ(32, atten_pixels[128 * 4 + 1]); + ASSERT_EQ(21, atten_pixels[128 * 4 + 2]); + ASSERT_EQ(128, atten_pixels[128 * 4 + 3]); + ASSERT_EQ(255, atten_pixels[255 * 4 + 0]); + ASSERT_EQ(127, atten_pixels[255 * 4 + 1]); + ASSERT_EQ(85, atten_pixels[255 * 4 + 2]); + ASSERT_EQ(255, atten_pixels[255 * 4 + 3]); free_aligned_buffer_page_end(atten2_pixels); free_aligned_buffer_page_end(unatten_pixels); @@ -211,28 +211,28 @@ TEST_F(LibYUVPlanarTest, ARGBAttenuate_Any) { benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(max_diff, 0); + ASSERT_EQ(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBAttenuate_Unaligned) { int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_EQ(max_diff, 0); + ASSERT_EQ(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBAttenuate_Invert) { int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_EQ(max_diff, 0); + ASSERT_EQ(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBAttenuate_Opt) { int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(max_diff, 0); + ASSERT_EQ(max_diff, 0); } static int TestUnattenuateI(int width, @@ -284,28 +284,28 @@ TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Any) { int max_diff = TestUnattenuateI(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); + ASSERT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); } TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Unaligned) { int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); + ASSERT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); } TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Invert) { int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); + ASSERT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); } TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Opt) { int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); + ASSERT_LE(max_diff, EXPECTED_UNATTENUATE_DIFF); } TEST_F(LibYUVPlanarTest, TestARGBComputeCumulativeSum) { @@ -326,10 +326,10 @@ TEST_F(LibYUVPlanarTest, TestARGBComputeCumulativeSum) { for (int y = 0; y < 16; ++y) { for (int x = 0; x < 16; ++x) { - EXPECT_EQ((x + 1) * (y + 1), added_pixels[y][x][0]); - EXPECT_EQ((x + 1) * (y + 1) * 2, added_pixels[y][x][1]); - EXPECT_EQ((x + 1) * (y + 1) * 3, added_pixels[y][x][2]); - EXPECT_EQ((x + 1) * (y + 1) * 255, added_pixels[y][x][3]); + ASSERT_EQ((x + 1) * (y + 1), added_pixels[y][x][0]); + ASSERT_EQ((x + 1) * (y + 1) * 2, added_pixels[y][x][1]); + ASSERT_EQ((x + 1) * (y + 1) * 3, added_pixels[y][x][2]); + ASSERT_EQ((x + 1) * (y + 1) * 255, added_pixels[y][x][3]); } } } @@ -371,30 +371,30 @@ TEST_F(LibYUVPlanarTest, TestARGBGray) { orig_pixels[5][3] = 224u; // Do 16 to test asm version. ARGBGray(&orig_pixels[0][0], 0, 0, 0, 16, 1); - EXPECT_NEAR(29u, orig_pixels[0][0], 1); - EXPECT_NEAR(29u, orig_pixels[0][1], 1); - EXPECT_NEAR(29u, orig_pixels[0][2], 1); - EXPECT_EQ(128u, orig_pixels[0][3]); - EXPECT_EQ(149u, orig_pixels[1][0]); - EXPECT_EQ(149u, orig_pixels[1][1]); - EXPECT_EQ(149u, orig_pixels[1][2]); - EXPECT_EQ(0u, orig_pixels[1][3]); - EXPECT_NEAR(77u, orig_pixels[2][0], 1); - EXPECT_NEAR(77u, orig_pixels[2][1], 1); - EXPECT_NEAR(77u, orig_pixels[2][2], 1); - EXPECT_EQ(255u, orig_pixels[2][3]); - EXPECT_EQ(0u, orig_pixels[3][0]); - EXPECT_EQ(0u, orig_pixels[3][1]); - EXPECT_EQ(0u, orig_pixels[3][2]); - EXPECT_EQ(255u, orig_pixels[3][3]); - EXPECT_EQ(255u, orig_pixels[4][0]); - EXPECT_EQ(255u, orig_pixels[4][1]); - EXPECT_EQ(255u, orig_pixels[4][2]); - EXPECT_EQ(255u, orig_pixels[4][3]); - EXPECT_NEAR(97u, orig_pixels[5][0], 1); - EXPECT_NEAR(97u, orig_pixels[5][1], 1); - EXPECT_NEAR(97u, orig_pixels[5][2], 1); - EXPECT_EQ(224u, orig_pixels[5][3]); + ASSERT_NEAR(29u, orig_pixels[0][0], 1); + ASSERT_NEAR(29u, orig_pixels[0][1], 1); + ASSERT_NEAR(29u, orig_pixels[0][2], 1); + ASSERT_EQ(128u, orig_pixels[0][3]); + ASSERT_EQ(149u, orig_pixels[1][0]); + ASSERT_EQ(149u, orig_pixels[1][1]); + ASSERT_EQ(149u, orig_pixels[1][2]); + ASSERT_EQ(0u, orig_pixels[1][3]); + ASSERT_NEAR(77u, orig_pixels[2][0], 1); + ASSERT_NEAR(77u, orig_pixels[2][1], 1); + ASSERT_NEAR(77u, orig_pixels[2][2], 1); + ASSERT_EQ(255u, orig_pixels[2][3]); + ASSERT_EQ(0u, orig_pixels[3][0]); + ASSERT_EQ(0u, orig_pixels[3][1]); + ASSERT_EQ(0u, orig_pixels[3][2]); + ASSERT_EQ(255u, orig_pixels[3][3]); + ASSERT_EQ(255u, orig_pixels[4][0]); + ASSERT_EQ(255u, orig_pixels[4][1]); + ASSERT_EQ(255u, orig_pixels[4][2]); + ASSERT_EQ(255u, orig_pixels[4][3]); + ASSERT_NEAR(97u, orig_pixels[5][0], 1); + ASSERT_NEAR(97u, orig_pixels[5][1], 1); + ASSERT_NEAR(97u, orig_pixels[5][2], 1); + ASSERT_EQ(224u, orig_pixels[5][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; orig_pixels[i][1] = i / 2; @@ -443,30 +443,30 @@ TEST_F(LibYUVPlanarTest, TestARGBGrayTo) { orig_pixels[5][3] = 224u; // Do 16 to test asm version. ARGBGrayTo(&orig_pixels[0][0], 0, &gray_pixels[0][0], 0, 16, 1); - EXPECT_NEAR(30u, gray_pixels[0][0], 1); - EXPECT_NEAR(30u, gray_pixels[0][1], 1); - EXPECT_NEAR(30u, gray_pixels[0][2], 1); - EXPECT_NEAR(128u, gray_pixels[0][3], 1); - EXPECT_NEAR(149u, gray_pixels[1][0], 1); - EXPECT_NEAR(149u, gray_pixels[1][1], 1); - EXPECT_NEAR(149u, gray_pixels[1][2], 1); - EXPECT_NEAR(0u, gray_pixels[1][3], 1); - EXPECT_NEAR(76u, gray_pixels[2][0], 1); - EXPECT_NEAR(76u, gray_pixels[2][1], 1); - EXPECT_NEAR(76u, gray_pixels[2][2], 1); - EXPECT_NEAR(255u, gray_pixels[2][3], 1); - EXPECT_NEAR(0u, gray_pixels[3][0], 1); - EXPECT_NEAR(0u, gray_pixels[3][1], 1); - EXPECT_NEAR(0u, gray_pixels[3][2], 1); - EXPECT_NEAR(255u, gray_pixels[3][3], 1); - EXPECT_NEAR(255u, gray_pixels[4][0], 1); - EXPECT_NEAR(255u, gray_pixels[4][1], 1); - EXPECT_NEAR(255u, gray_pixels[4][2], 1); - EXPECT_NEAR(255u, gray_pixels[4][3], 1); - EXPECT_NEAR(96u, gray_pixels[5][0], 1); - EXPECT_NEAR(96u, gray_pixels[5][1], 1); - EXPECT_NEAR(96u, gray_pixels[5][2], 1); - EXPECT_NEAR(224u, gray_pixels[5][3], 1); + ASSERT_NEAR(30u, gray_pixels[0][0], 1); + ASSERT_NEAR(30u, gray_pixels[0][1], 1); + ASSERT_NEAR(30u, gray_pixels[0][2], 1); + ASSERT_NEAR(128u, gray_pixels[0][3], 1); + ASSERT_NEAR(149u, gray_pixels[1][0], 1); + ASSERT_NEAR(149u, gray_pixels[1][1], 1); + ASSERT_NEAR(149u, gray_pixels[1][2], 1); + ASSERT_NEAR(0u, gray_pixels[1][3], 1); + ASSERT_NEAR(76u, gray_pixels[2][0], 1); + ASSERT_NEAR(76u, gray_pixels[2][1], 1); + ASSERT_NEAR(76u, gray_pixels[2][2], 1); + ASSERT_NEAR(255u, gray_pixels[2][3], 1); + ASSERT_NEAR(0u, gray_pixels[3][0], 1); + ASSERT_NEAR(0u, gray_pixels[3][1], 1); + ASSERT_NEAR(0u, gray_pixels[3][2], 1); + ASSERT_NEAR(255u, gray_pixels[3][3], 1); + ASSERT_NEAR(255u, gray_pixels[4][0], 1); + ASSERT_NEAR(255u, gray_pixels[4][1], 1); + ASSERT_NEAR(255u, gray_pixels[4][2], 1); + ASSERT_NEAR(255u, gray_pixels[4][3], 1); + ASSERT_NEAR(96u, gray_pixels[5][0], 1); + ASSERT_NEAR(96u, gray_pixels[5][1], 1); + ASSERT_NEAR(96u, gray_pixels[5][2], 1); + ASSERT_NEAR(224u, gray_pixels[5][3], 1); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; orig_pixels[i][1] = i / 2; @@ -485,10 +485,10 @@ TEST_F(LibYUVPlanarTest, TestARGBGrayTo) { } ARGBGray(&orig_pixels[0][0], 0, 0, 0, 256, 1); for (int i = 0; i < 256; ++i) { - EXPECT_EQ(i, orig_pixels[i][0]); - EXPECT_EQ(i, orig_pixels[i][1]); - EXPECT_EQ(i, orig_pixels[i][2]); - EXPECT_EQ(i, orig_pixels[i][3]); + ASSERT_EQ(i, orig_pixels[i][0]); + ASSERT_EQ(i, orig_pixels[i][1]); + ASSERT_EQ(i, orig_pixels[i][2]); + ASSERT_EQ(i, orig_pixels[i][3]); } } @@ -528,30 +528,30 @@ TEST_F(LibYUVPlanarTest, TestARGBSepia) { orig_pixels[5][3] = 224u; // Do 16 to test asm version. ARGBSepia(&orig_pixels[0][0], 0, 0, 0, 16, 1); - EXPECT_EQ(33u, orig_pixels[0][0]); - EXPECT_EQ(43u, orig_pixels[0][1]); - EXPECT_EQ(47u, orig_pixels[0][2]); - EXPECT_EQ(128u, orig_pixels[0][3]); - EXPECT_EQ(135u, orig_pixels[1][0]); - EXPECT_EQ(175u, orig_pixels[1][1]); - EXPECT_EQ(195u, orig_pixels[1][2]); - EXPECT_EQ(0u, orig_pixels[1][3]); - EXPECT_EQ(69u, orig_pixels[2][0]); - EXPECT_EQ(89u, orig_pixels[2][1]); - EXPECT_EQ(99u, orig_pixels[2][2]); - EXPECT_EQ(255u, orig_pixels[2][3]); - EXPECT_EQ(0u, orig_pixels[3][0]); - EXPECT_EQ(0u, orig_pixels[3][1]); - EXPECT_EQ(0u, orig_pixels[3][2]); - EXPECT_EQ(255u, orig_pixels[3][3]); - EXPECT_EQ(239u, orig_pixels[4][0]); - EXPECT_EQ(255u, orig_pixels[4][1]); - EXPECT_EQ(255u, orig_pixels[4][2]); - EXPECT_EQ(255u, orig_pixels[4][3]); - EXPECT_EQ(88u, orig_pixels[5][0]); - EXPECT_EQ(114u, orig_pixels[5][1]); - EXPECT_EQ(127u, orig_pixels[5][2]); - EXPECT_EQ(224u, orig_pixels[5][3]); + ASSERT_EQ(33u, orig_pixels[0][0]); + ASSERT_EQ(43u, orig_pixels[0][1]); + ASSERT_EQ(47u, orig_pixels[0][2]); + ASSERT_EQ(128u, orig_pixels[0][3]); + ASSERT_EQ(135u, orig_pixels[1][0]); + ASSERT_EQ(175u, orig_pixels[1][1]); + ASSERT_EQ(195u, orig_pixels[1][2]); + ASSERT_EQ(0u, orig_pixels[1][3]); + ASSERT_EQ(69u, orig_pixels[2][0]); + ASSERT_EQ(89u, orig_pixels[2][1]); + ASSERT_EQ(99u, orig_pixels[2][2]); + ASSERT_EQ(255u, orig_pixels[2][3]); + ASSERT_EQ(0u, orig_pixels[3][0]); + ASSERT_EQ(0u, orig_pixels[3][1]); + ASSERT_EQ(0u, orig_pixels[3][2]); + ASSERT_EQ(255u, orig_pixels[3][3]); + ASSERT_EQ(239u, orig_pixels[4][0]); + ASSERT_EQ(255u, orig_pixels[4][1]); + ASSERT_EQ(255u, orig_pixels[4][2]); + ASSERT_EQ(255u, orig_pixels[4][3]); + ASSERT_EQ(88u, orig_pixels[5][0]); + ASSERT_EQ(114u, orig_pixels[5][1]); + ASSERT_EQ(127u, orig_pixels[5][2]); + ASSERT_EQ(224u, orig_pixels[5][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -599,22 +599,22 @@ TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) { // Do 16 to test asm version. ARGBColorMatrix(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0, &kRGBToSepia[0], 16, 1); - EXPECT_EQ(31u, dst_pixels_opt[0][0]); - EXPECT_EQ(43u, dst_pixels_opt[0][1]); - EXPECT_EQ(47u, dst_pixels_opt[0][2]); - EXPECT_EQ(128u, dst_pixels_opt[0][3]); - EXPECT_EQ(135u, dst_pixels_opt[1][0]); - EXPECT_EQ(175u, dst_pixels_opt[1][1]); - EXPECT_EQ(195u, dst_pixels_opt[1][2]); - EXPECT_EQ(0u, dst_pixels_opt[1][3]); - EXPECT_EQ(67u, dst_pixels_opt[2][0]); - EXPECT_EQ(87u, dst_pixels_opt[2][1]); - EXPECT_EQ(99u, dst_pixels_opt[2][2]); - EXPECT_EQ(255u, dst_pixels_opt[2][3]); - EXPECT_EQ(87u, dst_pixels_opt[3][0]); - EXPECT_EQ(112u, dst_pixels_opt[3][1]); - EXPECT_EQ(127u, dst_pixels_opt[3][2]); - EXPECT_EQ(224u, dst_pixels_opt[3][3]); + ASSERT_EQ(31u, dst_pixels_opt[0][0]); + ASSERT_EQ(43u, dst_pixels_opt[0][1]); + ASSERT_EQ(47u, dst_pixels_opt[0][2]); + ASSERT_EQ(128u, dst_pixels_opt[0][3]); + ASSERT_EQ(135u, dst_pixels_opt[1][0]); + ASSERT_EQ(175u, dst_pixels_opt[1][1]); + ASSERT_EQ(195u, dst_pixels_opt[1][2]); + ASSERT_EQ(0u, dst_pixels_opt[1][3]); + ASSERT_EQ(67u, dst_pixels_opt[2][0]); + ASSERT_EQ(87u, dst_pixels_opt[2][1]); + ASSERT_EQ(99u, dst_pixels_opt[2][2]); + ASSERT_EQ(255u, dst_pixels_opt[2][3]); + ASSERT_EQ(87u, dst_pixels_opt[3][0]); + ASSERT_EQ(112u, dst_pixels_opt[3][1]); + ASSERT_EQ(127u, dst_pixels_opt[3][2]); + ASSERT_EQ(224u, dst_pixels_opt[3][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -633,10 +633,10 @@ TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); - EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); - EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); - EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); + ASSERT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); + ASSERT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); + ASSERT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); + ASSERT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); } } @@ -672,22 +672,22 @@ TEST_F(LibYUVPlanarTest, TestRGBColorMatrix) { orig_pixels[3][3] = 224u; // Do 16 to test asm version. RGBColorMatrix(&orig_pixels[0][0], 0, &kRGBToSepia[0], 0, 0, 16, 1); - EXPECT_EQ(31u, orig_pixels[0][0]); - EXPECT_EQ(43u, orig_pixels[0][1]); - EXPECT_EQ(47u, orig_pixels[0][2]); - EXPECT_EQ(128u, orig_pixels[0][3]); - EXPECT_EQ(135u, orig_pixels[1][0]); - EXPECT_EQ(175u, orig_pixels[1][1]); - EXPECT_EQ(195u, orig_pixels[1][2]); - EXPECT_EQ(0u, orig_pixels[1][3]); - EXPECT_EQ(67u, orig_pixels[2][0]); - EXPECT_EQ(87u, orig_pixels[2][1]); - EXPECT_EQ(99u, orig_pixels[2][2]); - EXPECT_EQ(255u, orig_pixels[2][3]); - EXPECT_EQ(87u, orig_pixels[3][0]); - EXPECT_EQ(112u, orig_pixels[3][1]); - EXPECT_EQ(127u, orig_pixels[3][2]); - EXPECT_EQ(224u, orig_pixels[3][3]); + ASSERT_EQ(31u, orig_pixels[0][0]); + ASSERT_EQ(43u, orig_pixels[0][1]); + ASSERT_EQ(47u, orig_pixels[0][2]); + ASSERT_EQ(128u, orig_pixels[0][3]); + ASSERT_EQ(135u, orig_pixels[1][0]); + ASSERT_EQ(175u, orig_pixels[1][1]); + ASSERT_EQ(195u, orig_pixels[1][2]); + ASSERT_EQ(0u, orig_pixels[1][3]); + ASSERT_EQ(67u, orig_pixels[2][0]); + ASSERT_EQ(87u, orig_pixels[2][1]); + ASSERT_EQ(99u, orig_pixels[2][2]); + ASSERT_EQ(255u, orig_pixels[2][3]); + ASSERT_EQ(87u, orig_pixels[3][0]); + ASSERT_EQ(112u, orig_pixels[3][1]); + ASSERT_EQ(127u, orig_pixels[3][2]); + ASSERT_EQ(224u, orig_pixels[3][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -727,22 +727,22 @@ TEST_F(LibYUVPlanarTest, TestARGBColorTable) { orig_pixels[3][3] = 3u; // Do 16 to test asm version. ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 16, 1); - EXPECT_EQ(1u, orig_pixels[0][0]); - EXPECT_EQ(2u, orig_pixels[0][1]); - EXPECT_EQ(3u, orig_pixels[0][2]); - EXPECT_EQ(4u, orig_pixels[0][3]); - EXPECT_EQ(5u, orig_pixels[1][0]); - EXPECT_EQ(6u, orig_pixels[1][1]); - EXPECT_EQ(7u, orig_pixels[1][2]); - EXPECT_EQ(8u, orig_pixels[1][3]); - EXPECT_EQ(9u, orig_pixels[2][0]); - EXPECT_EQ(10u, orig_pixels[2][1]); - EXPECT_EQ(11u, orig_pixels[2][2]); - EXPECT_EQ(12u, orig_pixels[2][3]); - EXPECT_EQ(1u, orig_pixels[3][0]); - EXPECT_EQ(6u, orig_pixels[3][1]); - EXPECT_EQ(11u, orig_pixels[3][2]); - EXPECT_EQ(16u, orig_pixels[3][3]); + ASSERT_EQ(1u, orig_pixels[0][0]); + ASSERT_EQ(2u, orig_pixels[0][1]); + ASSERT_EQ(3u, orig_pixels[0][2]); + ASSERT_EQ(4u, orig_pixels[0][3]); + ASSERT_EQ(5u, orig_pixels[1][0]); + ASSERT_EQ(6u, orig_pixels[1][1]); + ASSERT_EQ(7u, orig_pixels[1][2]); + ASSERT_EQ(8u, orig_pixels[1][3]); + ASSERT_EQ(9u, orig_pixels[2][0]); + ASSERT_EQ(10u, orig_pixels[2][1]); + ASSERT_EQ(11u, orig_pixels[2][2]); + ASSERT_EQ(12u, orig_pixels[2][3]); + ASSERT_EQ(1u, orig_pixels[3][0]); + ASSERT_EQ(6u, orig_pixels[3][1]); + ASSERT_EQ(11u, orig_pixels[3][2]); + ASSERT_EQ(16u, orig_pixels[3][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -783,22 +783,22 @@ TEST_F(LibYUVPlanarTest, TestRGBColorTable) { orig_pixels[3][3] = 3u; // Do 16 to test asm version. RGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 16, 1); - EXPECT_EQ(1u, orig_pixels[0][0]); - EXPECT_EQ(2u, orig_pixels[0][1]); - EXPECT_EQ(3u, orig_pixels[0][2]); - EXPECT_EQ(0u, orig_pixels[0][3]); // Alpha unchanged. - EXPECT_EQ(5u, orig_pixels[1][0]); - EXPECT_EQ(6u, orig_pixels[1][1]); - EXPECT_EQ(7u, orig_pixels[1][2]); - EXPECT_EQ(1u, orig_pixels[1][3]); // Alpha unchanged. - EXPECT_EQ(9u, orig_pixels[2][0]); - EXPECT_EQ(10u, orig_pixels[2][1]); - EXPECT_EQ(11u, orig_pixels[2][2]); - EXPECT_EQ(2u, orig_pixels[2][3]); // Alpha unchanged. - EXPECT_EQ(1u, orig_pixels[3][0]); - EXPECT_EQ(6u, orig_pixels[3][1]); - EXPECT_EQ(11u, orig_pixels[3][2]); - EXPECT_EQ(3u, orig_pixels[3][3]); // Alpha unchanged. + ASSERT_EQ(1u, orig_pixels[0][0]); + ASSERT_EQ(2u, orig_pixels[0][1]); + ASSERT_EQ(3u, orig_pixels[0][2]); + ASSERT_EQ(0u, orig_pixels[0][3]); // Alpha unchanged. + ASSERT_EQ(5u, orig_pixels[1][0]); + ASSERT_EQ(6u, orig_pixels[1][1]); + ASSERT_EQ(7u, orig_pixels[1][2]); + ASSERT_EQ(1u, orig_pixels[1][3]); // Alpha unchanged. + ASSERT_EQ(9u, orig_pixels[2][0]); + ASSERT_EQ(10u, orig_pixels[2][1]); + ASSERT_EQ(11u, orig_pixels[2][2]); + ASSERT_EQ(2u, orig_pixels[2][3]); // Alpha unchanged. + ASSERT_EQ(1u, orig_pixels[3][0]); + ASSERT_EQ(6u, orig_pixels[3][1]); + ASSERT_EQ(11u, orig_pixels[3][2]); + ASSERT_EQ(3u, orig_pixels[3][3]); // Alpha unchanged. for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -824,10 +824,10 @@ TEST_F(LibYUVPlanarTest, TestARGBQuantize) { 1280, 1); for (int i = 0; i < 1280; ++i) { - EXPECT_EQ((i / 8 * 8 + 8 / 2) & 255, orig_pixels[i][0]); - EXPECT_EQ((i / 2 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][1]); - EXPECT_EQ((i / 3 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][2]); - EXPECT_EQ(i & 255, orig_pixels[i][3]); + ASSERT_EQ((i / 8 * 8 + 8 / 2) & 255, orig_pixels[i][0]); + ASSERT_EQ((i / 2 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][1]); + ASSERT_EQ((i / 3 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][2]); + ASSERT_EQ(i & 255, orig_pixels[i][3]); } for (int i = 0; i < benchmark_pixels_div1280_; ++i) { ARGBQuantize(&orig_pixels[0][0], 0, (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, @@ -852,7 +852,7 @@ TEST_F(LibYUVPlanarTest, ARGBMirror_Opt) { benchmark_width_ * 4, benchmark_width_, benchmark_height_); } for (int i = 0; i < benchmark_width_ * benchmark_height_ * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); free_aligned_buffer_page_end(dst_pixels_opt); @@ -875,7 +875,7 @@ TEST_F(LibYUVPlanarTest, MirrorPlane_Opt) { benchmark_width_, benchmark_height_); } for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); free_aligned_buffer_page_end(dst_pixels_opt); @@ -899,7 +899,7 @@ TEST_F(LibYUVPlanarTest, MirrorUVPlane_Opt) { benchmark_width_ * 2, benchmark_width_, benchmark_height_); } for (int i = 0; i < benchmark_width_ * benchmark_height_ * 2; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); free_aligned_buffer_page_end(dst_pixels_opt); @@ -929,34 +929,34 @@ TEST_F(LibYUVPlanarTest, TestShade) { orig_pixels[3][3] = 0u; // Do 8 pixels to allow opt version to be used. ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 8, 1, 0x80ffffff); - EXPECT_EQ(10u, shade_pixels[0][0]); - EXPECT_EQ(20u, shade_pixels[0][1]); - EXPECT_EQ(40u, shade_pixels[0][2]); - EXPECT_EQ(40u, shade_pixels[0][3]); - EXPECT_EQ(0u, shade_pixels[1][0]); - EXPECT_EQ(0u, shade_pixels[1][1]); - EXPECT_EQ(0u, shade_pixels[1][2]); - EXPECT_EQ(128u, shade_pixels[1][3]); - EXPECT_EQ(0u, shade_pixels[2][0]); - EXPECT_EQ(0u, shade_pixels[2][1]); - EXPECT_EQ(0u, shade_pixels[2][2]); - EXPECT_EQ(0u, shade_pixels[2][3]); - EXPECT_EQ(0u, shade_pixels[3][0]); - EXPECT_EQ(0u, shade_pixels[3][1]); - EXPECT_EQ(0u, shade_pixels[3][2]); - EXPECT_EQ(0u, shade_pixels[3][3]); + ASSERT_EQ(10u, shade_pixels[0][0]); + ASSERT_EQ(20u, shade_pixels[0][1]); + ASSERT_EQ(40u, shade_pixels[0][2]); + ASSERT_EQ(40u, shade_pixels[0][3]); + ASSERT_EQ(0u, shade_pixels[1][0]); + ASSERT_EQ(0u, shade_pixels[1][1]); + ASSERT_EQ(0u, shade_pixels[1][2]); + ASSERT_EQ(128u, shade_pixels[1][3]); + ASSERT_EQ(0u, shade_pixels[2][0]); + ASSERT_EQ(0u, shade_pixels[2][1]); + ASSERT_EQ(0u, shade_pixels[2][2]); + ASSERT_EQ(0u, shade_pixels[2][3]); + ASSERT_EQ(0u, shade_pixels[3][0]); + ASSERT_EQ(0u, shade_pixels[3][1]); + ASSERT_EQ(0u, shade_pixels[3][2]); + ASSERT_EQ(0u, shade_pixels[3][3]); ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 8, 1, 0x80808080); - EXPECT_EQ(5u, shade_pixels[0][0]); - EXPECT_EQ(10u, shade_pixels[0][1]); - EXPECT_EQ(20u, shade_pixels[0][2]); - EXPECT_EQ(40u, shade_pixels[0][3]); + ASSERT_EQ(5u, shade_pixels[0][0]); + ASSERT_EQ(10u, shade_pixels[0][1]); + ASSERT_EQ(20u, shade_pixels[0][2]); + ASSERT_EQ(40u, shade_pixels[0][3]); ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 8, 1, 0x10204080); - EXPECT_EQ(5u, shade_pixels[0][0]); - EXPECT_EQ(5u, shade_pixels[0][1]); - EXPECT_EQ(5u, shade_pixels[0][2]); - EXPECT_EQ(5u, shade_pixels[0][3]); + ASSERT_EQ(5u, shade_pixels[0][0]); + ASSERT_EQ(5u, shade_pixels[0][1]); + ASSERT_EQ(5u, shade_pixels[0][2]); + ASSERT_EQ(5u, shade_pixels[0][3]); for (int i = 0; i < benchmark_pixels_div1280_; ++i) { ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 1280, 1, @@ -1007,37 +1007,37 @@ TEST_F(LibYUVPlanarTest, TestARGBInterpolate) { ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, &interpolate_pixels[0][0], 0, 4, 1, 128); - EXPECT_EQ(8u, interpolate_pixels[0][0]); - EXPECT_EQ(16u, interpolate_pixels[0][1]); - EXPECT_EQ(32u, interpolate_pixels[0][2]); - EXPECT_EQ(64u, interpolate_pixels[0][3]); - EXPECT_EQ(0u, interpolate_pixels[1][0]); - EXPECT_EQ(0u, interpolate_pixels[1][1]); - EXPECT_EQ(0u, interpolate_pixels[1][2]); - EXPECT_EQ(128u, interpolate_pixels[1][3]); - EXPECT_EQ(0u, interpolate_pixels[2][0]); - EXPECT_EQ(0u, interpolate_pixels[2][1]); - EXPECT_EQ(0u, interpolate_pixels[2][2]); - EXPECT_EQ(0u, interpolate_pixels[2][3]); - EXPECT_EQ(128u, interpolate_pixels[3][0]); - EXPECT_EQ(128u, interpolate_pixels[3][1]); - EXPECT_EQ(128u, interpolate_pixels[3][2]); - EXPECT_EQ(128u, interpolate_pixels[3][3]); + ASSERT_EQ(8u, interpolate_pixels[0][0]); + ASSERT_EQ(16u, interpolate_pixels[0][1]); + ASSERT_EQ(32u, interpolate_pixels[0][2]); + ASSERT_EQ(64u, interpolate_pixels[0][3]); + ASSERT_EQ(0u, interpolate_pixels[1][0]); + ASSERT_EQ(0u, interpolate_pixels[1][1]); + ASSERT_EQ(0u, interpolate_pixels[1][2]); + ASSERT_EQ(128u, interpolate_pixels[1][3]); + ASSERT_EQ(0u, interpolate_pixels[2][0]); + ASSERT_EQ(0u, interpolate_pixels[2][1]); + ASSERT_EQ(0u, interpolate_pixels[2][2]); + ASSERT_EQ(0u, interpolate_pixels[2][3]); + ASSERT_EQ(128u, interpolate_pixels[3][0]); + ASSERT_EQ(128u, interpolate_pixels[3][1]); + ASSERT_EQ(128u, interpolate_pixels[3][2]); + ASSERT_EQ(128u, interpolate_pixels[3][3]); ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, &interpolate_pixels[0][0], 0, 4, 1, 0); - EXPECT_EQ(16u, interpolate_pixels[0][0]); - EXPECT_EQ(32u, interpolate_pixels[0][1]); - EXPECT_EQ(64u, interpolate_pixels[0][2]); - EXPECT_EQ(128u, interpolate_pixels[0][3]); + ASSERT_EQ(16u, interpolate_pixels[0][0]); + ASSERT_EQ(32u, interpolate_pixels[0][1]); + ASSERT_EQ(64u, interpolate_pixels[0][2]); + ASSERT_EQ(128u, interpolate_pixels[0][3]); ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, &interpolate_pixels[0][0], 0, 4, 1, 192); - EXPECT_EQ(4u, interpolate_pixels[0][0]); - EXPECT_EQ(8u, interpolate_pixels[0][1]); - EXPECT_EQ(16u, interpolate_pixels[0][2]); - EXPECT_EQ(32u, interpolate_pixels[0][3]); + ASSERT_EQ(4u, interpolate_pixels[0][0]); + ASSERT_EQ(8u, interpolate_pixels[0][1]); + ASSERT_EQ(16u, interpolate_pixels[0][2]); + ASSERT_EQ(32u, interpolate_pixels[0][3]); for (int i = 0; i < benchmark_pixels_div1280_; ++i) { ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, @@ -1088,37 +1088,37 @@ TEST_F(LibYUVPlanarTest, TestInterpolatePlane) { InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 128); - EXPECT_EQ(8u, interpolate_pixels[0]); - EXPECT_EQ(16u, interpolate_pixels[1]); - EXPECT_EQ(32u, interpolate_pixels[2]); - EXPECT_EQ(64u, interpolate_pixels[3]); - EXPECT_EQ(0u, interpolate_pixels[4]); - EXPECT_EQ(0u, interpolate_pixels[5]); - EXPECT_EQ(0u, interpolate_pixels[6]); - EXPECT_EQ(128u, interpolate_pixels[7]); - EXPECT_EQ(0u, interpolate_pixels[8]); - EXPECT_EQ(0u, interpolate_pixels[9]); - EXPECT_EQ(0u, interpolate_pixels[10]); - EXPECT_EQ(0u, interpolate_pixels[11]); - EXPECT_EQ(128u, interpolate_pixels[12]); - EXPECT_EQ(128u, interpolate_pixels[13]); - EXPECT_EQ(128u, interpolate_pixels[14]); - EXPECT_EQ(128u, interpolate_pixels[15]); + ASSERT_EQ(8u, interpolate_pixels[0]); + ASSERT_EQ(16u, interpolate_pixels[1]); + ASSERT_EQ(32u, interpolate_pixels[2]); + ASSERT_EQ(64u, interpolate_pixels[3]); + ASSERT_EQ(0u, interpolate_pixels[4]); + ASSERT_EQ(0u, interpolate_pixels[5]); + ASSERT_EQ(0u, interpolate_pixels[6]); + ASSERT_EQ(128u, interpolate_pixels[7]); + ASSERT_EQ(0u, interpolate_pixels[8]); + ASSERT_EQ(0u, interpolate_pixels[9]); + ASSERT_EQ(0u, interpolate_pixels[10]); + ASSERT_EQ(0u, interpolate_pixels[11]); + ASSERT_EQ(128u, interpolate_pixels[12]); + ASSERT_EQ(128u, interpolate_pixels[13]); + ASSERT_EQ(128u, interpolate_pixels[14]); + ASSERT_EQ(128u, interpolate_pixels[15]); InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 0); - EXPECT_EQ(16u, interpolate_pixels[0]); - EXPECT_EQ(32u, interpolate_pixels[1]); - EXPECT_EQ(64u, interpolate_pixels[2]); - EXPECT_EQ(128u, interpolate_pixels[3]); + ASSERT_EQ(16u, interpolate_pixels[0]); + ASSERT_EQ(32u, interpolate_pixels[1]); + ASSERT_EQ(64u, interpolate_pixels[2]); + ASSERT_EQ(128u, interpolate_pixels[3]); InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 192); - EXPECT_EQ(4u, interpolate_pixels[0]); - EXPECT_EQ(8u, interpolate_pixels[1]); - EXPECT_EQ(16u, interpolate_pixels[2]); - EXPECT_EQ(32u, interpolate_pixels[3]); + ASSERT_EQ(4u, interpolate_pixels[0]); + ASSERT_EQ(8u, interpolate_pixels[1]); + ASSERT_EQ(16u, interpolate_pixels[2]); + ASSERT_EQ(32u, interpolate_pixels[3]); for (int i = 0; i < benchmark_pixels_div1280_; ++i) { InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, @@ -1169,37 +1169,37 @@ TEST_F(LibYUVPlanarTest, TestInterpolatePlane_16) { InterpolatePlane_16(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 128); - EXPECT_EQ(8u, interpolate_pixels[0]); - EXPECT_EQ(16u, interpolate_pixels[1]); - EXPECT_EQ(32u, interpolate_pixels[2]); - EXPECT_EQ(64u, interpolate_pixels[3]); - EXPECT_EQ(0u, interpolate_pixels[4]); - EXPECT_EQ(0u, interpolate_pixels[5]); - EXPECT_EQ(0u, interpolate_pixels[6]); - EXPECT_EQ(128u, interpolate_pixels[7]); - EXPECT_EQ(0u, interpolate_pixels[8]); - EXPECT_EQ(0u, interpolate_pixels[9]); - EXPECT_EQ(0u, interpolate_pixels[10]); - EXPECT_EQ(0u, interpolate_pixels[11]); - EXPECT_EQ(128u, interpolate_pixels[12]); - EXPECT_EQ(128u, interpolate_pixels[13]); - EXPECT_EQ(128u, interpolate_pixels[14]); - EXPECT_EQ(128u, interpolate_pixels[15]); + ASSERT_EQ(8u, interpolate_pixels[0]); + ASSERT_EQ(16u, interpolate_pixels[1]); + ASSERT_EQ(32u, interpolate_pixels[2]); + ASSERT_EQ(64u, interpolate_pixels[3]); + ASSERT_EQ(0u, interpolate_pixels[4]); + ASSERT_EQ(0u, interpolate_pixels[5]); + ASSERT_EQ(0u, interpolate_pixels[6]); + ASSERT_EQ(128u, interpolate_pixels[7]); + ASSERT_EQ(0u, interpolate_pixels[8]); + ASSERT_EQ(0u, interpolate_pixels[9]); + ASSERT_EQ(0u, interpolate_pixels[10]); + ASSERT_EQ(0u, interpolate_pixels[11]); + ASSERT_EQ(128u, interpolate_pixels[12]); + ASSERT_EQ(128u, interpolate_pixels[13]); + ASSERT_EQ(128u, interpolate_pixels[14]); + ASSERT_EQ(128u, interpolate_pixels[15]); InterpolatePlane_16(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 0); - EXPECT_EQ(16u, interpolate_pixels[0]); - EXPECT_EQ(32u, interpolate_pixels[1]); - EXPECT_EQ(64u, interpolate_pixels[2]); - EXPECT_EQ(128u, interpolate_pixels[3]); + ASSERT_EQ(16u, interpolate_pixels[0]); + ASSERT_EQ(32u, interpolate_pixels[1]); + ASSERT_EQ(64u, interpolate_pixels[2]); + ASSERT_EQ(128u, interpolate_pixels[3]); InterpolatePlane_16(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, &interpolate_pixels[0], 0, 16, 1, 192); - EXPECT_EQ(4u, interpolate_pixels[0]); - EXPECT_EQ(8u, interpolate_pixels[1]); - EXPECT_EQ(16u, interpolate_pixels[2]); - EXPECT_EQ(32u, interpolate_pixels[3]); + ASSERT_EQ(4u, interpolate_pixels[0]); + ASSERT_EQ(8u, interpolate_pixels[1]); + ASSERT_EQ(16u, interpolate_pixels[2]); + ASSERT_EQ(32u, interpolate_pixels[3]); for (int i = 0; i < benchmark_pixels_div1280_; ++i) { InterpolatePlane_16(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, @@ -1233,7 +1233,7 @@ TEST_F(LibYUVPlanarTest, TestInterpolatePlane_16) { dst_argb_opt, kStrideB, kWidth, NEG kHeight, TERP); \ } \ for (int i = 0; i < kStrideB * kHeight; ++i) { \ - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ } \ free_aligned_buffer_page_end(src_argb_a); \ free_aligned_buffer_page_end(src_argb_b); \ @@ -1310,35 +1310,35 @@ TEST_F(LibYUVPlanarTest, ARGBBlend_Any) { int max_diff = TestBlend(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBBlend_Unaligned) { int max_diff = TestBlend(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBBlend_Invert) { int max_diff = TestBlend(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBBlend_Unattenuated) { int max_diff = TestBlend(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) { int max_diff = TestBlend(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } static void TestBlendPlane(int width, @@ -1370,14 +1370,14 @@ static void TestBlendPlane(int width, BlendPlane(src_argb_a + off, width, src_argb_b + off, width, src_argb_alpha + off, width, dst_argb_opt + off, width, width, 1); for (int i = 0; i < width; ++i) { - EXPECT_EQ(src_argb_a[i + off], dst_argb_opt[i + off]); + ASSERT_EQ(src_argb_a[i + off], dst_argb_opt[i + off]); } // Test destination is maintained exactly if alpha is 0. memset(src_argb_alpha + off, 0, width); BlendPlane(src_argb_a + off, width, src_argb_b + off, width, src_argb_alpha + off, width, dst_argb_opt + off, width, width, 1); for (int i = 0; i < width; ++i) { - EXPECT_EQ(src_argb_b[i + off], dst_argb_opt[i + off]); + ASSERT_EQ(src_argb_b[i + off], dst_argb_opt[i + off]); } for (int i = 0; i < kStride * height; ++i) { src_argb_a[i + off] = (fastrand() & 0xff); @@ -1396,7 +1396,7 @@ static void TestBlendPlane(int width, invert * height); } for (int i = 0; i < kStride * height; ++i) { - EXPECT_EQ(dst_argb_c[i + off], dst_argb_opt[i + off]); + ASSERT_EQ(dst_argb_c[i + off], dst_argb_opt[i + off]); } free_aligned_buffer_page_end(src_argb_a); free_aligned_buffer_page_end(src_argb_b); @@ -1477,11 +1477,11 @@ static void TestI420Blend(int width, width, invert * height); } for (int i = 0; i < width * height; ++i) { - EXPECT_EQ(dst_y_c[i + off], dst_y_opt[i + off]); + ASSERT_EQ(dst_y_c[i + off], dst_y_opt[i + off]); } for (int i = 0; i < kSizeUV; ++i) { - EXPECT_EQ(dst_u_c[i + off], dst_u_opt[i + off]); - EXPECT_EQ(dst_v_c[i + off], dst_v_opt[i + off]); + ASSERT_EQ(dst_u_c[i + off], dst_u_opt[i + off]); + ASSERT_EQ(dst_v_c[i + off], dst_v_opt[i + off]); } free_aligned_buffer_page_end(src_y0); free_aligned_buffer_page_end(src_u0); @@ -1532,15 +1532,15 @@ TEST_F(LibYUVPlanarTest, TestAffine) { ARGBAffineRow_C(&orig_pixels_0[0][0], 0, &interpolate_pixels_C[0][0], uv_step, 1280); - EXPECT_EQ(0u, interpolate_pixels_C[0][0]); - EXPECT_EQ(96u, interpolate_pixels_C[128][0]); - EXPECT_EQ(191u, interpolate_pixels_C[255][3]); + ASSERT_EQ(0u, interpolate_pixels_C[0][0]); + ASSERT_EQ(96u, interpolate_pixels_C[128][0]); + ASSERT_EQ(191u, interpolate_pixels_C[255][3]); #if defined(HAS_ARGBAFFINEROW_SSE2) SIMD_ALIGNED(uint8_t interpolate_pixels_Opt[1280][4]); ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], uv_step, 1280); - EXPECT_EQ(0, memcmp(interpolate_pixels_Opt, interpolate_pixels_C, 1280 * 4)); + ASSERT_EQ(0, memcmp(interpolate_pixels_Opt, interpolate_pixels_C, 1280 * 4)); int has_sse2 = TestCpuFlag(kCpuHasSSE2); if (has_sse2) { @@ -1603,28 +1603,28 @@ TEST_F(LibYUVPlanarTest, CopyPlane_Any) { int max_diff = TestCopyPlane(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, CopyPlane_Unaligned) { int max_diff = TestCopyPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, CopyPlane_Invert) { int max_diff = TestCopyPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, CopyPlane_Opt) { int max_diff = TestCopyPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, TestCopyPlaneZero) { @@ -1636,30 +1636,30 @@ TEST_F(LibYUVPlanarTest, TestCopyPlaneZero) { // Disable all optimizations. MaskCpuFlags(disable_cpu_flags_); CopyPlane(&src, 0, &dst, 0, 0, 0); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); CopyPlane(&src, 1, &dst, 1, 1, 0); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); CopyPlane(&src, 1, &dst, 1, 0, 1); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); // Enable optimizations. MaskCpuFlags(benchmark_cpu_info_); CopyPlane(&src, 0, &dst, 0, 0, 0); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); CopyPlane(&src, 1, &dst, 1, 1, 0); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); CopyPlane(&src, 1, &dst, 1, 0, 1); - EXPECT_EQ(src, 42); - EXPECT_EQ(dst, 0); + ASSERT_EQ(src, 42); + ASSERT_EQ(dst, 0); } TEST_F(LibYUVPlanarTest, TestDetilePlane) { @@ -1693,7 +1693,7 @@ TEST_F(LibYUVPlanarTest, TestDetilePlane) { } for (i = 0; i < y_plane_size; ++i) { - EXPECT_EQ(dst_c[i], dst_opt[i]); + ASSERT_EQ(dst_c[i], dst_opt[i]); } free_aligned_buffer_page_end(tile_y); @@ -1732,7 +1732,7 @@ TEST_F(LibYUVPlanarTest, TestDetilePlane_16) { } for (i = 0; i < y_plane_size; ++i) { - EXPECT_EQ(dst_c[i], dst_opt[i]); + ASSERT_EQ(dst_c[i], dst_opt[i]); } free_aligned_buffer_page_end(tile_y); @@ -1778,8 +1778,8 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Correctness) { } for (i = 0; i < uv_plane_size; ++i) { - EXPECT_EQ(dst_u_two_stage[i], dst_u_opt[i]); - EXPECT_EQ(dst_v_two_stage[i], dst_v_opt[i]); + ASSERT_EQ(dst_u_two_stage[i], dst_u_opt[i]); + ASSERT_EQ(dst_v_two_stage[i], dst_v_opt[i]); } free_aligned_buffer_page_end(tile_uv); @@ -1827,8 +1827,8 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) { } for (i = 0; i < uv_plane_size; ++i) { - EXPECT_EQ(dst_u_c[i], dst_u_opt[i]); - EXPECT_EQ(dst_v_c[i], dst_v_opt[i]); + ASSERT_EQ(dst_u_c[i], dst_u_opt[i]); + ASSERT_EQ(dst_v_c[i], dst_v_opt[i]); } free_aligned_buffer_page_end(tile_uv); @@ -1888,28 +1888,28 @@ TEST_F(LibYUVPlanarTest, ARGBMultiply_Any) { int max_diff = TestMultiply(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBMultiply_Unaligned) { int max_diff = TestMultiply(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBMultiply_Invert) { int max_diff = TestMultiply(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } TEST_F(LibYUVPlanarTest, ARGBMultiply_Opt) { int max_diff = TestMultiply(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 0); + ASSERT_LE(max_diff, 0); } static int TestAdd(int width, @@ -1962,28 +1962,28 @@ TEST_F(LibYUVPlanarTest, ARGBAdd_Any) { int max_diff = TestAdd(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBAdd_Unaligned) { int max_diff = TestAdd(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBAdd_Invert) { int max_diff = TestAdd(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBAdd_Opt) { int max_diff = TestAdd(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } static int TestSubtract(int width, @@ -2036,28 +2036,28 @@ TEST_F(LibYUVPlanarTest, ARGBSubtract_Any) { int max_diff = TestSubtract(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBSubtract_Unaligned) { int max_diff = TestSubtract(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBSubtract_Invert) { int max_diff = TestSubtract(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, ARGBSubtract_Opt) { int max_diff = TestSubtract(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } static int TestSobel(int width, @@ -2108,28 +2108,28 @@ TEST_F(LibYUVPlanarTest, ARGBSobel_Any) { int max_diff = TestSobel(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobel_Unaligned) { int max_diff = TestSobel(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobel_Invert) { int max_diff = TestSobel(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobel_Opt) { int max_diff = TestSobel(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } static int TestSobelToPlane(int width, @@ -2182,28 +2182,28 @@ TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Any) { int max_diff = TestSobelToPlane(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Unaligned) { int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Invert) { int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Opt) { int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } static int TestSobelXY(int width, @@ -2254,28 +2254,28 @@ TEST_F(LibYUVPlanarTest, ARGBSobelXY_Any) { int max_diff = TestSobelXY(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelXY_Unaligned) { int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelXY_Invert) { int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBSobelXY_Opt) { int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } static int TestBlur(int width, @@ -2338,28 +2338,28 @@ TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlur_Any)) { int max_diff = TestBlur(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, kBlurSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlur_Unaligned)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1, kBlurSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlur_Invert)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0, kBlurSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlur_Opt)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, kBlurSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } static const int kBlurSmallSize = 5; @@ -2367,28 +2367,28 @@ TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlurSmall_Any)) { int max_diff = TestBlur(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, kBlurSmallSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlurSmall_Unaligned)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1, kBlurSmallSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlurSmall_Invert)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0, kBlurSmallSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(ARGBBlurSmall_Opt)) { int max_diff = TestBlur(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, kBlurSmallSize); - EXPECT_LE(max_diff, 1); + ASSERT_LE(max_diff, 1); } TEST_F(LibYUVPlanarTest, DISABLED_ARM(TestARGBPolynomial)) { @@ -2432,26 +2432,26 @@ TEST_F(LibYUVPlanarTest, DISABLED_ARM(TestARGBPolynomial)) { // Do 16 to test asm version. ARGBPolynomial(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0, &kWarmifyPolynomial[0], 16, 1); - EXPECT_EQ(235u, dst_pixels_opt[0][0]); - EXPECT_EQ(0u, dst_pixels_opt[0][1]); - EXPECT_EQ(0u, dst_pixels_opt[0][2]); - EXPECT_EQ(128u, dst_pixels_opt[0][3]); - EXPECT_EQ(0u, dst_pixels_opt[1][0]); - EXPECT_EQ(233u, dst_pixels_opt[1][1]); - EXPECT_EQ(0u, dst_pixels_opt[1][2]); - EXPECT_EQ(0u, dst_pixels_opt[1][3]); - EXPECT_EQ(0u, dst_pixels_opt[2][0]); - EXPECT_EQ(0u, dst_pixels_opt[2][1]); - EXPECT_EQ(241u, dst_pixels_opt[2][2]); - EXPECT_EQ(255u, dst_pixels_opt[2][3]); - EXPECT_EQ(235u, dst_pixels_opt[3][0]); - EXPECT_EQ(233u, dst_pixels_opt[3][1]); - EXPECT_EQ(241u, dst_pixels_opt[3][2]); - EXPECT_EQ(255u, dst_pixels_opt[3][3]); - EXPECT_EQ(10u, dst_pixels_opt[4][0]); - EXPECT_EQ(59u, dst_pixels_opt[4][1]); - EXPECT_EQ(188u, dst_pixels_opt[4][2]); - EXPECT_EQ(224u, dst_pixels_opt[4][3]); + ASSERT_EQ(235u, dst_pixels_opt[0][0]); + ASSERT_EQ(0u, dst_pixels_opt[0][1]); + ASSERT_EQ(0u, dst_pixels_opt[0][2]); + ASSERT_EQ(128u, dst_pixels_opt[0][3]); + ASSERT_EQ(0u, dst_pixels_opt[1][0]); + ASSERT_EQ(233u, dst_pixels_opt[1][1]); + ASSERT_EQ(0u, dst_pixels_opt[1][2]); + ASSERT_EQ(0u, dst_pixels_opt[1][3]); + ASSERT_EQ(0u, dst_pixels_opt[2][0]); + ASSERT_EQ(0u, dst_pixels_opt[2][1]); + ASSERT_EQ(241u, dst_pixels_opt[2][2]); + ASSERT_EQ(255u, dst_pixels_opt[2][3]); + ASSERT_EQ(235u, dst_pixels_opt[3][0]); + ASSERT_EQ(233u, dst_pixels_opt[3][1]); + ASSERT_EQ(241u, dst_pixels_opt[3][2]); + ASSERT_EQ(255u, dst_pixels_opt[3][3]); + ASSERT_EQ(10u, dst_pixels_opt[4][0]); + ASSERT_EQ(59u, dst_pixels_opt[4][1]); + ASSERT_EQ(188u, dst_pixels_opt[4][2]); + ASSERT_EQ(224u, dst_pixels_opt[4][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -2471,10 +2471,10 @@ TEST_F(LibYUVPlanarTest, DISABLED_ARM(TestARGBPolynomial)) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); - EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); - EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); - EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); + ASSERT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); + ASSERT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); + ASSERT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); + ASSERT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); } } @@ -2539,70 +2539,70 @@ TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_One) { int diff = TestHalfFloatPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f, 65535, +1, 0); - EXPECT_LE(diff, 1); + ASSERT_LE(diff, 1); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_Opt) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 65535.0f, 65535, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_12bit_Opt) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 4095.0f, 4095, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_10bit_Opt) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 1023.0f, 1023, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_9bit_Opt) { int diff = TestHalfFloatPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 511.0f, 511, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_Any) { int diff = TestHalfFloatPlane( benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 4096.0f, 4095, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_Unaligned) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 4096.0f, 4095, +1, 2); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_Invert) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 4096.0f, 4095, -1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_Opt) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 4096.0f, 4095, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_denormal) { int diff = TestHalfFloatPlane( benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 65535.0f, 65535, +1, 0); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } #if defined(__arm__) && !defined(__SOFTFP__) @@ -2635,7 +2635,7 @@ TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_flush_denormal) { benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 65535.0f, 65535, +1, 0); DisableFlushDenormalToZero(); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_10bit_flush_denormal) { @@ -2644,7 +2644,7 @@ TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_10bit_flush_denormal) { benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f / 1023.0f, 1023, +1, 0); DisableFlushDenormalToZero(); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } #endif // defined(__arm__) && !defined(__SOFTFP__) @@ -2691,7 +2691,7 @@ TEST_F(LibYUVPlanarTest, TestByteToFloat) { float diff = TestByteToFloat(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, 1.0f); - EXPECT_EQ(0.f, diff); + ASSERT_EQ(0.f, diff); } TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { @@ -2729,22 +2729,22 @@ TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { // Do 16 to test asm version. ARGBLumaColorTable(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0, &lumacolortable[0], 16, 1); - EXPECT_EQ(253u, dst_pixels_opt[0][0]); - EXPECT_EQ(0u, dst_pixels_opt[0][1]); - EXPECT_EQ(0u, dst_pixels_opt[0][2]); - EXPECT_EQ(128u, dst_pixels_opt[0][3]); - EXPECT_EQ(0u, dst_pixels_opt[1][0]); - EXPECT_EQ(253u, dst_pixels_opt[1][1]); - EXPECT_EQ(0u, dst_pixels_opt[1][2]); - EXPECT_EQ(0u, dst_pixels_opt[1][3]); - EXPECT_EQ(0u, dst_pixels_opt[2][0]); - EXPECT_EQ(0u, dst_pixels_opt[2][1]); - EXPECT_EQ(253u, dst_pixels_opt[2][2]); - EXPECT_EQ(255u, dst_pixels_opt[2][3]); - EXPECT_EQ(48u, dst_pixels_opt[3][0]); - EXPECT_EQ(192u, dst_pixels_opt[3][1]); - EXPECT_EQ(64u, dst_pixels_opt[3][2]); - EXPECT_EQ(224u, dst_pixels_opt[3][3]); + ASSERT_EQ(253u, dst_pixels_opt[0][0]); + ASSERT_EQ(0u, dst_pixels_opt[0][1]); + ASSERT_EQ(0u, dst_pixels_opt[0][2]); + ASSERT_EQ(128u, dst_pixels_opt[0][3]); + ASSERT_EQ(0u, dst_pixels_opt[1][0]); + ASSERT_EQ(253u, dst_pixels_opt[1][1]); + ASSERT_EQ(0u, dst_pixels_opt[1][2]); + ASSERT_EQ(0u, dst_pixels_opt[1][3]); + ASSERT_EQ(0u, dst_pixels_opt[2][0]); + ASSERT_EQ(0u, dst_pixels_opt[2][1]); + ASSERT_EQ(253u, dst_pixels_opt[2][2]); + ASSERT_EQ(255u, dst_pixels_opt[2][3]); + ASSERT_EQ(48u, dst_pixels_opt[3][0]); + ASSERT_EQ(192u, dst_pixels_opt[3][1]); + ASSERT_EQ(64u, dst_pixels_opt[3][2]); + ASSERT_EQ(224u, dst_pixels_opt[3][3]); for (int i = 0; i < 1280; ++i) { orig_pixels[i][0] = i; @@ -2763,10 +2763,10 @@ TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { lumacolortable, 1280, 1); } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); - EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); - EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); - EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); + ASSERT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); + ASSERT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); + ASSERT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); + ASSERT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); } free_aligned_buffer_page_end(lumacolortable); @@ -2792,7 +2792,7 @@ TEST_F(LibYUVPlanarTest, TestARGBCopyAlpha) { benchmark_width_ * 4, benchmark_width_, benchmark_height_); } for (int i = 0; i < kSize; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(dst_pixels_c); @@ -2831,7 +2831,7 @@ TEST_F(LibYUVPlanarTest, TestARGBExtractAlpha) { printf("%8d us C - %8d us OPT\n", static_cast(c_time * 1e6), static_cast(opt_time * 1e6)); for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(dst_pixels_c); @@ -2871,7 +2871,7 @@ TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) { printf("%8d us C - %8d us OPT\n", static_cast(c_time * 1e6), static_cast(opt_time * 1e6)); for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(dst_pixels_c); @@ -2932,56 +2932,56 @@ TEST_F(LibYUVPlanarTest, ARGBRect_Any) { int max_diff = TestARGBRect(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 4); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBRect_Unaligned) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1, 4); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBRect_Invert) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0, 4); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, ARGBRect_Opt) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 4); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, SetPlane_Any) { int max_diff = TestARGBRect(benchmark_width_ + 1, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, SetPlane_Unaligned) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 1, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, SetPlane_Invert) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, -1, 0, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, SetPlane_Opt) { int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_, +1, 0, 1); - EXPECT_EQ(0, max_diff); + ASSERT_EQ(0, max_diff); } TEST_F(LibYUVPlanarTest, MergeUVPlane_Opt) { @@ -3009,7 +3009,7 @@ TEST_F(LibYUVPlanarTest, MergeUVPlane_Opt) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels_u); @@ -3045,7 +3045,7 @@ TEST_F(LibYUVPlanarTest, MergeUVPlane_16_Opt) { } for (int i = 0; i < kPixels * 2 * 2; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels_u); free_aligned_buffer_page_end(src_pixels_v); @@ -3080,8 +3080,8 @@ TEST_F(LibYUVPlanarTest, SplitUVPlane_Opt) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_u_c[i], dst_pixels_u_opt[i]); - EXPECT_EQ(dst_pixels_v_c[i], dst_pixels_v_opt[i]); + ASSERT_EQ(dst_pixels_u_c[i], dst_pixels_u_opt[i]); + ASSERT_EQ(dst_pixels_v_c[i], dst_pixels_v_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3120,8 +3120,8 @@ TEST_F(LibYUVPlanarTest, SplitUVPlane_16_Opt) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_u_c[i], dst_pixels_u_opt[i]); - EXPECT_EQ(dst_pixels_v_c[i], dst_pixels_v_opt[i]); + ASSERT_EQ(dst_pixels_u_c[i], dst_pixels_u_opt[i]); + ASSERT_EQ(dst_pixels_v_c[i], dst_pixels_v_opt[i]); } free_aligned_buffer_page_end(src_pixels); free_aligned_buffer_page_end(dst_pixels_u_c); @@ -3152,7 +3152,7 @@ TEST_F(LibYUVPlanarTest, SwapUVPlane_Opt) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3207,7 +3207,7 @@ TEST_F(LibYUVPlanarTest, MergeRGBPlane_Opt) { } for (int i = 0; i < kPixels * 3; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3267,7 +3267,7 @@ TEST_F(LibYUVPlanarTest, SplitRGBPlane_Opt) { benchmark_height_); for (int i = 0; i < kPixels * 3; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3331,7 +3331,7 @@ TEST_F(LibYUVPlanarTest, MergeARGBPlane_Opt) { } for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3397,7 +3397,7 @@ TEST_F(LibYUVPlanarTest, SplitARGBPlane_Opt) { benchmark_width_ * 4, benchmark_width_, benchmark_height_); for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3459,7 +3459,7 @@ TEST_F(LibYUVPlanarTest, MergeXRGBPlane_Opt) { } for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3519,7 +3519,7 @@ TEST_F(LibYUVPlanarTest, SplitXRGBPlane_Opt) { benchmark_height_); for (int i = 0; i < kPixels * 4; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); @@ -3567,7 +3567,7 @@ TEST_F(LibYUVPlanarTest, SplitXRGBPlane_Opt) { kWidth, NEG benchmark_height_, DEPTH); \ } \ for (int i = 0; i < kPixels * 4; ++i) { \ - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ } \ free_aligned_buffer_page_end(src_memory_r); \ free_aligned_buffer_page_end(src_memory_g); \ @@ -3608,7 +3608,7 @@ TEST_F(LibYUVPlanarTest, SplitXRGBPlane_Opt) { NEG benchmark_height_, DEPTH); \ } \ for (int i = 0; i < kPixels * 4; ++i) { \ - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ } \ free_aligned_buffer_page_end(src_memory_r); \ free_aligned_buffer_page_end(src_memory_g); \ @@ -3667,7 +3667,7 @@ TESTQPLANARTOP(MergeARGB16To8, uint16_t, uint8_t, 16) NEG benchmark_height_, DEPTH); \ } \ for (int i = 0; i < kPixels * 4; ++i) { \ - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); \ } \ free_aligned_buffer_page_end(src_memory_r); \ free_aligned_buffer_page_end(src_memory_g); \ @@ -3723,7 +3723,7 @@ TEST_F(LibYUVPlanarTest, MergeUVRow_16_Opt) { } for (int i = 0; i < kPixels * 2 * 2; ++i) { - EXPECT_EQ(dst_pixels_uv_opt[i], dst_pixels_uv_c[i]); + ASSERT_EQ(dst_pixels_uv_opt[i], dst_pixels_uv_c[i]); } free_aligned_buffer_page_end(src_pixels_u); @@ -3764,7 +3764,7 @@ TEST_F(LibYUVPlanarTest, MultiplyRow_16_Opt) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3796,7 +3796,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Plane) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3827,7 +3827,7 @@ TEST_F(LibYUVPlanarTest, Convert8To8Plane) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3856,7 +3856,7 @@ TEST_F(LibYUVPlanarTest, YUY2ToY) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3885,7 +3885,7 @@ TEST_F(LibYUVPlanarTest, UYVYToY) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3931,7 +3931,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3959,7 +3959,7 @@ TEST_F(LibYUVPlanarTest, UYVYToYRow_Opt) { } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -3995,7 +3995,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Plane) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -4038,7 +4038,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Row_Opt) { } for (int i = 0; i < kPixels * 2; ++i) { - EXPECT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); + ASSERT_EQ(dst_pixels_y_opt[i], dst_pixels_y_c[i]); } free_aligned_buffer_page_end(src_pixels_y); @@ -4106,13 +4106,13 @@ float TestScaleMaxSamples(int benchmark_width, TEST_F(LibYUVPlanarTest, TestScaleMaxSamples_C) { float diff = TestScaleMaxSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, false); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestScaleMaxSamples_Opt) { float diff = TestScaleMaxSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, true); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } float TestScaleSumSamples(int benchmark_width, @@ -4185,13 +4185,13 @@ float TestScaleSumSamples(int benchmark_width, TEST_F(LibYUVPlanarTest, TestScaleSumSamples_C) { float diff = TestScaleSumSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, false); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestScaleSumSamples_Opt) { float diff = TestScaleSumSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, true); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } float TestScaleSamples(int benchmark_width, @@ -4249,13 +4249,13 @@ float TestScaleSamples(int benchmark_width, TEST_F(LibYUVPlanarTest, TestScaleSamples_C) { float diff = TestScaleSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, false); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestScaleSamples_Opt) { float diff = TestScaleSamples(benchmark_width_, benchmark_height_, benchmark_iterations_, 1.2f, true); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } float TestCopySamples(int benchmark_width, @@ -4309,13 +4309,13 @@ float TestCopySamples(int benchmark_width, TEST_F(LibYUVPlanarTest, TestCopySamples_C) { float diff = TestCopySamples(benchmark_width_, benchmark_height_, benchmark_iterations_, false); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } TEST_F(LibYUVPlanarTest, TestCopySamples_Opt) { float diff = TestCopySamples(benchmark_width_, benchmark_height_, benchmark_iterations_, true); - EXPECT_EQ(0, diff); + ASSERT_EQ(0, diff); } extern "C" void GaussRow_NEON(const uint32_t* src, uint16_t* dst, int width); @@ -4349,12 +4349,12 @@ TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } - EXPECT_EQ(dst_pixels_c[0], + ASSERT_EQ(dst_pixels_c[0], static_cast(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1)); - EXPECT_EQ(dst_pixels_c[639], static_cast(10256)); + ASSERT_EQ(dst_pixels_c[639], static_cast(10256)); } extern "C" void GaussCol_NEON(const uint16_t* src0, @@ -4409,7 +4409,7 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } } @@ -4440,7 +4440,7 @@ TEST_F(LibYUVPlanarTest, TestGaussRow_F32_Opt) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } } @@ -4480,7 +4480,7 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_F32_Opt) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(orig_pixels_buf); } @@ -4508,8 +4508,8 @@ TEST_F(LibYUVPlanarTest, SwapUVRow) { SwapUVRow(src_pixels_vu, dst_pixels_uv, kPixels); } for (int i = 0; i < kPixels; ++i) { - EXPECT_EQ(dst_pixels_uv[i * 2 + 0], src_pixels_vu[i * 2 + 1]); - EXPECT_EQ(dst_pixels_uv[i * 2 + 1], src_pixels_vu[i * 2 + 0]); + ASSERT_EQ(dst_pixels_uv[i * 2 + 0], src_pixels_vu[i * 2 + 1]); + ASSERT_EQ(dst_pixels_uv[i * 2 + 1], src_pixels_vu[i * 2 + 0]); } free_aligned_buffer_page_end(src_pixels_vu); @@ -4541,7 +4541,7 @@ TEST_F(LibYUVPlanarTest, TestGaussPlane_F32) { benchmark_height_); } for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { - EXPECT_NEAR(((float*)(dst_pixels_c))[i], ((float*)(dst_pixels_opt))[i], 1.f) + ASSERT_NEAR(((float*)(dst_pixels_c))[i], ((float*)(dst_pixels_opt))[i], 1.f) << i; } @@ -4576,7 +4576,7 @@ TEST_F(LibYUVPlanarTest, HalfMergeUVPlane_Opt) { } for (int i = 0; i < dst_width * 2 * dst_height; ++i) { - EXPECT_EQ(dst_pixels_uv_c[i], dst_pixels_uv_opt[i]); + ASSERT_EQ(dst_pixels_uv_c[i], dst_pixels_uv_opt[i]); } free_aligned_buffer_page_end(src_pixels_u); @@ -4605,10 +4605,10 @@ TEST_F(LibYUVPlanarTest, NV12Copy) { } for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { - EXPECT_EQ(src_y[i], dst_y[i]); + ASSERT_EQ(src_y[i], dst_y[i]); } for (int i = 0; i < halfwidth * 2 * halfheight; ++i) { - EXPECT_EQ(src_uv[i], dst_uv[i]); + ASSERT_EQ(src_uv[i], dst_uv[i]); } free_aligned_buffer_page_end(src_y); @@ -4637,10 +4637,10 @@ TEST_F(LibYUVPlanarTest, NV21Copy) { } for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { - EXPECT_EQ(src_y[i], dst_y[i]); + ASSERT_EQ(src_y[i], dst_y[i]); } for (int i = 0; i < halfwidth * 2 * halfheight; ++i) { - EXPECT_EQ(src_vu[i], dst_vu[i]); + ASSERT_EQ(src_vu[i], dst_vu[i]); } free_aligned_buffer_page_end(src_y); @@ -4680,7 +4680,7 @@ TEST_F(LibYUVPlanarTest, TestConvertFP16ToFP32) { y_plane_size); for (i = 0; i < y_plane_size; ++i) { - EXPECT_EQ(((const uint16_t*)orig_y)[i], ((const uint16_t*)rec_opt)[i]); + ASSERT_EQ(((const uint16_t*)orig_y)[i], ((const uint16_t*)rec_opt)[i]); } free_aligned_buffer_page_end(orig_f); @@ -4717,7 +4717,7 @@ TEST_F(LibYUVPlanarTest, TestConvertFP16ToFP32Column) { y_plane_size); for (i = 0; i < y_plane_size; ++i) { - EXPECT_EQ(((const uint16_t*)orig_y)[i], ((const uint16_t*)rec_opt)[i]); + ASSERT_EQ(((const uint16_t*)orig_y)[i], ((const uint16_t*)rec_opt)[i]); } free_aligned_buffer_page_end(orig_f); diff --git a/unit_test/rotate_argb_test.cc b/unit_test/rotate_argb_test.cc index 4c7b0b250..701e57a01 100644 --- a/unit_test/rotate_argb_test.cc +++ b/unit_test/rotate_argb_test.cc @@ -75,7 +75,7 @@ static void TestRotateBpp(int src_width, // Rotation should be exact. for (int i = 0; i < dst_argb_plane_size; ++i) { - EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); + ASSERT_EQ(dst_argb_c[i], dst_argb_opt[i]); } free_aligned_buffer_page_end(dst_argb_c); @@ -189,35 +189,35 @@ TEST_F(LibYUVRotateTest, RotatePlane90_TestStride) { align_buffer_page_end(src_argb, argb_plane_size); align_buffer_page_end(dst_argb, argb_plane_size); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, benchmark_width_ * 4, benchmark_width_, benchmark_height_, kRotate0)); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, benchmark_width_ * 4 - 1, benchmark_width_ - 1, benchmark_height_, kRotate0)); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, benchmark_width_ * 4, benchmark_width_, benchmark_height_, kRotate180)); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, benchmark_width_ * 4 - 1, benchmark_width_ - 1, benchmark_height_, kRotate180)); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, abs(benchmark_height_) * 4, benchmark_width_, benchmark_height_, kRotate90)); - EXPECT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + ASSERT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, abs(benchmark_height_) * 4, benchmark_width_ - 1, benchmark_height_, kRotate90)); - EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + ASSERT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, abs(benchmark_height_) * 4, benchmark_width_, benchmark_height_, kRotate270)); - EXPECT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + ASSERT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, abs(benchmark_height_) * 4, benchmark_width_ - 1, benchmark_height_, kRotate270)); @@ -271,7 +271,7 @@ static void TestRotatePlane_16(int src_width, // Rotation should be exact. for (int i = 0; i < dst_plane_size; ++i) { - EXPECT_EQ(dst_c[i], dst_opt[i]); + ASSERT_EQ(dst_c[i], dst_opt[i]); } free_aligned_buffer_page_end_16(dst_c); diff --git a/unit_test/rotate_test.cc b/unit_test/rotate_test.cc index abc08efa8..9256f8de0 100644 --- a/unit_test/rotate_test.cc +++ b/unit_test/rotate_test.cc @@ -78,7 +78,7 @@ static void I420TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i420_size; ++i) { - EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); + ASSERT_EQ(dst_i420_c[i], dst_i420_opt[i]); } free_aligned_buffer_page_end(dst_i420_c); @@ -197,7 +197,7 @@ static void I422TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i422_size; ++i) { - EXPECT_EQ(dst_i422_c[i], dst_i422_opt[i]); + ASSERT_EQ(dst_i422_c[i], dst_i422_opt[i]); } free_aligned_buffer_page_end(dst_i422_c); @@ -283,7 +283,7 @@ static void I444TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i444_size; ++i) { - EXPECT_EQ(dst_i444_c[i], dst_i444_opt[i]); + ASSERT_EQ(dst_i444_c[i], dst_i444_opt[i]); } free_aligned_buffer_page_end(dst_i444_c); @@ -401,7 +401,7 @@ static void NV12TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i420_size; ++i) { - EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); + ASSERT_EQ(dst_i420_c[i], dst_i420_opt[i]); } free_aligned_buffer_page_end(dst_i420_c); @@ -550,18 +550,18 @@ TEST_F(LibYUVRotateTest, NV12Rotate270_Invert) { } \ for (int i = 0; i < kHeight; ++i) { \ for (int j = 0; j < kWidth; ++j) { \ - EXPECT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ + ASSERT_EQ(dst_y_c[i * kWidth + j], dst_y_opt[i * kWidth + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ - EXPECT_EQ(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ + ASSERT_EQ(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ dst_u_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]); \ } \ } \ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ - EXPECT_EQ(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ + ASSERT_EQ(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j], \ dst_v_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]); \ } \ } \ @@ -656,7 +656,7 @@ static void I010TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i010_size; ++i) { - EXPECT_EQ(dst_i010_c[i], dst_i010_opt[i]); + ASSERT_EQ(dst_i010_c[i], dst_i010_opt[i]); } free_aligned_buffer_page_end_16(dst_i010_c); @@ -744,7 +744,7 @@ static void I210TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i210_size; ++i) { - EXPECT_EQ(dst_i210_c[i], dst_i210_opt[i]); + ASSERT_EQ(dst_i210_c[i], dst_i210_opt[i]); } free_aligned_buffer_page_end_16(dst_i210_c); @@ -830,7 +830,7 @@ static void I410TestRotate(int src_width, // Rotation should be exact. for (int i = 0; i < dst_i410_size; ++i) { - EXPECT_EQ(dst_i410_c[i], dst_i410_opt[i]); + ASSERT_EQ(dst_i410_c[i], dst_i410_opt[i]); } free_aligned_buffer_page_end_16(dst_i410_c); @@ -906,8 +906,8 @@ TEST_F(LibYUVRotateTest, Transpose4x4_Test) { for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { - EXPECT_EQ(dst_pixels_c[i][j], src_pixels[j][i]); - EXPECT_EQ(dst_pixels_c[i][j], dst_pixels_opt[i][j]); + ASSERT_EQ(dst_pixels_c[i][j], src_pixels[j][i]); + ASSERT_EQ(dst_pixels_c[i][j], dst_pixels_opt[i][j]); } } } @@ -949,7 +949,7 @@ TEST_F(LibYUVRotateTest, Transpose4x4_Opt) { } for (int i = 0; i < width * height; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } free_aligned_buffer_page_end(src_pixels); diff --git a/unit_test/scale_argb_test.cc b/unit_test/scale_argb_test.cc index 66fd4cf31..219e196dd 100644 --- a/unit_test/scale_argb_test.cc +++ b/unit_test/scale_argb_test.cc @@ -245,14 +245,14 @@ static int ARGBClipTestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##ARGBScaleDownClipBy##name##_##filter) { \ int diff = ARGBClipTestFilter( \ SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \ DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } // Test a scale factor with all 4 filters. Expect unfiltered to be exact, but @@ -294,28 +294,28 @@ TEST_FACTOR(3, 1, 3) int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \ int diff = ARGBTestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##name##ClipTo##width##x##height##_##filter) { \ int diff = \ ARGBClipTestFilter(benchmark_width_, benchmark_height_, width, height, \ kFilter##filter, benchmark_iterations_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##name##ClipFrom##width##x##height##_##filter) { \ int diff = ARGBClipTestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #ifndef DISABLE_SLOW_TESTS @@ -357,7 +357,7 @@ TEST_SCALETO(ARGBScale, 1920, 1080) benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -430,12 +430,14 @@ static void FillRamp(uint8_t* buf, } // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact. -static int YUVToARGBTestFilter(int src_width, +static void YUVToARGBTestFilter(int src_width, int src_height, int dst_width, int dst_height, FilterMode f, - int benchmark_iterations) { + int benchmark_iterations, + int error_threshold, + int* max_diff_out) { int64_t src_y_plane_size = Abs(src_width) * Abs(src_height); int64_t src_uv_plane_size = ((Abs(src_width) + 1) / 2) * ((Abs(src_height) + 1) / 2); @@ -452,7 +454,7 @@ static int YUVToARGBTestFilter(int src_width, align_buffer_page_end(dst_argb_opt, dst_argb_plane_size); if (!dst_argb_c || !dst_argb_opt || !src_y || !src_u || !src_v) { printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); - return 0; + return; } // Fill YUV image with continuous ramp, which is less sensitive to // subsampling and filtering differences for test purposes. @@ -481,36 +483,44 @@ static int YUVToARGBTestFilter(int src_width, int abs_diff = Abs(dst_argb_c[(i * dst_stride_argb) + j] - dst_argb_opt[(i * dst_stride_argb) + j]); if (abs_diff > max_diff) { - printf("error %d at %d,%d c %d opt %d", abs_diff, j, i, + max_diff = abs_diff; + } + if (abs_diff > error_threshold) { + printf("error %d at %d,%d c %d opt %d\n", abs_diff, j, i, dst_argb_c[(i * dst_stride_argb) + j], dst_argb_opt[(i * dst_stride_argb) + j]); - EXPECT_LE(abs_diff, 40); - max_diff = abs_diff; + goto cleanup; } } } +cleanup: + if (max_diff_out) { + *max_diff_out = max_diff; + } free_aligned_buffer_page_end(dst_argb_c); free_aligned_buffer_page_end(dst_argb_opt); free_aligned_buffer_page_end(src_y); free_aligned_buffer_page_end(src_u); free_aligned_buffer_page_end(src_v); - return max_diff; } TEST_F(LibYUVScaleTest, YUVToRGBScaleUp) { - int diff = - YUVToARGBTestFilter(benchmark_width_, benchmark_height_, - benchmark_width_ * 3 / 2, benchmark_height_ * 3 / 2, - libyuv::kFilterBilinear, benchmark_iterations_); - EXPECT_LE(diff, 10); + int diff = 0; + YUVToARGBTestFilter(benchmark_width_, benchmark_height_, + benchmark_width_ * 3 / 2, benchmark_height_ * 3 / 2, + libyuv::kFilterBilinear, benchmark_iterations_, 10, + &diff); + ASSERT_LE(diff, 10); } TEST_F(LibYUVScaleTest, YUVToRGBScaleDown) { - int diff = YUVToARGBTestFilter( + int diff = 0; + YUVToARGBTestFilter( benchmark_width_ * 3 / 2, benchmark_height_ * 3 / 2, benchmark_width_, - benchmark_height_, libyuv::kFilterBilinear, benchmark_iterations_); - EXPECT_LE(diff, 10); + benchmark_height_, libyuv::kFilterBilinear, benchmark_iterations_, 10, + &diff); + ASSERT_LE(diff, 10); } TEST_F(LibYUVScaleTest, ARGBTest3x) { @@ -533,18 +543,18 @@ TEST_F(LibYUVScaleTest, ARGBTest3x) { kFilterBilinear); } - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); - EXPECT_EQ(226, dest_pixels[2]); - EXPECT_EQ(235, dest_pixels[3]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(226, dest_pixels[2]); + ASSERT_EQ(235, dest_pixels[3]); ARGBScale(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); - EXPECT_EQ(226, dest_pixels[2]); - EXPECT_EQ(235, dest_pixels[3]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(226, dest_pixels[2]); + ASSERT_EQ(235, dest_pixels[3]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -570,18 +580,18 @@ TEST_F(LibYUVScaleTest, ARGBTest4x) { kFilterBilinear); } - EXPECT_NEAR(66, dest_pixels[0], 4); - EXPECT_NEAR(255 - 66, dest_pixels[1], 4); - EXPECT_NEAR(67, dest_pixels[2], 4); - EXPECT_NEAR(76, dest_pixels[3], 4); + ASSERT_NEAR(66, dest_pixels[0], 4); + ASSERT_NEAR(255 - 66, dest_pixels[1], 4); + ASSERT_NEAR(67, dest_pixels[2], 4); + ASSERT_NEAR(76, dest_pixels[3], 4); ARGBScale(orig_pixels, kSrcStride, 640, 4, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(2, dest_pixels[0]); - EXPECT_EQ(255 - 2, dest_pixels[1]); - EXPECT_EQ(3, dest_pixels[2]); - EXPECT_EQ(12, dest_pixels[3]); + ASSERT_EQ(2, dest_pixels[0]); + ASSERT_EQ(255 - 2, dest_pixels[1]); + ASSERT_EQ(3, dest_pixels[2]); + ASSERT_EQ(12, dest_pixels[3]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); diff --git a/unit_test/scale_plane_test.cc b/unit_test/scale_plane_test.cc index 979c70aad..b952a6f73 100644 --- a/unit_test/scale_plane_test.cc +++ b/unit_test/scale_plane_test.cc @@ -85,49 +85,49 @@ TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) { // Test regular half size. ScaleRowDown2Box_C(orig_pixels, 128, dst_pixels_c, 64); - EXPECT_EQ(64u, dst_pixels_c[0]); - EXPECT_EQ(25u, dst_pixels_c[1]); - EXPECT_EQ(13u, dst_pixels_c[2]); - EXPECT_EQ(5u, dst_pixels_c[3]); - EXPECT_EQ(0u, dst_pixels_c[4]); - EXPECT_EQ(133u, dst_pixels_c[63]); + ASSERT_EQ(64u, dst_pixels_c[0]); + ASSERT_EQ(25u, dst_pixels_c[1]); + ASSERT_EQ(13u, dst_pixels_c[2]); + ASSERT_EQ(5u, dst_pixels_c[3]); + ASSERT_EQ(0u, dst_pixels_c[4]); + ASSERT_EQ(133u, dst_pixels_c[63]); // Test Odd width version - Last pixel is just 1 horizontal pixel. ScaleRowDown2Box_Odd_C(orig_pixels, 128, dst_pixels_c, 64); - EXPECT_EQ(64u, dst_pixels_c[0]); - EXPECT_EQ(25u, dst_pixels_c[1]); - EXPECT_EQ(13u, dst_pixels_c[2]); - EXPECT_EQ(5u, dst_pixels_c[3]); - EXPECT_EQ(0u, dst_pixels_c[4]); - EXPECT_EQ(10u, dst_pixels_c[63]); + ASSERT_EQ(64u, dst_pixels_c[0]); + ASSERT_EQ(25u, dst_pixels_c[1]); + ASSERT_EQ(13u, dst_pixels_c[2]); + ASSERT_EQ(5u, dst_pixels_c[3]); + ASSERT_EQ(0u, dst_pixels_c[4]); + ASSERT_EQ(10u, dst_pixels_c[63]); // Test one pixel less, should skip the last pixel. memset(dst_pixels_c, 0, sizeof(dst_pixels_c)); ScaleRowDown2Box_Odd_C(orig_pixels, 128, dst_pixels_c, 63); - EXPECT_EQ(64u, dst_pixels_c[0]); - EXPECT_EQ(25u, dst_pixels_c[1]); - EXPECT_EQ(13u, dst_pixels_c[2]); - EXPECT_EQ(5u, dst_pixels_c[3]); - EXPECT_EQ(0u, dst_pixels_c[4]); - EXPECT_EQ(0u, dst_pixels_c[63]); + ASSERT_EQ(64u, dst_pixels_c[0]); + ASSERT_EQ(25u, dst_pixels_c[1]); + ASSERT_EQ(13u, dst_pixels_c[2]); + ASSERT_EQ(5u, dst_pixels_c[3]); + ASSERT_EQ(0u, dst_pixels_c[4]); + ASSERT_EQ(0u, dst_pixels_c[63]); // Test regular half size SSSE3. ScaleRowDown2Box_SSSE3(orig_pixels, 128, dst_pixels_opt, 64); - EXPECT_EQ(64u, dst_pixels_opt[0]); - EXPECT_EQ(25u, dst_pixels_opt[1]); - EXPECT_EQ(13u, dst_pixels_opt[2]); - EXPECT_EQ(5u, dst_pixels_opt[3]); - EXPECT_EQ(0u, dst_pixels_opt[4]); - EXPECT_EQ(133u, dst_pixels_opt[63]); + ASSERT_EQ(64u, dst_pixels_opt[0]); + ASSERT_EQ(25u, dst_pixels_opt[1]); + ASSERT_EQ(13u, dst_pixels_opt[2]); + ASSERT_EQ(5u, dst_pixels_opt[3]); + ASSERT_EQ(0u, dst_pixels_opt[4]); + ASSERT_EQ(133u, dst_pixels_opt[63]); // Compare C and SSSE3 match. ScaleRowDown2Box_Odd_C(orig_pixels, 128, dst_pixels_c, 64); ScaleRowDown2Box_Odd_SSSE3(orig_pixels, 128, dst_pixels_opt, 64); for (int i = 0; i < 64; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } } } @@ -160,11 +160,11 @@ TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_16) { } for (int i = 0; i < 1280; ++i) { - EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); + ASSERT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } - EXPECT_EQ(dst_pixels_c[0], (0 + 1 + 2560 + 2561 + 2) / 4); - EXPECT_EQ(dst_pixels_c[1279], 3839); + ASSERT_EQ(dst_pixels_c[0], (0 + 1 + 2560 + 2561 + 2) / 4); + ASSERT_EQ(dst_pixels_c[1279], 3839); } #endif // ENABLE_ROW_TESTS @@ -244,7 +244,7 @@ static int TestPlaneFilter_16(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } // Test a scale factor with all 4 filters. Expect unfiltered to be exact, but @@ -283,12 +283,12 @@ TEST_F(LibYUVScaleTest, PlaneTest3x) { kFilterBilinear); } - EXPECT_EQ(225, dest_pixels[0]); + ASSERT_EQ(225, dest_pixels[0]); ScalePlane(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(225, dest_pixels[0]); + ASSERT_EQ(225, dest_pixels[0]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -311,12 +311,12 @@ TEST_F(LibYUVScaleTest, PlaneTest4x) { kFilterBilinear); } - EXPECT_EQ(66, dest_pixels[0]); + ASSERT_EQ(66, dest_pixels[0]); ScalePlane(orig_pixels, kSrcStride, 640, 4, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row + ASSERT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -345,7 +345,7 @@ TEST_F(LibYUVScaleTest, PlaneTestRotate_None) { } for (int i = 0; i < kSize; ++i) { - EXPECT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); + ASSERT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); } free_aligned_buffer_page_end(dest_c_pixels); @@ -375,7 +375,7 @@ TEST_F(LibYUVScaleTest, PlaneTestRotate_Bilinear) { } for (int i = 0; i < kSize; ++i) { - EXPECT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); + ASSERT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); } free_aligned_buffer_page_end(dest_c_pixels); @@ -406,7 +406,7 @@ TEST_F(LibYUVScaleTest, PlaneTestRotate_Box) { } for (int i = 0; i < kSize; ++i) { - EXPECT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); + ASSERT_EQ(dest_c_pixels[i], dest_opt_pixels[i]); } free_aligned_buffer_page_end(dest_c_pixels); @@ -432,9 +432,9 @@ TEST_F(LibYUVScaleTest, PlaneTest1_Box) { /* dst_width= */ 1, /* dst_height= */ 2, libyuv::kFilterBox); - EXPECT_EQ(dst_pixels[0], 1); - EXPECT_EQ(dst_pixels[1], 1); - EXPECT_EQ(dst_pixels[2], 3); + ASSERT_EQ(dst_pixels[0], 1); + ASSERT_EQ(dst_pixels[1], 1); + ASSERT_EQ(dst_pixels[2], 3); free_aligned_buffer_page_end(dst_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -460,9 +460,9 @@ TEST_F(LibYUVScaleTest, PlaneTest1_16_Box) { /* src_height= */ 1, dst_pixels, /* dst_stride= */ 1, /* dst_width= */ 1, /* dst_height= */ 2, libyuv::kFilterNone); - EXPECT_EQ(dst_pixels[0], 1); - EXPECT_EQ(dst_pixels[1], 1); - EXPECT_EQ(dst_pixels[2], 3); + ASSERT_EQ(dst_pixels[0], 1); + ASSERT_EQ(dst_pixels[1], 1); + ASSERT_EQ(dst_pixels[2], 3); free_aligned_buffer_page_end(dst_pixels_alloc); free_aligned_buffer_page_end(orig_pixels_alloc); @@ -529,7 +529,7 @@ TEST_F(LibYUVScaleTest, ScalePlaneVertical_IntStrideOverflow) { kDstHeight, kFilterNone); // Not reached under ASAN. - EXPECT_EQ(0, r); + ASSERT_EQ(0, r); delete[] src; delete[] dst; } diff --git a/unit_test/scale_rgb_test.cc b/unit_test/scale_rgb_test.cc index 8296abe31..f6fa1e8ca 100644 --- a/unit_test/scale_rgb_test.cc +++ b/unit_test/scale_rgb_test.cc @@ -128,7 +128,7 @@ static int RGBTestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -163,14 +163,14 @@ TEST_FACTOR(3, 1, 3) int diff = RGBTestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \ int diff = RGBTestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -202,7 +202,7 @@ TEST_SCALETO(RGBScale, 1920, 1080) benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -233,14 +233,14 @@ TEST_F(LibYUVScaleTest, RGBTest3x) { kFilterBilinear); } - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); RGBScale(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -264,14 +264,14 @@ TEST_F(LibYUVScaleTest, RGBTest4x) { kFilterBilinear); } - EXPECT_EQ(66, dest_pixels[0]); - EXPECT_EQ(190, dest_pixels[1]); + ASSERT_EQ(66, dest_pixels[0]); + ASSERT_EQ(190, dest_pixels[1]); RGBScale(orig_pixels, kSrcStride, 64, 4, dest_pixels, kDstStride, 16, 1, kFilterNone); - EXPECT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row - EXPECT_EQ(255 - 2, dest_pixels[1]); + ASSERT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row + ASSERT_EQ(255 - 2, dest_pixels[1]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index 299fd2381..750e340fa 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -856,7 +856,7 @@ static int NV12TestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, I444ScaleDownBy##name##_##filter) { \ int diff = I444TestFilter( \ @@ -864,7 +864,7 @@ static int NV12TestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I420ScaleDownBy##name##_##filter##_12) { \ int diff = I420TestFilter_12( \ @@ -872,7 +872,7 @@ static int NV12TestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I444ScaleDownBy##name##_##filter##_12) { \ int diff = I444TestFilter_12( \ @@ -880,7 +880,7 @@ static int NV12TestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, NV12ScaleDownBy##name##_##filter) { \ int diff = NV12TestFilter( \ @@ -888,7 +888,7 @@ static int NV12TestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } // Test a scale factor with all 4 filters. Expect unfiltered to be exact, but @@ -931,61 +931,61 @@ TEST_FACTOR(3, 1, 3, 0) int diff = I420TestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, I444##name##To##width##x##height##_##filter) { \ int diff = I444TestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I420##name##To##width##x##height##_##filter##_12) { \ int diff = I420TestFilter_12( \ benchmark_width_, benchmark_height_, width, height, kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I444##name##To##width##x##height##_##filter##_12) { \ int diff = I444TestFilter_12( \ benchmark_width_, benchmark_height_, width, height, kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I420##name##To##width##x##height##_##filter##_16) { \ int diff = I420TestFilter_16( \ benchmark_width_, benchmark_height_, width, height, kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I444##name##To##width##x##height##_##filter##_16) { \ int diff = I444TestFilter_16( \ benchmark_width_, benchmark_height_, width, height, kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, NV12##name##To##width##x##height##_##filter) { \ int diff = NV12TestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, I420##name##From##width##x##height##_##filter) { \ int diff = I420TestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, I444##name##From##width##x##height##_##filter) { \ int diff = I444TestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I420##name##From##width##x##height##_##filter##_12) { \ @@ -993,7 +993,7 @@ TEST_FACTOR(3, 1, 3, 0) Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I444##name##From##width##x##height##_##filter##_12) { \ @@ -1001,7 +1001,7 @@ TEST_FACTOR(3, 1, 3, 0) Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I420##name##From##width##x##height##_##filter##_16) { \ @@ -1009,7 +1009,7 @@ TEST_FACTOR(3, 1, 3, 0) Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, \ DISABLED_##I444##name##From##width##x##height##_##filter##_16) { \ @@ -1017,14 +1017,14 @@ TEST_FACTOR(3, 1, 3, 0) Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, NV12##name##From##width##x##height##_##filter) { \ int diff = NV12TestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #ifndef DISABLE_SLOW_TESTS @@ -1068,49 +1068,49 @@ TEST_SCALETO(Scale, 1080, 1920) // for rotated phones benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, I444##name##SwapXY_##filter) { \ int diff = I444TestFilter(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I420##name##SwapXY_##filter##_12) { \ int diff = I420TestFilter_12(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I444##name##SwapXY_##filter##_12) { \ int diff = I444TestFilter_12(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I420##name##SwapXY_##filter##_16) { \ int diff = I420TestFilter_16(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, DISABLED_##I444##name##SwapXY_##filter##_16) { \ int diff = I444TestFilter_16(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, NV12##name##SwapXY_##filter) { \ int diff = NV12TestFilter(benchmark_width_, benchmark_height_, \ benchmark_height_, benchmark_width_, \ kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } // Test scale to a specified size with all 4 filters. diff --git a/unit_test/scale_uv_test.cc b/unit_test/scale_uv_test.cc index dab217c97..df1e4c54c 100644 --- a/unit_test/scale_uv_test.cc +++ b/unit_test/scale_uv_test.cc @@ -101,7 +101,7 @@ static int UVTestFilter(int src_width, DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \ kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_EQ(0, diff); \ + ASSERT_EQ(0, diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -132,14 +132,14 @@ TEST_FACTOR(3, 1, 3) int diff = UVTestFilter(benchmark_width_, benchmark_height_, width, \ height, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } \ TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \ int diff = UVTestFilter(width, height, Abs(benchmark_width_), \ Abs(benchmark_height_), kFilter##filter, \ benchmark_iterations_, disable_cpu_flags_, \ benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -171,7 +171,7 @@ TEST_SCALETO(UVScale, 1920, 1080) UVTestFilter(benchmark_width_, benchmark_height_, benchmark_height_, \ benchmark_width_, kFilter##filter, benchmark_iterations_, \ disable_cpu_flags_, benchmark_cpu_info_); \ - EXPECT_LE(diff, max_diff); \ + ASSERT_LE(diff, max_diff); \ } #if defined(ENABLE_FULL_TESTS) @@ -202,14 +202,14 @@ TEST_F(LibYUVScaleTest, UVTest3x) { kFilterBilinear); } - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); UVScale(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1, kFilterNone); - EXPECT_EQ(225, dest_pixels[0]); - EXPECT_EQ(255 - 225, dest_pixels[1]); + ASSERT_EQ(225, dest_pixels[0]); + ASSERT_EQ(255 - 225, dest_pixels[1]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); @@ -233,14 +233,14 @@ TEST_F(LibYUVScaleTest, UVTest4x) { kFilterBilinear); } - EXPECT_EQ(66, dest_pixels[0]); - EXPECT_EQ(190, dest_pixels[1]); + ASSERT_EQ(66, dest_pixels[0]); + ASSERT_EQ(190, dest_pixels[1]); UVScale(orig_pixels, kSrcStride, 64, 4, dest_pixels, kDstStride, 16, 1, kFilterNone); - EXPECT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row - EXPECT_EQ(255 - 2, dest_pixels[1]); + ASSERT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row + ASSERT_EQ(255 - 2, dest_pixels[1]); free_aligned_buffer_page_end(dest_pixels); free_aligned_buffer_page_end(orig_pixels); diff --git a/unit_test/video_common_test.cc b/unit_test/video_common_test.cc index 36728ea90..9ff99faac 100644 --- a/unit_test/video_common_test.cc +++ b/unit_test/video_common_test.cc @@ -36,77 +36,77 @@ static bool TestValidFourCC(uint32_t fourcc, int bpp) { } TEST_F(LibYUVBaseTest, TestCanonicalFourCC) { - EXPECT_EQ(static_cast(FOURCC_I420), CanonicalFourCC(FOURCC_IYUV)); - EXPECT_EQ(static_cast(FOURCC_I420), CanonicalFourCC(FOURCC_YU12)); - EXPECT_EQ(static_cast(FOURCC_I422), CanonicalFourCC(FOURCC_YU16)); - EXPECT_EQ(static_cast(FOURCC_I444), CanonicalFourCC(FOURCC_YU24)); - EXPECT_EQ(static_cast(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUYV)); - EXPECT_EQ(static_cast(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUVS)); - EXPECT_EQ(static_cast(FOURCC_UYVY), CanonicalFourCC(FOURCC_HDYC)); - EXPECT_EQ(static_cast(FOURCC_UYVY), CanonicalFourCC(FOURCC_2VUY)); - EXPECT_EQ(static_cast(FOURCC_MJPG), CanonicalFourCC(FOURCC_JPEG)); - EXPECT_EQ(static_cast(FOURCC_MJPG), CanonicalFourCC(FOURCC_DMB1)); - EXPECT_EQ(static_cast(FOURCC_RAW), CanonicalFourCC(FOURCC_RGB3)); - EXPECT_EQ(static_cast(FOURCC_24BG), CanonicalFourCC(FOURCC_BGR3)); - EXPECT_EQ(static_cast(FOURCC_BGRA), CanonicalFourCC(FOURCC_CM32)); - EXPECT_EQ(static_cast(FOURCC_RAW), CanonicalFourCC(FOURCC_CM24)); - EXPECT_EQ(static_cast(FOURCC_RGBO), CanonicalFourCC(FOURCC_L555)); - EXPECT_EQ(static_cast(FOURCC_RGBP), CanonicalFourCC(FOURCC_L565)); - EXPECT_EQ(static_cast(FOURCC_RGBO), CanonicalFourCC(FOURCC_5551)); + ASSERT_EQ(static_cast(FOURCC_I420), CanonicalFourCC(FOURCC_IYUV)); + ASSERT_EQ(static_cast(FOURCC_I420), CanonicalFourCC(FOURCC_YU12)); + ASSERT_EQ(static_cast(FOURCC_I422), CanonicalFourCC(FOURCC_YU16)); + ASSERT_EQ(static_cast(FOURCC_I444), CanonicalFourCC(FOURCC_YU24)); + ASSERT_EQ(static_cast(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUYV)); + ASSERT_EQ(static_cast(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUVS)); + ASSERT_EQ(static_cast(FOURCC_UYVY), CanonicalFourCC(FOURCC_HDYC)); + ASSERT_EQ(static_cast(FOURCC_UYVY), CanonicalFourCC(FOURCC_2VUY)); + ASSERT_EQ(static_cast(FOURCC_MJPG), CanonicalFourCC(FOURCC_JPEG)); + ASSERT_EQ(static_cast(FOURCC_MJPG), CanonicalFourCC(FOURCC_DMB1)); + ASSERT_EQ(static_cast(FOURCC_RAW), CanonicalFourCC(FOURCC_RGB3)); + ASSERT_EQ(static_cast(FOURCC_24BG), CanonicalFourCC(FOURCC_BGR3)); + ASSERT_EQ(static_cast(FOURCC_BGRA), CanonicalFourCC(FOURCC_CM32)); + ASSERT_EQ(static_cast(FOURCC_RAW), CanonicalFourCC(FOURCC_CM24)); + ASSERT_EQ(static_cast(FOURCC_RGBO), CanonicalFourCC(FOURCC_L555)); + ASSERT_EQ(static_cast(FOURCC_RGBP), CanonicalFourCC(FOURCC_L565)); + ASSERT_EQ(static_cast(FOURCC_RGBO), CanonicalFourCC(FOURCC_5551)); } TEST_F(LibYUVBaseTest, TestFourCC) { - EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I422, FOURCC_BPP_I422)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I444, FOURCC_BPP_I444)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I400, FOURCC_BPP_I400)); - EXPECT_TRUE(TestValidFourCC(FOURCC_NV21, FOURCC_BPP_NV21)); - EXPECT_TRUE(TestValidFourCC(FOURCC_NV12, FOURCC_BPP_NV12)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YUY2, FOURCC_BPP_YUY2)); - EXPECT_TRUE(TestValidFourCC(FOURCC_UYVY, FOURCC_BPP_UYVY)); - EXPECT_TRUE(TestValidFourCC(FOURCC_M420, FOURCC_BPP_M420)); // deprecated. - EXPECT_TRUE(TestValidFourCC(FOURCC_Q420, FOURCC_BPP_Q420)); // deprecated. - EXPECT_TRUE(TestValidFourCC(FOURCC_ARGB, FOURCC_BPP_ARGB)); - EXPECT_TRUE(TestValidFourCC(FOURCC_BGRA, FOURCC_BPP_BGRA)); - EXPECT_TRUE(TestValidFourCC(FOURCC_ABGR, FOURCC_BPP_ABGR)); - EXPECT_TRUE(TestValidFourCC(FOURCC_AR30, FOURCC_BPP_AR30)); - EXPECT_TRUE(TestValidFourCC(FOURCC_AB30, FOURCC_BPP_AB30)); - EXPECT_TRUE(TestValidFourCC(FOURCC_AR64, FOURCC_BPP_AR64)); - EXPECT_TRUE(TestValidFourCC(FOURCC_AB64, FOURCC_BPP_AB64)); - EXPECT_TRUE(TestValidFourCC(FOURCC_24BG, FOURCC_BPP_24BG)); - EXPECT_TRUE(TestValidFourCC(FOURCC_RAW, FOURCC_BPP_RAW)); - EXPECT_TRUE(TestValidFourCC(FOURCC_RGBA, FOURCC_BPP_RGBA)); - EXPECT_TRUE(TestValidFourCC(FOURCC_RGBP, FOURCC_BPP_RGBP)); - EXPECT_TRUE(TestValidFourCC(FOURCC_RGBO, FOURCC_BPP_RGBO)); - EXPECT_TRUE(TestValidFourCC(FOURCC_R444, FOURCC_BPP_R444)); - EXPECT_TRUE(TestValidFourCC(FOURCC_H420, FOURCC_BPP_H420)); - EXPECT_TRUE(TestValidFourCC(FOURCC_H422, FOURCC_BPP_H422)); - EXPECT_TRUE(TestValidFourCC(FOURCC_H010, FOURCC_BPP_H010)); - EXPECT_TRUE(TestValidFourCC(FOURCC_H210, FOURCC_BPP_H210)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I010, FOURCC_BPP_I010)); - EXPECT_TRUE(TestValidFourCC(FOURCC_I210, FOURCC_BPP_I210)); - EXPECT_TRUE(TestValidFourCC(FOURCC_P010, FOURCC_BPP_P010)); - EXPECT_TRUE(TestValidFourCC(FOURCC_P210, FOURCC_BPP_P210)); - EXPECT_TRUE(TestValidFourCC(FOURCC_MJPG, FOURCC_BPP_MJPG)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YV12, FOURCC_BPP_YV12)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YV16, FOURCC_BPP_YV16)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YV24, FOURCC_BPP_YV24)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YU12, FOURCC_BPP_YU12)); - EXPECT_TRUE(TestValidFourCC(FOURCC_IYUV, FOURCC_BPP_IYUV)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YU16, FOURCC_BPP_YU16)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YU24, FOURCC_BPP_YU24)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YUYV, FOURCC_BPP_YUYV)); - EXPECT_TRUE(TestValidFourCC(FOURCC_YUVS, FOURCC_BPP_YUVS)); - EXPECT_TRUE(TestValidFourCC(FOURCC_HDYC, FOURCC_BPP_HDYC)); - EXPECT_TRUE(TestValidFourCC(FOURCC_2VUY, FOURCC_BPP_2VUY)); - EXPECT_TRUE(TestValidFourCC(FOURCC_JPEG, FOURCC_BPP_JPEG)); - EXPECT_TRUE(TestValidFourCC(FOURCC_DMB1, FOURCC_BPP_DMB1)); - EXPECT_TRUE(TestValidFourCC(FOURCC_BA81, FOURCC_BPP_BA81)); - EXPECT_TRUE(TestValidFourCC(FOURCC_RGB3, FOURCC_BPP_RGB3)); - EXPECT_TRUE(TestValidFourCC(FOURCC_BGR3, FOURCC_BPP_BGR3)); - EXPECT_TRUE(TestValidFourCC(FOURCC_H264, FOURCC_BPP_H264)); - EXPECT_TRUE(TestValidFourCC(FOURCC_ANY, FOURCC_BPP_ANY)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I422, FOURCC_BPP_I422)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I444, FOURCC_BPP_I444)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I400, FOURCC_BPP_I400)); + ASSERT_TRUE(TestValidFourCC(FOURCC_NV21, FOURCC_BPP_NV21)); + ASSERT_TRUE(TestValidFourCC(FOURCC_NV12, FOURCC_BPP_NV12)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YUY2, FOURCC_BPP_YUY2)); + ASSERT_TRUE(TestValidFourCC(FOURCC_UYVY, FOURCC_BPP_UYVY)); + ASSERT_TRUE(TestValidFourCC(FOURCC_M420, FOURCC_BPP_M420)); // deprecated. + ASSERT_TRUE(TestValidFourCC(FOURCC_Q420, FOURCC_BPP_Q420)); // deprecated. + ASSERT_TRUE(TestValidFourCC(FOURCC_ARGB, FOURCC_BPP_ARGB)); + ASSERT_TRUE(TestValidFourCC(FOURCC_BGRA, FOURCC_BPP_BGRA)); + ASSERT_TRUE(TestValidFourCC(FOURCC_ABGR, FOURCC_BPP_ABGR)); + ASSERT_TRUE(TestValidFourCC(FOURCC_AR30, FOURCC_BPP_AR30)); + ASSERT_TRUE(TestValidFourCC(FOURCC_AB30, FOURCC_BPP_AB30)); + ASSERT_TRUE(TestValidFourCC(FOURCC_AR64, FOURCC_BPP_AR64)); + ASSERT_TRUE(TestValidFourCC(FOURCC_AB64, FOURCC_BPP_AB64)); + ASSERT_TRUE(TestValidFourCC(FOURCC_24BG, FOURCC_BPP_24BG)); + ASSERT_TRUE(TestValidFourCC(FOURCC_RAW, FOURCC_BPP_RAW)); + ASSERT_TRUE(TestValidFourCC(FOURCC_RGBA, FOURCC_BPP_RGBA)); + ASSERT_TRUE(TestValidFourCC(FOURCC_RGBP, FOURCC_BPP_RGBP)); + ASSERT_TRUE(TestValidFourCC(FOURCC_RGBO, FOURCC_BPP_RGBO)); + ASSERT_TRUE(TestValidFourCC(FOURCC_R444, FOURCC_BPP_R444)); + ASSERT_TRUE(TestValidFourCC(FOURCC_H420, FOURCC_BPP_H420)); + ASSERT_TRUE(TestValidFourCC(FOURCC_H422, FOURCC_BPP_H422)); + ASSERT_TRUE(TestValidFourCC(FOURCC_H010, FOURCC_BPP_H010)); + ASSERT_TRUE(TestValidFourCC(FOURCC_H210, FOURCC_BPP_H210)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I010, FOURCC_BPP_I010)); + ASSERT_TRUE(TestValidFourCC(FOURCC_I210, FOURCC_BPP_I210)); + ASSERT_TRUE(TestValidFourCC(FOURCC_P010, FOURCC_BPP_P010)); + ASSERT_TRUE(TestValidFourCC(FOURCC_P210, FOURCC_BPP_P210)); + ASSERT_TRUE(TestValidFourCC(FOURCC_MJPG, FOURCC_BPP_MJPG)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YV12, FOURCC_BPP_YV12)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YV16, FOURCC_BPP_YV16)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YV24, FOURCC_BPP_YV24)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YU12, FOURCC_BPP_YU12)); + ASSERT_TRUE(TestValidFourCC(FOURCC_IYUV, FOURCC_BPP_IYUV)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YU16, FOURCC_BPP_YU16)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YU24, FOURCC_BPP_YU24)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YUYV, FOURCC_BPP_YUYV)); + ASSERT_TRUE(TestValidFourCC(FOURCC_YUVS, FOURCC_BPP_YUVS)); + ASSERT_TRUE(TestValidFourCC(FOURCC_HDYC, FOURCC_BPP_HDYC)); + ASSERT_TRUE(TestValidFourCC(FOURCC_2VUY, FOURCC_BPP_2VUY)); + ASSERT_TRUE(TestValidFourCC(FOURCC_JPEG, FOURCC_BPP_JPEG)); + ASSERT_TRUE(TestValidFourCC(FOURCC_DMB1, FOURCC_BPP_DMB1)); + ASSERT_TRUE(TestValidFourCC(FOURCC_BA81, FOURCC_BPP_BA81)); + ASSERT_TRUE(TestValidFourCC(FOURCC_RGB3, FOURCC_BPP_RGB3)); + ASSERT_TRUE(TestValidFourCC(FOURCC_BGR3, FOURCC_BPP_BGR3)); + ASSERT_TRUE(TestValidFourCC(FOURCC_H264, FOURCC_BPP_H264)); + ASSERT_TRUE(TestValidFourCC(FOURCC_ANY, FOURCC_BPP_ANY)); } } // namespace libyuv