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
28void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs);28void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
29void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);29void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
30void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);30void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
31void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
32 const int32_t *coef0,
33 const int32_t *coef1,
34 int len);
31 35
32av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)36av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
33{37{
@@ -37,4 +41,5 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) · 3 unmodified lines
37 c->ac3_exponent_min = ff_ac3_exponent_min_neon;41 c->ac3_exponent_min = ff_ac3_exponent_min_neon;
38 c->extract_exponents = ff_ac3_extract_exponents_neon;42 c->extract_exponents = ff_ac3_extract_exponents_neon;
39 c->float_to_fixed24 = ff_float_to_fixed24_neon;43 c->float_to_fixed24 = ff_float_to_fixed24_neon;
44 c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon;
40}45}
libavcodec/aarch64/ac3dsp_neon.S+23−0
@@ -64,3 +64,26 @@ function ff_float_to_fixed24_neon, export=1 · 63 unmodified lines
64 b.ne 1b64 b.ne 1b
65 ret65 ret
66endfunc66endfunc
67
68function 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
731: 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
89endfunc
tests/checkasm/ac3dsp.c+27−0
@@ -139,6 +139,32 @@ static void check_float_to_fixed24(AC3DSPContext *c) { · 138 unmodified lines
139 report("float_to_fixed24");139 report("float_to_fixed24");
140}140}
141 141
142static 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
142void checkasm_check_ac3dsp(void)168void checkasm_check_ac3dsp(void)
143{169{
144 AC3DSPContext c;170 AC3DSPContext c;
@@ -147,4 +173,5 @@ void checkasm_check_ac3dsp(void) · 2 unmodified lines
147 check_ac3_exponent_min(&c);173 check_ac3_exponent_min(&c);
148 check_ac3_extract_exponents(&c);174 check_ac3_extract_exponents(&c);
149 check_float_to_fixed24(&c);175 check_float_to_fixed24(&c);
176 check_ac3_sum_square_butterfly_int32(&c);
150}177}

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