Make intra prediction pointers RTCD-based.

This probably has a mildly negative impact on performance, but will
(in future commits - or possibly merged with this one) allow SIMD
implementations of individual intra prediction functions. We may
perhaps want to consider having separate functions per txfm-size
also (i.e. 4x4, 8x8, 16x16 and 32x32 intra prediction functions for
each intra prediction mode), but I haven't played much with that
yet.

Change-Id: Ie739985eee0a3fcbb7aed29ee6910fdb653ea269
This commit is contained in:
Ronald S. Bultje 2013-07-08 17:25:51 -07:00
parent a5062cc635
commit 8350e7fe38
6 changed files with 231 additions and 716 deletions

View File

@ -34,47 +34,45 @@ const TX_TYPE mode2txfm_map[MB_MODE_COUNT] = {
};
static INLINE void d27_predictor(uint8_t *ypred_ptr, int y_stride,
int bw, int bh,
uint8_t *yabove_row, uint8_t *yleft_col) {
void vp9_d27_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
// first column
for (r = 0; r < bh - 1; ++r) {
for (r = 0; r < bs - 1; ++r) {
ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(yleft_col[r] +
yleft_col[r + 1], 1);
}
ypred_ptr[(bh - 1) * y_stride] = yleft_col[bh-1];
ypred_ptr[(bs - 1) * y_stride] = yleft_col[bs - 1];
ypred_ptr++;
// second column
for (r = 0; r < bh - 2; ++r) {
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);
}
ypred_ptr[(bh - 2) * y_stride] = ROUND_POWER_OF_TWO(yleft_col[bh - 2] +
yleft_col[bh - 1] * 3,
ypred_ptr[(bs - 2) * y_stride] = ROUND_POWER_OF_TWO(yleft_col[bs - 2] +
yleft_col[bs - 1] * 3,
2);
ypred_ptr[(bh - 1) * y_stride] = yleft_col[bh-1];
ypred_ptr[(bs - 1) * y_stride] = yleft_col[bs - 1];
ypred_ptr++;
// rest of last row
for (c = 0; c < bw - 2; ++c) {
ypred_ptr[(bh - 1) * y_stride + c] = yleft_col[bh-1];
for (c = 0; c < bs - 2; ++c) {
ypred_ptr[(bs - 1) * y_stride + c] = yleft_col[bs - 1];
}
for (r = bh - 2; r >= 0; --r) {
for (c = 0; c < bw - 2; ++c) {
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];
}
}
}
static INLINE void d63_predictor(uint8_t *ypred_ptr, int y_stride,
int bw, int bh,
uint8_t *yabove_row, uint8_t *yleft_col) {
void vp9_d63_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
for (r = 0; r < bh; ++r) {
for (c = 0; c < bw; ++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 +
@ -88,29 +86,27 @@ static INLINE void d63_predictor(uint8_t *ypred_ptr, int y_stride,
}
}
static INLINE void d45_predictor(uint8_t *ypred_ptr, int y_stride,
int bw, int bh,
uint8_t *yabove_row, uint8_t *yleft_col) {
void vp9_d45_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
for (r = 0; r < bh; ++r) {
for (c = 0; c < bw; ++c) {
if (r + c + 2 < bw * 2)
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);
else
ypred_ptr[c] = yabove_row[bw * 2 - 1];
ypred_ptr[c] = yabove_row[bs * 2 - 1];
}
ypred_ptr += y_stride;
}
}
static INLINE void d117_predictor(uint8_t *ypred_ptr, int y_stride,
int bw, int bh,
uint8_t *yabove_row, uint8_t *yleft_col) {
void vp9_d117_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
// first row
for (c = 0; c < bw; c++)
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;
@ -118,7 +114,7 @@ static INLINE void d117_predictor(uint8_t *ypred_ptr, int y_stride,
ypred_ptr[0] = ROUND_POWER_OF_TWO(yleft_col[0] +
yabove_row[-1] * 2 +
yabove_row[0], 2);
for (c = 1; c < bw; c++)
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);
@ -128,27 +124,26 @@ static INLINE void d117_predictor(uint8_t *ypred_ptr, int y_stride,
ypred_ptr[0] = ROUND_POWER_OF_TWO(yabove_row[-1] +
yleft_col[0] * 2 +
yleft_col[1], 2);
for (r = 3; r < bh; ++r)
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);
// the rest of the block
for (r = 2; r < bh; ++r) {
for (c = 1; c < bw; c++)
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;
}
}
static INLINE void d135_predictor(uint8_t *ypred_ptr, int y_stride,
int bw, int bh,
uint8_t *yabove_row, uint8_t *yleft_col) {
void vp9_d135_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
ypred_ptr[0] = ROUND_POWER_OF_TWO(yleft_col[0] +
yabove_row[-1] * 2 +
yabove_row[0], 2);
for (c = 1; c < bw; c++)
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);
@ -156,27 +151,24 @@ static INLINE void d135_predictor(uint8_t *ypred_ptr, int y_stride,
ypred_ptr[y_stride] = ROUND_POWER_OF_TWO(yabove_row[-1] +
yleft_col[0] * 2 +
yleft_col[1], 2);
for (r = 2; r < bh; ++r)
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 += y_stride;
for (r = 1; r < bh; ++r) {
for (c = 1; c < bw; c++)
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;
}
}
static INLINE void d153_predictor(uint8_t *ypred_ptr,
int y_stride,
int bw, int bh,
uint8_t *yabove_row,
uint8_t *yleft_col) {
void vp9_d153_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
ypred_ptr[0] = ROUND_POWER_OF_TWO(yabove_row[-1] + yleft_col[0], 1);
for (r = 1; r < bh; r++)
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++;
@ -187,33 +179,136 @@ static INLINE void d153_predictor(uint8_t *ypred_ptr,
ypred_ptr[y_stride] = ROUND_POWER_OF_TWO(yabove_row[-1] +
yleft_col[0] * 2 +
yleft_col[1], 2);
for (r = 2; r < bh; r++)
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++;
for (c = 0; c < bw - 2; c++)
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;
for (r = 1; r < bh; ++r) {
for (c = 0; c < bw - 2; c++)
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;
}
}
void vp9_build_intra_predictors(uint8_t *src, int src_stride,
uint8_t *ypred_ptr,
int y_stride, int mode,
int bw, int bh,
int up_available, int left_available,
int right_available) {
int r, c, i;
uint8_t yleft_col[64], yabove_data[129], ytop_left;
uint8_t *yabove_row = yabove_data + 1;
void vp9_v_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r;
for (r = 0; r < bs; r++) {
vpx_memcpy(ypred_ptr, yabove_row, bs);
ypred_ptr += y_stride;
}
}
void vp9_h_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r;
for (r = 0; r < bs; r++) {
vpx_memset(ypred_ptr, yleft_col[r], bs);
ypred_ptr += y_stride;
}
}
void vp9_tm_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r, c;
int ytop_left = yabove_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;
}
}
void vp9_dc_128_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int r;
for (r = 0; r < bs; r++) {
vpx_memset(ypred_ptr, 128, bs);
ypred_ptr += y_stride;
}
}
void vp9_dc_left_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int i, r;
int expected_dc = 128;
int average = 0;
const int count = bs;
for (i = 0; i < bs; i++)
average += yleft_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;
}
}
void vp9_dc_top_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int i, r;
int expected_dc = 128;
int average = 0;
const int count = bs;
for (i = 0; i < bs; i++)
average += yabove_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;
}
}
void vp9_dc_predictor_c(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col) {
int i, r;
int expected_dc = 128;
int average = 0;
const int count = 2 * bs;
for (i = 0; i < bs; i++)
average += yabove_row[i];
for (i = 0; i < bs; i++)
average += yleft_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;
}
}
typedef void (*intra_pred_fn)(uint8_t *ypred_ptr, int y_stride, int bs,
uint8_t *yabove_row, uint8_t *yleft_col);
static void build_intra_predictors(uint8_t *src, int src_stride,
uint8_t *ypred_ptr, int y_stride,
MB_PREDICTION_MODE mode, int bs,
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, 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
};
// 127 127 127 .. 127 127 127 127 127 127
// 129 A B .. Y Z
@ -222,94 +317,44 @@ void vp9_build_intra_predictors(uint8_t *src, int src_stride,
// 129 G H .. S T T T T T
// ..
assert(bw == bh);
if (left_available) {
for (i = 0; i < bh; i++)
for (i = 0; i < bs; i++)
yleft_col[i] = src[i * src_stride - 1];
} else {
vpx_memset(yleft_col, 129, bh);
vpx_memset(yleft_col, 129, bs);
}
if (up_available) {
uint8_t *yabove_ptr = src - src_stride;
vpx_memcpy(yabove_row, yabove_ptr, bw);
if (bw == 4 && right_available)
vpx_memcpy(yabove_row + bw, yabove_ptr + bw, bw);
else
vpx_memset(yabove_row + bw, yabove_row[bw -1], bw);
ytop_left = left_available ? yabove_ptr[-1] : 129;
} else {
vpx_memset(yabove_row, 127, bw * 2);
ytop_left = 127;
}
yabove_row[-1] = ytop_left;
switch (mode) {
case DC_PRED: {
int i;
int expected_dc = 128;
int average = 0;
int count = 0;
if (up_available || left_available) {
if (up_available) {
for (i = 0; i < bw; i++)
average += yabove_row[i];
count += bw;
}
if (left_available) {
for (i = 0; i < bh; i++)
average += yleft_col[i];
count += bh;
}
expected_dc = (average + (count >> 1)) / count;
}
for (r = 0; r < bh; r++) {
vpx_memset(ypred_ptr, expected_dc, bw);
ypred_ptr += y_stride;
}
if (bs == 4 && right_available && left_available) {
yabove_row = yabove_ptr;
} else {
vpx_memcpy(yabove_row, yabove_ptr, bs);
if (bs == 4 && right_available)
vpx_memcpy(yabove_row + bs, yabove_ptr + bs, bs);
else
vpx_memset(yabove_row + bs, yabove_row[bs - 1], bs);
yabove_row[-1] = left_available ? yabove_ptr[-1] : 129;
}
break;
case V_PRED:
for (r = 0; r < bh; r++) {
vpx_memcpy(ypred_ptr, yabove_row, bw);
ypred_ptr += y_stride;
} else {
vpx_memset(yabove_row, 127, bs * 2);
yabove_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);
}
break;
case H_PRED:
for (r = 0; r < bh; r++) {
vpx_memset(ypred_ptr, yleft_col[r], bw);
ypred_ptr += y_stride;
}
break;
case TM_PRED:
for (r = 0; r < bh; r++) {
for (c = 0; c < bw; c++)
ypred_ptr[c] = clip_pixel(yleft_col[r] + yabove_row[c] - ytop_left);
ypred_ptr += y_stride;
}
break;
case D45_PRED:
d45_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
case D135_PRED:
d135_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
case D117_PRED:
d117_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
case D153_PRED:
d153_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
case D27_PRED:
d27_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
case D63_PRED:
d63_predictor(ypred_ptr, y_stride, bw, bh, yabove_row, yleft_col);
break;
default:
break;
} 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);
}
} else {
pred[mode](ypred_ptr, y_stride, bs, yabove_row, yleft_col);
}
}
@ -328,11 +373,10 @@ void vp9_predict_intra_block(MACROBLOCKD *xd,
const int txfm_block_size = 4 << tx_size;
assert(bwl >= 0);
vp9_build_intra_predictors(reference, ref_stride,
predictor, pre_stride,
mode,
txfm_block_size,
txfm_block_size,
have_top, have_left,
have_right);
build_intra_predictors(reference, ref_stride,
predictor, pre_stride,
mode,
txfm_block_size,
have_top, have_left,
have_right);
}

View File

@ -35,8 +35,6 @@ specialize vp9_idct_add_8x8
prototype void vp9_idct_add "int16_t *input, uint8_t *dest, int stride, int eob"
specialize vp9_idct_add
prototype void vp9_idct_add_32x32 "int16_t *q, uint8_t *dst, int stride, int eob"
specialize vp9_idct_add_32x32
@ -54,8 +52,44 @@ vp9_copy_mem8x8_dspr2=vp9_copy_mem8x8_dspr2
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_build_intra_predictors "uint8_t *src, int src_stride, uint8_t *pred, int y_stride, int mode, int bw, int bh, int up_available, int left_available, int right_available"
specialize void vp9_build_intra_predictors
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_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_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_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_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_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_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_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_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_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_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_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_128_predictor "uint8_t *ypred_ptr, int y_stride, int bs, uint8_t *yabove_row, uint8_t *yleft_col"
specialize vp9_dc_128_predictor
if [ "$CONFIG_VP9_DECODER" = "yes" ]; then
prototype void vp9_add_constant_residual_8x8 "const int16_t diff, uint8_t *dest, int stride"

View File

@ -113,460 +113,3 @@ sym(vp9_copy_mem16x16_sse2):
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_dc_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
global sym(vp9_intra_pred_uv_dc_mmx2) PRIVATE
sym(vp9_intra_pred_uv_dc_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
push rsi
push rdi
; end prolog
; from top
mov rsi, arg(2) ;src;
movsxd rax, dword ptr arg(3) ;src_stride;
sub rsi, rax
pxor mm0, mm0
movq mm1, [rsi]
psadbw mm1, mm0
; from left
dec rsi
lea rdi, [rax*3]
movzx ecx, byte [rsi+rax]
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
movzx edx, byte [rsi+rax*4]
add ecx, edx
; add up
pextrw edx, mm1, 0x0
lea edx, [edx+ecx+8]
sar edx, 4
movd mm1, edx
pshufw mm1, mm1, 0x0
packuswb mm1, mm1
; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_dctop_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
global sym(vp9_intra_pred_uv_dctop_mmx2) PRIVATE
sym(vp9_intra_pred_uv_dctop_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
GET_GOT rbx
push rsi
push rdi
; end prolog
; from top
mov rsi, arg(2) ;src;
movsxd rax, dword ptr arg(3) ;src_stride;
sub rsi, rax
pxor mm0, mm0
movq mm1, [rsi]
psadbw mm1, mm0
; add up
paddw mm1, [GLOBAL(dc_4)]
psraw mm1, 3
pshufw mm1, mm1, 0x0
packuswb mm1, mm1
; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_dcleft_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
global sym(vp9_intra_pred_uv_dcleft_mmx2) PRIVATE
sym(vp9_intra_pred_uv_dcleft_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
push rsi
push rdi
; end prolog
; from left
mov rsi, arg(2) ;src;
movsxd rax, dword ptr arg(3) ;src_stride;
dec rsi
lea rdi, [rax*3]
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
lea edx, [ecx+edx+4]
; add up
shr edx, 3
movd mm1, edx
pshufw mm1, mm1, 0x0
packuswb mm1, mm1
; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_dc128_mmx(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
global sym(vp9_intra_pred_uv_dc128_mmx) PRIVATE
sym(vp9_intra_pred_uv_dc128_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
GET_GOT rbx
; end prolog
; write out
movq mm1, [GLOBAL(dc_128)]
mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
lea rax, [rax+rdx*4]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
; begin epilog
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_tm_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
%macro vp9_intra_pred_uv_tm 1
global sym(vp9_intra_pred_uv_tm_%1) PRIVATE
sym(vp9_intra_pred_uv_tm_%1):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
GET_GOT rbx
push rsi
push rdi
; end prolog
; read top row
mov edx, 4
mov rsi, arg(2) ;src;
movsxd rax, dword ptr arg(3) ;src_stride;
sub rsi, rax
pxor xmm0, xmm0
%ifidn %1, ssse3
movdqa xmm2, [GLOBAL(dc_1024)]
%endif
movq xmm1, [rsi]
punpcklbw xmm1, xmm0
; set up left ptrs ans subtract topleft
movd xmm3, [rsi-1]
lea rsi, [rsi+rax-1]
%ifidn %1, sse2
punpcklbw xmm3, xmm0
pshuflw xmm3, xmm3, 0x0
punpcklqdq xmm3, xmm3
%else
pshufb xmm3, xmm2
%endif
psubw xmm1, xmm3
; set up dest ptrs
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
.vp9_intra_pred_uv_tm_%1_loop:
movd xmm3, [rsi]
movd xmm5, [rsi+rax]
%ifidn %1, sse2
punpcklbw xmm3, xmm0
punpcklbw xmm5, xmm0
pshuflw xmm3, xmm3, 0x0
pshuflw xmm5, xmm5, 0x0
punpcklqdq xmm3, xmm3
punpcklqdq xmm5, xmm5
%else
pshufb xmm3, xmm2
pshufb xmm5, xmm2
%endif
paddw xmm3, xmm1
paddw xmm5, xmm1
packuswb xmm3, xmm5
movq [rdi ], xmm3
movhps[rdi+rcx], xmm3
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz .vp9_intra_pred_uv_tm_%1_loop
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
%endmacro
vp9_intra_pred_uv_tm sse2
vp9_intra_pred_uv_tm ssse3
;void vp9_intra_pred_uv_ve_mmx(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
global sym(vp9_intra_pred_uv_ve_mmx) PRIVATE
sym(vp9_intra_pred_uv_ve_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
; end prolog
; read from top
mov rax, arg(2) ;src;
movsxd rdx, dword ptr arg(3) ;src_stride;
sub rax, rdx
movq mm1, [rax]
; write out
mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
lea rax, [rax+rdx*4]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
; begin epilog
UNSHADOW_ARGS
pop rbp
ret
;void vp9_intra_pred_uv_ho_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *src,
; int src_stride,
; )
%macro vp9_intra_pred_uv_ho 1
global sym(vp9_intra_pred_uv_ho_%1) PRIVATE
sym(vp9_intra_pred_uv_ho_%1):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
push rsi
push rdi
%ifidn %1, ssse3
%ifndef GET_GOT_SAVE_ARG
push rbx
%endif
GET_GOT rbx
%endif
; end prolog
; read from left and write out
%ifidn %1, mmx2
mov edx, 4
%endif
mov rsi, arg(2) ;src;
movsxd rax, dword ptr arg(3) ;src_stride;
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
%ifidn %1, ssse3
lea rdx, [rcx*3]
movdqa xmm2, [GLOBAL(dc_00001111)]
lea rbx, [rax*3]
%endif
dec rsi
%ifidn %1, mmx2
.vp9_intra_pred_uv_ho_%1_loop:
movd mm0, [rsi]
movd mm1, [rsi+rax]
punpcklbw mm0, mm0
punpcklbw mm1, mm1
pshufw mm0, mm0, 0x0
pshufw mm1, mm1, 0x0
movq [rdi ], mm0
movq [rdi+rcx], mm1
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz .vp9_intra_pred_uv_ho_%1_loop
%else
movd xmm0, [rsi]
movd xmm3, [rsi+rax]
movd xmm1, [rsi+rax*2]
movd xmm4, [rsi+rbx]
punpcklbw xmm0, xmm3
punpcklbw xmm1, xmm4
pshufb xmm0, xmm2
pshufb xmm1, xmm2
movq [rdi ], xmm0
movhps [rdi+rcx], xmm0
movq [rdi+rcx*2], xmm1
movhps [rdi+rdx], xmm1
lea rsi, [rsi+rax*4]
lea rdi, [rdi+rcx*4]
movd xmm0, [rsi]
movd xmm3, [rsi+rax]
movd xmm1, [rsi+rax*2]
movd xmm4, [rsi+rbx]
punpcklbw xmm0, xmm3
punpcklbw xmm1, xmm4
pshufb xmm0, xmm2
pshufb xmm1, xmm2
movq [rdi ], xmm0
movhps [rdi+rcx], xmm0
movq [rdi+rcx*2], xmm1
movhps [rdi+rdx], xmm1
%endif
; begin epilog
%ifidn %1, ssse3
RESTORE_GOT
%ifndef GET_GOT_SAVE_ARG
pop rbx
%endif
%endif
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
%endmacro
vp9_intra_pred_uv_ho mmx2
vp9_intra_pred_uv_ho ssse3
SECTION_RODATA
dc_128:
times 8 db 128
dc_4:
times 4 dw 4
align 16
dc_1024:
times 8 dw 0x400
align 16
dc_00001111:
times 8 db 0
times 8 db 1

View File

@ -1,101 +0,0 @@
/*
* 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 "./vpx_config.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/vp9_blockd.h"
#define build_intra_predictors_mbuv_prototype(sym) \
void sym(unsigned char *dst, int dst_stride, \
const unsigned char *src, int src_stride)
typedef build_intra_predictors_mbuv_prototype((*build_intra_pred_mbuv_fn_t));
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dc_mmx2);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dctop_mmx2);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dcleft_mmx2);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dc128_mmx);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_ho_mmx2);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_ho_ssse3);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_ve_mmx);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_tm_sse2);
extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_tm_ssse3);
static void build_intra_predictors_mbuv_x86(MACROBLOCKD *xd,
unsigned char *dst_u,
unsigned char *dst_v,
int dst_stride,
build_intra_pred_mbuv_fn_t tm_fn,
build_intra_pred_mbuv_fn_t ho_fn) {
int mode = xd->mode_info_context->mbmi.uv_mode;
build_intra_pred_mbuv_fn_t fn;
int src_stride = xd->plane[1].dst.stride;
switch (mode) {
case V_PRED:
fn = vp9_intra_pred_uv_ve_mmx;
break;
case H_PRED:
fn = ho_fn;
break;
case TM_PRED:
fn = tm_fn;
break;
case DC_PRED:
if (xd->up_available) {
if (xd->left_available) {
fn = vp9_intra_pred_uv_dc_mmx2;
break;
} else {
fn = vp9_intra_pred_uv_dctop_mmx2;
break;
}
} else if (xd->left_available) {
fn = vp9_intra_pred_uv_dcleft_mmx2;
break;
} else {
fn = vp9_intra_pred_uv_dc128_mmx;
break;
}
break;
default:
return;
}
fn(dst_u, dst_stride, xd->plane[1].dst.buf, src_stride);
fn(dst_v, dst_stride, xd->plane[2].dst.buf, src_stride);
}
void vp9_build_intra_predictors_mbuv_sse2(MACROBLOCKD *xd) {
build_intra_predictors_mbuv_x86(xd, xd->plane[1].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride,
vp9_intra_pred_uv_tm_sse2,
vp9_intra_pred_uv_ho_mmx2);
}
void vp9_build_intra_predictors_mbuv_ssse3(MACROBLOCKD *xd) {
build_intra_predictors_mbuv_x86(xd, xd->plane[1].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride,
vp9_intra_pred_uv_tm_ssse3,
vp9_intra_pred_uv_ho_ssse3);
}
void vp9_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *xd) {
build_intra_predictors_mbuv_x86(xd, xd->plane[1].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride,
vp9_intra_pred_uv_tm_sse2,
vp9_intra_pred_uv_ho_mmx2);
}
void vp9_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *xd) {
build_intra_predictors_mbuv_x86(xd, xd->plane[1].dst.buf,
xd->plane[2].dst.buf, xd->plane[1].dst.stride,
vp9_intra_pred_uv_tm_ssse3,
vp9_intra_pred_uv_ho_ssse3);
}

View File

@ -15,6 +15,7 @@
#include <vp9/encoder/vp9_rdopt.h>
#include <vp9/common/vp9_blockd.h>
#include <vp9/common/vp9_reconinter.h>
#include <vp9/common/vp9_reconintra.h>
#include <vp9/common/vp9_systemdependent.h>
#include <vp9/encoder/vp9_segmentation.h>
@ -146,16 +147,11 @@ static int find_best_16x16_intra(VP9_COMP *cpi,
// we're intentionally not doing 4x4, we just want a rough estimate
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
unsigned int err;
const int bwl = b_width_log2(BLOCK_SIZE_MB16X16), bw = 4 << bwl;
const int bhl = b_height_log2(BLOCK_SIZE_MB16X16), bh = 4 << bhl;
xd->mode_info_context->mbmi.mode = mode;
vp9_build_intra_predictors(x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride,
xd->mode_info_context->mbmi.mode,
bw, bh,
xd->up_available, xd->left_available,
xd->right_available);
vp9_predict_intra_block(xd, 0, 2, TX_16X16, mode,
x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride);
err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride, best_err);

View File

@ -80,7 +80,6 @@ VP9_COMMON_SRCS-$(HAVE_MMX) += common/x86/vp9_loopfilter_mmx.asm
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_recon_wrapper_sse2.c
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