From 861175ef001e5211ad9e60221e04da7fd1970d31 Mon Sep 17 00:00:00 2001 From: Scott LaVarnway Date: Wed, 23 Feb 2011 16:37:08 -0500 Subject: [PATCH] Removed vp8_block2type and used defines instead. Change-Id: Idb56e0295d004793f406dfd2d8d8c546aad62e03 --- vp8/common/blockd.c | 2 -- vp8/common/blockd.h | 12 +++++------- vp8/encoder/encodemb.c | 30 ++++++++---------------------- vp8/encoder/rdopt.c | 16 ++++++---------- 4 files changed, 19 insertions(+), 41 deletions(-) diff --git a/vp8/common/blockd.c b/vp8/common/blockd.c index 7f75a72c5..1fc3cd0ca 100644 --- a/vp8/common/blockd.c +++ b/vp8/common/blockd.c @@ -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 diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index 5a8991e65..fc8e0722c 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -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]; diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c index 30ef299ec..30b8c4590 100644 --- a/vp8/encoder/encodemb.c +++ b/vp8/encoder/encodemb.c @@ -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 diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 0359ad416..8aaca0917 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -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]);