shithub: libvpx

Download patch

ref: 2914bcfd9b95f04f51ac124316ccfdac2714b699
parent: 6769143cef03f52a4619caa56bb44d258cd0ec27
parent: ded9e191445c599f4fcc5d75ccf26a8b4c33532e
author: Yaowu Xu <yaowu@google.com>
date: Tue Apr 8 03:13:49 EDT 2014

Merge "vp9_firstpass: Get rid of magic number in bits per MB calculation"

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -916,9 +916,10 @@
   if (section_target_bandwitdh <= 0)
     return rc->worst_quality;          // Highest value allowed
 
-  target_norm_bits_per_mb = section_target_bandwitdh < (1 << 20)
-                              ? (512 * section_target_bandwitdh) / num_mbs
-                              : 512 * (section_target_bandwitdh / num_mbs);
+  target_norm_bits_per_mb =
+      section_target_bandwitdh < (1 << 20)
+      ? (section_target_bandwitdh << BPER_MB_NORMBITS) / num_mbs
+      : (section_target_bandwitdh / num_mbs) << BPER_MB_NORMBITS;
 
   // Try and pick a max Q that will be high enough to encode the
   // content at the given rate.
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -35,9 +35,6 @@
 #define MIN_BPB_FACTOR 0.005
 #define MAX_BPB_FACTOR 50
 
-// Bits Per MB at different Q (Multiplied by 512)
-#define BPER_MB_NORMBITS    9
-
 // Tables relating active max Q to active min Q
 static int kf_low_motion_minq[QINDEX_RANGE];
 static int kf_high_motion_minq[QINDEX_RANGE];
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -22,6 +22,9 @@
 
 #define FRAME_OVERHEAD_BITS 200
 
+// Bits Per MB at different Q (Multiplied by 512)
+#define BPER_MB_NORMBITS    9
+
 typedef struct {
   // Rate targetting variables
   int this_frame_target;
--