summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/bitstream.c4
-rw-r--r--vp8/encoder/denoising.c5
-rw-r--r--vp8/encoder/encodeframe.c12
-rw-r--r--vp8/encoder/ethreading.c7
-rw-r--r--vp8/encoder/firstpass.c101
-rw-r--r--vp8/encoder/onyx_if.c189
-rw-r--r--vp8/encoder/onyx_int.h26
-rw-r--r--vp8/encoder/pickinter.c14
-rw-r--r--vp8/encoder/ratectrl.c23
-rw-r--r--vp8/encoder/rdopt.c2
10 files changed, 229 insertions, 154 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 92a7e067b..27991433b 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -397,7 +397,7 @@ static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data,
{
const TOKENEXTRA *p = cpi->tplist[mb_row].start;
const TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
- int tokens = stop - p;
+ int tokens = (int)(stop - p);
vp8_pack_tokens_c(w, p, tokens);
}
@@ -416,7 +416,7 @@ static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w)
{
const TOKENEXTRA *p = cpi->tplist[mb_row].start;
const TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
- int tokens = stop - p;
+ int tokens = (int)(stop - p);
vp8_pack_tokens_c(w, p, tokens);
}
diff --git a/vp8/encoder/denoising.c b/vp8/encoder/denoising.c
index 6bdd5c26e..d6b03e63a 100644
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -256,8 +256,9 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
mv_row = x->best_sse_mv.as_mv.row;
if (frame == INTRA_FRAME ||
- (mv_row *mv_row + mv_col *mv_col <= NOISE_MOTION_THRESHOLD &&
- sse_diff < SSE_DIFF_THRESHOLD))
+ ((unsigned int)(mv_row *mv_row + mv_col *mv_col)
+ <= NOISE_MOTION_THRESHOLD &&
+ sse_diff < (int)SSE_DIFF_THRESHOLD))
{
/*
* Handle intra blocks as referring to last frame with zero motion
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 7ff693cd6..600e815dd 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -523,10 +523,6 @@ void encode_mb_row(VP8_COMP *cpi,
#endif
- /* Count of last ref frame 0,0 usage */
- if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
- cpi->inter_zz_count ++;
-
/* Special case code for cyclic refresh
* If cyclic update enabled then copy xd->mbmi.segment_id; (which
* may have been updated based on mode during
@@ -721,9 +717,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
xd->subpixel_predict16x16 = vp8_bilinear_predict16x16;
}
- /* Reset frame count of inter 0,0 motion vector usage. */
- cpi->inter_zz_count = 0;
-
cpi->prediction_error = 0;
cpi->intra_error = 0;
cpi->skip_true_count = 0;
@@ -823,7 +816,8 @@ void vp8_encode_frame(VP8_COMP *cpi)
for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
{
- cpi->tok_count += cpi->tplist[mb_row].stop - cpi->tplist[mb_row].start;
+ cpi->tok_count += (unsigned int)
+ (cpi->tplist[mb_row].stop - cpi->tplist[mb_row].start);
}
if (xd->segmentation_enabled)
@@ -867,7 +861,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
x->src.v_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
}
- cpi->tok_count = tp - cpi->tok;
+ cpi->tok_count = (unsigned int)(tp - cpi->tok);
}
#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
index 919bc70a0..d92462b85 100644
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -59,8 +59,6 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data)
MB_ROW_COMP *mbri = (MB_ROW_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr2);
ENTROPY_CONTEXT_PLANES mb_row_left_context;
- const int nsync = cpi->mt_sync_range;
-
while (1)
{
if (cpi->b_multi_threaded == 0)
@@ -68,6 +66,7 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data)
if (sem_wait(&cpi->h_event_start_encoding[ithread]) == 0)
{
+ const int nsync = cpi->mt_sync_range;
VP8_COMMON *cm = &cpi->common;
int mb_row;
MACROBLOCK *x = &mbri->mb;
@@ -214,10 +213,6 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data)
#endif
- /* Count of last ref frame 0,0 usage */
- if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
- cpi->inter_zz_count++;
-
/* Special case code for cyclic refresh
* If cyclic update enabled then copy
* xd->mbmi.segment_id; (which may have been updated
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index c98544f71..b668c8f3b 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -798,8 +798,8 @@ skip_motion_search:
FIRSTPASS_STATS fps;
fps.frame = cm->current_video_frame ;
- fps.intra_error = intra_error >> 8;
- fps.coded_error = coded_error >> 8;
+ fps.intra_error = (double)(intra_error >> 8);
+ fps.coded_error = (double)(coded_error >> 8);
weight = simple_weight(cpi->Source);
@@ -841,8 +841,8 @@ skip_motion_search:
/* TODO: handle the case when duration is set to 0, or something less
* than the full time between subsequent cpi->source_time_stamps
*/
- fps.duration = cpi->source->ts_end
- - cpi->source->ts_start;
+ fps.duration = (double)(cpi->source->ts_end
+ - cpi->source->ts_start);
/* don't want to do output stats with a stack variable! */
memcpy(&cpi->twopass.this_frame_stats,
@@ -1030,7 +1030,8 @@ static int estimate_max_q(VP8_COMP *cpi,
/* Estimate of overhead bits per mb */
/* Correction to overhead bits for min allowed Q. */
overhead_bits_per_mb = overhead_bits / num_mbs;
- overhead_bits_per_mb *= pow( 0.98, (double)cpi->twopass.maxq_min_limit );
+ overhead_bits_per_mb = (int)(overhead_bits_per_mb *
+ pow( 0.98, (double)cpi->twopass.maxq_min_limit ));
/* Try and pick a max Q that will be high enough to encode the
* content at the given rate.
@@ -1073,7 +1074,7 @@ static int estimate_max_q(VP8_COMP *cpi,
* Give average a chance to settle though.
*/
if ( (cpi->ni_frames >
- ((unsigned int)cpi->twopass.total_stats.count >> 8)) &&
+ ((int)cpi->twopass.total_stats.count >> 8)) &&
(cpi->ni_frames > 150) )
{
cpi->twopass.maxq_max_limit = ((cpi->ni_av_qi + 32) < cpi->worst_quality)
@@ -1880,7 +1881,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
/* For cbr apply buffer related limits */
if (cpi->drop_frames_allowed)
{
- int df_buffer_level = cpi->oxcf.drop_frames_water_mark *
+ int64_t df_buffer_level = cpi->oxcf.drop_frames_water_mark *
(cpi->oxcf.optimal_buffer_level / 100);
if (cpi->buffer_level > df_buffer_level)
@@ -2043,8 +2044,8 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
* so it now points at the ARF frame.
*/
half_gf_int = cpi->baseline_gf_interval >> 1;
- frames_after_arf = cpi->twopass.total_stats.count -
- this_frame->frame - 1;
+ frames_after_arf = (int)(cpi->twopass.total_stats.count -
+ this_frame->frame - 1);
switch (cpi->oxcf.arnr_type)
{
@@ -2120,11 +2121,11 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
else
cpi->twopass.gf_group_bits = 0;
- cpi->twopass.gf_group_bits =
+ cpi->twopass.gf_group_bits = (int)(
(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;
+ ? 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)
@@ -2236,8 +2237,8 @@ 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;
+ if (cpi->twopass.gf_bits > (int)(cpi->buffer_level >> 1))
+ cpi->twopass.gf_bits = (int)(cpi->buffer_level >> 1);
}
/* Dont allow a negative value for gf_bits */
@@ -2260,7 +2261,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
{
/* Adjust KF group bits and error remainin */
- cpi->twopass.kf_group_error_left -= gf_group_err;
+ cpi->twopass.kf_group_error_left -= (int64_t)gf_group_err;
cpi->twopass.kf_group_bits -= cpi->twopass.gf_group_bits;
if (cpi->twopass.kf_group_bits < 0)
@@ -2272,9 +2273,10 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
* already happened)
*/
if (!cpi->source_alt_ref_pending && cpi->common.frame_type != KEY_FRAME)
- cpi->twopass.gf_group_error_left = gf_group_err - gf_first_frame_err;
+ cpi->twopass.gf_group_error_left = (int)(gf_group_err -
+ gf_first_frame_err);
else
- cpi->twopass.gf_group_error_left = gf_group_err;
+ cpi->twopass.gf_group_error_left = (int) gf_group_err;
cpi->twopass.gf_group_bits -= cpi->twopass.gf_bits - cpi->min_frame_bandwidth;
@@ -2330,9 +2332,9 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
avg_stats(&sectionstats);
- cpi->twopass.section_intra_rating =
- sectionstats.intra_error /
- DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
+ cpi->twopass.section_intra_rating = (unsigned int)
+ (sectionstats.intra_error /
+ DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
cpi->twopass.section_max_qfactor = 1.0 - ((Ratio - 10.0) * 0.025);
@@ -2381,7 +2383,7 @@ static void assign_std_frame_bits(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
}
/* Adjust error and bits remaining */
- cpi->twopass.gf_group_error_left -= modified_err;
+ cpi->twopass.gf_group_error_left -= (int)modified_err;
cpi->twopass.gf_group_bits -= target_frame_size;
if (cpi->twopass.gf_group_bits < 0)
@@ -2443,8 +2445,9 @@ void vp8_second_pass(VP8_COMP *cpi)
*/
if (cpi->oxcf.error_resilient_mode)
{
- cpi->twopass.gf_group_bits = cpi->twopass.kf_group_bits;
- cpi->twopass.gf_group_error_left = cpi->twopass.kf_group_error_left;
+ cpi->twopass.gf_group_bits = (int)cpi->twopass.kf_group_bits;
+ cpi->twopass.gf_group_error_left =
+ (int)cpi->twopass.kf_group_error_left;
cpi->baseline_gf_interval = cpi->twopass.frames_to_key;
cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
cpi->source_alt_ref_pending = 0;
@@ -2508,25 +2511,26 @@ void vp8_second_pass(VP8_COMP *cpi)
}
/* Keep a globally available copy of this and the next frame's iiratio. */
- cpi->twopass.this_iiratio = this_frame_intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame_coded_error);
+ cpi->twopass.this_iiratio = (unsigned int)(this_frame_intra_error /
+ DOUBLE_DIVIDE_CHECK(this_frame_coded_error));
{
FIRSTPASS_STATS next_frame;
if ( lookup_next_frame_stats(cpi, &next_frame) != EOF )
{
- cpi->twopass.next_iiratio = next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error);
+ cpi->twopass.next_iiratio = (unsigned int)(next_frame.intra_error /
+ DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
}
}
/* Set nominal per second bandwidth for this frame */
- cpi->target_bandwidth = cpi->per_frame_bandwidth * cpi->output_frame_rate;
+ cpi->target_bandwidth = (int)
+ (cpi->per_frame_bandwidth * cpi->output_frame_rate);
if (cpi->target_bandwidth < 0)
cpi->target_bandwidth = 0;
/* Account for mv, mode and other overheads. */
- overhead_bits = estimate_modemvcost(
+ overhead_bits = (int)estimate_modemvcost(
cpi, &cpi->twopass.total_left_stats );
/* Special case code for first frame. */
@@ -2899,15 +2903,15 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
/* Additional special case for CBR if buffer is getting full. */
if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
{
- int opt_buffer_lvl = cpi->oxcf.optimal_buffer_level;
- int buffer_lvl = cpi->buffer_level;
+ int64_t opt_buffer_lvl = cpi->oxcf.optimal_buffer_level;
+ int64_t buffer_lvl = cpi->buffer_level;
/* If the buffer is near or above the optimal and this kf group is
* not being allocated much then increase the allocation a bit.
*/
if (buffer_lvl >= opt_buffer_lvl)
{
- int high_water_mark = (opt_buffer_lvl +
+ int64_t high_water_mark = (opt_buffer_lvl +
cpi->oxcf.maximum_buffer_size) >> 1;
int64_t av_group_bits;
@@ -3005,9 +3009,9 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
avg_stats(&sectionstats);
- cpi->twopass.section_intra_rating =
- sectionstats.intra_error
- / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
+ cpi->twopass.section_intra_rating = (unsigned int)
+ (sectionstats.intra_error
+ / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
cpi->twopass.section_max_qfactor = 1.0 - ((Ratio - 10.0) * 0.025);
@@ -3023,7 +3027,8 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
if (cpi->drop_frames_allowed)
{
- int df_buffer_level = cpi->oxcf.drop_frames_water_mark * (cpi->oxcf.optimal_buffer_level / 100);
+ int df_buffer_level = (int)(cpi->oxcf.drop_frames_water_mark
+ * (cpi->oxcf.optimal_buffer_level / 100));
if (cpi->buffer_level > df_buffer_level)
max_boost = ((double)((cpi->buffer_level - df_buffer_level) * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
@@ -3049,7 +3054,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
/* Work out how many bits to allocate for the key frame itself */
if (1)
{
- int kf_boost = boost_score;
+ int kf_boost = (int)boost_score;
int allocation_chunks;
int Counter = cpi->twopass.frames_to_key;
int alt_kf_bits;
@@ -3125,8 +3130,8 @@ static void find_next_key_frame(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.kf_bits > ((3 * cpi->buffer_level) >> 2))
- cpi->twopass.kf_bits = (3 * cpi->buffer_level) >> 2;
+ if (cpi->twopass.kf_bits > (int)((3 * cpi->buffer_level) >> 2))
+ cpi->twopass.kf_bits = (int)((3 * cpi->buffer_level) >> 2);
}
/* If the key frame is actually easier than the average for the
@@ -3174,7 +3179,8 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
cpi->per_frame_bandwidth = cpi->twopass.kf_bits;
/* Convert to a per second bitrate */
- cpi->target_bandwidth = cpi->twopass.kf_bits * cpi->output_frame_rate;
+ cpi->target_bandwidth = (int)(cpi->twopass.kf_bits *
+ cpi->output_frame_rate);
}
/* Note the total error score of the kf group minus the key frame itself */
@@ -3195,7 +3201,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
int new_width = cpi->oxcf.Width;
int new_height = cpi->oxcf.Height;
- int projected_buffer_level = cpi->buffer_level;
+ int projected_buffer_level = (int)cpi->buffer_level;
int tmp_q;
double projected_bits_perframe;
@@ -3228,7 +3234,8 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
else
{
/* This accounts for how hard the section is... */
- bits_per_frame = cpi->twopass.kf_group_bits / cpi->twopass.frames_to_key;
+ bits_per_frame = (double)
+ (cpi->twopass.kf_group_bits / cpi->twopass.frames_to_key);
/* Dont turn to resampling in easy sections just because they
* have been assigned a small number of bits
@@ -3242,7 +3249,8 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
bits_per_frame = (cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
/* Work out if spatial resampling is necessary */
- kf_q = estimate_kf_group_q(cpi, err_per_frame, bits_per_frame, group_iiratio);
+ kf_q = estimate_kf_group_q(cpi, err_per_frame,
+ (int)bits_per_frame, group_iiratio);
/* If we project a required Q higher than the maximum allowed Q then
* make a guess at the actual size of frames in this section
@@ -3257,7 +3265,10 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
}
/* Guess at buffer level at the end of the section */
- projected_buffer_level = cpi->buffer_level - (int)((projected_bits_perframe - av_bits_per_frame) * cpi->twopass.frames_to_key);
+ projected_buffer_level = (int)
+ (cpi->buffer_level - (int)
+ ((projected_bits_perframe - av_bits_per_frame) *
+ cpi->twopass.frames_to_key));
if (0)
{
@@ -3326,7 +3337,9 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
/* Now try again and see what Q we get with the smaller
* image size
*/
- kf_q = estimate_kf_group_q(cpi, err_per_frame * effective_size_ratio, bits_per_frame, group_iiratio);
+ kf_q = estimate_kf_group_q(cpi,
+ err_per_frame * effective_size_ratio,
+ (int)bits_per_frame, group_iiratio);
if (0)
{
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 3e7087f5a..1d27ae017 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -555,7 +555,12 @@ static void set_default_lf_deltas(VP8_COMP *cpi)
cpi->mb.e_mbd.ref_lf_deltas[ALTREF_FRAME] = -2;
cpi->mb.e_mbd.mode_lf_deltas[0] = 4; /* BPRED */
- cpi->mb.e_mbd.mode_lf_deltas[1] = -2; /* Zero */
+
+ if(cpi->oxcf.Mode == MODE_REALTIME)
+ cpi->mb.e_mbd.mode_lf_deltas[1] = -12; /* Zero */
+ else
+ cpi->mb.e_mbd.mode_lf_deltas[1] = -2; /* Zero */
+
cpi->mb.e_mbd.mode_lf_deltas[2] = 2; /* New mv */
cpi->mb.e_mbd.mode_lf_deltas[3] = 4; /* Split mv */
}
@@ -1103,22 +1108,47 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
cpi->gf_update_recommended = 0;
- /* Structures used to minitor GF usage */
+ /* Structures used to monitor GF usage */
vpx_free(cpi->gf_active_flags);
CHECK_MEM_ERROR(cpi->gf_active_flags,
- vpx_calloc(1, cm->mb_rows * cm->mb_cols));
+ vpx_calloc(sizeof(*cpi->gf_active_flags),
+ cm->mb_rows * cm->mb_cols));
cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
vpx_free(cpi->mb_activity_map);
CHECK_MEM_ERROR(cpi->mb_activity_map,
- vpx_calloc(sizeof(unsigned int),
+ vpx_calloc(sizeof(*cpi->mb_activity_map),
cm->mb_rows * cm->mb_cols));
vpx_free(cpi->mb_norm_activity_map);
CHECK_MEM_ERROR(cpi->mb_norm_activity_map,
- vpx_calloc(sizeof(unsigned int),
+ vpx_calloc(sizeof(*cpi->mb_norm_activity_map),
cm->mb_rows * cm->mb_cols));
+ /* allocate memory for storing last frame's MVs for MV prediction. */
+ vpx_free(cpi->lfmv);
+ CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
+ sizeof(*cpi->lfmv)));
+ vpx_free(cpi->lf_ref_frame_sign_bias);
+ CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias,
+ vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
+ sizeof(*cpi->lf_ref_frame_sign_bias)));
+ vpx_free(cpi->lf_ref_frame);
+ CHECK_MEM_ERROR(cpi->lf_ref_frame,
+ vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
+ sizeof(*cpi->lf_ref_frame)));
+
+ /* Create the encoder segmentation map and set all entries to 0 */
+ vpx_free(cpi->segmentation_map);
+ CHECK_MEM_ERROR(cpi->segmentation_map,
+ vpx_calloc(cm->mb_rows * cm->mb_cols,
+ sizeof(*cpi->segmentation_map)));
+ vpx_free(cpi->active_map);
+ CHECK_MEM_ERROR(cpi->active_map,
+ vpx_calloc(cm->mb_rows * cm->mb_cols,
+ sizeof(*cpi->active_map)));
+ vpx_memset(cpi->active_map , 1, (cm->mb_rows * cm->mb_cols));
+
#if CONFIG_MULTITHREAD
if (width < 640)
cpi->mt_sync_range = 1;
@@ -1133,14 +1163,13 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
{
vpx_free(cpi->mt_current_mb_col);
CHECK_MEM_ERROR(cpi->mt_current_mb_col,
- vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
+ vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
}
#endif
vpx_free(cpi->tplist);
- CHECK_MEM_ERROR(cpi->tplist,
- vpx_malloc(sizeof(TOKENLIST) * cpi->common.mb_rows));
+ CHECK_MEM_ERROR(cpi->tplist, vpx_malloc(sizeof(TOKENLIST) * cm->mb_rows));
}
@@ -1211,7 +1240,7 @@ rescale(int val, int num, int denom)
int64_t llden = denom;
int64_t llval = val;
- return llval * llnum / llden;
+ return (int)(llval * llnum / llden);
}
@@ -1281,28 +1310,29 @@ static void init_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
lc->maximum_buffer_size_in_ms = oxcf->maximum_buffer_size;
lc->starting_buffer_level =
- rescale(oxcf->starting_buffer_level,
+ rescale((int)(oxcf->starting_buffer_level),
lc->target_bandwidth, 1000);
if (oxcf->optimal_buffer_level == 0)
lc->optimal_buffer_level = lc->target_bandwidth / 8;
else
lc->optimal_buffer_level =
- rescale(oxcf->optimal_buffer_level,
+ rescale((int)(oxcf->optimal_buffer_level),
lc->target_bandwidth, 1000);
if (oxcf->maximum_buffer_size == 0)
lc->maximum_buffer_size = lc->target_bandwidth / 8;
else
lc->maximum_buffer_size =
- rescale(oxcf->maximum_buffer_size,
+ rescale((int)oxcf->maximum_buffer_size,
lc->target_bandwidth, 1000);
/* Work out the average size of a frame within this layer */
if (i > 0)
- lc->avg_frame_size_for_layer = (cpi->oxcf.target_bitrate[i] -
- cpi->oxcf.target_bitrate[i-1]) * 1000 /
- (lc->frame_rate - prev_layer_frame_rate);
+ lc->avg_frame_size_for_layer =
+ (int)((cpi->oxcf.target_bitrate[i] -
+ cpi->oxcf.target_bitrate[i-1]) * 1000 /
+ (lc->frame_rate - prev_layer_frame_rate));
lc->active_worst_quality = cpi->oxcf.worst_allowed_q;
lc->active_best_quality = cpi->oxcf.best_allowed_q;
@@ -1318,7 +1348,7 @@ static void init_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
lc->rate_correction_factor = 1.0;
lc->key_frame_rate_correction_factor = 1.0;
lc->gf_rate_correction_factor = 1.0;
- lc->inter_frame_target = 0.0;
+ lc->inter_frame_target = 0;
prev_layer_frame_rate = lc->frame_rate;
}
@@ -1355,28 +1385,29 @@ static void update_layer_contexts (VP8_COMP *cpi)
lc->target_bandwidth = oxcf->target_bitrate[i] * 1000;
lc->starting_buffer_level = rescale(
- oxcf->starting_buffer_level_in_ms,
+ (int)oxcf->starting_buffer_level_in_ms,
lc->target_bandwidth, 1000);
if (oxcf->optimal_buffer_level == 0)
lc->optimal_buffer_level = lc->target_bandwidth / 8;
else
lc->optimal_buffer_level = rescale(
- oxcf->optimal_buffer_level_in_ms,
+ (int)oxcf->optimal_buffer_level_in_ms,
lc->target_bandwidth, 1000);
if (oxcf->maximum_buffer_size == 0)
lc->maximum_buffer_size = lc->target_bandwidth / 8;
else
lc->maximum_buffer_size = rescale(
- oxcf->maximum_buffer_size_in_ms,
+ (int)oxcf->maximum_buffer_size_in_ms,
lc->target_bandwidth, 1000);
/* Work out the average size of a frame within this layer */
if (i > 0)
- lc->avg_frame_size_for_layer = (oxcf->target_bitrate[i] -
- oxcf->target_bitrate[i-1]) * 1000 /
- (lc->frame_rate - prev_layer_frame_rate);
+ lc->avg_frame_size_for_layer =
+ (int)((oxcf->target_bitrate[i] -
+ oxcf->target_bitrate[i-1]) * 1000 /
+ (lc->frame_rate - prev_layer_frame_rate));
prev_layer_frame_rate = lc->frame_rate;
}
@@ -1549,7 +1580,7 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
cpi->oxcf.target_bandwidth *= 1000;
cpi->oxcf.starting_buffer_level =
- rescale(cpi->oxcf.starting_buffer_level,
+ rescale((int)cpi->oxcf.starting_buffer_level,
cpi->oxcf.target_bandwidth, 1000);
/* Set or reset optimal and maximum buffer levels. */
@@ -1557,14 +1588,14 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
else
cpi->oxcf.optimal_buffer_level =
- rescale(cpi->oxcf.optimal_buffer_level,
+ rescale((int)cpi->oxcf.optimal_buffer_level,
cpi->oxcf.target_bandwidth, 1000);
if (cpi->oxcf.maximum_buffer_size == 0)
cpi->oxcf.maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
else
cpi->oxcf.maximum_buffer_size =
- rescale(cpi->oxcf.maximum_buffer_size,
+ rescale((int)cpi->oxcf.maximum_buffer_size,
cpi->oxcf.target_bandwidth, 1000);
/* Set up frame rate and related parameters rate control values. */
@@ -1767,16 +1798,6 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->alt_is_last = 0 ;
cpi->gold_is_alt = 0 ;
- /* allocate memory for storing last frame's MVs for MV prediction. */
- CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int_mv)));
- CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int)));
- CHECK_MEM_ERROR(cpi->lf_ref_frame, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int)));
-
- /* Create the encoder segmentation map and set all entries to 0 */
- CHECK_MEM_ERROR(cpi->segmentation_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
-
- CHECK_MEM_ERROR(cpi->active_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
- vpx_memset(cpi->active_map , 1, (cpi->common.mb_rows * cpi->common.mb_cols));
cpi->active_map_enabled = 0;
#if 0
@@ -1910,7 +1931,7 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
else if (cpi->pass == 2)
{
size_t packet_sz = sizeof(FIRSTPASS_STATS);
- int packets = oxcf->two_pass_stats_in.sz / packet_sz;
+ int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
cpi->twopass.stats_in_start = oxcf->two_pass_stats_in.buf;
cpi->twopass.stats_in = cpi->twopass.stats_in_start;
@@ -2096,7 +2117,7 @@ void vp8_remove_compressor(VP8_COMP **ptr)
fprintf(f, "Layer\tBitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t"
"GLPsnrP\tVPXSSIM\t\n");
- for (i=0; i<cpi->oxcf.number_of_layers; i++)
+ for (i=0; i<(int)cpi->oxcf.number_of_layers; i++)
{
double dr = (double)cpi->bytes_in_layer[i] *
8.0 / 1000.0 / time_encoded;
@@ -2147,7 +2168,7 @@ void vp8_remove_compressor(VP8_COMP **ptr)
fprintf(f, "Layer\tBitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t"
"Time(us)\n");
- for (i=0; i<cpi->oxcf.number_of_layers; i++)
+ for (i=0; i<(int)cpi->oxcf.number_of_layers; i++)
{
double dr = (double)cpi->bytes_in_layer[i] *
8.0 / 1000.0 / time_encoded;
@@ -2455,7 +2476,7 @@ static void generate_psnr_packet(VP8_COMP *cpi)
for (i = 0; i < 4; i++)
pkt.data.psnr.psnr[i] = vp8_mse2psnr(pkt.data.psnr.samples[i], 255.0,
- pkt.data.psnr.sse[i]);
+ (double)(pkt.data.psnr.sse[i]));
vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
}
@@ -3277,7 +3298,8 @@ static void encode_frame_to_data_rate
int undershoot_seen = 0;
#endif
- int drop_mark = cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100;
+ int drop_mark = (int)(cpi->oxcf.drop_frames_water_mark *
+ cpi->oxcf.optimal_buffer_level / 100);
int drop_mark75 = drop_mark * 2 / 3;
int drop_mark50 = drop_mark / 4;
int drop_mark25 = drop_mark / 8;
@@ -3313,7 +3335,8 @@ static void encode_frame_to_data_rate
/* Per frame bit target for the alt ref frame */
cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
/* per second target bitrate */
- cpi->target_bandwidth = cpi->twopass.gf_bits * cpi->output_frame_rate;
+ cpi->target_bandwidth = (int)(cpi->twopass.gf_bits *
+ cpi->output_frame_rate);
}
}
else
@@ -3562,10 +3585,16 @@ static void encode_frame_to_data_rate
if (cpi->buffer_level < cpi->oxcf.maximum_buffer_size)
{
- buff_lvl_step = (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level) / Adjustment;
+ buff_lvl_step = (int)
+ ((cpi->oxcf.maximum_buffer_size -
+ cpi->oxcf.optimal_buffer_level) /
+ Adjustment);
if (buff_lvl_step)
- Adjustment = (cpi->buffer_level - cpi->oxcf.optimal_buffer_level) / buff_lvl_step;
+ Adjustment = (int)
+ ((cpi->buffer_level -
+ cpi->oxcf.optimal_buffer_level) /
+ buff_lvl_step);
else
Adjustment = 0;
}
@@ -3686,8 +3715,12 @@ static void encode_frame_to_data_rate
else if (cpi->buffer_level > cpi->oxcf.optimal_buffer_level)
{
- int Fraction = ((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128) / (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level);
- int min_qadjustment = ((cpi->active_best_quality - cpi->best_quality) * Fraction) / 128;
+ int Fraction = (int)
+ (((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128)
+ / (cpi->oxcf.maximum_buffer_size -
+ cpi->oxcf.optimal_buffer_level));
+ int min_qadjustment = ((cpi->active_best_quality -
+ cpi->best_quality) * Fraction) / 128;
cpi->active_best_quality -= min_qadjustment;
}
@@ -4265,6 +4298,30 @@ static void encode_frame_to_data_rate
}
}
+ /* Count last ref frame 0,0 usage on current encoded frame. */
+ {
+ int mb_row;
+ int mb_col;
+ /* Point to beginning of MODE_INFO arrays. */
+ MODE_INFO *tmp = cm->mi;
+
+ cpi->inter_zz_count = 0;
+
+ if(cm->frame_type != KEY_FRAME)
+ {
+ for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
+ {
+ for (mb_col = 0; mb_col < cm->mb_cols; mb_col ++)
+ {
+ if(tmp->mbmi.mode == ZEROMV && tmp->mbmi.ref_frame == LAST_FRAME)
+ cpi->inter_zz_count++;
+ tmp++;
+ }
+ tmp++;
+ }
+ }
+ }
+
#if CONFIG_MULTI_RES_ENCODING
vp8_cal_dissimilarity(cpi);
#endif
@@ -4448,8 +4505,9 @@ static void encode_frame_to_data_rate
for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++)
{
LAYER_CONTEXT *lc = &cpi->layer_context[i];
- int bits_off_for_this_layer = lc->target_bandwidth / lc->frame_rate
- - cpi->projected_frame_size;
+ int bits_off_for_this_layer =
+ (int)(lc->target_bandwidth / lc->frame_rate -
+ cpi->projected_frame_size);
lc->bits_off_target += bits_off_for_this_layer;
@@ -4985,7 +5043,8 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
- cpi->last_time_stamp_seen;
/* do a step update if the duration changes by 10% */
if (last_duration)
- step = ((this_duration - last_duration) * 10 / last_duration);
+ step = (int)(((this_duration - last_duration) *
+ 10 / last_duration));
}
if (this_duration)
@@ -5000,7 +5059,8 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
* frame rate. If we haven't seen 1 second yet, then average
* over the whole interval seen.
*/
- interval = cpi->source->ts_end - cpi->first_time_stamp_ever;
+ interval = (double)(cpi->source->ts_end -
+ cpi->first_time_stamp_ever);
if(interval > 10000000.0)
interval = 10000000;
@@ -5132,7 +5192,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
vpx_usec_timer_mark(&tsctimer);
vpx_usec_timer_mark(&ticktimer);
- duration = vpx_usec_timer_elapsed(&ticktimer);
+ duration = (int)(vpx_usec_timer_elapsed(&ticktimer));
duration2 = (unsigned int)((double)duration / 2);
if (cm->frame_type != KEY_FRAME)
@@ -5211,14 +5271,14 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
if (cpi->b_calculate_psnr)
{
- double ye,ue,ve;
+ uint64_t ye,ue,ve;
double frame_psnr;
YV12_BUFFER_CONFIG *orig = cpi->Source;
YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show;
int y_samples = orig->y_height * orig->y_width ;
int uv_samples = orig->uv_height * orig->uv_width ;
int t_samples = y_samples + 2 * uv_samples;
- int64_t sq_error, sq_error2;
+ double sq_error, sq_error2;
ye = calc_plane_error(orig->y_buffer, orig->y_stride,
recon->y_buffer, recon->y_stride, orig->y_width, orig->y_height);
@@ -5229,13 +5289,13 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
recon->v_buffer, recon->uv_stride, orig->uv_width, orig->uv_height);
- sq_error = ye + ue + ve;
+ sq_error = (double)(ye + ue + ve);
frame_psnr = vp8_mse2psnr(t_samples, 255.0, sq_error);
- cpi->total_y += vp8_mse2psnr(y_samples, 255.0, ye);
- cpi->total_u += vp8_mse2psnr(uv_samples, 255.0, ue);
- cpi->total_v += vp8_mse2psnr(uv_samples, 255.0, ve);
+ cpi->total_y += vp8_mse2psnr(y_samples, 255.0, (double)ye);
+ cpi->total_u += vp8_mse2psnr(uv_samples, 255.0, (double)ue);
+ cpi->total_v += vp8_mse2psnr(uv_samples, 255.0, (double)ve);
cpi->total_sq_error += sq_error;
cpi->total += frame_psnr;
#if CONFIG_POSTPROC
@@ -5256,13 +5316,16 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
pp->v_buffer, pp->uv_stride, orig->uv_width, orig->uv_height);
- sq_error2 = ye + ue + ve;
+ sq_error2 = (double)(ye + ue + ve);
frame_psnr2 = vp8_mse2psnr(t_samples, 255.0, sq_error2);
- cpi->totalp_y += vp8_mse2psnr(y_samples, 255.0, ye);
- cpi->totalp_u += vp8_mse2psnr(uv_samples, 255.0, ue);
- cpi->totalp_v += vp8_mse2psnr(uv_samples, 255.0, ve);
+ cpi->totalp_y += vp8_mse2psnr(y_samples,
+ 255.0, (double)ye);
+ cpi->totalp_u += vp8_mse2psnr(uv_samples,
+ 255.0, (double)ue);
+ cpi->totalp_v += vp8_mse2psnr(uv_samples,
+ 255.0, (double)ve);
cpi->total_sq_error2 += sq_error2;
cpi->totalp += frame_psnr2;
@@ -5274,7 +5337,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
if (cpi->oxcf.number_of_layers > 1)
{
- int i;
+ unsigned int i;
for (i=cpi->current_layer;
i<cpi->oxcf.number_of_layers; i++)
@@ -5302,7 +5365,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
if (cpi->oxcf.number_of_layers > 1)
{
- int i;
+ unsigned int i;
for (i=cpi->current_layer;
i<cpi->oxcf.number_of_layers; i++)
@@ -5410,7 +5473,7 @@ int vp8_set_roimap(VP8_COMP *cpi, unsigned char *map, unsigned int rows, unsigne
{
signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
int internal_delta_q[MAX_MB_SEGMENTS];
- const unsigned int range = 63;
+ const int range = 63;
int i;
// This method is currently incompatible with the cyclic refresh method
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 584cadae6..caccc60ae 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -236,17 +236,17 @@ typedef struct
int target_bandwidth;
/* Layer specific coding parameters */
- int starting_buffer_level;
- int optimal_buffer_level;
- int maximum_buffer_size;
- int starting_buffer_level_in_ms;
- int optimal_buffer_level_in_ms;
- int maximum_buffer_size_in_ms;
+ int64_t starting_buffer_level;
+ int64_t optimal_buffer_level;
+ int64_t maximum_buffer_size;
+ int64_t starting_buffer_level_in_ms;
+ int64_t optimal_buffer_level_in_ms;
+ int64_t maximum_buffer_size_in_ms;
int avg_frame_size_for_layer;
- int buffer_level;
- int bits_off_target;
+ int64_t buffer_level;
+ int64_t bits_off_target;
int64_t total_actual_bits;
int total_target_vs_actual;
@@ -431,7 +431,7 @@ typedef struct VP8_COMP
double frame_rate;
double ref_frame_rate;
int64_t buffer_level;
- int bits_off_target;
+ int64_t bits_off_target;
int rolling_target_bits;
int rolling_actual_bits;
@@ -569,10 +569,10 @@ typedef struct VP8_COMP
vp8_refining_search_fn_t refining_search_sad;
vp8_diamond_search_fn_t diamond_search_sad;
vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
- unsigned int time_receive_data;
- unsigned int time_compress_data;
- unsigned int time_pick_lpf;
- unsigned int time_encode_mb_row;
+ uint64_t time_receive_data;
+ uint64_t time_compress_data;
+ uint64_t time_pick_lpf;
+ uint64_t time_encode_mb_row;
int base_skip_false_prob[128];
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 77d9152eb..b67f04b85 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -151,7 +151,7 @@ static int pick_intra4x4block(
unsigned char *yleft = dst - 1;
unsigned char top_left = Above[-1];
- for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
+ for (mode = B_DC_PRED; mode <= B_HE_PRED; mode++)
{
int this_rd;
@@ -171,7 +171,7 @@ static int pick_intra4x4block(
}
}
- b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode);
+ b->bmi.as_mode = *best_mode;
vp8_encode_intra4x4block(x, ib);
return best_rd;
}
@@ -458,7 +458,15 @@ void get_lower_res_motion_info(VP8_COMP *cpi, MACROBLOCKD *xd, int *dissim,
static void check_for_encode_breakout(unsigned int sse, MACROBLOCK* x)
{
- if (sse < x->encode_breakout)
+ MACROBLOCKD *xd = &x->e_mbd;
+
+ unsigned int threshold = (xd->block[0].dequant[1]
+ * xd->block[0].dequant[1] >>4);
+
+ if(threshold < x->encode_breakout)
+ threshold = x->encode_breakout;
+
+ if (sse < threshold )
{
/* Check u and v to make sure skip is ok */
unsigned int sse2 = 0;
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index e1c8c4eb7..4dc078a1d 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -353,7 +353,7 @@ static void calc_iframe_target_size(VP8_COMP *cpi)
{
/* boost defaults to half second */
int kf_boost;
- unsigned int target;
+ uint64_t target;
/* Clear down mmx registers to allow floating point in what follows */
vp8_clear_system_state();
@@ -423,7 +423,7 @@ static void calc_iframe_target_size(VP8_COMP *cpi)
target = max_rate;
}
- cpi->this_frame_target = target;
+ cpi->this_frame_target = (int)target;
/* TODO: if we separate rate targeting from Q targetting, move this.
* Reset the active worst quality to the baseline value for key frames.
@@ -747,7 +747,8 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
/* Adapt target frame size with respect to any buffering constraints: */
if (cpi->buffered_mode)
{
- int one_percent_bits = 1 + cpi->oxcf.optimal_buffer_level / 100;
+ int one_percent_bits = (int)
+ (1 + cpi->oxcf.optimal_buffer_level / 100);
if ((cpi->buffer_level < cpi->oxcf.optimal_buffer_level) ||
(cpi->bits_off_target < cpi->oxcf.optimal_buffer_level))
@@ -764,9 +765,9 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
(cpi->buffer_level < cpi->oxcf.optimal_buffer_level))
{
- percent_low =
- (cpi->oxcf.optimal_buffer_level - cpi->buffer_level) /
- one_percent_bits;
+ percent_low = (int)
+ ((cpi->oxcf.optimal_buffer_level - cpi->buffer_level) /
+ one_percent_bits);
}
/* Are we overshooting the long term clip data rate... */
else if (cpi->bits_off_target < 0)
@@ -790,7 +791,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
*/
if (cpi->auto_worst_q && cpi->ni_frames > 150)
{
- int critical_buffer_level;
+ int64_t critical_buffer_level;
/* For streaming applications the most important factor is
* cpi->buffer_level as this takes into account the
@@ -841,7 +842,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
*/
cpi->active_worst_quality =
cpi->worst_quality -
- ((qadjustment_range * above_base) /
+ (int)((qadjustment_range * above_base) /
(cpi->oxcf.optimal_buffer_level*3>>2));
}
else
@@ -866,9 +867,9 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
&& (cpi->buffer_level > cpi->oxcf.optimal_buffer_level))
{
- percent_high = (cpi->buffer_level
+ percent_high = (int)((cpi->buffer_level
- cpi->oxcf.optimal_buffer_level)
- / one_percent_bits;
+ / one_percent_bits);
}
else if (cpi->bits_off_target > cpi->oxcf.optimal_buffer_level)
{
@@ -956,7 +957,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
/* Update the buffer level variable. */
cpi->bits_off_target += cpi->av_per_frame_bandwidth;
if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
- cpi->bits_off_target = cpi->oxcf.maximum_buffer_size;
+ cpi->bits_off_target = (int)cpi->oxcf.maximum_buffer_size;
cpi->buffer_level = cpi->bits_off_target;
}
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 005f26213..28d5c1ee8 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -694,7 +694,7 @@ static int rd_pick_intra4x4block(
vpx_memcpy(best_dqcoeff, b->dqcoeff, 32);
}
}
- b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode);
+ b->bmi.as_mode = *best_mode;
vp8_short_idct4x4llm(best_dqcoeff, best_predictor, 16, dst, dst_stride);