]> granicus.if.org Git - libvpx/commitdiff
Add first_pass_info in TWO_PASS
authorangiebird <angiebird@google.com>
Thu, 10 Oct 2019 00:47:49 +0000 (17:47 -0700)
committerangiebird <angiebird@google.com>
Thu, 10 Oct 2019 22:44:51 +0000 (15:44 -0700)
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
vp9/encoder/vp9_firstpass.h

index e7cfc82f7e2c389d31c6d3820b625bcb0c851118..2881d2856e7e4275cae4167e0a42b62d7c3ee257 100644 (file)
@@ -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);
     }
index bf256017319ba72fefb7f0de05494fedf45a4ab6..493d5663a51d7e5443d27a925efb07d1ef49e63b 100644 (file)
@@ -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;