ref: 6fdd4d26de9bddb2b0acd82bde72b0b3ccfb7c5a
parent: 89e4ce20d0996b72b0bd5a688466730c7306ff77
parent: b339aea67520ea2dd90cedd9e626b4446824ee4f
author: Yunqing Wang <yunqingwang@google.com>
date: Thu Mar 7 10:40:37 EST 2013
Merge "Allocate 16-byte aligned diff buffer" into experimental
--- a/vp9/decoder/vp9_dequantize.c
+++ b/vp9/decoder/vp9_dequantize.c
@@ -69,7 +69,7 @@
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 @@
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_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_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 @@
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 @@
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,9 +179,8 @@
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.
input[0] *= dq[0];
@@ -241,7 +240,7 @@
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_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_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;
--- a/vp9/decoder/x86/vp9_dequantize_x86.c
+++ b/vp9/decoder/x86/vp9_dequantize_x86.c
@@ -67,14 +67,14 @@
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 @@
__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 @@
__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));
--
⑨