2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef VP9_ENCODER_VP9_RDOPT_H_
12 #define VP9_ENCODER_VP9_RDOPT_H_
14 #include "vp9/encoder/vp9_onyx_int.h"
22 #define RDCOST(RM, DM, R, D) \
23 (((128 + ((int64_t)R) * (RM)) >> 8) + (D << DM))
24 #define QIDX_SKIP_THRESH 115
26 #define RD_THRESH_MAX_FACT 64
27 #define RD_THRESH_INC 1
28 #define RD_THRESH_POW 1.25
29 #define RD_MULT_EPB_RATIO 64
31 #define MV_COST_WEIGHT 108
32 #define MV_COST_WEIGHT_SUB 120
34 #define INVALID_MV 0x80008000
38 int vp9_compute_rd_mult(VP9_COMP *cpi, int qindex);
40 void vp9_initialize_rd_consts(VP9_COMP *cpi);
42 void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex);
44 void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
45 const TileInfo *const tile,
46 MV_REFERENCE_FRAME ref_frame,
47 BLOCK_SIZE block_size,
48 int mi_row, int mi_col,
49 int_mv frame_nearest_mv[MAX_REF_FRAMES],
50 int_mv frame_near_mv[MAX_REF_FRAMES],
51 struct buf_2d yv12_mb[4][MAX_MB_PLANE]);
53 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
56 void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
57 int *r, int64_t *d, BLOCK_SIZE bsize,
58 PICK_MODE_CONTEXT *ctx, int64_t best_rd);
60 int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
61 const struct TileInfo *const tile,
62 int mi_row, int mi_col,
64 int64_t *returndistortion,
66 PICK_MODE_CONTEXT *ctx,
67 int64_t best_rd_so_far);
69 int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
70 const struct TileInfo *const tile,
71 int mi_row, int mi_col,
73 int64_t *returndistortion,
75 PICK_MODE_CONTEXT *ctx,
76 int64_t best_rd_so_far);
78 void vp9_init_me_luts();
80 void vp9_set_mbmode_and_mvs(MACROBLOCKD *xd, MB_PREDICTION_MODE mode,
83 void vp9_get_entropy_contexts(TX_SIZE tx_size,
84 ENTROPY_CONTEXT t_above[16], ENTROPY_CONTEXT t_left[16],
85 const ENTROPY_CONTEXT *above, const ENTROPY_CONTEXT *left,
86 int num_4x4_w, int num_4x4_h);
92 #endif // VP9_ENCODER_VP9_RDOPT_H_