diff options
author | Geoff Hill <geoff@geoffhill.org> | 2024-04-06 07:26:01 -0700 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2024-04-08 13:36:40 +0300 |
commit | 69cb34f8859ed62fd1c46d3612912a334542fe28 (patch) | |
tree | 18c68304f42d58cd17d400c7ce94326ef1d958d9 /tests | |
parent | 6f6bd10531e439de67d1354c5fc6f78cc031c66b (diff) | |
download | ffmpeg-69cb34f8859ed62fd1c46d3612912a334542fe28.tar.gz |
avcodec/ac3: Implement ac3_extract_exponents for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkasm/ac3dsp.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c index 06f31339f9..dc1b169e68 100644 --- a/tests/checkasm/ac3dsp.c +++ b/tests/checkasm/ac3dsp.c @@ -19,6 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <stdint.h> #include <string.h> #include "libavutil/mem.h" @@ -36,6 +37,16 @@ } \ } while (0) +#define randomize_i24(buf, len) \ + do { \ + int i; \ + for (i = 0; i < len; i++) { \ + int32_t v = (int32_t)rnd(); \ + int32_t u = (v & 0xFFFFFF); \ + buf[i] = (v < 0) ? -u : u; \ + } \ + } while (0) + #define randomize_float(buf, len) \ do { \ int i; \ @@ -77,6 +88,32 @@ static void check_ac3_exponent_min(AC3DSPContext *c) { report("ac3_exponent_min"); } +static void check_ac3_extract_exponents(AC3DSPContext *c) { +#define MAX_EXPS 3072 + LOCAL_ALIGNED_16(int32_t, src, [MAX_EXPS]); + LOCAL_ALIGNED_16(uint8_t, v1, [MAX_EXPS]); + LOCAL_ALIGNED_16(uint8_t, v2, [MAX_EXPS]); + int n; + + declare_func(void, uint8_t *, int32_t *, int); + + for (n = 512; n <= MAX_EXPS; n += 256) { + if (check_func(c->extract_exponents, "ac3_extract_exponents_n%d", n)) { + randomize_i24(src, n); + + call_ref(v1, src, n); + call_new(v2, src, n); + + if (memcmp(v1, v2, n) != 0) + fail(); + + bench_new(v1, src, n); + } + } + + report("ac3_extract_exponents"); +} + static void check_float_to_fixed24(AC3DSPContext *c) { #define BUF_SIZE 1024 LOCAL_ALIGNED_32(float, src, [BUF_SIZE]); @@ -108,5 +145,6 @@ void checkasm_check_ac3dsp(void) ff_ac3dsp_init(&c); check_ac3_exponent_min(&c); + check_ac3_extract_exponents(&c); check_float_to_fixed24(&c); } |