Adding const to FIRSTPASS_STATS pointers.

Change-Id: Ia94d757de1d1b24609128cd40e68558078f50a38
This commit is contained in:
Dmitry Kovalev 2014-03-06 18:58:17 -08:00
parent d1aeef94a5
commit cca347ed4e
3 changed files with 13 additions and 19 deletions

View File

@ -95,7 +95,7 @@ static int kfboost_qadjust(int qindex) {
// Resets the first pass file to the given position using a relative seek from
// the current position.
static void reset_fpf_position(struct twopass_rc *p,
FIRSTPASS_STATS *position) {
const FIRSTPASS_STATS *position) {
p->stats_in = position;
}
@ -903,7 +903,7 @@ extern void vp9_new_framerate(VP9_COMP *cpi, double framerate);
void vp9_init_second_pass(VP9_COMP *cpi) {
FIRSTPASS_STATS this_frame;
FIRSTPASS_STATS *start_pos;
const FIRSTPASS_STATS *start_pos;
struct twopass_rc *const twopass = &cpi->twopass;
const VP9_CONFIG *const oxcf = &cpi->oxcf;
@ -1011,7 +1011,7 @@ static int detect_transition_to_still(VP9_COMP *cpi, int frame_interval,
loop_decay_rate >= 0.999 &&
last_decay_rate < 0.9) {
int j;
FIRSTPASS_STATS *position = cpi->twopass.stats_in;
const FIRSTPASS_STATS *position = cpi->twopass.stats_in;
FIRSTPASS_STATS tmp_next_frame;
// Look ahead a few frames to see if static condition persists...
@ -1346,7 +1346,7 @@ void define_fixed_arf_period(VP9_COMP *cpi) {
// Analyse and define a gf/arf group.
static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
FIRSTPASS_STATS next_frame = { 0 };
FIRSTPASS_STATS *start_pos;
const FIRSTPASS_STATS *start_pos;
struct twopass_rc *const twopass = &cpi->twopass;
int i;
double boost_score = 0.0;
@ -1793,19 +1793,12 @@ static int test_candidate_kf(VP9_COMP *cpi,
((next_frame->intra_error /
DOUBLE_DIVIDE_CHECK(next_frame->coded_error)) > 3.5))))) {
int i;
FIRSTPASS_STATS *start_pos;
FIRSTPASS_STATS local_next_frame;
const FIRSTPASS_STATS *start_pos = cpi->twopass.stats_in;
FIRSTPASS_STATS local_next_frame = *next_frame;
double boost_score = 0.0;
double old_boost_score = 0.0;
double decay_accumulator = 1.0;
local_next_frame = *next_frame;
// Note the starting file position so we can reset to it.
start_pos = cpi->twopass.stats_in;
// Examine how well the key frame predicts subsequent frames.
for (i = 0; i < 16; ++i) {
double next_iiratio = (IIKFACTOR1 * local_next_frame.intra_error /
@ -1861,7 +1854,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
FIRSTPASS_STATS last_frame;
FIRSTPASS_STATS first_frame;
FIRSTPASS_STATS next_frame;
FIRSTPASS_STATS *start_position;
const FIRSTPASS_STATS *start_position;
double decay_accumulator = 1.0;
double zero_motion_accumulator = 1.0;

View File

@ -43,7 +43,9 @@ struct twopass_rc {
unsigned int this_iiratio;
FIRSTPASS_STATS total_stats;
FIRSTPASS_STATS this_frame_stats;
FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start;
const FIRSTPASS_STATS *stats_in;
const FIRSTPASS_STATS *stats_in_start;
const FIRSTPASS_STATS *stats_in_end;
FIRSTPASS_STATS total_left_stats;
int first_pass_done;
int64_t bits_left;

View File

@ -1879,13 +1879,12 @@ VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf) {
if (cpi->pass == 1) {
vp9_init_first_pass(cpi);
} else if (cpi->pass == 2) {
size_t packet_sz = sizeof(FIRSTPASS_STATS);
int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
const size_t packet_sz = sizeof(FIRSTPASS_STATS);
const 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;
cpi->twopass.stats_in_end = (void *)((char *)cpi->twopass.stats_in
+ (packets - 1) * packet_sz);
cpi->twopass.stats_in_end = &cpi->twopass.stats_in[packets - 1];
vp9_init_second_pass(cpi);
}