diff mbox series

[FFmpeg-devel,2/2] tests/checkasm: add overflow test for hevc_add_res

Message ID 1583765728-27680-1-git-send-email-linjie.fu@intel.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] checkasm/hevc_add_res: prepare test data only if the fuction is not tested
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork fail Make fate failed

Commit Message

Fu, Linjie March 9, 2020, 2:55 p.m. UTC
Add overflow test for hevc_add_res when int16_t coeff = -32768.

The result of C is good, while ASM is not.

To verify:
    make fate-checkasm-hevc_add_res
    ffmpeg/tests/checkasm/checkasm --test=hevc_add_res

./checkasm --test=hevc_add_res
checkasm: using random seed 679391863
MMXEXT:
    hevc_add_res_4x4_8_mmxext (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
SSE2:
    hevc_add_res_8x8_8_sse2 (hevc_add_res.c:69)
    hevc_add_res_16x16_8_sse2 (hevc_add_res.c:69)
    hevc_add_res_32x32_8_sse2 (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
AVX:
    hevc_add_res_8x8_8_avx (hevc_add_res.c:69)
    hevc_add_res_16x16_8_avx (hevc_add_res.c:69)
    hevc_add_res_32x32_8_avx (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
AVX2:
    hevc_add_res_32x32_8_avx2 (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
checkasm: 8 of 14 tests have failed

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
[v2/v3]: test 2x cases to make sure enough random residuals

Should be applied after the 3 fixing patch, otherwise this
would break fate.
[1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394457-21484-1-git-send-email-linjie.fu@intel.com/
[2] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394474-21605-1-git-send-email-linjie.fu@intel.com/
[3] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394489-21717-1-git-send-email-linjie.fu@intel.com/

 tests/checkasm/hevc_add_res.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Fu, Linjie March 18, 2020, 9:05 a.m. UTC | #1
> From: Fu, Linjie <linjie.fu@intel.com>
> Sent: Monday, March 9, 2020 22:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie <linjie.fu@intel.com>; Xu, Guangxin <guangxin.xu@intel.com>
> Subject: [PATCH 2/2] tests/checkasm: add overflow test for hevc_add_res
> 
> Add overflow test for hevc_add_res when int16_t coeff = -32768.
> 
> The result of C is good, while ASM is not.
> 
> To verify:
>     make fate-checkasm-hevc_add_res
>     ffmpeg/tests/checkasm/checkasm --test=hevc_add_res
> 
> ./checkasm --test=hevc_add_res
> checkasm: using random seed 679391863
> MMXEXT:
>     hevc_add_res_4x4_8_mmxext (hevc_add_res.c:69)
>   - hevc_add_res.add_residual [FAILED]
> SSE2:
>     hevc_add_res_8x8_8_sse2 (hevc_add_res.c:69)
>     hevc_add_res_16x16_8_sse2 (hevc_add_res.c:69)
>     hevc_add_res_32x32_8_sse2 (hevc_add_res.c:69)
>   - hevc_add_res.add_residual [FAILED]
> AVX:
>     hevc_add_res_8x8_8_avx (hevc_add_res.c:69)
>     hevc_add_res_16x16_8_avx (hevc_add_res.c:69)
>     hevc_add_res_32x32_8_avx (hevc_add_res.c:69)
>   - hevc_add_res.add_residual [FAILED]
> AVX2:
>     hevc_add_res_32x32_8_avx2 (hevc_add_res.c:69)
>   - hevc_add_res.add_residual [FAILED]
> checkasm: 8 of 14 tests have failed
> 
> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
> [v2/v3]: test 2x cases to make sure enough random residuals
> 
> Should be applied after the 3 fixing patch, otherwise this
> would break fate.
> [1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394457-21484-
> 1-git-send-email-linjie.fu@intel.com/
> [2] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394474-21605-
> 1-git-send-email-linjie.fu@intel.com/
> [3] https://patchwork.ffmpeg.org/project/ffmpeg/patch/1583394489-21717-
> 1-git-send-email-linjie.fu@intel.com/
> 
>  tests/checkasm/hevc_add_res.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/checkasm/hevc_add_res.c
> b/tests/checkasm/hevc_add_res.c
> index a68d574..0a3bcbb 100644
> --- a/tests/checkasm/hevc_add_res.c
> +++ b/tests/checkasm/hevc_add_res.c
> @@ -42,7 +42,7 @@
>              AV_WN16A(buf + j * 2, rnd() & 0x3FF); \
>      } while (0)
> 
> -static void compare_add_res(int size, ptrdiff_t stride)
> +static void compare_add_res(int size, ptrdiff_t stride, int overflow_test)
>  {
>      LOCAL_ALIGNED_32(int16_t, res0, [32 * 32]);
>      LOCAL_ALIGNED_32(int16_t, res1, [32 * 32]);
> @@ -53,6 +53,8 @@ static void compare_add_res(int size, ptrdiff_t stride)
> 
>      randomize_buffers(res0, size);
>      randomize_buffers2(dst0, size);
> +    if (overflow_test)
> +        res0[0] = 0x8000;
>      memcpy(res1, res0, sizeof(*res0) * size);
>      memcpy(dst1, dst0, sizeof(int16_t) * size);
> 
> @@ -73,7 +75,9 @@ static void check_add_res(HEVCDSPContext h, int
> bit_depth)
>          ptrdiff_t stride = block_size << (bit_depth > 8);
> 
>          if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d",
> block_size, block_size, bit_depth)) {
> -            compare_add_res(size, stride);
> +            compare_add_res(size, stride, 0);
> +            // overflow test for res = -32768
> +            compare_add_res(size, stride, 1);
>          }
>      }
>  }
> --
Ping for the patch set, thanks.

- Linjie
diff mbox series

Patch

diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c
index a68d574..0a3bcbb 100644
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@ -42,7 +42,7 @@ 
             AV_WN16A(buf + j * 2, rnd() & 0x3FF); \
     } while (0)
 
-static void compare_add_res(int size, ptrdiff_t stride)
+static void compare_add_res(int size, ptrdiff_t stride, int overflow_test)
 {
     LOCAL_ALIGNED_32(int16_t, res0, [32 * 32]);
     LOCAL_ALIGNED_32(int16_t, res1, [32 * 32]);
@@ -53,6 +53,8 @@  static void compare_add_res(int size, ptrdiff_t stride)
 
     randomize_buffers(res0, size);
     randomize_buffers2(dst0, size);
+    if (overflow_test)
+        res0[0] = 0x8000;
     memcpy(res1, res0, sizeof(*res0) * size);
     memcpy(dst1, dst0, sizeof(int16_t) * size);
 
@@ -73,7 +75,9 @@  static void check_add_res(HEVCDSPContext h, int bit_depth)
         ptrdiff_t stride = block_size << (bit_depth > 8);
 
         if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", block_size, block_size, bit_depth)) {
-            compare_add_res(size, stride);
+            compare_add_res(size, stride, 0);
+            // overflow test for res = -32768
+            compare_add_res(size, stride, 1);
         }
     }
 }