Removed vp8_block2type

and used defines instead.

Change-Id: Idb56e0295d004793f406dfd2d8d8c546aad62e03
This commit is contained in:
Scott LaVarnway 2011-02-23 16:37:08 -05:00
parent d53492bba4
commit 861175ef00
4 changed files with 19 additions and 41 deletions

View File

@ -12,8 +12,6 @@
#include "blockd.h"
#include "vpx_mem/vpx_mem.h"
const int vp8_block2type[25] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1};
const unsigned char vp8_block2left[25] =
{
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8

View File

@ -28,11 +28,6 @@ void vpx_log(const char *format, ...);
#define DCPREDSIMTHRESH 0
#define DCPREDCNTTHRESH 3
#define Y1CONTEXT 0
#define UCONTEXT 1
#define VCONTEXT 2
#define Y2CONTEXT 3
#define MB_FEATURE_TREE_PROBS 3
#define MAX_MB_SEGMENTS 4
@ -48,6 +43,11 @@ typedef struct
int r, c;
} POS;
#define PLANE_TYPE_Y_NO_DC 0
#define PLANE_TYPE_Y2 1
#define PLANE_TYPE_UV 2
#define PLANE_TYPE_Y_WITH_DC 3
typedef char ENTROPY_CONTEXT;
typedef struct
@ -58,8 +58,6 @@ typedef struct
ENTROPY_CONTEXT y2;
} ENTROPY_CONTEXT_PLANES;
extern const int vp8_block2type[25];
extern const unsigned char vp8_block2left[25];
extern const unsigned char vp8_block2above[25];

View File

@ -518,7 +518,7 @@ void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
&& x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
type = has_2nd_order ? 0 : 3;
type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
for (b = 0; b < 16; b++)
{
@ -526,23 +526,16 @@ void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
for (b = 16; b < 20; b++)
for (b = 16; b < 24; b++)
{
vp8_optimize_b(x, b, vp8_block2type[b],
vp8_optimize_b(x, b, PLANE_TYPE_UV,
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
for (b = 20; b < 24; b++)
{
vp8_optimize_b(x, b, vp8_block2type[b],
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
if (has_2nd_order)
{
b=24;
vp8_optimize_b(x, b, vp8_block2type[b],
vp8_optimize_b(x, b, PLANE_TYPE_Y2,
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
}
@ -572,7 +565,7 @@ void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
&& x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
type = has_2nd_order ? 0 : 3;
type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
for (b = 0; b < 16; b++)
{
@ -584,7 +577,7 @@ void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
if (has_2nd_order)
{
b=24;
vp8_optimize_b(x, b, vp8_block2type[b],
vp8_optimize_b(x, b, PLANE_TYPE_Y2,
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
}
@ -608,18 +601,11 @@ void vp8_optimize_mbuv(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
ta = (ENTROPY_CONTEXT *)&t_above;
tl = (ENTROPY_CONTEXT *)&t_left;
for (b = 16; b < 20; b++)
for (b = 16; b < 24; b++)
{
vp8_optimize_b(x, b, vp8_block2type[b],
vp8_optimize_b(x, b, PLANE_TYPE_UV,
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
for (b = 20; b < 24; b++)
{
vp8_optimize_b(x, b, vp8_block2type[b],
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
}
}
#endif

View File

@ -529,10 +529,10 @@ static int vp8_rdcost_mby(MACROBLOCK *mb)
tl = (ENTROPY_CONTEXT *)&t_left;
for (b = 0; b < 16; b++)
cost += cost_coeffs(mb, x->block + b, 0,
cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_Y_NO_DC,
ta + vp8_block2above[b], tl + vp8_block2left[b]);
cost += cost_coeffs(mb, x->block + 24, 1,
cost += cost_coeffs(mb, x->block + 24, PLANE_TYPE_Y2,
ta + vp8_block2above[24], tl + vp8_block2left[24]);
return cost;
@ -637,7 +637,7 @@ static int rd_pick_intra4x4block(
tempa = ta;
templ = tl;
ratey = cost_coeffs(x, b, 3, &tempa, &templ);
ratey = cost_coeffs(x, b, PLANE_TYPE_Y_WITH_DC, &tempa, &templ);
rate += ratey;
distortion = ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)(be->coeff, b->dqcoeff) >> 2;
@ -782,12 +782,8 @@ static int rd_cost_mbuv(MACROBLOCK *mb)
ta = (ENTROPY_CONTEXT *)&t_above;
tl = (ENTROPY_CONTEXT *)&t_left;
for (b = 16; b < 20; b++)
cost += cost_coeffs(mb, x->block + b, vp8_block2type[b],
ta + vp8_block2above[b], tl + vp8_block2left[b]);
for (b = 20; b < 24; b++)
cost += cost_coeffs(mb, x->block + b, vp8_block2type[b],
for (b = 16; b < 24; b++)
cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_UV,
ta + vp8_block2above[b], tl + vp8_block2left[b]);
return cost;
@ -968,7 +964,7 @@ static int rdcost_mbsegment_y(MACROBLOCK *mb, const int *labels,
for (b = 0; b < 16; b++)
if (labels[ b] == which_label)
cost += cost_coeffs(mb, x->block + b, 3,
cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_Y_WITH_DC,
ta + vp8_block2above[b],
tl + vp8_block2left[b]);