History

neon hadamard 16x16

Runs about twice as fast as C BUG=webm:1027

Johann committed 10 years ago

Commit c516dd61 parent 63eb2ee3 files · +45 −1Browse files

Unified · Split

3 files
  1. test/hadamard_test.cc +5 −0
  2. vpx_dsp/arm/hadamard_neon.c +39 −0
  3. vpx_dsp/vpx_dsp_rtcd_defs.pl +1 −1
test/hadamard_test.cc+5−0
@@ -212,4 +212,9 @@ INSTANTIATE_TEST_CASE_P(C, Hadamard16x16Test, · 211 unmodified lines
212212 INSTANTIATE_TEST_CASE_P(SSE2, Hadamard16x16Test,
213213 ::testing::Values(&vpx_hadamard_16x16_sse2));
214214 #endif // HAVE_SSE2
215+
216+#if HAVE_NEON
217+INSTANTIATE_TEST_CASE_P(NEON, Hadamard16x16Test,
218+ ::testing::Values(&vpx_hadamard_16x16_neon));
219+#endif // HAVE_NEON
215220 } // namespace
vpx_dsp/arm/hadamard_neon.c+39−0
@@ -160,3 +160,42 @@ void vpx_hadamard_8x8_neon(const int16_t *src_diff, int src_stride, · 159 unmodified lines
160160 vst1q_s16(coeff + 48, a6);
161161 vst1q_s16(coeff + 56, a7);
162162 }
163+
164+void vpx_hadamard_16x16_neon(const int16_t *src_diff, int src_stride,
165+ int16_t *coeff) {
166+ int i;
167+
168+ /* Rearrange 16x16 to 8x32 and remove stride.
169+ * Top left first. */
170+ vpx_hadamard_8x8_neon(src_diff + 0 + 0 * src_stride, src_stride, coeff + 0);
171+ /* Top right. */
172+ vpx_hadamard_8x8_neon(src_diff + 8 + 0 * src_stride, src_stride, coeff + 64);
173+ /* Bottom left. */
174+ vpx_hadamard_8x8_neon(src_diff + 0 + 8 * src_stride, src_stride, coeff + 128);
175+ /* Bottom right. */
176+ vpx_hadamard_8x8_neon(src_diff + 8 + 8 * src_stride, src_stride, coeff + 192);
177+
178+ for (i = 0; i < 64; i += 8) {
179+ const int16x8_t a0 = vld1q_s16(coeff + 0);
180+ const int16x8_t a1 = vld1q_s16(coeff + 64);
181+ const int16x8_t a2 = vld1q_s16(coeff + 128);
182+ const int16x8_t a3 = vld1q_s16(coeff + 192);
183+
184+ const int16x8_t b0 = vhaddq_s16(a0, a1);
185+ const int16x8_t b1 = vhsubq_s16(a0, a1);
186+ const int16x8_t b2 = vhaddq_s16(a2, a3);
187+ const int16x8_t b3 = vhsubq_s16(a2, a3);
188+
189+ const int16x8_t c0 = vaddq_s16(b0, b2);
190+ const int16x8_t c1 = vaddq_s16(b1, b3);
191+ const int16x8_t c2 = vsubq_s16(b0, b2);
192+ const int16x8_t c3 = vsubq_s16(b1, b3);
193+
194+ vst1q_s16(coeff + 0, c0);
195+ vst1q_s16(coeff + 64, c1);
196+ vst1q_s16(coeff + 128, c2);
197+ vst1q_s16(coeff + 192, c3);
198+
199+ coeff += 8;
200+ }
201+}
vpx_dsp/vpx_dsp_rtcd_defs.pl+1−1
@@ -1020,7 +1020,7 @@ if ((vpx_config("CONFIG_VP9_ENCODER") eq "yes") || (vpx_config("CONFIG_VP10_ENCO · 1019 unmodified lines
10201020 specialize qw/vpx_hadamard_8x8 sse2 neon/, "$ssse3_x86_64_x86inc";
10211021
10221022 add_proto qw/void vpx_hadamard_16x16/, "const int16_t *src_diff, int src_stride, int16_t *coeff";
1023− specialize qw/vpx_hadamard_16x16 sse2/;
1023+ specialize qw/vpx_hadamard_16x16 sse2 neon/;
10241024
10251025 add_proto qw/int vpx_satd/, "const int16_t *coeff, int length";
10261026 specialize qw/vpx_satd sse2 neon/;

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