Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
libvpx
Commits
d71ba038
Commit
d71ba038
authored
Aug 17, 2012
by
Yaowu Xu
Browse files
silent compiling warnings for VC9 build
Change-Id: Iaa947e640f27e6f6eaf7d845f243536bca2df513
parent
2b59e14a
Changes
16
Hide whitespace changes
Inline
Side-by-side
libmkv/EbmlWriter.c
View file @
d71ba038
...
...
@@ -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 */
u
int64_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
)
...
...
nestegg/src/nestegg.c
View file @
d71ba038
...
...
@@ -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
;
}
...
...
vp8/decoder/dboolhuff.h
View file @
d71ba038
...
...
@@ -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) \
{ \
...
...
vp8/decoder/decodframe.c
View file @
d71ba038
...
...
@@ -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
)
{
...
...
vp8/encoder/bitstream.c
View file @
d71ba038
...
...
@@ -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
);
}
...
...
vp8/encoder/denoising.c
View file @
d71ba038
...
...
@@ -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
...
...
vp8/encoder/encodeframe.c
View file @
d71ba038
...
...
@@ -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
...
...
vp8/encoder/firstpass.c
View file @
d71ba038
...
...
@@ -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
*
int
64_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
;
int
64_t
opt_buffer_lvl
=
cpi
->
oxcf
.
optimal_buffer_level
;
int
64_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
+
int
64_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
)
{
...
...
vp8/encoder/onyx_if.c
View file @
d71ba038
...
...
@@ -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