From df0ec9f0b6e58d5d80a1a1b93593f35d4336ba0c Mon Sep 17 00:00:00 2001 From: angiebird Date: Wed, 9 Oct 2019 17:47:49 -0700 Subject: [PATCH] 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 --- vp9/encoder/vp9_encoder.c | 5 +++++ vp9/encoder/vp9_firstpass.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index e7cfc82f7..2881d2856 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2376,6 +2376,9 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, 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 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, 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); } diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h index bf2560173..493d5663a 100644 --- a/vp9/encoder/vp9_firstpass.h +++ b/vp9/encoder/vp9_firstpass.h @@ -146,6 +146,18 @@ typedef struct { int group_noise_energy; } 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; @@ -154,6 +166,7 @@ typedef struct { 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; -- 2.40.0