silent compiling warnings for VC9 build

Change-Id: Iaa947e640f27e6f6eaf7d845f243536bca2df513
This commit is contained in:
Yaowu Xu 2012-08-17 10:05:35 -07:00
Родитель 2b59e14a00
Коммит d71ba03822
16 изменённых файлов: 215 добавлений и 176 удалений

Просмотреть файл

@ -24,7 +24,7 @@ void Ebml_WriteLen(EbmlGlobal *glob, int64_t val)
unsigned char size = 8; /* size in bytes to output */
/* mask to compare for byte size */
uint64_t minVal = 0xff;
int64_t minVal = 0xff;
for (size = 1; size < 8; size ++)
{
@ -47,7 +47,7 @@ void Ebml_WriteString(EbmlGlobal *glob, const char *str)
/* TODO: it's not clear from the spec whether the nul terminator
* should be serialized too. For now we omit the null terminator.
*/
Ebml_Write(glob, str, size);
Ebml_Write(glob, str, (unsigned long)size);
}
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr)
@ -60,7 +60,7 @@ void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr)
const uint64_t size = strlen;
Ebml_WriteLen(glob, size);
Ebml_Write(glob, wstr, size);
Ebml_Write(glob, wstr, (unsigned long)size);
}
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id)

Просмотреть файл

@ -1272,7 +1272,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
if (total > block_size)
return -1;
entry = ne_find_track_entry(ctx, track - 1);
entry = ne_find_track_entry(ctx, (unsigned int)(track - 1));
if (!entry)
return -1;
@ -1291,7 +1291,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
pkt = ne_alloc(sizeof(*pkt));
pkt->track = track - 1;
pkt->timecode = abs_timecode * tc_scale * track_scale;
pkt->timecode = (uint64_t)(abs_timecode * tc_scale * track_scale);
ctx->log(ctx, NESTEGG_LOG_DEBUG, "%sblock t %lld pts %f f %llx frames: %llu",
block_id == ID_BLOCK ? "" : "simple", pkt->track, pkt->timecode / 1e9, flags, frames);
@ -1774,35 +1774,35 @@ nestegg_track_video_params(nestegg * ctx, unsigned int track,
if (ne_get_uint(entry->video.pixel_width, &value) != 0)
return -1;
params->width = value;
params->width = (unsigned int)value;
if (ne_get_uint(entry->video.pixel_height, &value) != 0)
return -1;
params->height = value;
params->height = (unsigned int)value;
value = 0;
ne_get_uint(entry->video.pixel_crop_bottom, &value);
params->crop_bottom = value;
params->crop_bottom = (unsigned int)value;
value = 0;
ne_get_uint(entry->video.pixel_crop_top, &value);
params->crop_top = value;
params->crop_top = (unsigned int)value;
value = 0;
ne_get_uint(entry->video.pixel_crop_left, &value);
params->crop_left = value;
params->crop_left = (unsigned int)value;
value = 0;
ne_get_uint(entry->video.pixel_crop_right, &value);
params->crop_right = value;
params->crop_right = (unsigned int)value;
value = params->width;
ne_get_uint(entry->video.display_width, &value);
params->display_width = value;
params->display_width = (unsigned int)value;
value = params->height;
ne_get_uint(entry->video.display_height, &value);
params->display_height = value;
params->display_height = (unsigned int)value;
return 0;
}
@ -1828,11 +1828,11 @@ nestegg_track_audio_params(nestegg * ctx, unsigned int track,
value = 1;
ne_get_uint(entry->audio.channels, &value);
params->channels = value;
params->channels = (unsigned int)value;
value = 16;
ne_get_uint(entry->audio.bit_depth, &value);
params->depth = value;
params->depth = (unsigned int)value;
return 0;
}
@ -1888,7 +1888,7 @@ nestegg_free_packet(nestegg_packet * pkt)
int
nestegg_packet_track(nestegg_packet * pkt, unsigned int * track)
{
*track = pkt->track;
*track = (unsigned int)pkt->track;
return 0;
}

Просмотреть файл

@ -55,7 +55,7 @@ void vp8dx_bool_decoder_fill(BOOL_DECODER *br);
int loop_end, x; \
size_t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
\
x = shift + CHAR_BIT - bits_left; \
x = (int)(shift + CHAR_BIT - bits_left); \
loop_end = 0; \
if(x >= 0) \
{ \

Просмотреть файл

@ -509,13 +509,13 @@ static unsigned int read_available_partition_size(
if (read_is_valid(partition_size_ptr, 3, first_fragment_end))
partition_size = read_partition_size(partition_size_ptr);
else if (pbi->ec_active)
partition_size = bytes_left;
partition_size = (unsigned int)bytes_left;
else
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
"Truncated partition size data");
}
else
partition_size = bytes_left;
partition_size = (unsigned int)bytes_left;
/* Validate the calculated partition length. If the buffer
* described by the partition can't be fully read, then restrict
@ -524,7 +524,7 @@ static unsigned int read_available_partition_size(
if (!read_is_valid(fragment_start, partition_size, fragment_end))
{
if (pbi->ec_active)
partition_size = bytes_left;
partition_size = (unsigned int)bytes_left;
else
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt partition "
@ -570,10 +570,10 @@ static void setup_token_decoder(VP8D_COMP *pbi,
/* Size of first partition + token partition sizes element */
ptrdiff_t ext_first_part_size = token_part_sizes -
pbi->fragments[0] + 3 * (num_token_partitions - 1);
fragment_size -= ext_first_part_size;
fragment_size -= (unsigned int)ext_first_part_size;
if (fragment_size > 0)
{
pbi->fragment_sizes[0] = ext_first_part_size;
pbi->fragment_sizes[0] = (unsigned int)ext_first_part_size;
/* The fragment contains an additional partition. Move to
* next. */
fragment_idx++;
@ -592,8 +592,8 @@ static void setup_token_decoder(VP8D_COMP *pbi,
fragment_end,
fragment_idx - 1,
num_token_partitions);
pbi->fragment_sizes[fragment_idx] = partition_size;
fragment_size -= partition_size;
pbi->fragment_sizes[fragment_idx] = (unsigned int)partition_size;
fragment_size -= (unsigned int)partition_size;
assert(fragment_idx <= num_token_partitions);
if (fragment_size > 0)
{
@ -859,7 +859,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
init_frame(pbi);
if (vp8dx_start_decode(bc, data, data_end - data))
if (vp8dx_start_decode(bc, data, (unsigned int)(data_end - data)))
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
if (pc->frame_type == KEY_FRAME) {

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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

Просмотреть файл

@ -823,7 +823,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 +868,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

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -1235,7 +1235,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);
}
@ -1305,28 +1305,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;
@ -1342,7 +1343,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;
}
@ -1379,28 +1380,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;
}
@ -1573,7 +1575,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. */
@ -1581,14 +1583,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. */
@ -1924,7 +1926,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;
@ -2110,7 +2112,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;
@ -2161,7 +2163,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;
@ -2469,7 +2471,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);
}
@ -3291,7 +3293,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;
@ -3327,7 +3330,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
@ -3576,10 +3580,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;
}
@ -3700,8 +3710,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;
}
@ -4462,8 +4476,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;
@ -5003,7 +5018,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)
@ -5018,7 +5034,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;
@ -5150,7 +5167,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)
@ -5229,14 +5246,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);
@ -5247,13 +5264,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
@ -5274,13 +5291,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;
@ -5292,7 +5312,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++)
@ -5320,7 +5340,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++)
@ -5428,7 +5448,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

Просмотреть файл

@ -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];

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -212,7 +212,8 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
if (cfg->g_pass == VPX_RC_LAST_PASS)
{
size_t packet_sz = sizeof(FIRSTPASS_STATS);
int n_packets = cfg->rc_twopass_stats_in.sz / packet_sz;
int n_packets = (int)(cfg->rc_twopass_stats_in.sz /
packet_sz);
FIRSTPASS_STATS *stats;
if (!cfg->rc_twopass_stats_in.buf)
@ -898,9 +899,9 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
pkt.data.frame.pts =
(dst_time_stamp * ctx->cfg.g_timebase.den + round)
/ ctx->cfg.g_timebase.num / 10000000;
pkt.data.frame.duration =
(delta * ctx->cfg.g_timebase.den + round)
/ ctx->cfg.g_timebase.num / 10000000;
pkt.data.frame.duration = (unsigned long)
((delta * ctx->cfg.g_timebase.den + round)
/ ctx->cfg.g_timebase.num / 10000000);
pkt.data.frame.flags = lib_flags << 16;
if (lib_flags & FRAMEFLAGS_KEY)

Просмотреть файл

@ -162,7 +162,7 @@ x86_readtsc(void)
return tsc;
#else
#if ARCH_X86_64
return __rdtsc();
return (unsigned int)__rdtsc();
#else
__asm rdtsc;
#endif

Просмотреть файл

@ -503,7 +503,7 @@ nestegg_seek_cb(int64_t offset, int whence, void * userdata)
case NESTEGG_SEEK_CUR: whence = SEEK_CUR; break;
case NESTEGG_SEEK_END: whence = SEEK_END; break;
};
return fseek(userdata, offset, whence)? -1 : 0;
return fseek(userdata, (long)offset, whence)? -1 : 0;
}
@ -560,7 +560,7 @@ webm_guess_framerate(struct input_ctx *input,
goto fail;
*fps_num = (i - 1) * 1000000;
*fps_den = tstamp / 1000;
*fps_den = (unsigned int)(tstamp / 1000);
return 0;
fail:
nestegg_destroy(input->nestegg_ctx);
@ -963,7 +963,8 @@ int main(int argc, const char **argv_)
That will have to wait until these tools support WebM natively.*/
sprintf(buffer, "YUV4MPEG2 C%s W%u H%u F%u:%u I%c\n",
"420jpeg", width, height, fps_num, fps_den, 'p');
out_put(out, (unsigned char *)buffer, strlen(buffer), do_md5);
out_put(out, (unsigned char *)buffer,
(unsigned int)strlen(buffer), do_md5);
}
/* Try to determine the codec from the fourcc. */
@ -1041,7 +1042,7 @@ int main(int argc, const char **argv_)
vpx_usec_timer_start(&timer);
if (vpx_codec_decode(&decoder, buf, buf_sz, NULL, 0))
if (vpx_codec_decode(&decoder, buf, (unsigned int)buf_sz, NULL, 0))
{
const char *detail = vpx_codec_error_detail(&decoder);
fprintf(stderr, "Failed to decode frame: %s\n", vpx_codec_error(&decoder));
@ -1053,7 +1054,7 @@ int main(int argc, const char **argv_)
}
vpx_usec_timer_mark(&timer);
dx_time += vpx_usec_timer_elapsed(&timer);
dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
++frame_in;

Просмотреть файл

@ -494,7 +494,7 @@ static void write_ivf_frame_header(FILE *outfile,
return;
pts = pkt->data.frame.pts;
mem_put_le32(header, pkt->data.frame.sz);
mem_put_le32(header, (int)pkt->data.frame.sz);
mem_put_le32(header + 4, pts & 0xFFFFFFFF);
mem_put_le32(header + 8, pts >> 32);
@ -504,7 +504,7 @@ static void write_ivf_frame_header(FILE *outfile,
static void write_ivf_frame_size(FILE *outfile, size_t size)
{
char header[4];
mem_put_le32(header, size);
mem_put_le32(header, (int)size);
(void) fwrite(header, 1, 4, outfile);
}
@ -559,7 +559,7 @@ void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len)
#define WRITE_BUFFER(s) \
for(i = len-1; i>=0; i--)\
{ \
x = *(const s *)buffer_in >> (i * CHAR_BIT); \
x = (char)(*(const s *)buffer_in >> (i * CHAR_BIT)); \
Ebml_Write(glob, &x, 1); \
}
void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, int buffer_size, unsigned long len)
@ -698,7 +698,7 @@ write_webm_seek_info(EbmlGlobal *ebml)
Ebml_StartSubElement(ebml, &startInfo, Info);
Ebml_SerializeUnsigned(ebml, TimecodeScale, 1000000);
Ebml_SerializeFloat(ebml, Segment_Duration,
ebml->last_pts_ms + frame_time);
(double)(ebml->last_pts_ms + frame_time));
Ebml_SerializeString(ebml, 0x4D80, version_string);
Ebml_SerializeString(ebml, 0x5741, version_string);
Ebml_EndSubElement(ebml, &startInfo);
@ -790,7 +790,7 @@ write_webm_block(EbmlGlobal *glob,
if(pts_ms - glob->cluster_timecode > SHRT_MAX)
start_cluster = 1;
else
block_timecode = pts_ms - glob->cluster_timecode;
block_timecode = (unsigned short)pts_ms - glob->cluster_timecode;
is_keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY);
if(start_cluster || is_keyframe)
@ -801,7 +801,7 @@ write_webm_block(EbmlGlobal *glob,
/* Open the new cluster */
block_timecode = 0;
glob->cluster_open = 1;
glob->cluster_timecode = pts_ms;
glob->cluster_timecode = (uint32_t)pts_ms;
glob->cluster_pos = ftello(glob->stream);
Ebml_StartSubElement(glob, &glob->startCluster, Cluster); /* cluster */
Ebml_SerializeUnsigned(glob, Timecode, glob->cluster_timecode);
@ -828,7 +828,7 @@ write_webm_block(EbmlGlobal *glob,
/* Write the Simple Block */
Ebml_WriteID(glob, SimpleBlock);
block_length = pkt->data.frame.sz + 4;
block_length = (unsigned long)pkt->data.frame.sz + 4;
block_length |= 0x10000000;
Ebml_Serialize(glob, &block_length, sizeof(block_length), 4);
@ -845,7 +845,7 @@ write_webm_block(EbmlGlobal *glob,
flags |= 0x08;
Ebml_Write(glob, &flags, 1);
Ebml_Write(glob, pkt->data.frame.buf, pkt->data.frame.sz);
Ebml_Write(glob, pkt->data.frame.buf, (unsigned long)pkt->data.frame.sz);
}
@ -1336,7 +1336,7 @@ static void show_histogram(const struct hist_bucket *bucket,
int j;
float pct;
pct = 100.0 * (float)bucket[i].count / (float)total;
pct = (float)(100.0 * bucket[i].count / total);
len = HIST_BAR_MAX * bucket[i].count / scale;
if(len < 1)
len = 1;
@ -1438,7 +1438,7 @@ static void update_rate_histogram(struct rate_hist *hist,
idx = hist->frames++ % hist->samples;
hist->pts[idx] = now;
hist->sz[idx] = pkt->data.frame.sz;
hist->sz[idx] = (int)pkt->data.frame.sz;
if(now < cfg->rc_buf_initial_sz)
return;
@ -1460,15 +1460,15 @@ static void update_rate_histogram(struct rate_hist *hist,
return;
avg_bitrate = sum_sz * 8 * 1000 / (now - then);
idx = avg_bitrate * (RATE_BINS/2) / (cfg->rc_target_bitrate * 1000);
idx = (int)(avg_bitrate * (RATE_BINS/2) / (cfg->rc_target_bitrate * 1000));
if(idx < 0)
idx = 0;
if(idx > RATE_BINS-1)
idx = RATE_BINS-1;
if(hist->bucket[idx].low > avg_bitrate)
hist->bucket[idx].low = avg_bitrate;
hist->bucket[idx].low = (int)avg_bitrate;
if(hist->bucket[idx].high < avg_bitrate)
hist->bucket[idx].high = avg_bitrate;
hist->bucket[idx].high = (int)avg_bitrate;
hist->bucket[idx].count++;
hist->total++;
}
@ -2011,7 +2011,7 @@ static void set_default_kf_interval(struct stream_state *stream,
{
double framerate = (double)global->framerate.num/global->framerate.den;
if (framerate > 0.0)
stream->config.cfg.kf_max_dist = 5.0*framerate;
stream->config.cfg.kf_max_dist = (unsigned int)(5.0*framerate);
}
}
@ -2191,7 +2191,7 @@ static void encode_frame(struct stream_state *stream,
/ cfg->g_timebase.num / global->framerate.num;
vpx_usec_timer_start(&timer);
vpx_codec_encode(&stream->encoder, img, frame_start,
next_frame_start - frame_start,
(unsigned long)(next_frame_start - frame_start),
0, global->deadline);
vpx_usec_timer_mark(&timer);
stream->cx_time += vpx_usec_timer_elapsed(&timer);
@ -2244,7 +2244,8 @@ static void get_cx_data(struct stream_state *stream,
/* Update the hash */
if(!stream->ebml.debug)
stream->hash = murmur(pkt->data.frame.buf,
pkt->data.frame.sz, stream->hash);
(int)pkt->data.frame.sz,
stream->hash);
write_webm_block(&stream->ebml, cfg, pkt);
}
@ -2317,8 +2318,8 @@ static void show_psnr(struct stream_state *stream)
return;
fprintf(stderr, "Stream %d PSNR (Overall/Avg/Y/U/V)", stream->index);
ovpsnr = vp8_mse2psnr(stream->psnr_samples_total, 255.0,
stream->psnr_sse_total);
ovpsnr = vp8_mse2psnr((double)stream->psnr_samples_total, 255.0,
(double)stream->psnr_sse_total);
fprintf(stderr, " %.3f", ovpsnr);
for (i = 0; i < 4; i++)
@ -2331,7 +2332,7 @@ static void show_psnr(struct stream_state *stream)
float usec_to_fps(uint64_t usec, unsigned int frames)
{
return usec > 0 ? (float)frames * 1000000.0 / (float)usec : 0;
return (float)(usec > 0 ? frames * 1000000.0 / (float)usec : 0);
}
@ -2495,7 +2496,7 @@ int main(int argc, const char **argv_)
frame_avail ? &raw : NULL,
frames_in));
vpx_usec_timer_mark(&timer);
cx_time += vpx_usec_timer_elapsed(&timer);
cx_time += (unsigned long)vpx_usec_timer_elapsed(&timer);
FOREACH_STREAM(update_quantizer_histogram(stream));

Просмотреть файл

@ -662,7 +662,7 @@ int y4m_input_open(y4m_input *_y4m,FILE *_fin,char *_skip,int _nskip){
_nskip--;
}
else{
ret=fread(buffer+i,1,1,_fin);
ret=(int)fread(buffer+i,1,1,_fin);
if(ret<1)return -1;
}
if(buffer[i]=='\n')break;
@ -818,7 +818,7 @@ int y4m_input_fetch_frame(y4m_input *_y4m,FILE *_fin,vpx_image_t *_img){
int c_sz;
int ret;
/*Read and skip the frame header.*/
ret=fread(frame,1,6,_fin);
ret=(int)fread(frame,1,6,_fin);
if(ret<6)return 0;
if(memcmp(frame,"FRAME",5)){
fprintf(stderr,"Loss of framing in Y4M input data\n");