ref: 92c5d3665dabe8b55b9b32df9fac92171d5f7947
parent: b1df674a99c37ff8dea0609d1f6d7864fa6a05f4
author: Ronald S. Bultje <[email protected]>
date: Tue Jul 9 10:52:20 EDT 2013
SSE/SSE2 assembly for 4x4/8x8/16x16/32x32 DC intra prediction. Change-Id: Ibe1690afc5459f3b3beca401e7734fcd03da6dd0
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -15,6 +15,7 @@
#include "vp9/common/vp9_reconintra.h"
#include "vp9/common/vp9_onyxc_int.h"
#include "vpx_mem/vpx_mem.h"
+#include "vpx_ports/vpx_once.h"
const TX_TYPE mode2txfm_map[MB_MODE_COUNT] = {
DCT_DCT, // DC
@@ -33,214 +34,236 @@
DCT_DCT // NEWMV
};
+#define intra_pred_sized(type, size) \
+void vp9_##type##_predictor_##size##x##size##_c(uint8_t *pred_ptr, \
+ ptrdiff_t stride, \
+ uint8_t *above_row, \
+ uint8_t *left_col) { \
+ type##_predictor(pred_ptr, stride, size, above_row, left_col); \
+}
+#define intra_pred_allsizes(type) \
+ intra_pred_sized(type, 4) \
+ intra_pred_sized(type, 8) \
+ intra_pred_sized(type, 16) \
+ intra_pred_sized(type, 32)
-void vp9_d27_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d27_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
// first column
for (r = 0; r < bs - 1; ++r) {
- ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r] +
- yleft_col[r + 1], 1);
+ pred_ptr[r * stride] = ROUND_POWER_OF_TWO(left_col[r] +
+ left_col[r + 1], 1);
}
- ypred_ptr[(bs - 1) * y_stride] = yleft_col[bs - 1];
- ypred_ptr++;
+ pred_ptr[(bs - 1) * stride] = left_col[bs - 1];
+ pred_ptr++;
// second column
for (r = 0; r < bs - 2; ++r) {
- ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r] +
- yleft_col[r + 1] * 2 +
- yleft_col[r + 2], 2);
+ pred_ptr[r * stride] = ROUND_POWER_OF_TWO(left_col[r] +
+ left_col[r + 1] * 2 +
+ left_col[r + 2], 2);
}
- ypred_ptr[(bs - 2) * y_stride] = ROUND_POWER_OF_TWO(yleft_col[bs - 2] +
- yleft_col[bs - 1] * 3,
+ pred_ptr[(bs - 2) * stride] = ROUND_POWER_OF_TWO(left_col[bs - 2] +
+ left_col[bs - 1] * 3,
2);
- ypred_ptr[(bs - 1) * y_stride] = yleft_col[bs - 1];
- ypred_ptr++;
+ pred_ptr[(bs - 1) * stride] = left_col[bs - 1];
+ pred_ptr++;
// rest of last row
for (c = 0; c < bs - 2; ++c) {
- ypred_ptr[(bs - 1) * y_stride + c] = yleft_col[bs - 1];
+ pred_ptr[(bs - 1) * stride + c] = left_col[bs - 1];
}
for (r = bs - 2; r >= 0; --r) {
for (c = 0; c < bs - 2; ++c) {
- ypred_ptr[r * y_stride + c] = ypred_ptr[(r + 1) * y_stride + c - 2];
+ pred_ptr[r * stride + c] = pred_ptr[(r + 1) * stride + c - 2];
}
}
}
+intra_pred_allsizes(d27)
-void vp9_d63_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d63_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
for (r = 0; r < bs; ++r) {
for (c = 0; c < bs; ++c) {
if (r & 1) {
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[r/2 + c] +
- yabove_row[r/2 + c + 1] * 2 +
- yabove_row[r/2 + c + 2], 2);
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[r/2 + c] +
+ above_row[r/2 + c + 1] * 2 +
+ above_row[r/2 + c + 2], 2);
} else {
- ypred_ptr[c] =ROUND_POWER_OF_TWO(yabove_row[r/2 + c] +
- yabove_row[r/2+ c + 1], 1);
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[r/2 + c] +
+ above_row[r/2+ c + 1], 1);
}
}
- ypred_ptr += y_stride;
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(d63)
-void vp9_d45_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d45_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
for (r = 0; r < bs; ++r) {
for (c = 0; c < bs; ++c) {
if (r + c + 2 < bs * 2)
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[r + c] +
- yabove_row[r + c + 1] * 2 +
- yabove_row[r + c + 2], 2);
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[r + c] +
+ above_row[r + c + 1] * 2 +
+ above_row[r + c + 2], 2);
else
- ypred_ptr[c] = yabove_row[bs * 2 - 1];
+ pred_ptr[c] = above_row[bs * 2 - 1];
}
- ypred_ptr += y_stride;
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(d45)
-void vp9_d117_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d117_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
// first row
for (c = 0; c < bs; c++)
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[c - 1] + yabove_row[c], 1);
- ypred_ptr += y_stride;
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[c - 1] + above_row[c], 1);
+ pred_ptr += stride;
// second row
- ypred_ptr[0] = ROUND_POWER_OF_TWO(yleft_col[0] +
- yabove_row[-1] * 2 +
- yabove_row[0], 2);
+ pred_ptr[0] = ROUND_POWER_OF_TWO(left_col[0] +
+ above_row[-1] * 2 +
+ above_row[0], 2);
for (c = 1; c < bs; c++)
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[c - 2] +
- yabove_row[c - 1] * 2 +
- yabove_row[c], 2);
- ypred_ptr += y_stride;
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[c - 2] +
+ above_row[c - 1] * 2 +
+ above_row[c], 2);
+ pred_ptr += stride;
// the rest of first col
- ypred_ptr[0] = ROUND_POWER_OF_TWO(yabove_row[-1] +
- yleft_col[0] * 2 +
- yleft_col[1], 2);
+ pred_ptr[0] = ROUND_POWER_OF_TWO(above_row[-1] +
+ left_col[0] * 2 +
+ left_col[1], 2);
for (r = 3; r < bs; ++r)
- ypred_ptr[(r-2) * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r - 3] +
- yleft_col[r - 2] * 2 +
- yleft_col[r - 1], 2);
+ pred_ptr[(r-2) * stride] = ROUND_POWER_OF_TWO(left_col[r - 3] +
+ left_col[r - 2] * 2 +
+ left_col[r - 1], 2);
// the rest of the block
for (r = 2; r < bs; ++r) {
for (c = 1; c < bs; c++)
- ypred_ptr[c] = ypred_ptr[-2 * y_stride + c - 1];
- ypred_ptr += y_stride;
+ pred_ptr[c] = pred_ptr[-2 * stride + c - 1];
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(d117)
-
-void vp9_d135_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d135_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
- ypred_ptr[0] = ROUND_POWER_OF_TWO(yleft_col[0] +
- yabove_row[-1] * 2 +
- yabove_row[0], 2);
+ pred_ptr[0] = ROUND_POWER_OF_TWO(left_col[0] +
+ above_row[-1] * 2 +
+ above_row[0], 2);
for (c = 1; c < bs; c++)
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[c - 2] +
- yabove_row[c - 1] * 2 +
- yabove_row[c], 2);
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[c - 2] +
+ above_row[c - 1] * 2 +
+ above_row[c], 2);
- ypred_ptr[y_stride] = ROUND_POWER_OF_TWO(yabove_row[-1] +
- yleft_col[0] * 2 +
- yleft_col[1], 2);
+ pred_ptr[stride] = ROUND_POWER_OF_TWO(above_row[-1] +
+ left_col[0] * 2 +
+ left_col[1], 2);
for (r = 2; r < bs; ++r)
- ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r - 2] +
- yleft_col[r - 1] * 2 +
- yleft_col[r], 2);
+ pred_ptr[r * stride] = ROUND_POWER_OF_TWO(left_col[r - 2] +
+ left_col[r - 1] * 2 +
+ left_col[r], 2);
- ypred_ptr += y_stride;
+ pred_ptr += stride;
for (r = 1; r < bs; ++r) {
for (c = 1; c < bs; c++)
- ypred_ptr[c] = ypred_ptr[-y_stride + c - 1];
- ypred_ptr += y_stride;
+ pred_ptr[c] = pred_ptr[-stride + c - 1];
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(d135)
-void vp9_d153_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void d153_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
- ypred_ptr[0] = ROUND_POWER_OF_TWO(yabove_row[-1] + yleft_col[0], 1);
+ pred_ptr[0] = ROUND_POWER_OF_TWO(above_row[-1] + left_col[0], 1);
for (r = 1; r < bs; r++)
- ypred_ptr[r * y_stride] =
- ROUND_POWER_OF_TWO(yleft_col[r - 1] + yleft_col[r], 1);
- ypred_ptr++;
+ pred_ptr[r * stride] =
+ ROUND_POWER_OF_TWO(left_col[r - 1] + left_col[r], 1);
+ pred_ptr++;
- ypred_ptr[0] = ROUND_POWER_OF_TWO(yleft_col[0] +
- yabove_row[-1] * 2 +
- yabove_row[0], 2);
- ypred_ptr[y_stride] = ROUND_POWER_OF_TWO(yabove_row[-1] +
- yleft_col[0] * 2 +
- yleft_col[1], 2);
+ pred_ptr[0] = ROUND_POWER_OF_TWO(left_col[0] +
+ above_row[-1] * 2 +
+ above_row[0], 2);
+ pred_ptr[stride] = ROUND_POWER_OF_TWO(above_row[-1] +
+ left_col[0] * 2 +
+ left_col[1], 2);
for (r = 2; r < bs; r++)
- ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r - 2] +
- yleft_col[r - 1] * 2 +
- yleft_col[r], 2);
- ypred_ptr++;
+ pred_ptr[r * stride] = ROUND_POWER_OF_TWO(left_col[r - 2] +
+ left_col[r - 1] * 2 +
+ left_col[r], 2);
+ pred_ptr++;
for (c = 0; c < bs - 2; c++)
- ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[c - 1] +
- yabove_row[c] * 2 +
- yabove_row[c + 1], 2);
- ypred_ptr += y_stride;
+ pred_ptr[c] = ROUND_POWER_OF_TWO(above_row[c - 1] +
+ above_row[c] * 2 +
+ above_row[c + 1], 2);
+ pred_ptr += stride;
for (r = 1; r < bs; ++r) {
for (c = 0; c < bs - 2; c++)
- ypred_ptr[c] = ypred_ptr[-y_stride + c - 2];
- ypred_ptr += y_stride;
+ pred_ptr[c] = pred_ptr[-stride + c - 2];
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(d153)
-void vp9_v_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void v_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r;
for (r = 0; r < bs; r++) {
- vpx_memcpy(ypred_ptr, yabove_row, bs);
- ypred_ptr += y_stride;
+ vpx_memcpy(pred_ptr, above_row, bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(v)
-void vp9_h_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void h_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r;
for (r = 0; r < bs; r++) {
- vpx_memset(ypred_ptr, yleft_col[r], bs);
- ypred_ptr += y_stride;
+ vpx_memset(pred_ptr, left_col[r], bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(h)
-void vp9_tm_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void tm_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r, c;
- int ytop_left = yabove_row[-1];
+ int ytop_left = above_row[-1];
for (r = 0; r < bs; r++) {
for (c = 0; c < bs; c++)
- ypred_ptr[c] = clip_pixel(yleft_col[r] + yabove_row[c] - ytop_left);
- ypred_ptr += y_stride;
+ pred_ptr[c] = clip_pixel(left_col[r] + above_row[c] - ytop_left);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(tm)
-void vp9_dc_128_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void dc_128_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int r;
for (r = 0; r < bs; r++) {
- vpx_memset(ypred_ptr, 128, bs);
- ypred_ptr += y_stride;
+ vpx_memset(pred_ptr, 128, bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(dc_128)
-void vp9_dc_left_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void dc_left_predictor(uint8_t *pred_ptr, ptrdiff_t stride,
+ int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int i, r;
int expected_dc = 128;
int average = 0;
@@ -247,17 +270,18 @@
const int count = bs;
for (i = 0; i < bs; i++)
- average += yleft_col[i];
+ average += left_col[i];
expected_dc = (average + (count >> 1)) / count;
for (r = 0; r < bs; r++) {
- vpx_memset(ypred_ptr, expected_dc, bs);
- ypred_ptr += y_stride;
+ vpx_memset(pred_ptr, expected_dc, bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(dc_left)
-void vp9_dc_top_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void dc_top_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int i, r;
int expected_dc = 128;
int average = 0;
@@ -264,17 +288,18 @@
const int count = bs;
for (i = 0; i < bs; i++)
- average += yabove_row[i];
+ average += above_row[i];
expected_dc = (average + (count >> 1)) / count;
for (r = 0; r < bs; r++) {
- vpx_memset(ypred_ptr, expected_dc, bs);
- ypred_ptr += y_stride;
+ vpx_memset(pred_ptr, expected_dc, bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(dc_top)
-void vp9_dc_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col) {
+static INLINE void dc_predictor(uint8_t *pred_ptr, ptrdiff_t stride, int bs,
+ uint8_t *above_row, uint8_t *left_col) {
int i, r;
int expected_dc = 128;
int average = 0;
@@ -281,34 +306,60 @@
const int count = 2 * bs;
for (i = 0; i < bs; i++)
- average += yabove_row[i];
+ average += above_row[i];
for (i = 0; i < bs; i++)
- average += yleft_col[i];
+ average += left_col[i];
expected_dc = (average + (count >> 1)) / count;
for (r = 0; r < bs; r++) {
- vpx_memset(ypred_ptr, expected_dc, bs);
- ypred_ptr += y_stride;
+ vpx_memset(pred_ptr, expected_dc, bs);
+ pred_ptr += stride;
}
}
+intra_pred_allsizes(dc)
+#undef intra_pred_allsizes
-typedef void (*intra_pred_fn)(uint8_t *ypred_ptr, int y_stride, int bs,
- uint8_t *yabove_row, uint8_t *yleft_col);
+typedef void (*intra_pred_fn)(uint8_t *pred_ptr, ptrdiff_t stride,
+ uint8_t *above_row, uint8_t *left_col);
+static intra_pred_fn pred[VP9_INTRA_MODES][4];
+static intra_pred_fn dc_pred[2][2][4];
+
+static void init_intra_pred_fn_ptrs(void) {
+#define intra_pred_allsizes(l, type) \
+ l[0] = vp9_##type##_predictor_4x4; \
+ l[1] = vp9_##type##_predictor_8x8; \
+ l[2] = vp9_##type##_predictor_16x16; \
+ l[3] = vp9_##type##_predictor_32x32
+
+ intra_pred_allsizes(pred[V_PRED], v);
+ intra_pred_allsizes(pred[H_PRED], h);
+ intra_pred_allsizes(pred[D27_PRED], d27);
+ intra_pred_allsizes(pred[D45_PRED], d45);
+ intra_pred_allsizes(pred[D63_PRED], d63);
+ intra_pred_allsizes(pred[D117_PRED], d117);
+ intra_pred_allsizes(pred[D135_PRED], d135);
+ intra_pred_allsizes(pred[D153_PRED], d153);
+ intra_pred_allsizes(pred[TM_PRED], tm);
+
+ intra_pred_allsizes(dc_pred[0][0], dc_128);
+ intra_pred_allsizes(dc_pred[0][1], dc_top);
+ intra_pred_allsizes(dc_pred[1][0], dc_left);
+ intra_pred_allsizes(dc_pred[1][1], dc);
+
+#undef intra_pred_allsizes
+}
+
static void build_intra_predictors(uint8_t *src, int src_stride,
- uint8_t *ypred_ptr, int y_stride,
- MB_PREDICTION_MODE mode, int bs,
+ uint8_t *pred_ptr, int stride,
+ MB_PREDICTION_MODE mode, TX_SIZE txsz,
int up_available, int left_available,
int right_available) {
int i;
- DECLARE_ALIGNED_ARRAY(16, uint8_t, yleft_col, 64);
+ DECLARE_ALIGNED_ARRAY(16, uint8_t, left_col, 64);
DECLARE_ALIGNED_ARRAY(16, uint8_t, yabove_data, 128 + 16);
- uint8_t *yabove_row = yabove_data + 16;
- static const intra_pred_fn pred[VP9_INTRA_MODES] = {
- NULL, vp9_v_predictor, vp9_h_predictor, vp9_d45_predictor,
- vp9_d135_predictor, vp9_d117_predictor, vp9_d153_predictor,
- vp9_d27_predictor, vp9_d63_predictor, vp9_tm_predictor
- };
+ uint8_t *above_row = yabove_data + 16;
+ const int bs = 4 << txsz;
// 127 127 127 .. 127 127 127 127 127 127
// 129 A B .. Y Z
@@ -317,44 +368,36 @@
// 129 G H .. S T T T T T
// ..
+ once(init_intra_pred_fn_ptrs);
if (left_available) {
for (i = 0; i < bs; i++)
- yleft_col[i] = src[i * src_stride - 1];
+ left_col[i] = src[i * src_stride - 1];
} else {
- vpx_memset(yleft_col, 129, bs);
+ vpx_memset(left_col, 129, bs);
}
if (up_available) {
- uint8_t *yabove_ptr = src - src_stride;
+ uint8_t *above_ptr = src - src_stride;
if (bs == 4 && right_available && left_available) {
- yabove_row = yabove_ptr;
+ above_row = above_ptr;
} else {
- vpx_memcpy(yabove_row, yabove_ptr, bs);
+ vpx_memcpy(above_row, above_ptr, bs);
if (bs == 4 && right_available)
- vpx_memcpy(yabove_row + bs, yabove_ptr + bs, bs);
+ vpx_memcpy(above_row + bs, above_ptr + bs, bs);
else
- vpx_memset(yabove_row + bs, yabove_row[bs - 1], bs);
- yabove_row[-1] = left_available ? yabove_ptr[-1] : 129;
+ vpx_memset(above_row + bs, above_row[bs - 1], bs);
+ above_row[-1] = left_available ? above_ptr[-1] : 129;
}
} else {
- vpx_memset(yabove_row, 127, bs * 2);
- yabove_row[-1] = 127;
+ vpx_memset(above_row, 127, bs * 2);
+ above_row[-1] = 127;
}
if (mode == DC_PRED) {
- if (left_available) {
- if (up_available) {
- vp9_dc_predictor(ypred_ptr, y_stride, bs, yabove_row, yleft_col);
- } else {
- vp9_dc_left_predictor(ypred_ptr, y_stride, bs, yabove_row, yleft_col);
- }
- } else if (up_available) {
- vp9_dc_top_predictor(ypred_ptr, y_stride, bs, yabove_row, yleft_col);
- } else {
- vp9_dc_128_predictor(ypred_ptr, y_stride, bs, yabove_row, yleft_col);
- }
+ dc_pred[left_available][up_available][txsz](pred_ptr, stride,
+ above_row, left_col);
} else {
- pred[mode](ypred_ptr, y_stride, bs, yabove_row, yleft_col);
+ pred[mode][txsz](pred_ptr, stride, above_row, left_col);
}
}
@@ -370,13 +413,12 @@
const int have_top = (block_idx >> bwl) || xd->up_available;
const int have_left = (block_idx & wmask) || xd->left_available;
const int have_right = ((block_idx & wmask) != wmask);
- const int txfm_block_size = 4 << tx_size;
assert(bwl >= 0);
build_intra_predictors(reference, ref_stride,
predictor, pre_stride,
mode,
- txfm_block_size,
+ tx_size,
have_top, have_left,
have_right);
}
--- a/vp9/common/vp9_rtcd_defs.sh
+++ b/vp9/common/vp9_rtcd_defs.sh
@@ -52,44 +52,161 @@
prototype void vp9_copy_mem8x4 "const uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
specialize vp9_copy_mem8x4 mmx
-prototype void vp9_d27_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d27_predictor
+prototype void vp9_d27_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d27_predictor_4x4
-prototype void vp9_d45_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d45_predictor
+prototype void vp9_d45_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d45_predictor_4x4
-prototype void vp9_d63_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d63_predictor
+prototype void vp9_d63_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d63_predictor_4x4
-prototype void vp9_h_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_h_predictor
+prototype void vp9_h_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_h_predictor_4x4
-prototype void vp9_d117_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d117_predictor
+prototype void vp9_d117_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d117_predictor_4x4
-prototype void vp9_d135_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d135_predictor
+prototype void vp9_d135_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d135_predictor_4x4
-prototype void vp9_d153_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_d153_predictor
+prototype void vp9_d153_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d153_predictor_4x4
-prototype void vp9_v_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_v_predictor
+prototype void vp9_v_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_v_predictor_4x4
-prototype void vp9_tm_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_tm_predictor
+prototype void vp9_tm_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_tm_predictor_4x4
-prototype void vp9_dc_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_dc_predictor
+prototype void vp9_dc_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_predictor_4x4 sse
-prototype void vp9_dc_top_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_dc_top_predictor
+prototype void vp9_dc_top_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_top_predictor_4x4
-prototype void vp9_dc_left_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_dc_left_predictor
+prototype void vp9_dc_left_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_left_predictor_4x4
-prototype void vp9_dc_128_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
-specialize vp9_dc_128_predictor
+prototype void vp9_dc_128_predictor_4x4 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_128_predictor_4x4
+
+prototype void vp9_d27_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d27_predictor_8x8
+
+prototype void vp9_d45_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d45_predictor_8x8
+
+prototype void vp9_d63_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d63_predictor_8x8
+
+prototype void vp9_h_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_h_predictor_8x8
+
+prototype void vp9_d117_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d117_predictor_8x8
+
+prototype void vp9_d135_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d135_predictor_8x8
+
+prototype void vp9_d153_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d153_predictor_8x8
+
+prototype void vp9_v_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_v_predictor_8x8
+
+prototype void vp9_tm_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_tm_predictor_8x8
+
+prototype void vp9_dc_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_predictor_8x8 sse
+
+prototype void vp9_dc_top_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_top_predictor_8x8
+
+prototype void vp9_dc_left_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_left_predictor_8x8
+
+prototype void vp9_dc_128_predictor_8x8 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_128_predictor_8x8
+
+prototype void vp9_d27_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d27_predictor_16x16
+
+prototype void vp9_d45_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d45_predictor_16x16
+
+prototype void vp9_d63_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d63_predictor_16x16
+
+prototype void vp9_h_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_h_predictor_16x16
+
+prototype void vp9_d117_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d117_predictor_16x16
+
+prototype void vp9_d135_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d135_predictor_16x16
+
+prototype void vp9_d153_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d153_predictor_16x16
+
+prototype void vp9_v_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_v_predictor_16x16
+
+prototype void vp9_tm_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_tm_predictor_16x16
+
+prototype void vp9_dc_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_predictor_16x16 sse2
+
+prototype void vp9_dc_top_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_top_predictor_16x16
+
+prototype void vp9_dc_left_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_left_predictor_16x16
+
+prototype void vp9_dc_128_predictor_16x16 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_128_predictor_16x16
+
+prototype void vp9_d27_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d27_predictor_32x32
+
+prototype void vp9_d45_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d45_predictor_32x32
+
+prototype void vp9_d63_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d63_predictor_32x32
+
+prototype void vp9_h_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_h_predictor_32x32
+
+prototype void vp9_d117_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d117_predictor_32x32
+
+prototype void vp9_d135_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d135_predictor_32x32
+
+prototype void vp9_d153_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_d153_predictor_32x32
+
+prototype void vp9_v_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_v_predictor_32x32
+
+prototype void vp9_tm_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_tm_predictor_32x32
+
+prototype void vp9_dc_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_predictor_32x32 sse2
+
+prototype void vp9_dc_top_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_top_predictor_32x32
+
+prototype void vp9_dc_left_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_left_predictor_32x32
+
+prototype void vp9_dc_128_predictor_32x32 "uint8_t *ypred_ptr, ptrdiff_t y_stride, uint8_t *yabove_row, uint8_t *yleft_col"
+specialize vp9_dc_128_predictor_32x32
if [ "$CONFIG_VP9_DECODER" = "yes" ]; then
prototype void vp9_add_constant_residual_8x8 "const int16_t diff, uint8_t *dest, int stride"
--- /dev/null
+++ b/vp9/common/x86/vp9_intrapred_sse2.asm
@@ -1,0 +1,127 @@
+;
+; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
+;
+; Use of this source code is governed by a BSD-style license
+; that can be found in the LICENSE file in the root of the source
+; tree. An additional intellectual property rights grant can be found
+; in the file PATENTS. All contributing project authors may
+; be found in the AUTHORS file in the root of the source tree.
+;
+
+%include "third_party/x86inc/x86inc.asm"
+
+SECTION_RODATA
+pw_4: times 8 dw 4
+pw_8: times 8 dw 8
+pw_16: times 8 dw 16
+pw_32: times 8 dw 32
+
+SECTION .text
+
+INIT_MMX sse
+cglobal dc_predictor_4x4, 4, 4, 2, dst, stride, above, left
+ pxor m1, m1
+ movd m0, [aboveq]
+ punpckldq m0, [leftq]
+ psadbw m0, m1
+ paddw m0, [pw_4]
+ psraw m0, 3
+ pshufw m0, m0, 0x0
+ packuswb m0, m0
+ movd [dstq ], m0
+ movd [dstq+strideq], m0
+ lea dstq, [dstq+strideq*2]
+ movd [dstq ], m0
+ movd [dstq+strideq], m0
+ RET
+
+INIT_MMX sse
+cglobal dc_predictor_8x8, 4, 4, 3, dst, stride, above, left
+ pxor m1, m1
+ movq m0, [aboveq]
+ movq m2, [leftq]
+ DEFINE_ARGS dst, stride, stride3
+ lea stride3q, [strideq*3]
+ psadbw m0, m1
+ psadbw m2, m1
+ paddw m0, m2
+ paddw m0, [pw_8]
+ psraw m0, 4
+ pshufw m0, m0, 0x0
+ packuswb m0, m0
+ movq [dstq ], m0
+ movq [dstq+strideq ], m0
+ movq [dstq+strideq*2], m0
+ movq [dstq+stride3q ], m0
+ lea dstq, [dstq+strideq*4]
+ movq [dstq ], m0
+ movq [dstq+strideq ], m0
+ movq [dstq+strideq*2], m0
+ movq [dstq+stride3q ], m0
+ RET
+
+INIT_XMM sse2
+cglobal dc_predictor_16x16, 4, 4, 3, dst, stride, above, left
+ pxor m1, m1
+ mova m0, [aboveq]
+ mova m2, [leftq]
+ DEFINE_ARGS dst, stride, stride3, lines4
+ lea stride3q, [strideq*3]
+ mov lines4d, 4
+ psadbw m0, m1
+ psadbw m2, m1
+ paddw m0, m2
+ movhlps m2, m0
+ paddw m0, m2
+ paddw m0, [pw_16]
+ psraw m0, 5
+ pshuflw m0, m0, 0x0
+ punpcklqdq m0, m0
+ packuswb m0, m0
+.loop:
+ mova [dstq ], m0
+ mova [dstq+strideq ], m0
+ mova [dstq+strideq*2], m0
+ mova [dstq+stride3q ], m0
+ lea dstq, [dstq+strideq*4]
+ dec lines4d
+ jnz .loop
+ REP_RET
+
+INIT_XMM sse2
+cglobal dc_predictor_32x32, 4, 4, 5, dst, stride, above, left
+ pxor m1, m1
+ mova m0, [aboveq]
+ mova m2, [aboveq+16]
+ mova m3, [leftq]
+ mova m4, [leftq+16]
+ DEFINE_ARGS dst, stride, stride3, lines4
+ lea stride3q, [strideq*3]
+ mov lines4d, 8
+ psadbw m0, m1
+ psadbw m2, m1
+ psadbw m3, m1
+ psadbw m4, m1
+ paddw m0, m2
+ paddw m0, m3
+ paddw m0, m4
+ movhlps m2, m0
+ paddw m0, m2
+ paddw m0, [pw_32]
+ psraw m0, 6
+ pshuflw m0, m0, 0x0
+ punpcklqdq m0, m0
+ packuswb m0, m0
+.loop:
+ mova [dstq ], m0
+ mova [dstq +16], m0
+ mova [dstq+strideq ], m0
+ mova [dstq+strideq +16], m0
+ mova [dstq+strideq*2 ], m0
+ mova [dstq+strideq*2+16], m0
+ mova [dstq+stride3q ], m0
+ mova [dstq+stride3q +16], m0
+ lea dstq, [dstq+strideq*4]
+ dec lines4d
+ jnz .loop
+ REP_RET
--- a/vp9/vp9_common.mk
+++ b/vp9/vp9_common.mk
@@ -81,6 +81,7 @@
VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_iwalsh_sse2.asm
VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_loopfilter_sse2.asm
VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_recon_sse2.asm
+VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_intrapred_sse2.asm
VP9_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/vp9_subpixel_8t_ssse3.asm
ifeq ($(CONFIG_POSTPROC),yes)
VP9_COMMON_SRCS-$(HAVE_MMX) += common/x86/vp9_postproc_mmx.asm