]> granicus.if.org Git - libvpx/commitdiff
Store a group level noise metric from first pass.
authorPaul Wilkins <paulwilkins@google.com>
Thu, 28 Feb 2019 13:19:11 +0000 (13:19 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Mon, 11 Mar 2019 13:49:14 +0000 (13:49 +0000)
Adds a variable to GF group structure to store a noise
energy metric for the current group that can be used
in things like film grain retention code.

Change-Id: I81b07630d3242f7928110f19a6c1ed4c86125f05

vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_firstpass.h

index 620d21f5affe71c74436323a2fda0d297a6cb2b1..094524f66ce9c327321629d6a43d54492237d533 100644 (file)
@@ -49,7 +49,6 @@
 #define MIN_DECAY_FACTOR 0.01
 #define NEW_MV_MODE_PENALTY 32
 #define DARK_THRESH 64
-#define SECTION_NOISE_DEF 250.0
 #define LOW_I_THRESH 24000
 
 #define NCOUNT_INTRA_THRESH 8192
@@ -2656,6 +2655,10 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
   // Calculate the bits to be allocated to the gf/arf group as a whole
   gf_group_bits = calculate_total_gf_group_bits(cpi, gf_group_err);
 
+  // Store the average moise level measured for the group
+  twopass->gf_group.group_noise_energy =
+      (int)(gf_group_noise / rc->baseline_gf_interval);
+
   // Calculate an estimate of the maxq needed for the group.
   // We are more aggressive about correcting for sections
   // where there could be significant overshoot than for easier
index 0807097ac1ab0ba5ce3dbd5805051bcbad47edd1..d2490f99dc6201a6778997602e55760664b24d7c 100644 (file)
@@ -44,6 +44,7 @@ typedef struct {
 #define INVALID_ROW -1
 
 #define MAX_ARF_LAYERS 6
+#define SECTION_NOISE_DEF 250.0
 
 typedef struct {
   double frame_mb_intra_factor;
@@ -142,6 +143,7 @@ typedef struct {
   int gf_group_size;
   int max_layer_depth;
   int allowed_max_layer_depth;
+  int group_noise_energy;
 } GF_GROUP;
 
 typedef struct {