History

avcodec/ac3: Implement sum_square_butterfly_int32 for aarch64 NEON

Geoff Hill committed 2 years ago

Commit 42e88f11 parent 69cb34f3 files · +55 −0Browse files

Unified · Split

3 files
  1. libavcodec/aarch64/ac3dsp_init_aarch64.c +5 −0
  2. libavcodec/aarch64/ac3dsp_neon.S +23 −0
  3. tests/checkasm/ac3dsp.c +27 −0
libavcodec/aarch64/ac3dsp_init_aarch64.c+5−0
@@ -28,6 +28,10 @@ · 27 unmodified lines
2828 void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
2929 void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
3030 void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
31+void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
32+ const int32_t *coef0,
33+ const int32_t *coef1,
34+ int len);
3135
3236 av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
3337 {
@@ -37,4 +41,5 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) · 3 unmodified lines
3741 c->ac3_exponent_min = ff_ac3_exponent_min_neon;
3842 c->extract_exponents = ff_ac3_extract_exponents_neon;
3943 c->float_to_fixed24 = ff_float_to_fixed24_neon;
44+ c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon;
4045 }
libavcodec/aarch64/ac3dsp_neon.S+23−0
@@ -64,3 +64,26 @@ function ff_float_to_fixed24_neon, export=1 · 63 unmodified lines
6464 b.ne 1b
6565 ret
6666 endfunc
67+
68+function ff_ac3_sum_square_butterfly_int32_neon, export=1
69+ movi v0.2d, #0
70+ movi v1.2d, #0
71+ movi v2.2d, #0
72+ movi v3.2d, #0
73+1: ld1 {v4.2s}, [x1], #8
74+ ld1 {v5.2s}, [x2], #8
75+ add v6.2s, v4.2s, v5.2s
76+ sub v7.2s, v4.2s, v5.2s
77+ smlal v0.2d, v4.2s, v4.2s
78+ smlal v1.2d, v5.2s, v5.2s
79+ smlal v2.2d, v6.2s, v6.2s
80+ smlal v3.2d, v7.2s, v7.2s
81+ subs w3, w3, #2
82+ b.gt 1b
83+ addp d0, v0.2d
84+ addp d1, v1.2d
85+ addp d2, v2.2d
86+ addp d3, v3.2d
87+ st1 {v0.1d-v3.1d}, [x0]
88+ ret
89+endfunc
tests/checkasm/ac3dsp.c+27−0
@@ -139,6 +139,32 @@ static void check_float_to_fixed24(AC3DSPContext *c) { · 138 unmodified lines
139139 report("float_to_fixed24");
140140 }
141141
142+static void check_ac3_sum_square_butterfly_int32(AC3DSPContext *c) {
143+#define ELEMS 240
144+ LOCAL_ALIGNED_16(int32_t, lt, [ELEMS]);
145+ LOCAL_ALIGNED_16(int32_t, rt, [ELEMS]);
146+ LOCAL_ALIGNED_16(uint64_t, v1, [4]);
147+ LOCAL_ALIGNED_16(uint64_t, v2, [4]);
148+
149+ declare_func(void, int64_t[4], const int32_t *, const int32_t *, int);
150+
151+ randomize_i24(lt, ELEMS);
152+ randomize_i24(rt, ELEMS);
153+
154+ if (check_func(c->sum_square_butterfly_int32,
155+ "ac3_sum_square_bufferfly_int32")) {
156+ call_ref(v1, lt, rt, ELEMS);
157+ call_new(v2, lt, rt, ELEMS);
158+
159+ if (memcmp(v1, v2, sizeof(int64_t[4])) != 0)
160+ fail();
161+
162+ bench_new(v2, lt, rt, ELEMS);
163+ }
164+
165+ report("ac3_sum_square_butterfly_int32");
166+}
167+
142168 void checkasm_check_ac3dsp(void)
143169 {
144170 AC3DSPContext c;
@@ -147,4 +173,5 @@ void checkasm_check_ac3dsp(void) · 2 unmodified lines
147173 check_ac3_exponent_min(&c);
148174 check_ac3_extract_exponents(&c);
149175 check_float_to_fixed24(&c);
176+ check_ac3_sum_square_butterfly_int32(&c);
150177 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t