Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
55f2f14f
Commit
55f2f14f
authored
Nov 06, 2012
by
Yaowu Xu
Committed by
Gerrit Code Review
Nov 06, 2012
Browse files
Options
Browse Files
Download
Plain Diff
Merge "silent a lot of MSVC compiler warnings" into experimental
parents
8ca1ed23
8a336b0d
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
125 additions
and
122 deletions
+125
-122
vp9/common/blockd.h
vp9/common/blockd.h
+1
-1
vp9/common/quant_common.c
vp9/common/quant_common.c
+3
-3
vp9/decoder/dboolhuff.h
vp9/decoder/dboolhuff.h
+1
-1
vp9/decoder/decodemv.c
vp9/decoder/decodemv.c
+4
-4
vp9/decoder/decodframe.c
vp9/decoder/decodframe.c
+4
-2
vp9/decoder/detokenize.c
vp9/decoder/detokenize.c
+7
-4
vp9/encoder/bitstream.c
vp9/encoder/bitstream.c
+0
-2
vp9/encoder/encodeframe.c
vp9/encoder/encodeframe.c
+3
-3
vp9/encoder/encodemv.c
vp9/encoder/encodemv.c
+1
-1
vp9/encoder/encodemv.h
vp9/encoder/encodemv.h
+2
-2
vp9/encoder/firstpass.c
vp9/encoder/firstpass.c
+49
-42
vp9/encoder/lookahead.c
vp9/encoder/lookahead.c
+4
-4
vp9/encoder/mbgraph.c
vp9/encoder/mbgraph.c
+3
-3
vp9/encoder/mcomp.c
vp9/encoder/mcomp.c
+3
-3
vp9/encoder/onyx_if.c
vp9/encoder/onyx_if.c
+18
-15
vp9/encoder/onyx_int.h
vp9/encoder/onyx_int.h
+6
-3
vp9/encoder/ratectrl.c
vp9/encoder/ratectrl.c
+2
-2
vp9/encoder/rdopt.c
vp9/encoder/rdopt.c
+10
-9
vp9/vp9_cx_iface.c
vp9/vp9_cx_iface.c
+4
-4
vpx_ports/x86.h
vpx_ports/x86.h
+0
-14
No files found.
vp9/common/blockd.h
View file @
55f2f14f
...
...
@@ -483,7 +483,7 @@ static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) {
static
TX_TYPE
get_tx_type
(
const
MACROBLOCKD
*
xd
,
const
BLOCKD
*
b
)
{
TX_TYPE
tx_type
=
DCT_DCT
;
int
ib
=
(
b
-
xd
->
block
);
int
ib
=
(
int
)
(
b
-
xd
->
block
);
if
(
ib
>=
16
)
return
tx_type
;
if
(
xd
->
mode_info_context
->
mbmi
.
txfm_size
==
TX_16X16
)
{
...
...
vp9/common/quant_common.c
View file @
55f2f14f
...
...
@@ -30,9 +30,9 @@ void vp9_init_quant_tables() {
last_val
=
current_val
;
ac_val
=
ac_qlookup
[
i
];
dc_qlookup
[
i
]
=
(
0
.
000000305
*
ac_val
*
ac_val
*
ac_val
)
+
(
-
0
.
00065
*
ac_val
*
ac_val
)
+
(
0
.
9
*
ac_val
)
+
0
.
5
;
dc_qlookup
[
i
]
=
(
int
)(
(
0
.
000000305
*
ac_val
*
ac_val
*
ac_val
)
+
(
-
0
.
00065
*
ac_val
*
ac_val
)
+
(
0
.
9
*
ac_val
)
+
0
.
5
)
;
if
(
dc_qlookup
[
i
]
<
ACDC_MIN
)
dc_qlookup
[
i
]
=
ACDC_MIN
;
}
...
...
vp9/decoder/dboolhuff.h
View file @
55f2f14f
...
...
@@ -56,7 +56,7 @@ int vp9_inv_recenter_nonneg(int v, int m);
{ \
int shift = VP9_BD_VALUE_SIZE - 8 - ((_count) + 8); \
int loop_end, x; \
size_
t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
in
t bits_left =
(int)(
((_bufend)-(_bufptr))*CHAR_BIT
)
; \
\
x = shift + CHAR_BIT - bits_left; \
loop_end = 0; \
...
...
vp9/decoder/decodemv.c
View file @
55f2f14f
...
...
@@ -654,7 +654,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
const
int
mis
=
pbi
->
common
.
mode_info_stride
;
MACROBLOCKD
*
const
xd
=
&
pbi
->
mb
;
int_mv
*
const
mv
=
&
mbmi
->
mv
;
int_mv
*
const
mv
=
&
mbmi
->
mv
[
0
]
;
int
mb_to_left_edge
;
int
mb_to_right_edge
;
int
mb_to_top_edge
;
...
...
@@ -1172,7 +1172,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
}
}
void
vp9_decode_mode_mvs_init
(
VP9D_COMP
*
pbi
,
BOOL_DECODER
*
const
bc
)
{
void
vp9_decode_mode_mvs_init
(
VP9D_COMP
*
const
pbi
,
BOOL_DECODER
*
const
bc
)
{
VP9_COMMON
*
cm
=
&
pbi
->
common
;
vpx_memset
(
cm
->
mbskip_pred_probs
,
0
,
sizeof
(
cm
->
mbskip_pred_probs
));
...
...
@@ -1184,8 +1184,8 @@ void vp9_decode_mode_mvs_init(VP9D_COMP *pbi, BOOL_DECODER* const bc) {
mb_mode_mv_init
(
pbi
,
bc
);
}
void
vp9_decode_mb_mode_mv
(
VP9D_COMP
*
pbi
,
MACROBLOCKD
*
xd
,
void
vp9_decode_mb_mode_mv
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
int
mb_row
,
int
mb_col
,
BOOL_DECODER
*
const
bc
)
{
...
...
vp9/decoder/decodframe.c
View file @
55f2f14f
...
...
@@ -729,7 +729,8 @@ static void setup_token_decoder(VP9D_COMP *pbi,
"%d length"
,
1
);
}
if
(
vp9_start_decode
(
bool_decoder
,
partition
,
partition_size
))
if
(
vp9_start_decode
(
bool_decoder
,
partition
,
(
unsigned
int
)
partition_size
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate bool decoder %d"
,
1
);
}
...
...
@@ -986,7 +987,8 @@ int vp9_decode_frame(VP9D_COMP *pbi) {
init_frame
(
pbi
);
if
(
vp9_start_decode
(
&
header_bc
,
data
,
first_partition_length_in_bytes
))
if
(
vp9_start_decode
(
&
header_bc
,
data
,
(
unsigned
int
)
first_partition_length_in_bytes
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate bool decoder 0"
);
if
(
pc
->
frame_type
==
KEY_FRAME
)
{
...
...
vp9/decoder/detokenize.c
View file @
55f2f14f
...
...
@@ -98,7 +98,7 @@ DECLARE_ALIGNED(16, static const int, coef_bands_x_16x16[256]) = {
static
const
unsigned
char
cat6_prob
[
14
]
=
{
254
,
254
,
252
,
249
,
243
,
230
,
196
,
177
,
153
,
140
,
133
,
130
,
129
,
0
};
void
vp9_reset_mb_tokens_context
(
MACROBLOCKD
*
xd
)
{
void
vp9_reset_mb_tokens_context
(
MACROBLOCKD
*
const
xd
)
{
/* Clear entropy contexts for Y2 blocks */
if
((
xd
->
mode_info_context
->
mbmi
.
mode
!=
B_PRED
&&
xd
->
mode_info_context
->
mbmi
.
mode
!=
I8X8_PRED
&&
...
...
@@ -414,7 +414,8 @@ SKIP_START:
return
c
;
}
int
vp9_decode_mb_tokens_16x16
(
VP9D_COMP
*
pbi
,
MACROBLOCKD
*
xd
,
int
vp9_decode_mb_tokens_16x16
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
ENTROPY_CONTEXT
*
const
A
=
(
ENTROPY_CONTEXT
*
)
xd
->
above_context
;
ENTROPY_CONTEXT
*
const
L
=
(
ENTROPY_CONTEXT
*
)
xd
->
left_context
;
...
...
@@ -477,7 +478,8 @@ int vp9_decode_mb_tokens_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
return
eobtotal
;
}
int
vp9_decode_mb_tokens_8x8
(
VP9D_COMP
*
pbi
,
MACROBLOCKD
*
xd
,
int
vp9_decode_mb_tokens_8x8
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
ENTROPY_CONTEXT
*
const
A
=
(
ENTROPY_CONTEXT
*
)
xd
->
above_context
;
ENTROPY_CONTEXT
*
const
L
=
(
ENTROPY_CONTEXT
*
)
xd
->
left_context
;
...
...
@@ -571,7 +573,8 @@ int vp9_decode_mb_tokens_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
}
int
vp9_decode_mb_tokens
(
VP9D_COMP
*
dx
,
MACROBLOCKD
*
xd
,
int
vp9_decode_mb_tokens
(
VP9D_COMP
*
const
dx
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
ENTROPY_CONTEXT
*
const
A
=
(
ENTROPY_CONTEXT
*
)
xd
->
above_context
;
ENTROPY_CONTEXT
*
const
L
=
(
ENTROPY_CONTEXT
*
)
xd
->
left_context
;
...
...
vp9/encoder/bitstream.c
View file @
55f2f14f
...
...
@@ -218,7 +218,6 @@ static void update_switchable_interp_probs(VP9_COMP *cpi,
static
void
update_refpred_stats
(
VP9_COMP
*
cpi
)
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
int
i
;
int
tot_count
;
vp9_prob
new_pred_probs
[
PREDICTION_PROBS
];
int
old_cost
,
new_cost
;
...
...
@@ -884,7 +883,6 @@ static void update_ref_probs(VP9_COMP *const cpi) {
}
static
void
pack_inter_mode_mvs
(
VP9_COMP
*
const
cpi
,
vp9_writer
*
const
bc
)
{
int
i
;
VP9_COMMON
*
const
pc
=
&
cpi
->
common
;
const
nmv_context
*
nmvc
=
&
pc
->
fc
.
nmvc
;
MACROBLOCK
*
x
=
&
cpi
->
mb
;
...
...
vp9/encoder/encodeframe.c
View file @
55f2f14f
...
...
@@ -1390,7 +1390,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
x
->
src
.
v_buffer
+=
16
*
x
->
src
.
uv_stride
-
8
*
offset
;
}
cpi
->
tok_count
=
tp
-
cpi
->
tok
;
cpi
->
tok_count
=
(
unsigned
int
)(
tp
-
cpi
->
tok
)
;
}
vpx_usec_timer_mark
(
&
emr_timer
);
...
...
@@ -1578,7 +1578,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
encode_frame_internal
(
cpi
);
for
(
i
=
0
;
i
<
NB_PREDICTION_TYPES
;
++
i
)
{
const
int
diff
=
cpi
->
rd_comp_pred_diff
[
i
]
/
cpi
->
common
.
MBs
;
const
int
diff
=
(
int
)(
cpi
->
rd_comp_pred_diff
[
i
]
/
cpi
->
common
.
MBs
)
;
cpi
->
rd_prediction_type_threshes
[
frame_type
][
i
]
+=
diff
;
cpi
->
rd_prediction_type_threshes
[
frame_type
][
i
]
>>=
1
;
}
...
...
@@ -1588,7 +1588,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
int
diff
;
if
(
i
==
TX_MODE_SELECT
)
pd
-=
RDCOST
(
cpi
->
mb
.
rdmult
,
cpi
->
mb
.
rddiv
,
2048
*
(
TX_SIZE_MAX
-
1
),
0
);
diff
=
pd
/
cpi
->
common
.
MBs
;
diff
=
(
int
)(
pd
/
cpi
->
common
.
MBs
)
;
cpi
->
rd_tx_select_threshes
[
frame_type
][
i
]
+=
diff
;
cpi
->
rd_tx_select_threshes
[
frame_type
][
i
]
/=
2
;
}
...
...
vp9/encoder/encodemv.c
View file @
55f2f14f
...
...
@@ -168,7 +168,7 @@ static int update_nmv_savings(const unsigned int ct[2],
if
(
cur_b
-
mod_b
-
cost
>
0
)
{
return
cur_b
-
mod_b
-
cost
;
}
else
{
return
-
vp9_cost_zero
(
upd_p
);
return
0
-
vp9_cost_zero
(
upd_p
);
}
}
...
...
vp9/encoder/encodemv.h
View file @
55f2f14f
...
...
@@ -18,11 +18,11 @@ void vp9_write_nmvprobs(VP9_COMP* const, int usehp, vp9_writer* const);
void
vp9_encode_nmv
(
vp9_writer
*
const
w
,
const
MV
*
const
mv
,
const
MV
*
const
ref
,
const
nmv_context
*
const
mvctx
);
void
vp9_encode_nmv_fp
(
vp9_writer
*
const
w
,
const
MV
*
const
mv
,
const
MV
*
const
ref
,
const
nmv_context
*
mvctx
,
const
MV
*
const
ref
,
const
nmv_context
*
const
mvctx
,
int
usehp
);
void
vp9_build_nmv_cost_table
(
int
*
mvjoint
,
int
*
mvcost
[
2
],
const
nmv_context
*
mvctx
,
const
nmv_context
*
const
mvctx
,
int
usehp
,
int
mvc_flag_v
,
int
mvc_flag_h
);
...
...
vp9/encoder/firstpass.c
View file @
55f2f14f
...
...
@@ -696,9 +696,9 @@ void vp9_first_pass(VP9_COMP *cpi) {
FIRSTPASS_STATS
fps
;
fps
.
frame
=
cm
->
current_video_frame
;
fps
.
intra_error
=
intra_error
>>
8
;
fps
.
coded_error
=
coded_error
>>
8
;
fps
.
sr_coded_error
=
sr_coded_error
>>
8
;
fps
.
intra_error
=
(
double
)(
intra_error
>>
8
)
;
fps
.
coded_error
=
(
double
)(
coded_error
>>
8
)
;
fps
.
sr_coded_error
=
(
double
)(
sr_coded_error
>>
8
)
;
weight
=
simple_weight
(
cpi
->
Source
);
...
...
@@ -738,8 +738,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
// TODO: handle the case when duration is set to 0, or something less
// than the full time between subsequent cpi->source_time_stamp s .
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
,
...
...
@@ -901,7 +901,7 @@ static int estimate_max_q(VP9_COMP *cpi,
double
err_per_mb
=
section_err
/
num_mbs
;
double
err_correction_factor
;
double
speed_correction
=
1
.
0
;
int
overhead_bits_per_mb
;
double
overhead_bits_per_mb
;
if
(
section_target_bandwitdh
<=
0
)
return
cpi
->
twopass
.
maxq_max_limit
;
// Highest value allowed
...
...
@@ -976,7 +976,7 @@ static int estimate_max_q(VP9_COMP *cpi,
err_correction_factor
=
5
.
0
;
bits_per_mb_at_this_q
=
vp9_bits_per_mb
(
INTER_FRAME
,
Q
)
+
overhead_bits_per_mb
;
vp9_bits_per_mb
(
INTER_FRAME
,
Q
)
+
(
int
)
overhead_bits_per_mb
;
bits_per_mb_at_this_q
=
(
int
)(.
5
+
err_correction_factor
*
(
double
)
bits_per_mb_at_this_q
);
...
...
@@ -1003,7 +1003,7 @@ static int estimate_max_q(VP9_COMP *cpi,
// Give average a chance to settle though.
// PGW TODO.. This code is broken for the extended Q range
if
((
cpi
->
ni_frames
>
((
unsigned
int
)
cpi
->
twopass
.
total_stats
->
count
>>
8
))
&&
((
int
)
cpi
->
twopass
.
total_stats
->
count
>>
8
))
&&
(
cpi
->
ni_frames
>
150
))
{
adjust_maxq_qrange
(
cpi
);
}
...
...
@@ -1029,7 +1029,7 @@ static int estimate_cq(VP9_COMP *cpi,
double
speed_correction
=
1
.
0
;
double
clip_iiratio
;
double
clip_iifactor
;
int
overhead_bits_per_mb
;
double
overhead_bits_per_mb
;
target_norm_bits_per_mb
=
(
section_target_bandwitdh
<
(
1
<<
20
))
...
...
@@ -1082,7 +1082,7 @@ static int estimate_cq(VP9_COMP *cpi,
err_correction_factor
=
5
.
0
;
bits_per_mb_at_this_q
=
vp9_bits_per_mb
(
INTER_FRAME
,
Q
)
+
overhead_bits_per_mb
;
vp9_bits_per_mb
(
INTER_FRAME
,
Q
)
+
(
int
)
overhead_bits_per_mb
;
bits_per_mb_at_this_q
=
(
int
)(.
5
+
err_correction_factor
*
(
double
)
bits_per_mb_at_this_q
);
...
...
@@ -1417,7 +1417,7 @@ static int calc_arf_boost(
calc_frame_boost
(
cpi
,
&
this_frame
,
this_frame_mv_in_out
));
}
*
f_boost
=
boost_score
;
*
f_boost
=
(
int
)
boost_score
;
// Reset for backward looking loop
boost_score
=
0
.
0
;
...
...
@@ -1455,7 +1455,7 @@ static int calc_arf_boost(
calc_frame_boost
(
cpi
,
&
this_frame
,
this_frame_mv_in_out
));
}
*
b_boost
=
boost_score
;
*
b_boost
=
(
int
)
boost_score
;
arf_boost
=
(
*
f_boost
+
*
b_boost
);
if
(
arf_boost
<
((
b_frames
+
f_frames
)
*
20
))
...
...
@@ -1477,8 +1477,8 @@ static void configure_arnr_filter(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Note: this_frame->frame has been updated in the loop
// 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
)
{
case
1
:
// Backward filter
...
...
@@ -1701,7 +1701,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
(
cpi
->
twopass
.
kf_group_error_left
>
0
))
{
cpi
->
twopass
.
gf_group_bits
=
(
int
)((
double
)
cpi
->
twopass
.
kf_group_bits
*
(
gf_group_err
/
(
double
)
cpi
->
twopass
.
kf_group_error_left
));
(
gf_group_err
/
cpi
->
twopass
.
kf_group_error_left
));
}
else
cpi
->
twopass
.
gf_group_bits
=
0
;
...
...
@@ -1767,7 +1767,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
alt_gf_grp_bits
=
(
double
)
cpi
->
twopass
.
kf_group_bits
*
(
mod_frame_err
*
(
double
)
cpi
->
baseline_gf_interval
)
/
DOUBLE_DIVIDE_CHECK
(
(
double
)
cpi
->
twopass
.
kf_group_error_left
);
DOUBLE_DIVIDE_CHECK
(
cpi
->
twopass
.
kf_group_error_left
);
alt_gf_bits
=
(
int
)((
double
)
boost
*
(
alt_gf_grp_bits
/
(
double
)
allocation_chunks
));
...
...
@@ -1783,7 +1783,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
int
alt_gf_bits
=
(
int
)((
double
)
cpi
->
twopass
.
kf_group_bits
*
mod_frame_err
/
DOUBLE_DIVIDE_CHECK
(
(
double
)
cpi
->
twopass
.
kf_group_error_left
));
DOUBLE_DIVIDE_CHECK
(
cpi
->
twopass
.
kf_group_error_left
));
if
(
alt_gf_bits
>
gf_bits
)
{
gf_bits
=
alt_gf_bits
;
...
...
@@ -1806,7 +1806,7 @@ static void define_gf_group(VP9_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
)
...
...
@@ -1817,9 +1817,10 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// of the group (except in Key frame case where this has 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
=
(
int64_t
)(
gf_group_err
-
gf_first_frame_err
);
else
cpi
->
twopass
.
gf_group_error_left
=
gf_group_err
;
cpi
->
twopass
.
gf_group_error_left
=
(
int64_t
)
gf_group_err
;
cpi
->
twopass
.
gf_group_bits
-=
cpi
->
twopass
.
gf_bits
-
cpi
->
min_frame_bandwidth
;
...
...
@@ -1839,8 +1840,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
pct_extra
=
(
boost
-
100
)
/
50
;
pct_extra
=
(
pct_extra
>
20
)
?
20
:
pct_extra
;
cpi
->
twopass
.
alt_extra_bits
=
(
cpi
->
twopass
.
gf_group_bits
*
pct_extra
)
/
100
;
cpi
->
twopass
.
alt_extra_bits
=
(
int
)
(
(
cpi
->
twopass
.
gf_group_bits
*
pct_extra
)
/
100
)
;
cpi
->
twopass
.
gf_group_bits
-=
cpi
->
twopass
.
alt_extra_bits
;
cpi
->
twopass
.
alt_extra_bits
/=
((
cpi
->
baseline_gf_interval
-
1
)
>>
1
);
...
...
@@ -1863,9 +1864,9 @@ static void define_gf_group(VP9_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
=
(
int
)
(
sectionstats
.
intra_error
/
DOUBLE_DIVIDE_CHECK
(
sectionstats
.
coded_error
)
)
;
reset_fpf_position
(
cpi
,
start_pos
);
}
...
...
@@ -1898,10 +1899,11 @@ static void assign_std_frame_bits(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
target_frame_size
=
max_bits
;
if
(
target_frame_size
>
cpi
->
twopass
.
gf_group_bits
)
target_frame_size
=
cpi
->
twopass
.
gf_group_bits
;
target_frame_size
=
(
int
)
cpi
->
twopass
.
gf_group_bits
;
}
cpi
->
twopass
.
gf_group_error_left
-=
modified_err
;
// Adjust error remaining
// Adjust error remaining
cpi
->
twopass
.
gf_group_error_left
-=
(
int64_t
)
modified_err
;
cpi
->
twopass
.
gf_group_bits
-=
target_frame_size
;
// Adjust bits remaining
if
(
cpi
->
twopass
.
gf_group_bits
<
0
)
...
...
@@ -2010,25 +2012,26 @@ void vp9_second_pass(VP9_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
=
(
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
=
(
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
(
cpi
,
cpi
->
twopass
.
total_left_stats
);
overhead_bits
=
(
int
)
estimate_modemvcost
(
cpi
,
cpi
->
twopass
.
total_left_stats
);
// Special case code for first frame.
if
(
cpi
->
common
.
current_video_frame
==
0
)
{
...
...
@@ -2418,9 +2421,9 @@ static void find_next_key_frame(VP9_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
=
(
int
)
(
sectionstats
.
intra_error
/
DOUBLE_DIVIDE_CHECK
(
sectionstats
.
coded_error
)
)
;
}
// Reset the first pass file position
...
...
@@ -2428,7 +2431,7 @@ static void find_next_key_frame(VP9_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
alt_kf_bits
;
...
...
@@ -2510,10 +2513,14 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
}
cpi
->
twopass
.
kf_group_bits
-=
cpi
->
twopass
.
kf_bits
;
cpi
->
twopass
.
kf_bits
+=
cpi
->
min_frame_bandwidth
;
// Add in the minimum frame allowance
cpi
->
per_frame_bandwidth
=
cpi
->
twopass
.
kf_bits
;
// Peer frame bit target for this frame
cpi
->
target_bandwidth
=
cpi
->
twopass
.
kf_bits
*
cpi
->
output_frame_rate
;
// Convert to a per second bitrate
// Add in the minimum frame allowance
cpi
->
twopass
.
kf_bits
+=
cpi
->
min_frame_bandwidth
;
// Peer frame bit target for this frame
cpi
->
per_frame_bandwidth
=
cpi
->
twopass
.
kf_bits
;
// Convert to a per second bitrate
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
...
...
vp9/encoder/lookahead.c
View file @
55f2f14f
...
...
@@ -43,7 +43,7 @@ void
vp9_lookahead_destroy
(
struct
lookahead_ctx
*
ctx
)
{
if
(
ctx
)
{
if
(
ctx
->
buf
)
{
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
ctx
->
max_sz
;
i
++
)
vp8_yv12_de_alloc_frame_buffer
(
&
ctx
->
buf
[
i
].
img
);
...
...
@@ -59,7 +59,6 @@ vp9_lookahead_init(unsigned int width,
unsigned
int
height
,
unsigned
int
depth
)
{
struct
lookahead_ctx
*
ctx
=
NULL
;
int
i
;
/* Clamp the lookahead queue depth */
if
(
depth
<
1
)
...
...
@@ -74,6 +73,7 @@ vp9_lookahead_init(unsigned int width,
/* Allocate the lookahead structures */
ctx
=
calloc
(
1
,
sizeof
(
*
ctx
));
if
(
ctx
)
{
unsigned
int
i
;
ctx
->
max_sz
=
depth
;
ctx
->
buf
=
calloc
(
depth
,
sizeof
(
*
ctx
->
buf
));
if
(
!
ctx
->
buf
)
...
...
@@ -175,9 +175,9 @@ vp9_lookahead_peek(struct lookahead_ctx *ctx,
struct
lookahead_entry
*
buf
=
NULL
;
assert
(
index
<
ctx
->
max_sz
);
if
(
index
<
ctx
->
sz
)
{
if
(
index
<
(
int
)
ctx
->
sz
)
{
index
+=
ctx
->
read_idx
;
if
(
index
>=
ctx
->
max_sz
)
if
(
index
>=
(
int
)
ctx
->
max_sz
)
index
-=
ctx
->
max_sz
;
buf
=
ctx
->
buf
+
index
;
}
...
...
vp9/encoder/mbgraph.c
View file @
55f2f14f
...
...
@@ -139,7 +139,7 @@ static int do_16x16_motion_search
// If the current best reference mv is not centred on 0,0 then do a 0,0 based search as well
if
(
ref_mv
->
as_int
)
{
int
tmp_err
;
unsigned
int
tmp_err
;
int_mv
zero_ref_mv
,
tmp_mv
;
zero_ref_mv
.
as_int
=
0
;
...
...
@@ -202,7 +202,7 @@ static int find_best_16x16_intra
MACROBLOCK
*
const
x
=
&
cpi
->
mb
;
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
MB_PREDICTION_MODE
best_mode
=
-
1
,
mode
;
int
best_err
=
INT_MAX
;
unsigned
int
best_err
=
INT_MAX
;
// calculate SATD for each intra prediction mode;
// we're intentionally not doing 4x4, we just want a rough estimate
...
...
@@ -449,7 +449,7 @@ void vp9_update_mbgraph_stats
// being a GF - so exit if we don't look ahead beyond that
if
(
n_frames
<=
cpi
->
frames_till_gf_update_due
)
return
;
if
(
n_frames
>
cpi
->
common
.
frames_till_alt_ref_frame
)
if
(
n_frames
>
(
int
)
cpi
->
common
.
frames_till_alt_ref_frame
)
n_frames
=
cpi
->
common
.
frames_till_alt_ref_frame
;
if
(
n_frames
>
MAX_LAG_BUFFERS
)
n_frames
=
MAX_LAG_BUFFERS
;
...
...
vp9/encoder/mcomp.c
View file @
55f2f14f
...
...
@@ -1380,7 +1380,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int
tot_steps
;
int_mv
this_mv
;
int
bestsad
=
INT_MAX
;
unsigned
int
bestsad
=
INT_MAX
;
int
best_site
=
0
;
int
last_site
=
0
;
...
...
@@ -1674,7 +1674,7 @@ int vp9_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
unsigned
char
*
bestaddress
;
int_mv
*
best_mv
=
&
d
->
bmi
.
as_mv
.
first
;
int_mv
this_mv
;
int
bestsad
=
INT_MAX
;
unsigned
int
bestsad
=
INT_MAX
;
int
r
,
c
;
unsigned
char
*
check_here
;
...
...
@@ -1802,7 +1802,7 @@ int vp9_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
unsigned
char
*
bestaddress
;
int_mv
*
best_mv
=
&
d
->
bmi
.
as_mv
.
first
;
int_mv
this_mv
;
int
bestsad
=
INT_MAX
;
unsigned
int
bestsad
=
INT_MAX
;
int
r
,
c
;
unsigned
char
*
check_here
;
...
...
vp9/encoder/onyx_if.c
View file @
55f2f14f
...
...
@@ -244,14 +244,14 @@ static void init_base_skip_probs(void) {
skip_prob
=
255
;
base_skip_false_prob
[
i
][
1
]
=
skip_prob
;
skip_prob
=
t
*
0
.
75
;
skip_prob
=
t
*
3
/
4
;
if
(
skip_prob
<
1
)
skip_prob
=
1
;
else
if
(
skip_prob
>
255
)
skip_prob
=
255
;
base_skip_false_prob
[
i
][
2
]
=
skip_prob
;
skip_prob
=
t
*
1
.
25
;
skip_prob
=
t
*
5
/
4
;
if
(
skip_prob
<
1
)
skip_prob
=
1
;
else
if
(
skip_prob
>
255
)
...
...
@@ -1400,7 +1400,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
)
;
}
...
...
@@ -1912,7 +1912,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
vp9_init_first_pass
(
cpi
);
}
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
;
...
...
@@ -2338,7 +2338,7 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
for
(
i
=
0
;
i
<
4
;
i
++
)
pkt
.
data
.
psnr
.
psnr
[
i
]
=
vp9_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
);
}
...
...
@@ -2904,7 +2904,9 @@ static void encode_frame_to_data_rate
// pass function that sets the target bandwidth so must set it here
if
(
cpi
->
common
.
refresh_alt_ref_frame
)
{
cpi
->
per_frame_bandwidth
=
cpi
->
twopass
.
gf_bits
;
// Per frame bit target for the alt ref frame
cpi
->
target_bandwidth
=
cpi
->
twopass
.
gf_bits
*
cpi
->
output_frame_rate
;
// per second target bitrate
// per second target bitrate
cpi
->
target_bandwidth
=
(
int
)(
cpi
->
twopass
.
gf_bits
*
cpi
->
output_frame_rate
);
}
// Default turn off buffer to buffer copying
...
...
@@ -4106,7 +4108,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
-
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
)
{
...
...
@@ -4119,7 +4121,8 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
* 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
;
...
...
@@ -4221,17 +4224,17 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
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
;
double
sq_error
;
ye
=
calc_plane_error
(