chromium/third_party/libvpx/source/libvpx/vp8/encoder/ratectrl.c

/*
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <assert.h>

#include "math.h"
#include "vp8/common/common.h"
#include "ratectrl.h"
#include "vp8/common/entropymode.h"
#include "vpx_mem/vpx_mem.h"
#include "vp8/common/systemdependent.h"
#include "encodemv.h"
#include "vpx_dsp/vpx_dsp_common.h"
#include "vpx_ports/system_state.h"

#define MIN_BPB_FACTOR
#define MAX_BPB_FACTOR

extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES];

#ifdef MODE_STATS
extern int y_modes[5];
extern int uv_modes[4];
extern int b_modes[10];

extern int inter_y_modes[10];
extern int inter_uv_modes[4];
extern int inter_b_modes[10];
#endif

/* Bits Per MB at different Q (Multiplied by 512) */
#define BPER_MB_NORMBITS

/* Work in progress recalibration of baseline rate tables based on
 * the assumption that bits per mb is inversely proportional to the
 * quantizer value.
 */
const int vp8_bits_per_mb[2][QINDEX_RANGE] =;

static const int kf_boost_qadjustment[QINDEX_RANGE] =;

/* #define GFQ_ADJUSTMENT (Q+100) */
#define GFQ_ADJUSTMENT
const int vp8_gf_boost_qadjustment[QINDEX_RANGE] =;

/*
const int vp8_gf_boost_qadjustment[QINDEX_RANGE] =
{
    100,101,102,103,104,105,105,106,
    106,107,107,108,109,109,110,111,
    112,113,114,115,116,117,118,119,
    120,121,122,123,124,125,126,127,
    128,129,130,131,132,133,134,135,
    136,137,138,139,140,141,142,143,
    144,145,146,147,148,149,150,151,
    152,153,154,155,156,157,158,159,
    160,161,162,163,164,165,166,167,
    168,169,170,170,171,171,172,172,
    173,173,173,174,174,174,175,175,
    175,176,176,176,177,177,177,177,
    178,178,179,179,180,180,181,181,
    182,182,183,183,184,184,185,185,
    186,186,187,187,188,188,189,189,
    190,190,191,191,192,192,193,193,
};
*/

static const int kf_gf_boost_qlimits[QINDEX_RANGE] =;

static const int gf_adjust_table[101] =;

static const int gf_intra_usage_adjustment[20] =;

static const int gf_interval_table[101] =;

static const unsigned int prior_key_frame_weight[KEY_FRAME_CONTEXT] =;

void vp8_save_coding_context(VP8_COMP *cpi) {}

void vp8_restore_coding_context(VP8_COMP *cpi) {}

void vp8_setup_key_frame(VP8_COMP *cpi) {}

static int estimate_bits_at_q(int frame_kind, int Q, int MBs,
                              double correction_factor) {}

static void calc_iframe_target_size(VP8_COMP *cpi) {}

/* Do the best we can to define the parameters for the next GF based on what
 * information we have available.
 */
static void calc_gf_params(VP8_COMP *cpi) {}

static void calc_pframe_target_size(VP8_COMP *cpi) {}

void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var) {}

static int limit_q_cbr_inter(int last_q, int current_q) {}

int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame) {}

static int estimate_keyframe_frequency(VP8_COMP *cpi) {}

void vp8_adjust_key_frame_context(VP8_COMP *cpi) {}

void vp8_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit,
                                   int *frame_over_shoot_limit) {}

/* return of 0 means drop frame */
int vp8_pick_frame_size(VP8_COMP *cpi) {}
// If this just encoded frame (mcomp/transform/quant, but before loopfilter and
// pack_bitstream) has large overshoot, and was not being encoded close to the
// max QP, then drop this frame and force next frame to be encoded at max QP.
// Allow this for screen_content_mode = 2, or if drop frames is allowed.
// TODO(marpan): Should do this exit condition during the encode_frame
// (i.e., halfway during the encoding of the frame) to save cycles.
int vp8_drop_encodedframe_overshoot(VP8_COMP *cpi, int Q) {}