summaryrefslogtreecommitdiff
path: root/vp9/decoder
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2013-03-07 15:29:27 -0800
committerYunqing Wang <yunqingwang@google.com>2013-03-07 15:29:27 -0800
commitb339aea67520ea2dd90cedd9e626b4446824ee4f (patch)
treeb867b4c53885728fad2e0c61f078a17277827b2a /vp9/decoder
parent3162371544da4bfd956951ca43422d3d8c2ca195 (diff)
downloadlibvpx-b339aea67520ea2dd90cedd9e626b4446824ee4f.tar
libvpx-b339aea67520ea2dd90cedd9e626b4446824ee4f.tar.gz
libvpx-b339aea67520ea2dd90cedd9e626b4446824ee4f.tar.bz2
libvpx-b339aea67520ea2dd90cedd9e626b4446824ee4f.zip
Allocate 16-byte aligned diff buffer
This was done based on John's suggestion. Change-Id: I62516a513c31fe3dbea0d6cd063df79d9e819ec8
Diffstat (limited to 'vp9/decoder')
-rw-r--r--vp9/decoder/vp9_dequantize.c21
-rw-r--r--vp9/decoder/x86/vp9_dequantize_x86.c48
2 files changed, 34 insertions, 35 deletions
diff --git a/vp9/decoder/vp9_dequantize.c b/vp9/decoder/vp9_dequantize.c
index dade2aff5..271a75d16 100644
--- a/vp9/decoder/vp9_dequantize.c
+++ b/vp9/decoder/vp9_dequantize.c
@@ -69,7 +69,7 @@ void vp9_ht_dequant_idct_add_c(TX_TYPE tx_type, int16_t *input,
uint8_t *pred, uint8_t *dest,
int pitch, int stride, int eob) {
int i;
- int16_t output[16];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 16);
for (i = 0; i < 16; i++)
input[i] *= dq[i];
@@ -83,7 +83,7 @@ void vp9_ht_dequant_idct_add_8x8_c(TX_TYPE tx_type, int16_t *input,
const int16_t *dq,
uint8_t *pred, uint8_t *dest,
int pitch, int stride, int eob) {
- int16_t output[64];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 64);
if (eob == 0) {
// All 0 DCT coefficients
@@ -104,7 +104,7 @@ void vp9_ht_dequant_idct_add_8x8_c(TX_TYPE tx_type, int16_t *input,
void vp9_dequant_idct_add_c(int16_t *input, const int16_t *dq, uint8_t *pred,
uint8_t *dest, int pitch, int stride, int eob) {
int i;
- int16_t output[16];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 16);
if (eob > 1) {
for (i = 0; i < 16; i++)
@@ -125,7 +125,7 @@ void vp9_dequant_idct_add_c(int16_t *input, const int16_t *dq, uint8_t *pred,
void vp9_dequant_dc_idct_add_c(int16_t *input, const int16_t *dq, uint8_t *pred,
uint8_t *dest, int pitch, int stride, int dc) {
int i;
- int16_t output[16];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 16);
input[0] = dc;
@@ -142,7 +142,7 @@ void vp9_dequant_idct_add_lossless_c(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *dest,
int pitch, int stride, int eob) {
int i;
- int16_t output[16];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 16);
if (eob > 1) {
for (i = 0; i < 16; i++)
@@ -164,7 +164,7 @@ void vp9_dequant_dc_idct_add_lossless_c(int16_t *input, const int16_t *dq,
uint8_t *dest,
int pitch, int stride, int dc) {
int i;
- int16_t output[16];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 16);
input[0] = dc;
@@ -179,8 +179,7 @@ void vp9_dequant_dc_idct_add_lossless_c(int16_t *input, const int16_t *dq,
void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *dest, int pitch,
int stride, int eob) {
- int16_t output[64];
-
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 64);
// If dc is 1, then input[0] is the reconstructed value, do not need
// dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
@@ -241,7 +240,7 @@ void vp9_ht_dequant_idct_add_16x16_c(TX_TYPE tx_type, int16_t *input,
const int16_t *dq, uint8_t *pred,
uint8_t *dest, int pitch, int stride,
int eob) {
- int16_t output[256];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 256);
if (eob == 0) {
// All 0 DCT coefficients
@@ -270,7 +269,7 @@ void vp9_ht_dequant_idct_add_16x16_c(TX_TYPE tx_type, int16_t *input,
void vp9_dequant_idct_add_16x16_c(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *dest, int pitch,
int stride, int eob) {
- int16_t output[256];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 256);
/* The calculation can be simplified if there are not many non-zero dct
* coefficients. Use eobs to separate different cases. */
@@ -330,7 +329,7 @@ void vp9_dequant_idct_add_16x16_c(int16_t *input, const int16_t *dq,
void vp9_dequant_idct_add_32x32_c(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *dest, int pitch,
int stride, int eob) {
- int16_t output[1024];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, output, 1024);
if (eob) {
input[0] = input[0] * dq[0] / 2;
diff --git a/vp9/decoder/x86/vp9_dequantize_x86.c b/vp9/decoder/x86/vp9_dequantize_x86.c
index c225deca5..4fa408690 100644
--- a/vp9/decoder/x86/vp9_dequantize_x86.c
+++ b/vp9/decoder/x86/vp9_dequantize_x86.c
@@ -67,14 +67,14 @@ void vp9_add_residual_8x8_sse2(const int16_t *diff, const uint8_t *pred,
const __m128i zero = _mm_setzero_si128();
// Diff data
- const __m128i d0 = _mm_loadu_si128((const __m128i *)(diff + 0 * width));
- const __m128i d1 = _mm_loadu_si128((const __m128i *)(diff + 1 * width));
- const __m128i d2 = _mm_loadu_si128((const __m128i *)(diff + 2 * width));
- const __m128i d3 = _mm_loadu_si128((const __m128i *)(diff + 3 * width));
- const __m128i d4 = _mm_loadu_si128((const __m128i *)(diff + 4 * width));
- const __m128i d5 = _mm_loadu_si128((const __m128i *)(diff + 5 * width));
- const __m128i d6 = _mm_loadu_si128((const __m128i *)(diff + 6 * width));
- const __m128i d7 = _mm_loadu_si128((const __m128i *)(diff + 7 * width));
+ const __m128i d0 = _mm_load_si128((const __m128i *)(diff + 0 * width));
+ const __m128i d1 = _mm_load_si128((const __m128i *)(diff + 1 * width));
+ const __m128i d2 = _mm_load_si128((const __m128i *)(diff + 2 * width));
+ const __m128i d3 = _mm_load_si128((const __m128i *)(diff + 3 * width));
+ const __m128i d4 = _mm_load_si128((const __m128i *)(diff + 4 * width));
+ const __m128i d5 = _mm_load_si128((const __m128i *)(diff + 5 * width));
+ const __m128i d6 = _mm_load_si128((const __m128i *)(diff + 6 * width));
+ const __m128i d7 = _mm_load_si128((const __m128i *)(diff + 7 * width));
// Prediction data.
__m128i p0 = _mm_loadl_epi64((const __m128i *)(pred + 0 * pitch));
@@ -137,14 +137,14 @@ void vp9_add_residual_16x16_sse2(const int16_t *diff, const uint8_t *pred,
__m128i p0, p1, p2, p3, p4, p5, p6, p7;
do {
- d0 = _mm_loadu_si128((const __m128i *)(diff + 0 * width));
- d1 = _mm_loadu_si128((const __m128i *)(diff + 0 * width + 8));
- d2 = _mm_loadu_si128((const __m128i *)(diff + 1 * width));
- d3 = _mm_loadu_si128((const __m128i *)(diff + 1 * width + 8));
- d4 = _mm_loadu_si128((const __m128i *)(diff + 2 * width));
- d5 = _mm_loadu_si128((const __m128i *)(diff + 2 * width + 8));
- d6 = _mm_loadu_si128((const __m128i *)(diff + 3 * width));
- d7 = _mm_loadu_si128((const __m128i *)(diff + 3 * width + 8));
+ d0 = _mm_load_si128((const __m128i *)(diff + 0 * width));
+ d1 = _mm_load_si128((const __m128i *)(diff + 0 * width + 8));
+ d2 = _mm_load_si128((const __m128i *)(diff + 1 * width));
+ d3 = _mm_load_si128((const __m128i *)(diff + 1 * width + 8));
+ d4 = _mm_load_si128((const __m128i *)(diff + 2 * width));
+ d5 = _mm_load_si128((const __m128i *)(diff + 2 * width + 8));
+ d6 = _mm_load_si128((const __m128i *)(diff + 3 * width));
+ d7 = _mm_load_si128((const __m128i *)(diff + 3 * width + 8));
// Prediction data.
p1 = _mm_load_si128((const __m128i *)(pred + 0 * pitch));
@@ -197,14 +197,14 @@ void vp9_add_residual_32x32_sse2(const int16_t *diff, const uint8_t *pred,
__m128i p0, p1, p2, p3, p4, p5, p6, p7;
do {
- d0 = _mm_loadu_si128((const __m128i *)(diff + 0 * width));
- d1 = _mm_loadu_si128((const __m128i *)(diff + 0 * width + 8));
- d2 = _mm_loadu_si128((const __m128i *)(diff + 0 * width + 16));
- d3 = _mm_loadu_si128((const __m128i *)(diff + 0 * width + 24));
- d4 = _mm_loadu_si128((const __m128i *)(diff + 1 * width));
- d5 = _mm_loadu_si128((const __m128i *)(diff + 1 * width + 8));
- d6 = _mm_loadu_si128((const __m128i *)(diff + 1 * width + 16));
- d7 = _mm_loadu_si128((const __m128i *)(diff + 1 * width + 24));
+ d0 = _mm_load_si128((const __m128i *)(diff + 0 * width));
+ d1 = _mm_load_si128((const __m128i *)(diff + 0 * width + 8));
+ d2 = _mm_load_si128((const __m128i *)(diff + 0 * width + 16));
+ d3 = _mm_load_si128((const __m128i *)(diff + 0 * width + 24));
+ d4 = _mm_load_si128((const __m128i *)(diff + 1 * width));
+ d5 = _mm_load_si128((const __m128i *)(diff + 1 * width + 8));
+ d6 = _mm_load_si128((const __m128i *)(diff + 1 * width + 16));
+ d7 = _mm_load_si128((const __m128i *)(diff + 1 * width + 24));
// Prediction data.
p1 = _mm_load_si128((const __m128i *)(pred + 0 * pitch));