Commit b339aea6 authored by Yunqing Wang's avatar Yunqing Wang
Browse files

Allocate 16-byte aligned diff buffer

This was done based on John's suggestion.

Change-Id: I62516a513c31fe3dbea0d6cd063df79d9e819ec8
parent 31623715
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment