summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorJohann <johannkoenig@google.com>2011-06-22 07:45:17 -0400
committerJohann <johannkoenig@google.com>2011-06-22 07:45:17 -0400
commit786246ebf1fd4b875f33a8b0c35bab2a3df911b3 (patch)
treefd2235c0be262280a561429bc2df343c79c3d646 /vp8
parente18d7bc23095b89132007c64e38ce262dcb0a943 (diff)
parent76495617e05d7192f887c688fa177fea77b9469b (diff)
downloadlibvpx-786246ebf1fd4b875f33a8b0c35bab2a3df911b3.tar
libvpx-786246ebf1fd4b875f33a8b0c35bab2a3df911b3.tar.gz
libvpx-786246ebf1fd4b875f33a8b0c35bab2a3df911b3.tar.bz2
libvpx-786246ebf1fd4b875f33a8b0c35bab2a3df911b3.zip
Merge remote branch 'origin/master' into experimental
Conflicts: vp8/encoder/rdopt.c Use new constant (110) from 10ed60dc7 Change-Id: Ic7d8a45ccc8deeeb94a0ab1c58d5d052ef3c27e4
Diffstat (limited to 'vp8')
-rw-r--r--vp8/decoder/dboolhuff.h10
-rw-r--r--vp8/encoder/encodeframe.c7
-rw-r--r--vp8/encoder/mcomp.c88
-rw-r--r--vp8/encoder/rdopt.c2
4 files changed, 31 insertions, 76 deletions
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index 5f6b211ea..f729837f9 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -81,11 +81,14 @@ static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
int count;
unsigned int range;
+ split = 1 + (((br->range - 1) * probability) >> 8);
+
+ if(br->count < 0)
+ vp8dx_bool_decoder_fill(br);
+
value = br->value;
count = br->count;
- range = br->range;
- split = 1 + (((range - 1) * probability) >> 8);
bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
range = split;
@@ -106,8 +109,7 @@ static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
br->value = value;
br->count = count;
br->range = range;
- if(count < 0)
- vp8dx_bool_decoder_fill(br);
+
return bit;
}
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 5834e6f08..7a6650696 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -335,7 +335,8 @@ void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x)
{
#if USE_ACT_INDEX
x->rdmult += *(x->mb_activity_ptr) * (x->rdmult >> 2);
- x->errorperbit = x->rdmult/x->rddiv;
+ x->errorperbit = x->rdmult * 100 /(110 * x->rddiv);
+ x->errorperbit += (x->errorperbit==0);
#else
INT64 a;
INT64 b;
@@ -346,8 +347,8 @@ void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x)
b = (2*act) + cpi->activity_avg;
x->rdmult = (unsigned int)(((INT64)x->rdmult*b + (a>>1))/a);
- x->errorperbit = x->rdmult/x->rddiv;
-
+ x->errorperbit = x->rdmult * 100 /(110 * x->rddiv);
+ x->errorperbit += (x->errorperbit==0);
#endif
// Activity based Zbin adjustment
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
index d22fdb2e6..416948870 100644
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -317,17 +317,6 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int whichdir ;
int thismse;
-
- // Trap uncodable vectors
- if ((abs((bestmv->as_mv.col << 3) - ref_mv->as_mv.col) > MAX_FULL_PEL_VAL)
- || (abs((bestmv->as_mv.row << 3) - ref_mv->as_mv.row) > MAX_FULL_PEL_VAL))
- {
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
- *distortion = INT_MAX;
- return INT_MAX;
- }
-
// central mv
bestmv->as_mv.row <<= 3;
bestmv->as_mv.col <<= 3;
@@ -628,16 +617,6 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
unsigned int sse;
int thismse;
- // Trap uncodable vectors
- if ((abs((bestmv->as_mv.col << 3) - ref_mv->as_mv.col) > MAX_FULL_PEL_VAL)
- || (abs((bestmv->as_mv.row << 3) - ref_mv->as_mv.row) > MAX_FULL_PEL_VAL))
- {
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
- *distortion = INT_MAX;
- return INT_MAX;
- }
-
// central mv
bestmv->as_mv.row <<= 3;
bestmv->as_mv.col <<= 3;
@@ -1055,15 +1034,10 @@ int vp8_diamond_search_sad
in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col);
best_address = in_what;
- // We need to check that the starting point for the search (as indicated by ref_mv) is within the buffer limits
- if ((ref_col > x->mv_col_min) && (ref_col < x->mv_col_max) &&
- (ref_row > x->mv_row_min) && (ref_row < x->mv_row_max))
- {
- // Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what,
- in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
- }
+ // Check the starting position
+ bestsad = fn_ptr->sdf(what, what_stride, in_what,
+ in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number of iterations
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc.
@@ -1178,15 +1152,10 @@ int vp8_diamond_search_sadx4
in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col);
best_address = in_what;
- // We need to check that the starting point for the search (as indicated by ref_mv) is within the buffer limits
- if ((ref_col > x->mv_col_min) && (ref_col < x->mv_col_max) &&
- (ref_row > x->mv_row_min) && (ref_row < x->mv_row_max))
- {
- // Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride,
- in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
- }
+ // Check the starting position
+ bestsad = fn_ptr->sdf(what, what_stride,
+ in_what, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number of iterations
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc.
@@ -1329,17 +1298,10 @@ int vp8_full_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col;
- // We need to check that the starting point for the search (as indicated by ref_mv) is within the buffer limits
- if ((ref_col > x->mv_col_min) && (ref_col < x->mv_col_max) &&
- (ref_row > x->mv_row_min) && (ref_row < x->mv_row_max))
- {
- // Baseline value at the centre
-
- //bestsad = fn_ptr->sf( what,what_stride,bestaddress,in_what_stride) + (int)sqrt(mv_err_cost(ref_mv,ref_mv, mvcost,error_per_bit*14));
- bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
- in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
- }
+ // Baseline value at the centre
+ bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
+ in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border
if (col_min < x->mv_col_min)
@@ -1430,15 +1392,10 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col;
- // We need to check that the starting point for the search (as indicated by ref_mv) is within the buffer limits
- if ((ref_col > x->mv_col_min) && (ref_col < x->mv_col_max) &&
- (ref_row > x->mv_row_min) && (ref_row < x->mv_row_max))
- {
- // Baseline value at the centre
- bestsad = fn_ptr->sdf(what, what_stride,
- bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
- }
+ // Baseline value at the centre
+ bestsad = fn_ptr->sdf(what, what_stride,
+ bestaddress, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border
if (col_min < x->mv_col_min)
@@ -1566,15 +1523,10 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col;
- // We need to check that the starting point for the search (as indicated by ref_mv) is within the buffer limits
- if ((ref_col > x->mv_col_min) && (ref_col < x->mv_col_max) &&
- (ref_row > x->mv_row_min) && (ref_row < x->mv_row_max))
- {
- // Baseline value at the centre
- bestsad = fn_ptr->sdf(what, what_stride,
- bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
- }
+ // Baseline value at the centre
+ bestsad = fn_ptr->sdf(what, what_stride,
+ bestaddress, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border
if (col_min < x->mv_col_min)
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index cd250c425..9173272fc 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -290,7 +290,7 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
if (cpi->RDMULT < 7)
cpi->RDMULT = 7;
#endif
- cpi->mb.errorperbit = (cpi->RDMULT / 100);
+ cpi->mb.errorperbit = (cpi->RDMULT / 110);
cpi->mb.errorperbit += (cpi->mb.errorperbit==0);
#if CONFIG_EXTEND_QRANGE