ref: df0ec9f0b6e58d5d80a1a1b93593f35d4336ba0c
parent: aa49cd4ad4ff74f8c35578689b64ce6d4a1dce05
author: angiebird <angiebird@google.com>
date: Wed Oct 9 13:47:49 EDT 2019
Add first_pass_info in TWO_PASS This is part of the change aims at replacing stats_in/stats_in_start/stats_in_end by first_pass_info. Change-Id: Ibcd2a08e57cb749fe68996f33fe3a5e7f92b1758
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2376,6 +2376,9 @@
lc->twopass.stats_in = lc->twopass.stats_in_start;
lc->twopass.stats_in_end =
lc->twopass.stats_in_start + packets_in_layer - 1;
+ fps_init_first_pass_info(&lc->twopass.first_pass_info,
+ lc->rc_twopass_stats_in.buf,
+ packets_in_layer);
stats_copy[layer_id] = lc->rc_twopass_stats_in.buf;
}
}
@@ -2407,6 +2410,8 @@
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 = &cpi->twopass.stats_in[packets - 1];
+ fps_init_first_pass_info(&cpi->twopass.first_pass_info,
+ oxcf->two_pass_stats_in.buf, packets);
vp9_init_second_pass(cpi);
}
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -147,6 +147,18 @@
} GF_GROUP;
typedef struct {
+ const FIRSTPASS_STATS *stats;
+ int num_frames;
+} FIRST_PASS_INFO;
+
+static INLINE void fps_init_first_pass_info(FIRST_PASS_INFO *first_pass_info,
+ const FIRSTPASS_STATS *stats,
+ int num_frames) {
+ first_pass_info->stats = stats;
+ first_pass_info->num_frames = num_frames;
+}
+
+typedef struct {
unsigned int section_intra_rating;
unsigned int key_frame_section_intra_rating;
FIRSTPASS_STATS total_stats;
@@ -154,6 +166,7 @@
const FIRSTPASS_STATS *stats_in;
const FIRSTPASS_STATS *stats_in_start;
const FIRSTPASS_STATS *stats_in_end;
+ FIRST_PASS_INFO first_pass_info;
FIRSTPASS_STATS total_left_stats;
int first_pass_done;
int64_t bits_left;