From d2de1ca37b630e691d64401b4a4d74d862981dc9 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 24 Jul 2013 16:33:57 -0700 Subject: [PATCH] Merge vp9_dc_only_idct_add and vp9_short_idct4x4_1 They share the same functionality, so merging together. Change-Id: I98a0386fcee052cb854f9ff90c283c1b844bcb79 --- vp9/common/vp9_idct.c | 17 -------- vp9/common/vp9_rtcd_defs.sh | 3 -- vp9/common/x86/vp9_idct_intrin_sse2.c | 58 --------------------------- vp9/decoder/vp9_idct_blk.c | 2 +- 4 files changed, 1 insertion(+), 79 deletions(-) diff --git a/vp9/common/vp9_idct.c b/vp9/common/vp9_idct.c index 3103be214..a95560a55 100644 --- a/vp9/common/vp9_idct.c +++ b/vp9/common/vp9_idct.c @@ -156,23 +156,6 @@ void vp9_short_idct4x4_1_add_c(int16_t *input, uint8_t *dest, int dest_stride) { } } -void vp9_dc_only_idct_add_c(int input_dc, uint8_t *pred_ptr, - uint8_t *dst_ptr, int pitch, int stride) { - int a1; - int r, c; - int16_t out = dct_const_round_shift(input_dc * cospi_16_64); - out = dct_const_round_shift(out * cospi_16_64); - a1 = ROUND_POWER_OF_TWO(out, 4); - - for (r = 0; r < 4; r++) { - for (c = 0; c < 4; c++) - dst_ptr[c] = clip_pixel(a1 + pred_ptr[c]); - - dst_ptr += stride; - pred_ptr += pitch; - } -} - static void idct8_1d(int16_t *input, int16_t *output) { int16_t step1[8], step2[8]; int temp1, temp2; diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh index 2a9e62d0f..f1789fb74 100644 --- a/vp9/common/vp9_rtcd_defs.sh +++ b/vp9/common/vp9_rtcd_defs.sh @@ -337,9 +337,6 @@ prototype void vp9_idct4_1d "int16_t *input, int16_t *output" specialize vp9_idct4_1d sse2 # dct and add -prototype void vp9_dc_only_idct_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride" -specialize vp9_dc_only_idct_add sse2 neon - prototype void vp9_short_iwalsh4x4_1_add "int16_t *input, uint8_t *dest, int dest_stride" specialize vp9_short_iwalsh4x4_1_add diff --git a/vp9/common/x86/vp9_idct_intrin_sse2.c b/vp9/common/x86/vp9_idct_intrin_sse2.c index c380d4216..b4766df5b 100644 --- a/vp9/common/x86/vp9_idct_intrin_sse2.c +++ b/vp9/common/x86/vp9_idct_intrin_sse2.c @@ -15,64 +15,6 @@ #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_idct.h" -// In order to improve performance, clip absolute diff values to [0, 255], -// which allows to keep the additions/subtractions in 8 bits. -void vp9_dc_only_idct_add_sse2(int input_dc, uint8_t *pred_ptr, - uint8_t *dst_ptr, int pitch, int stride) { - int a1; - int16_t out; - uint8_t abs_diff; - __m128i p0, p1, p2, p3; - unsigned int extended_diff; - __m128i diff; - - out = dct_const_round_shift(input_dc * cospi_16_64); - out = dct_const_round_shift(out * cospi_16_64); - a1 = ROUND_POWER_OF_TWO(out, 4); - - // Read prediction data. - p0 = _mm_cvtsi32_si128 (*(const int *)(pred_ptr + 0 * pitch)); - p1 = _mm_cvtsi32_si128 (*(const int *)(pred_ptr + 1 * pitch)); - p2 = _mm_cvtsi32_si128 (*(const int *)(pred_ptr + 2 * pitch)); - p3 = _mm_cvtsi32_si128 (*(const int *)(pred_ptr + 3 * pitch)); - - // Unpack prediction data, and store 4x4 array in 1 XMM register. - p0 = _mm_unpacklo_epi32(p0, p1); - p2 = _mm_unpacklo_epi32(p2, p3); - p0 = _mm_unpacklo_epi64(p0, p2); - - // Clip dc value to [0, 255] range. Then, do addition or subtraction - // according to its sign. - if (a1 >= 0) { - abs_diff = (a1 > 255) ? 255 : a1; - extended_diff = abs_diff * 0x01010101u; - diff = _mm_shuffle_epi32(_mm_cvtsi32_si128((int)extended_diff), 0); - - p1 = _mm_adds_epu8(p0, diff); - } else { - abs_diff = (a1 < -255) ? 255 : -a1; - extended_diff = abs_diff * 0x01010101u; - diff = _mm_shuffle_epi32(_mm_cvtsi32_si128((int)extended_diff), 0); - - p1 = _mm_subs_epu8(p0, diff); - } - - // Store results to dst. - *(int *)dst_ptr = _mm_cvtsi128_si32(p1); - dst_ptr += stride; - - p1 = _mm_srli_si128(p1, 4); - *(int *)dst_ptr = _mm_cvtsi128_si32(p1); - dst_ptr += stride; - - p1 = _mm_srli_si128(p1, 4); - *(int *)dst_ptr = _mm_cvtsi128_si32(p1); - dst_ptr += stride; - - p1 = _mm_srli_si128(p1, 4); - *(int *)dst_ptr = _mm_cvtsi128_si32(p1); -} - void vp9_short_idct4x4_add_sse2(int16_t *input, uint8_t *dest, int stride) { const __m128i zero = _mm_setzero_si128(); const __m128i eight = _mm_set1_epi16(8); diff --git a/vp9/decoder/vp9_idct_blk.c b/vp9/decoder/vp9_idct_blk.c index c52963c49..0217919da 100644 --- a/vp9/decoder/vp9_idct_blk.c +++ b/vp9/decoder/vp9_idct_blk.c @@ -66,7 +66,7 @@ void vp9_idct_add_c(int16_t *input, uint8_t *dest, int stride, int eob) { vp9_short_idct4x4_add(input, dest, stride); vpx_memset(input, 0, 32); } else { - vp9_dc_only_idct_add(input[0], dest, dest, stride, stride); + vp9_short_idct4x4_1_add(input, dest, stride); ((int *)input)[0] = 0; } } -- 2.40.0