summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
Diffstat (limited to 'vp8')
-rw-r--r--vp8/decoder/treereader.h23
-rw-r--r--vp8/encoder/bitstream.c13
-rw-r--r--vp8/encoder/firstpass.c65
-rw-r--r--vp8/encoder/mcomp.c7
-rw-r--r--vp8/encoder/mcomp.h1
-rw-r--r--vp8/encoder/onyx_if.c61
-rw-r--r--vp8/encoder/onyx_int.h4
-rw-r--r--vp8/encoder/pickinter.c2
-rw-r--r--vp8/encoder/ratectrl.c43
-rw-r--r--vp8/encoder/rdopt.c65
-rw-r--r--vp8/encoder/temporal_filter.c3
-rw-r--r--vp8/encoder/tokenize.c8
12 files changed, 178 insertions, 117 deletions
diff --git a/vp8/decoder/treereader.h b/vp8/decoder/treereader.h
index b50a4d2ff..238ff8536 100644
--- a/vp8/decoder/treereader.h
+++ b/vp8/decoder/treereader.h
@@ -38,27 +38,4 @@ static int vp8_treed_read(
return -i;
}
-
-/* Variant reads a binary number given distributions on each bit.
- Note that tree is arbitrary; probability of decoding a zero
- may or may not depend on previously decoded bits. */
-
-static int vp8_treed_read_num(
- vp8_reader *const r, /* !!! must return a 0 or 1 !!! */
- vp8_tree t,
- const vp8_prob *const p
-)
-{
- vp8_tree_index i = 0;
- int v = 0, b;
-
- do
- {
- b = vp8_read(r, p[i>>1]);
- v = (v << 1) + b;
- }
- while ((i = t[i+b]) > 0);
-
- return v;
-}
#endif /* tree_reader_h */
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index ced963559..e93d30d1a 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -776,9 +776,9 @@ static void write_mv_ref
vp8_writer *w, MB_PREDICTION_MODE m, const vp8_prob *p
)
{
-
+#if CONFIG_DEBUG
assert(NEARESTMV <= m && m <= SPLITMV);
-
+#endif
vp8_write_token(w, vp8_mv_ref_tree, p,
vp8_mv_ref_encoding_array - NEARESTMV + m);
}
@@ -788,8 +788,9 @@ static void write_sub_mv_ref
vp8_writer *w, B_PREDICTION_MODE m, const vp8_prob *p
)
{
+#if CONFIG_DEBUG
assert(LEFT4X4 <= m && m <= NEW4X4);
-
+#endif
vp8_write_token(w, vp8_sub_mv_ref_tree, p,
vp8_sub_mv_ref_encoding_array - LEFT4X4 + m);
}
@@ -1017,11 +1018,13 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
blockmode = cpi->mb.partition_info->bmi[j].mode;
blockmv = cpi->mb.partition_info->bmi[j].mv;
-
+#if CONFIG_DEBUG
while (j != L[++k])
if (k >= 16)
assert(0);
-
+#else
+ while (j != L[++k]);
+#endif
leftmv.as_int = left_block_mv(m, k);
abovemv.as_int = above_block_mv(m, k, mis);
mv_contz = vp8_mv_cont(&leftmv, &abovemv);
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 7b4869534..6bba5ecc3 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -243,33 +243,58 @@ static int frame_max_bits(VP8_COMP *cpi)
int max_bits;
// For CBR we need to also consider buffer fullness.
- // If we are running below the optimal level then we need to gradually tighten up on max_bits.
if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
{
- double buffer_fullness_ratio = (double)cpi->buffer_level / DOUBLE_DIVIDE_CHECK((double)cpi->oxcf.optimal_buffer_level);
+ max_bits = 2 * cpi->av_per_frame_bandwidth;
+ max_bits -= cpi->buffered_av_per_frame_bandwidth;
+ max_bits *= ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0);
+ }
+ // VBR
+ else
+ {
+ // For VBR base this on the bits and frames left plus the two_pass_vbrmax_section rate passed in by the user
+ max_bits = (int)(((double)cpi->twopass.bits_left / (cpi->twopass.total_stats->count - (double)cpi->common.current_video_frame)) * ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0));
+ }
+
+ // Trap case where we are out of bits
+ if (max_bits < 0)
+ max_bits = 0;
- // For CBR base this on the target average bits per frame plus the maximum sedction rate passed in by the user
- max_bits = (int)(cpi->av_per_frame_bandwidth * ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0));
+ return max_bits;
+}
- // If our buffer is below the optimum level
- if (buffer_fullness_ratio < 1.0)
- {
- // The lower of max_bits / 4 or cpi->av_per_frame_bandwidth / 4.
- int min_max_bits = ((cpi->av_per_frame_bandwidth >> 2) < (max_bits >> 2)) ? cpi->av_per_frame_bandwidth >> 2 : max_bits >> 2;
- max_bits = (int)(max_bits * buffer_fullness_ratio);
+static int gf_group_max_bits(VP8_COMP *cpi)
+{
+ // Max allocation for a golden frame group
+ int max_bits;
- if (max_bits < min_max_bits)
- max_bits = min_max_bits; // Lowest value we will set ... which should allow the buffer to refil.
+ // For CBR we need to also consider buffer fullness.
+ if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
+ {
+ max_bits = cpi->av_per_frame_bandwidth * cpi->baseline_gf_interval;
+ if (max_bits > cpi->oxcf.optimal_buffer_level)
+ {
+ max_bits -= cpi->oxcf.optimal_buffer_level;
+ max_bits += cpi->buffer_level;
}
+ else
+ {
+ max_bits -= (cpi->buffered_av_per_frame_bandwidth
+ - cpi->av_per_frame_bandwidth)
+ * cpi->baseline_gf_interval;
+ }
+
+ max_bits *= ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0);
}
- // VBR
else
{
// For VBR base this on the bits and frames left plus the two_pass_vbrmax_section rate passed in by the user
max_bits = (int)(((double)cpi->twopass.bits_left / (cpi->twopass.total_stats->count - (double)cpi->common.current_video_frame)) * ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0));
+ max_bits *= cpi->baseline_gf_interval;
}
+
// Trap case where we are out of bits
if (max_bits < 0)
max_bits = 0;
@@ -1362,7 +1387,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
double abs_mv_in_out_accumulator = 0.0;
double mod_err_per_mb_accumulator = 0.0;
- int max_bits = frame_max_bits(cpi); // Max for a single frame
+ int max_group_bits;
unsigned int allow_alt_ref =
cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames;
@@ -1715,8 +1740,9 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
cpi->twopass.gf_group_bits = (cpi->twopass.gf_group_bits < 0) ? 0 : (cpi->twopass.gf_group_bits > cpi->twopass.kf_group_bits) ? cpi->twopass.kf_group_bits : cpi->twopass.gf_group_bits;
// Clip cpi->twopass.gf_group_bits based on user supplied data rate variability limit (cpi->oxcf.two_pass_vbrmax_section)
- if (cpi->twopass.gf_group_bits > max_bits * cpi->baseline_gf_interval)
- cpi->twopass.gf_group_bits = max_bits * cpi->baseline_gf_interval;
+ max_group_bits = gf_group_max_bits(cpi);
+ if (cpi->twopass.gf_group_bits > max_group_bits)
+ cpi->twopass.gf_group_bits = max_group_bits;
// Reset the file position
reset_fpf_position(cpi, start_pos);
@@ -1810,13 +1836,6 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
}
}
- // Apply an additional limit for CBR
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- if (cpi->twopass.gf_bits > (cpi->buffer_level >> 1))
- cpi->twopass.gf_bits = cpi->buffer_level >> 1;
- }
-
// Dont allow a negative value for gf_bits
if (cpi->twopass.gf_bits < 0)
cpi->twopass.gf_bits = 0;
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
index 50c4745b1..d22fdb2e6 100644
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -842,7 +842,6 @@ int vp8_hex_search
int_mv *best_mv,
int search_param,
int sad_per_bit,
- int *num00,
const vp8_variance_fn_ptr_t *vfp,
int *mvsadcost[2],
int *mvcost[2],
@@ -996,12 +995,8 @@ cal_neighbors:
best_mv->as_mv.row = br;
best_mv->as_mv.col = bc;
- this_mv.as_mv.row = br<<3;
- this_mv.as_mv.col = bc<<3;
- this_offset = (unsigned char *)(*(d->base_pre) + d->pre + (br * (in_what_stride)) + bc);
- return vfp->vf(what, what_stride, this_offset, in_what_stride, &bestsad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit) ;
+ return bestsad;
}
#undef CHECK_BOUNDS
#undef CHECK_POINT
diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
index bf9fa6f76..44ed055db 100644
--- a/vp8/encoder/mcomp.h
+++ b/vp8/encoder/mcomp.h
@@ -40,7 +40,6 @@ extern int vp8_hex_search
int_mv *best_mv,
int search_param,
int error_per_bit,
- int *num00,
const vp8_variance_fn_ptr_t *vf,
int *mvsadcost[2],
int *mvcost[2],
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 0296d9290..bebc9417d 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1477,6 +1477,7 @@ static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
cpi->rolling_actual_bits = cpi->av_per_frame_bandwidth;
cpi->long_rolling_target_bits = cpi->av_per_frame_bandwidth;
cpi->long_rolling_actual_bits = cpi->av_per_frame_bandwidth;
+ cpi->buffered_av_per_frame_bandwidth = cpi->av_per_frame_bandwidth;
cpi->total_actual_bits = 0;
cpi->total_target_vs_actual = 0;
@@ -1572,7 +1573,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
break;
}
- if (cpi->pass == 0)
+ if (cpi->pass == 0 && cpi->oxcf.end_usage != USAGE_STREAM_FROM_SERVER)
cpi->auto_worst_q = 1;
cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
@@ -3453,7 +3454,8 @@ static void encode_frame_to_data_rate
// For CBR if the buffer reaches its maximum level then we can no longer
// save up bits for later frames so we might as well use them up
// on the current frame.
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
+ if (cpi->pass == 2
+ && (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
(cpi->buffer_level >= cpi->oxcf.optimal_buffer_level) && cpi->buffered_mode)
{
int Adjustment = cpi->active_worst_quality / 4; // Max adjustment is 1/4
@@ -3544,6 +3546,9 @@ static void encode_frame_to_data_rate
}
else
{
+ if(cpi->pass != 2)
+ Q = cpi->avg_frame_qindex;
+
cpi->active_best_quality = inter_minq[Q];
// For the constant/constrained quality mode we dont want
@@ -3845,15 +3850,16 @@ static void encode_frame_to_data_rate
(cpi->active_worst_quality < cpi->worst_quality) &&
(cpi->projected_frame_size > frame_over_shoot_limit))
{
- int over_size_percent = ((cpi->projected_frame_size - frame_over_shoot_limit) * 100) / frame_over_shoot_limit;
+ /* step down active_worst_quality such that the corresponding
+ * active_best_quality will be equal to the current
+ * active_worst_quality + 1
+ */
+ int i;
- // If so is there any scope for relaxing it
- while ((cpi->active_worst_quality < cpi->worst_quality) && (over_size_percent > 0))
- {
- cpi->active_worst_quality++;
- top_index = cpi->active_worst_quality;
- over_size_percent = (int)(over_size_percent * 0.96); // Assume 1 qstep = about 4% on frame size.
- }
+ for(i=cpi->active_worst_quality; i<cpi->worst_quality; i++)
+ if(inter_minq[i] >= cpi->active_worst_quality + 1)
+ break;
+ cpi->active_worst_quality = i;
// If we have updated the active max Q do not call vp8_update_rate_correction_factors() this loop.
active_worst_qchanged = TRUE;
@@ -4241,10 +4247,9 @@ static void encode_frame_to_data_rate
// Update the buffer level variable.
// Non-viewable frames are a special case and are treated as pure overhead.
- if ( !cm->show_frame )
- cpi->bits_off_target -= cpi->projected_frame_size;
- else
- cpi->bits_off_target += cpi->av_per_frame_bandwidth - cpi->projected_frame_size;
+ if ( cm->show_frame )
+ cpi->bits_off_target += cpi->av_per_frame_bandwidth;
+ cpi->bits_off_target -= cpi->projected_frame_size;
// Rolling monitors of whether we are over or underspending used to help regulate min and Max Q in two pass.
cpi->rolling_target_bits = ((cpi->rolling_target_bits * 3) + cpi->this_frame_target + 2) / 4;
@@ -4258,7 +4263,33 @@ static void encode_frame_to_data_rate
// Debug stats
cpi->total_target_vs_actual += (cpi->this_frame_target - cpi->projected_frame_size);
- cpi->buffer_level = cpi->bits_off_target;
+ // Update the buffered average bitrate
+ {
+ long long numerator;
+
+ numerator = cpi->oxcf.maximum_buffer_size
+ - cpi->buffered_av_per_frame_bandwidth
+ + cpi->projected_frame_size;
+ numerator *= cpi->buffered_av_per_frame_bandwidth;
+ cpi->buffered_av_per_frame_bandwidth = numerator
+ / cpi->oxcf.maximum_buffer_size;
+ }
+
+ {
+ long long tmp = (long long)cpi->buffered_av_per_frame_bandwidth
+ * cpi->oxcf.maximum_buffer_size
+ / cpi->av_per_frame_bandwidth;
+ cpi->buffer_level = cpi->oxcf.maximum_buffer_size
+ - tmp
+ + cpi->oxcf.optimal_buffer_level;
+ }
+
+ // Accumulate overshoot error.
+ cpi->accumulated_overshoot +=
+ (cpi->projected_frame_size > cpi->av_per_frame_bandwidth)
+ ? cpi->projected_frame_size - cpi->av_per_frame_bandwidth
+ : 0;
+
// Update bits left to the kf and gf groups to account for overshoot or undershoot on these frames
if (cm->frame_type == KEY_FRAME)
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 663786004..84ddeeba6 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -351,6 +351,10 @@ typedef struct VP8_COMP
int per_frame_bandwidth; // Current section per frame bandwidth target
int av_per_frame_bandwidth; // Average frame size target for clip
int min_frame_bandwidth; // Minimum allocation that should be used for any frame
+ int buffered_av_per_frame_bandwidth; // Average bitrate over the last buffer
+ int buffered_av_per_frame_bandwidth_rem; // Average bitrate remainder
+ int accumulated_overshoot; // Accumulated # of bits spent > target
+
int inter_frame_target;
double output_frame_rate;
long long last_time_stamp_seen;
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index e6716fac2..456059cf8 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -762,7 +762,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
if (cpi->sf.search_method == HEX)
{
bestsme = vp8_hex_search(x, b, d, &mvp, &d->bmi.mv, step_param,
- sadpb, &num00, &cpi->fn_ptr[BLOCK_16X16],
+ sadpb, &cpi->fn_ptr[BLOCK_16X16],
x->mvsadcost, x->mvcost, &best_ref_mv);
mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
}
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index 54c394dfc..73e1437b5 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -605,10 +605,10 @@ static void calc_gf_params(VP8_COMP *cpi)
static void calc_pframe_target_size(VP8_COMP *cpi)
{
- int min_frame_target;
+ int min_frame_target, max_frame_target;
int Adjustment;
- min_frame_target = 0;
+ min_frame_target = 1;
if (cpi->pass == 2)
{
@@ -616,10 +616,19 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
if (min_frame_target < (cpi->av_per_frame_bandwidth >> 5))
min_frame_target = cpi->av_per_frame_bandwidth >> 5;
+
+ max_frame_target = INT_MAX;
}
- else if (min_frame_target < cpi->per_frame_bandwidth / 4)
- min_frame_target = cpi->per_frame_bandwidth / 4;
+ else
+ {
+ if (min_frame_target < cpi->per_frame_bandwidth / 4)
+ min_frame_target = cpi->per_frame_bandwidth / 4;
+ /* Don't allow the target to completely deplete the buffer. */
+ max_frame_target = cpi->buffer_level + cpi->av_per_frame_bandwidth;
+ if(max_frame_target < min_frame_target)
+ max_frame_target = min_frame_target;
+ }
// Special alt reference frame case
if (cpi->common.refresh_alt_ref_frame)
@@ -1112,6 +1121,32 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
}
}
+
+ if (cpi->pass==0 && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER){
+ /* determine the accumulated error to apply to this frame. Apply
+ * more of the error when we've been undershooting, less when
+ * we've been overshooting
+ */
+ long long adjust;
+ int bitrate_error;
+
+ bitrate_error = cpi->av_per_frame_bandwidth
+ - cpi->buffered_av_per_frame_bandwidth;
+
+ adjust = cpi->accumulated_overshoot;
+ adjust *= cpi->av_per_frame_bandwidth + bitrate_error;
+ adjust /= cpi->oxcf.maximum_buffer_size;
+ if (adjust > (cpi->this_frame_target - min_frame_target))
+ adjust = (cpi->this_frame_target - min_frame_target);
+ else if (adjust < 0)
+ adjust = 0;
+
+ cpi->this_frame_target -= adjust;
+ cpi->accumulated_overshoot -= adjust;
+ }
+
+ if(cpi->this_frame_target > max_frame_target)
+ cpi->this_frame_target = max_frame_target;
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 95dbca002..ebfc438f7 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -155,51 +155,50 @@ static int rd_iifactor [ 32 ] = { 4, 4, 3, 2, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-
/* values are now correlated to quantizer */
static int sad_per_bit16lut[QINDEX_RANGE] =
{
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 6, 6,
- 6, 6, 6, 6, 6, 7, 7, 7,
- 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 9, 9,
- 9, 9, 9, 9, 10, 10, 10, 10,
- 10, 10, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 13,
- 13, 13, 13, 13, 13, 14, 14, 14,
- 14, 14, 15, 15, 15, 15, 15, 15,
- 16, 16, 16, 16, 16, 16, 17, 17,
- 17, 17, 17, 17, 17, 18, 18, 18,
- 18, 18, 19, 19, 19, 19, 19, 19,
- 20, 20, 20, 21, 21, 21, 21, 22,
- 22, 22, 23, 23, 23, 24, 24, 24,
- 25, 25, 26, 26, 27, 27, 27, 28,
- 28, 28, 29, 29, 30, 30, 31, 31
+ 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 10, 10,
+ 10, 10, 10, 10, 10, 10, 11, 11,
+ 11, 11, 11, 11, 12, 12, 12, 12,
+ 12, 12, 13, 13, 13, 13, 14, 14
};
static int sad_per_bit4lut[QINDEX_RANGE] =
{
- 5, 5, 5, 5, 5, 5, 7, 7,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 5, 5,
+ 5, 5, 5, 5, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 8, 8, 8,
- 8, 8, 8, 8, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 13, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 16, 16, 16, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 19, 19, 19,
- 19, 19, 20, 20, 20, 20, 20, 20,
- 22, 22, 22, 22, 22, 22, 23, 23,
- 23, 23, 23, 23, 23, 25, 25, 25,
- 25, 25, 26, 26, 26, 26, 26, 26,
- 28, 28, 28, 29, 29, 29, 29, 31,
- 31, 31, 32, 32, 32, 34, 34, 34,
- 35, 35, 37, 37, 38, 38, 38, 40,
- 40, 40, 41, 41, 43, 43, 44, 44,
+ 8, 8, 9, 9, 9, 9, 9, 9,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 13, 13, 13, 13, 13, 13, 13, 14,
+ 14, 14, 14, 14, 15, 15, 15, 15,
+ 16, 16, 16, 16, 17, 17, 17, 18,
+ 18, 18, 19, 19, 19, 20, 20, 20,
};
void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex)
{
- cpi->mb.sadperbit16 = sad_per_bit16lut[QIndex]/2;
- cpi->mb.sadperbit4 = sad_per_bit4lut[QIndex]/2;
+ cpi->mb.sadperbit16 = sad_per_bit16lut[QIndex];
+ cpi->mb.sadperbit4 = sad_per_bit4lut[QIndex];
}
void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
diff --git a/vp8/encoder/temporal_filter.c b/vp8/encoder/temporal_filter.c
index 2997f77d1..c1ca7d4ed 100644
--- a/vp8/encoder/temporal_filter.c
+++ b/vp8/encoder/temporal_filter.c
@@ -153,7 +153,6 @@ static int vp8_temporal_filter_find_matching_mb_c
int further_steps;
int sadpb = x->sadperbit16;
int bestsme = INT_MAX;
- int num00 = 0;
BLOCK *b = &x->block[0];
BLOCKD *d = &x->e_mbd.block[0];
@@ -201,7 +200,7 @@ static int vp8_temporal_filter_find_matching_mb_c
&best_ref_mv1, &d->bmi.mv,
step_param,
sadpb,
- &num00, &cpi->fn_ptr[BLOCK_16X16],
+ &cpi->fn_ptr[BLOCK_16X16],
mvsadcost, mvcost, &best_ref_mv1);
#if ALT_REF_SUBPEL_ENABLED
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index 1c5923813..210143280 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -120,9 +120,9 @@ static void tokenize2nd_order_b
{
int rc = vp8_default_zig_zag1d[c];
const int v = qcoeff_ptr[rc];
-
+#if CONFIG_DEBUG
assert(-DCT_MAX_VALUE <= v && v < (DCT_MAX_VALUE));
-
+#endif
t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
x = vp8_dct_value_tokens_ptr[v].Token;
}
@@ -173,9 +173,9 @@ static void tokenize1st_order_b
{
int rc = vp8_default_zig_zag1d[c];
const int v = qcoeff_ptr[rc];
-
+#if CONFIG_DEBUG
assert(-DCT_MAX_VALUE <= v && v < (DCT_MAX_VALUE));
-
+#endif
t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
x = vp8_dct_value_tokens_ptr[v].Token;
}