1 /* 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3 * 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. 9 */ 10 11 #ifndef VP9_ENCODER_VP9_RDOPT_H_ 12 #define VP9_ENCODER_VP9_RDOPT_H_ 13 14 #include "vp9/encoder/vp9_onyx_int.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define RDDIV_BITS 7 21 22 #define RDCOST(RM, DM, R, D) \ 23 (((128 + ((int64_t)R) * (RM)) >> 8) + (D << DM)) 24 #define QIDX_SKIP_THRESH 115 25 26 #define MV_COST_WEIGHT 108 27 #define MV_COST_WEIGHT_SUB 120 28 29 #define INVALID_MV 0x80008000 30 31 struct TileInfo; 32 33 int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex); 34 35 void vp9_initialize_rd_consts(VP9_COMP *cpi); 36 37 void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex); 38 39 void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n, 40 unsigned int qstep, int *rate, 41 int64_t *dist); 42 43 int vp9_get_switchable_rate(const MACROBLOCK *x); 44 45 void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, 46 const TileInfo *const tile, 47 MV_REFERENCE_FRAME ref_frame, 48 BLOCK_SIZE block_size, 49 int mi_row, int mi_col, 50 int_mv frame_nearest_mv[MAX_REF_FRAMES], 51 int_mv frame_near_mv[MAX_REF_FRAMES], 52 struct buf_2d yv12_mb[4][MAX_MB_PLANE]); 53 54 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, 55 int ref_frame); 56 57 void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 58 int *r, int64_t *d, BLOCK_SIZE bsize, 59 PICK_MODE_CONTEXT *ctx, int64_t best_rd); 60 61 int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 62 const struct TileInfo *const tile, 63 int mi_row, int mi_col, 64 int *returnrate, 65 int64_t *returndistortion, 66 BLOCK_SIZE bsize, 67 PICK_MODE_CONTEXT *ctx, 68 int64_t best_rd_so_far); 69 70 int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, 71 const struct TileInfo *const tile, 72 int mi_row, int mi_col, 73 int *returnrate, 74 int64_t *returndistortion, 75 BLOCK_SIZE bsize, 76 PICK_MODE_CONTEXT *ctx, 77 int64_t best_rd_so_far); 78 79 void vp9_init_me_luts(); 80 81 void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, 82 const struct macroblockd_plane *pd, 83 ENTROPY_CONTEXT t_above[16], 84 ENTROPY_CONTEXT t_left[16]); 85 86 #ifdef __cplusplus 87 } // extern "C" 88 #endif 89 90 #endif // VP9_ENCODER_VP9_RDOPT_H_ 91