Commit 31498df5 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Gerrit Code Review
Browse files

Merge "vp8: change build_intra4x4_predictors() to use vpx_dsp."

parents 12238fe8 c26a9eca
This diff is collapsed.
......@@ -16,6 +16,7 @@
#include "vpx_ports/vpx_once.h"
#include "blockd.h"
#include "vp8/common/reconintra.h"
#include "vp8/common/reconintra4x4.h"
enum {
SIZE_16,
......@@ -43,6 +44,7 @@ static void vp8_init_intra_predictors_internal(void)
INIT_SIZE(16);
INIT_SIZE(8);
vp8_init_intra4x4_predictors_internal();
}
void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x,
......
......@@ -8,290 +8,47 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <string.h>
#include "vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "vp8_rtcd.h"
#include "blockd.h"
void vp8_intra4x4_predict_c(unsigned char *Above,
unsigned char *yleft, int left_stride,
int _b_mode,
unsigned char *dst, int dst_stride,
unsigned char top_left)
typedef void (*intra_pred_fn)(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left);
static intra_pred_fn pred[10];
void vp8_init_intra4x4_predictors_internal(void)
{
pred[B_DC_PRED] = vpx_dc_predictor_4x4;
pred[B_TM_PRED] = vpx_tm_predictor_4x4;
pred[B_VE_PRED] = vpx_ve_predictor_4x4;
pred[B_HE_PRED] = vpx_he_predictor_4x4;
pred[B_LD_PRED] = vpx_d45e_predictor_4x4;
pred[B_RD_PRED] = vpx_d135_predictor_4x4;
pred[B_VR_PRED] = vpx_d117_predictor_4x4;
pred[B_VL_PRED] = vpx_d63e_predictor_4x4;
pred[B_HD_PRED] = vpx_d153_predictor_4x4;
pred[B_HU_PRED] = vpx_d207_predictor_4x4;
}
void vp8_intra4x4_predict(unsigned char *above,
unsigned char *yleft, int left_stride,
B_PREDICTION_MODE b_mode,
unsigned char *dst, int dst_stride,
unsigned char top_left)
{
int i, r, c;
B_PREDICTION_MODE b_mode = (B_PREDICTION_MODE)_b_mode;
unsigned char Left[4];
unsigned char Aboveb[12], *Above = Aboveb + 4;
Left[0] = yleft[0];
Left[1] = yleft[left_stride];
Left[2] = yleft[2 * left_stride];
Left[3] = yleft[3 * left_stride];
memcpy(Above, above, 8);
Above[-1] = top_left;
switch (b_mode)
{
case B_DC_PRED:
{
int expected_dc = 0;
for (i = 0; i < 4; i++)
{
expected_dc += Above[i];
expected_dc += Left[i];
}
expected_dc = (expected_dc + 4) >> 3;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
dst[c] = expected_dc;
}
dst += dst_stride;
}
}
break;
case B_TM_PRED:
{
/* prediction similar to true_motion prediction */
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
int pred = Above[c] - top_left + Left[r];
if (pred < 0)
pred = 0;
if (pred > 255)
pred = 255;
dst[c] = pred;
}
dst += dst_stride;
}
}
break;
case B_VE_PRED:
{
unsigned int ap[4];
ap[0] = (top_left + 2 * Above[0] + Above[1] + 2) >> 2;
ap[1] = (Above[0] + 2 * Above[1] + Above[2] + 2) >> 2;
ap[2] = (Above[1] + 2 * Above[2] + Above[3] + 2) >> 2;
ap[3] = (Above[2] + 2 * Above[3] + Above[4] + 2) >> 2;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
dst[c] = ap[c];
}
dst += dst_stride;
}
}
break;
case B_HE_PRED:
{
unsigned int lp[4];
lp[0] = (top_left + 2 * Left[0] + Left[1] + 2) >> 2;
lp[1] = (Left[0] + 2 * Left[1] + Left[2] + 2) >> 2;
lp[2] = (Left[1] + 2 * Left[2] + Left[3] + 2) >> 2;
lp[3] = (Left[2] + 2 * Left[3] + Left[3] + 2) >> 2;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
dst[c] = lp[r];
}
dst += dst_stride;
}
}
break;
case B_LD_PRED:
{
unsigned char *ptr = Above;
dst[0 * dst_stride + 0] = (ptr[0] + ptr[1] * 2 + ptr[2] + 2) >> 2;
dst[0 * dst_stride + 1] =
dst[1 * dst_stride + 0] = (ptr[1] + ptr[2] * 2 + ptr[3] + 2) >> 2;
dst[0 * dst_stride + 2] =
dst[1 * dst_stride + 1] =
dst[2 * dst_stride + 0] = (ptr[2] + ptr[3] * 2 + ptr[4] + 2) >> 2;
dst[0 * dst_stride + 3] =
dst[1 * dst_stride + 2] =
dst[2 * dst_stride + 1] =
dst[3 * dst_stride + 0] = (ptr[3] + ptr[4] * 2 + ptr[5] + 2) >> 2;
dst[1 * dst_stride + 3] =
dst[2 * dst_stride + 2] =
dst[3 * dst_stride + 1] = (ptr[4] + ptr[5] * 2 + ptr[6] + 2) >> 2;
dst[2 * dst_stride + 3] =
dst[3 * dst_stride + 2] = (ptr[5] + ptr[6] * 2 + ptr[7] + 2) >> 2;
dst[3 * dst_stride + 3] = (ptr[6] + ptr[7] * 2 + ptr[7] + 2) >> 2;
}
break;
case B_RD_PRED:
{
unsigned char pp[9];
pp[0] = Left[3];
pp[1] = Left[2];
pp[2] = Left[1];
pp[3] = Left[0];
pp[4] = top_left;
pp[5] = Above[0];
pp[6] = Above[1];
pp[7] = Above[2];
pp[8] = Above[3];
dst[3 * dst_stride + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
dst[3 * dst_stride + 1] =
dst[2 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
dst[3 * dst_stride + 2] =
dst[2 * dst_stride + 1] =
dst[1 * dst_stride + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
dst[3 * dst_stride + 3] =
dst[2 * dst_stride + 2] =
dst[1 * dst_stride + 1] =
dst[0 * dst_stride + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
dst[2 * dst_stride + 3] =
dst[1 * dst_stride + 2] =
dst[0 * dst_stride + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
dst[1 * dst_stride + 3] =
dst[0 * dst_stride + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
dst[0 * dst_stride + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
}
break;
case B_VR_PRED:
{
unsigned char pp[9];
pp[0] = Left[3];
pp[1] = Left[2];
pp[2] = Left[1];
pp[3] = Left[0];
pp[4] = top_left;
pp[5] = Above[0];
pp[6] = Above[1];
pp[7] = Above[2];
pp[8] = Above[3];
dst[3 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
dst[2 * dst_stride + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
dst[3 * dst_stride + 1] =
dst[1 * dst_stride + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
dst[2 * dst_stride + 1] =
dst[0 * dst_stride + 0] = (pp[4] + pp[5] + 1) >> 1;
dst[3 * dst_stride + 2] =
dst[1 * dst_stride + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
dst[2 * dst_stride + 2] =
dst[0 * dst_stride + 1] = (pp[5] + pp[6] + 1) >> 1;
dst[3 * dst_stride + 3] =
dst[1 * dst_stride + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
dst[2 * dst_stride + 3] =
dst[0 * dst_stride + 2] = (pp[6] + pp[7] + 1) >> 1;
dst[1 * dst_stride + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
dst[0 * dst_stride + 3] = (pp[7] + pp[8] + 1) >> 1;
}
break;
case B_VL_PRED:
{
unsigned char *pp = Above;
dst[0 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
dst[1 * dst_stride + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
dst[2 * dst_stride + 0] =
dst[0 * dst_stride + 1] = (pp[1] + pp[2] + 1) >> 1;
dst[1 * dst_stride + 1] =
dst[3 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
dst[2 * dst_stride + 1] =
dst[0 * dst_stride + 2] = (pp[2] + pp[3] + 1) >> 1;
dst[3 * dst_stride + 1] =
dst[1 * dst_stride + 2] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
dst[0 * dst_stride + 3] =
dst[2 * dst_stride + 2] = (pp[3] + pp[4] + 1) >> 1;
dst[1 * dst_stride + 3] =
dst[3 * dst_stride + 2] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
dst[2 * dst_stride + 3] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
dst[3 * dst_stride + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
}
break;
case B_HD_PRED:
{
unsigned char pp[9];
pp[0] = Left[3];
pp[1] = Left[2];
pp[2] = Left[1];
pp[3] = Left[0];
pp[4] = top_left;
pp[5] = Above[0];
pp[6] = Above[1];
pp[7] = Above[2];
pp[8] = Above[3];
dst[3 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
dst[3 * dst_stride + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
dst[2 * dst_stride + 0] =
dst[3 * dst_stride + 2] = (pp[1] + pp[2] + 1) >> 1;
dst[2 * dst_stride + 1] =
dst[3 * dst_stride + 3] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
dst[2 * dst_stride + 2] =
dst[1 * dst_stride + 0] = (pp[2] + pp[3] + 1) >> 1;
dst[2 * dst_stride + 3] =
dst[1 * dst_stride + 1] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
dst[1 * dst_stride + 2] =
dst[0 * dst_stride + 0] = (pp[3] + pp[4] + 1) >> 1;
dst[1 * dst_stride + 3] =
dst[0 * dst_stride + 1] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
dst[0 * dst_stride + 2] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
dst[0 * dst_stride + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
}
break;
case B_HU_PRED:
{
unsigned char *pp = Left;
dst[0 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
dst[0 * dst_stride + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
dst[0 * dst_stride + 2] =
dst[1 * dst_stride + 0] = (pp[1] + pp[2] + 1) >> 1;
dst[0 * dst_stride + 3] =
dst[1 * dst_stride + 1] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
dst[1 * dst_stride + 2] =
dst[2 * dst_stride + 0] = (pp[2] + pp[3] + 1) >> 1;
dst[1 * dst_stride + 3] =
dst[2 * dst_stride + 1] = (pp[2] + pp[3] * 2 + pp[3] + 2) >> 2;
dst[2 * dst_stride + 2] =
dst[2 * dst_stride + 3] =
dst[3 * dst_stride + 0] =
dst[3 * dst_stride + 1] =
dst[3 * dst_stride + 2] =
dst[3 * dst_stride + 3] = pp[3];
}
break;
default:
break;
}
pred[b_mode](dst, dst_stride, Above, Left);
}
......@@ -18,7 +18,7 @@ extern "C" {
#endif
static void intra_prediction_down_copy(MACROBLOCKD *xd,
unsigned char *above_right_src)
unsigned char *above_right_src)
{
int dst_stride = xd->dst.y_stride;
unsigned char *above_right_dst = xd->dst.y_buffer - dst_stride + 16;
......@@ -33,6 +33,14 @@ static void intra_prediction_down_copy(MACROBLOCKD *xd,
*dst_ptr2 = *src_ptr;
}
void vp8_intra4x4_predict(unsigned char *Above,
unsigned char *yleft, int left_stride,
B_PREDICTION_MODE b_mode,
unsigned char *dst, int dst_stride,
unsigned char top_left);
void vp8_init_intra4x4_predictors_internal(void);
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -152,10 +152,6 @@ specialize qw/vp8_copy_mem8x4 mmx media neon dspr2 msa/;
$vp8_copy_mem8x4_media=vp8_copy_mem8x4_v6;
$vp8_copy_mem8x4_dspr2=vp8_copy_mem8x4_dspr2;
add_proto qw/void vp8_intra4x4_predict/, "unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left";
specialize qw/vp8_intra4x4_predict media/;
$vp8_intra4x4_predict_media=vp8_intra4x4_predict_armv6;
#
# Postproc
#
......
......@@ -145,7 +145,6 @@ VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/idct_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/loopfilter_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/simpleloopfilter_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/sixtappredict8x4_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/intra4x4_predict_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/dequant_idct_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/dequantize_v6$(ASM)
VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/idct_blk_v6.c
......
......@@ -247,6 +247,38 @@ static INLINE void dc_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
}
}
void vpx_he_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int H = above[-1];
const int I = left[0];
const int J = left[1];
const int K = left[2];
const int L = left[3];
memset(dst + stride * 0, AVG3(H, I, J), 4);
memset(dst + stride * 1, AVG3(I, J, K), 4);
memset(dst + stride * 2, AVG3(J, K, L), 4);
memset(dst + stride * 3, AVG3(K, L, L), 4);
}
void vpx_ve_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int H = above[-1];
const int I = above[0];
const int J = above[1];
const int K = above[2];
const int L = above[3];
const int M = above[4];
dst[0] = AVG3(H, I, J);
dst[1] = AVG3(I, J, K);
dst[2] = AVG3(J, K, L);
dst[3] = AVG3(K, L, M);
memcpy(dst + stride * 1, dst, 4);
memcpy(dst + stride * 2, dst, 4);
memcpy(dst + stride * 3, dst, 4);
}
void vpx_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int I = left[0];
......@@ -287,6 +319,30 @@ void vpx_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
DST(3, 3) = AVG3(E, F, G); // differs from vp8
}
void vpx_d63e_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int A = above[0];
const int B = above[1];
const int C = above[2];
const int D = above[3];
const int E = above[4];
const int F = above[5];
const int G = above[6];
const int H = above[7];
(void)left;
DST(0, 0) = AVG2(A, B);
DST(1, 0) = DST(0, 2) = AVG2(B, C);
DST(2, 0) = DST(1, 2) = AVG2(C, D);
DST(3, 0) = DST(2, 2) = AVG2(D, E);
DST(3, 2) = AVG3(E, F, G);
DST(0, 1) = AVG3(A, B, C);
DST(1, 1) = DST(0, 3) = AVG3(B, C, D);
DST(2, 1) = DST(1, 3) = AVG3(C, D, E);
DST(3, 1) = DST(2, 3) = AVG3(D, E, F);
DST(3, 3) = AVG3(F, G, H);
}
void vpx_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int A = above[0];
......@@ -308,6 +364,27 @@ void vpx_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
DST(3, 3) = H; // differs from vp8
}
void vpx_d45e_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int A = above[0];
const int B = above[1];
const int C = above[2];
const int D = above[3];
const int E = above[4];
const int F = above[5];
const int G = above[6];
const int H = above[7];
(void)stride;
(void)left;
DST(0, 0) = AVG3(A, B, C);
DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
DST(3, 3) = AVG3(G, H, H);
}
void vpx_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const int I = left[0];
......
......@@ -60,12 +60,21 @@ specialize qw/vpx_d207_predictor_4x4/, "$ssse3_x86inc";
add_proto qw/void vpx_d45_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45_predictor_4x4 neon/, "$ssse3_x86inc";
add_proto qw/void vpx_d45e_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45e_predictor_4x4/;
add_proto qw/void vpx_d63_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63_predictor_4x4/, "$ssse3_x86inc";
add_proto qw/void vpx_d63e_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63e_predictor_4x4/;
add_proto qw/void vpx_h_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_h_predictor_4x4 neon dspr2 msa/, "$ssse3_x86inc";
add_proto qw/void vpx_he_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_he_predictor_4x4/;
add_proto qw/void vpx_d117_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d117_predictor_4x4/;
......@@ -78,6 +87,9 @@ specialize qw/vpx_d153_predictor_4x4/, "$ssse3_x86inc";
add_proto qw/void vpx_v_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_v_predictor_4x4 neon msa/, "$sse_x86inc";
add_proto qw/void vpx_ve_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_ve_predictor_4x4/;
add_proto qw/void vpx_tm_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_tm_predictor_4x4 neon dspr2 msa/, "$sse_x86inc";
......
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