summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2011-01-07 06:46:45 -0800
committerCode Review <code-review@webmproject.org>2011-01-07 06:46:45 -0800
commitdd314351e656e2ca0f7d6f103fc2ce12a8dde7b1 (patch)
treedd968942f559cb115af80e3923fadfdcb0bec068
parent8b0cf5f79d4c3812ae3d23f2ddc124afcf79b070 (diff)
parent6dbdfe3422cee54d42d08d54abf500824a2a2d4a (diff)
downloadlibvpx-dd314351e656e2ca0f7d6f103fc2ce12a8dde7b1.tar
libvpx-dd314351e656e2ca0f7d6f103fc2ce12a8dde7b1.tar.gz
libvpx-dd314351e656e2ca0f7d6f103fc2ce12a8dde7b1.tar.bz2
libvpx-dd314351e656e2ca0f7d6f103fc2ce12a8dde7b1.zip
Merge "Removed cpi->target_bits_per_mb"
-rw-r--r--vp8/encoder/encodeframe.c14
-rw-r--r--vp8/encoder/onyx_if.c3
-rw-r--r--vp8/encoder/onyx_int.h1
-rw-r--r--vp8/encoder/rdopt.c79
4 files changed, 10 insertions, 87 deletions
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index cb7cc65d7..e27e2e64e 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -734,20 +734,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
x->activity_sum = 0;
-#if 0
- // Experimental rd code
- // 2 Pass - Possibly set Rdmult based on last frame distortion + this frame target bits or other metrics
- // such as cpi->rate_correction_factor that indicate relative complexity.
- /*if ( cpi->pass == 2 && (cpi->last_frame_distortion > 0) && (cpi->target_bits_per_mb > 0) )
- {
- //x->rdmult = ((cpi->last_frame_distortion * 256)/cpi->common.MBs)/ cpi->target_bits_per_mb;
- x->rdmult = (int)(cpi->RDMULT * cpi->rate_correction_factor);
- }
- else
- x->rdmult = cpi->RDMULT; */
- //x->rdmult = (int)(cpi->RDMULT * pow( (cpi->rate_correction_factor * 2.0), 0.75 ));
-#endif
-
xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_context->mbmi.uv_mode = DC_PRED;
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 56f7ef6f8..08ed931bb 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3081,9 +3081,6 @@ static int pick_frame_size(VP8_COMP *cpi)
}
}
- // Note target_size in bits * 256 per MB
- cpi->target_bits_per_mb = (cpi->this_frame_target * 256) / cpi->common.MBs;
-
return 1;
}
static void set_quantizer(VP8_COMP *cpi, int Q)
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 2f9cc4776..87d9815ff 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -365,7 +365,6 @@ typedef struct
int this_frame_target;
int projected_frame_size;
int last_q[2]; // Separate values for Intra/Inter
- int target_bits_per_mb;
double rate_correction_factor;
double key_frame_rate_correction_factor;
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index e6c7c9ab3..d694d39fb 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -36,7 +36,6 @@
#include "dct.h"
#include "systemdependent.h"
-#define DIAMONDSEARCH 1
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
#else
@@ -46,19 +45,6 @@
void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x);
-
-#define RDFUNC(RM,DM,R,D,target_rd) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
-/*int RDFUNC( int RM,int DM, int R, int D, int target_r )
-{
- int rd_value;
-
- rd_value = ( ((128+(R)*(RM)) >> 8) + (DM)*(D) );
-
- return rd_value;
-}*/
-
-#define UVRDFUNC(RM,DM,R,D,target_r) RDFUNC(RM,DM,R,D,target_r)
-
#define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
#define MAXF(a,b) (((a) > (b)) ? (a) : (b))
@@ -223,8 +209,6 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
{
int q;
int i;
- int *thresh;
- int threshmult;
double capped_q = (Qvalue < 160) ? (double)Qvalue : 160.0;
double rdconst = 3.00;
@@ -271,22 +255,6 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
if (q < 8)
q = 8;
- if (cpi->ref_frame_flags == VP8_ALT_FLAG)
- {
- thresh = &cpi->rd_threshes[THR_NEWA];
- threshmult = cpi->sf.thresh_mult[THR_NEWA];
- }
- else if (cpi->ref_frame_flags == VP8_GOLD_FLAG)
- {
- thresh = &cpi->rd_threshes[THR_NEWG];
- threshmult = cpi->sf.thresh_mult[THR_NEWG];
- }
- else
- {
- thresh = &cpi->rd_threshes[THR_NEWMV];
- threshmult = cpi->sf.thresh_mult[THR_NEWMV];
- }
-
if (cpi->RDMULT > 1000)
{
cpi->RDDIV = 1;
@@ -775,7 +743,7 @@ static int vp8_rd_inter_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *distort
*rate = rd_cost_mbuv(x);
*distortion = ENCODEMB_INVOKE(&cpi->rtcd.encodemb, mbuverr)(x) / 4;
- return UVRDFUNC(x->rdmult, x->rddiv, *rate, *distortion, cpi->target_bits_per_mb);
+ return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
}
int vp8_rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int *distortion)
@@ -800,7 +768,7 @@ int vp8_rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *ra
distortion = vp8_get_mbuvrecon_error(IF_RTCD(&cpi->rtcd.variance), x);
- this_rd = UVRDFUNC(x->rdmult, x->rddiv, rate, distortion, cpi->target_bits_per_mb);
+ this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
if (this_rd < best_rd)
{
@@ -1097,7 +1065,7 @@ void vp8_rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi,
// Segmentation method overheads
rate = vp8_cost_token(vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + segmentation);
rate += vp8_cost_mv_ref(SPLITMV, bsi->mdcounts);
- this_segment_rd += RDFUNC(x->rdmult, x->rddiv, rate, 0, cpi->target_bits_per_mb);
+ this_segment_rd += RDCOST(x->rdmult, x->rddiv, rate, 0);
br += rate;
for (i = 0; i < label_count; i++)
@@ -1252,7 +1220,7 @@ void vp8_rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi,
labelyrate = rdcost_mbsegment_y(x, labels, i, ta_s, tl_s);
rate += labelyrate;
- this_rd = RDFUNC(x->rdmult, x->rddiv, rate, distortion, cpi->target_bits_per_mb);
+ this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
if (this_rd < best_label_rd)
{
@@ -1751,7 +1719,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
//int intermodecost[MAX_MODES];
MB_PREDICTION_MODE uv_intra_mode;
- int uvintra_eob = 0;
+
int force_no_skip = 0;
MV mvp;
@@ -1770,27 +1738,6 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
ref_frame_cost[INTRA_FRAME] = vp8_cost_zero(cpi->prob_intra_coded);
- // Experimental code
- // Adjust the RD multiplier based on the best case distortion we saw in the most recently coded mb
- //if ( (cpi->last_mb_distortion) > 0 && (cpi->target_bits_per_mb > 0) )
- /*{
- int tmprdmult;
-
- //tmprdmult = (cpi->last_mb_distortion * 256) / ((cpi->av_per_frame_bandwidth*256)/cpi->common.MBs);
- tmprdmult = (cpi->last_mb_distortion * 256) / cpi->target_bits_per_mb;
- //tmprdmult = tmprdmult;
-
- //if ( tmprdmult > cpi->RDMULT * 2 )
- // tmprdmult = cpi->RDMULT * 2;
- //else if ( tmprdmult < cpi->RDMULT / 2 )
- // tmprdmult = cpi->RDMULT / 2;
-
- //tmprdmult = (tmprdmult < 25) ? 25 : tmprdmult;
-
- //x->rdmult = tmprdmult;
-
- }*/
-
// Special case treatment when GF and ARF are not sensible options for reference
if (cpi->ref_frame_flags == VP8_LAST_FLAG)
{
@@ -1820,12 +1767,6 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
vp8_rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
- {
- uvintra_eob = 0;
-
- for (i = 16; i < 24; i++)
- uvintra_eob += x->e_mbd.block[i].eob;
- }
for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
{
@@ -2339,8 +2280,8 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
distortion_uv = sse2;
disable_skip = 1;
- this_rd = RDFUNC(x->rdmult, x->rddiv, rate2,
- distortion2, cpi->target_bits_per_mb);
+ this_rd = RDCOST(x->rdmult, x->rddiv, rate2,
+ distortion2);
break;
}
@@ -2414,7 +2355,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
}
}
// Calculate the final RD estimate for this mode
- this_rd = RDFUNC(x->rdmult, x->rddiv, rate2, distortion2, cpi->target_bits_per_mb);
+ this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
}
// Experimental debug code.
@@ -2442,8 +2383,8 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
other_cost += ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
/* Calculate the final y RD estimate for this mode */
- best_yrd = RDFUNC(x->rdmult, x->rddiv, (rate2-rate_uv-other_cost),
- (distortion2-distortion_uv), cpi->target_bits_per_mb);
+ best_yrd = RDCOST(x->rdmult, x->rddiv, (rate2-rate_uv-other_cost),
+ (distortion2-distortion_uv));
*returnrate = rate2;
*returndistortion = distortion2;