diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index dc329fd1e4409719bfd0d243ddfc6e0e73a85123..9875343945bd3c839a76bd5dde83dabbc9ac6884 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -916,9 +916,10 @@ int vp9_twopass_worst_quality(VP9_COMP *cpi, FIRSTPASS_STATS *fpstats, 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. diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 2d5b0e49a000acb8415e3ba79f3fdd8f2eefed7f..ef14b43413767b1b071264ef96711ff54debee5b 100644 --- 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]; diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index c0dffe751df974dfa87e91589925db06293f757d..4b3d2f1e451abc25e88a2c05770c4e43b2e2627e 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -22,6 +22,9 @@ extern "C" { #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;