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 void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, 44 const TileInfo *const tile, 45 MV_REFERENCE_FRAME ref_frame, 46 BLOCK_SIZE block_size, 47 int mi_row, int mi_col, 48 int_mv frame_nearest_mv[MAX_REF_FRAMES], 49 int_mv frame_near_mv[MAX_REF_FRAMES], 50 struct buf_2d yv12_mb[4][MAX_MB_PLANE]); 51 52 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, 53 int ref_frame); 54 55 void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 56 int *r, int64_t *d, BLOCK_SIZE bsize, 57 PICK_MODE_CONTEXT *ctx, int64_t best_rd); 58 59 int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 60 const struct TileInfo *const tile, 61 int mi_row, int mi_col, 62 int *returnrate, 63 int64_t *returndistortion, 64 BLOCK_SIZE bsize, 65 PICK_MODE_CONTEXT *ctx, 66 int64_t best_rd_so_far); 67 68 int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, 69 const struct TileInfo *const tile, 70 int mi_row, int mi_col, 71 int *returnrate, 72 int64_t *returndistortion, 73 BLOCK_SIZE bsize, 74 PICK_MODE_CONTEXT *ctx, 75 int64_t best_rd_so_far); 76 77 void vp9_init_me_luts(); 78 79 void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, 80 const struct macroblockd_plane *pd, 81 ENTROPY_CONTEXT t_above[16], 82 ENTROPY_CONTEXT t_left[16]); 83 84 #ifdef __cplusplus 85 } // extern "C" 86 #endif 87 88 #endif // VP9_ENCODER_VP9_RDOPT_H_ 89