From b5bc15305b6e8a5d5824b41566e58c1e3dde3dfb Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 23 Oct 2014 15:01:50 +0200 Subject: [PATCH] dec_neon: DC4: use pair-wise adds for top row reduces load count, slightly faster Change-Id: I880340ef8ef75ce4ce321c330f56f86b758bda08 --- src/dsp/dec_neon.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/dsp/dec_neon.c b/src/dsp/dec_neon.c index 94b76853..4064080f 100644 --- a/src/dsp/dec_neon.c +++ b/src/dsp/dec_neon.c @@ -1262,21 +1262,17 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { // 4x4 static void DC4(uint8_t* dst) { // DC - const uint16x8_t A0 = vmovl_u8(vld1_u8(dst - BPS + 0)); - const uint16x8_t A1 = vmovl_u8(vld1_u8(dst - BPS + 1)); - const uint16x8_t A2 = vmovl_u8(vld1_u8(dst - BPS + 2)); - const uint16x8_t A3 = vmovl_u8(vld1_u8(dst - BPS + 3)); + const uint8x8_t A = vld1_u8(dst - BPS); // top row + const uint16x4_t p0 = vpaddl_u8(A); // cascading summation of the top + const uint16x4_t p1 = vpadd_u16(p0, p0); const uint16x8_t L0 = vmovl_u8(vld1_u8(dst + 0 * BPS - 1)); const uint16x8_t L1 = vmovl_u8(vld1_u8(dst + 1 * BPS - 1)); const uint16x8_t L2 = vmovl_u8(vld1_u8(dst + 2 * BPS - 1)); const uint16x8_t L3 = vmovl_u8(vld1_u8(dst + 3 * BPS - 1)); - const uint16x8_t s0 = vaddq_u16(A0, L0); - const uint16x8_t s1 = vaddq_u16(A1, L1); - const uint16x8_t s2 = vaddq_u16(A2, L2); - const uint16x8_t s3 = vaddq_u16(A3, L3); + const uint16x8_t s0 = vaddq_u16(L0, L1); + const uint16x8_t s1 = vaddq_u16(L2, L3); const uint16x8_t s01 = vaddq_u16(s0, s1); - const uint16x8_t s23 = vaddq_u16(s2, s3); - const uint16x8_t sum = vaddq_u16(s01, s23); + const uint16x8_t sum = vaddq_u16(s01, vcombine_u16(p1, p1)); const uint8x8_t dc0 = vrshrn_n_u16(sum, 3); // (sum + 4) >> 3 const uint8x8_t dc = vdup_lane_u8(dc0, 0); int i;