vp9_rdopt.h 3.29 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
 */

11
12
#ifndef VP9_ENCODER_VP9_RDOPT_H_
#define VP9_ENCODER_VP9_RDOPT_H_
Yunqing Wang's avatar
Yunqing Wang committed
13

14
15
#include "vp9/encoder/vp9_onyx_int.h"

16
17
18
19
#ifdef __cplusplus
extern "C" {
#endif

20
21
#define RDDIV_BITS          7

Jim Bankoski's avatar
Jim Bankoski committed
22
#define RDCOST(RM, DM, R, D) \
23
  (((128 + ((int64_t)R) * (RM)) >> 8) + (D << DM))
24
25
#define QIDX_SKIP_THRESH     115

26
27
28
29
30
31
32
33
34
35
#define RD_THRESH_MAX_FACT 64
#define RD_THRESH_INC      1
#define RD_THRESH_POW      1.25
#define RD_MULT_EPB_RATIO  64

#define MV_COST_WEIGHT      108
#define MV_COST_WEIGHT_SUB  120

#define INVALID_MV 0x80008000

James Zern's avatar
James Zern committed
36
37
struct TileInfo;

38
39
40
int vp9_compute_rd_mult(VP9_COMP *cpi, int qindex);

void vp9_initialize_rd_consts(VP9_COMP *cpi);
41

Dmitry Kovalev's avatar
Dmitry Kovalev committed
42
void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex);
43

44
45
void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
                            const TileInfo *const tile,
46
                            MV_REFERENCE_FRAME ref_frame,
47
48
49
50
51
52
                            BLOCK_SIZE block_size,
                            int mi_row, int mi_col,
                            int_mv frame_nearest_mv[MAX_REF_FRAMES],
                            int_mv frame_near_mv[MAX_REF_FRAMES],
                            struct buf_2d yv12_mb[4][MAX_MB_PLANE]);

53
54
const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
                                                   int ref_frame);
55

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);
59

60
int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
James Zern's avatar
James Zern committed
61
                                  const struct TileInfo *const tile,
62
                                  int mi_row, int mi_col,
James Zern's avatar
James Zern committed
63
64
65
66
67
                                  int *returnrate,
                                  int64_t *returndistortion,
                                  BLOCK_SIZE bsize,
                                  PICK_MODE_CONTEXT *ctx,
                                  int64_t best_rd_so_far);
68

69
int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
James Zern's avatar
James Zern committed
70
                                      const struct TileInfo *const tile,
71
                                      int mi_row, int mi_col,
James Zern's avatar
James Zern committed
72
73
74
75
76
                                      int *returnrate,
                                      int64_t *returndistortion,
                                      BLOCK_SIZE bsize,
                                      PICK_MODE_CONTEXT *ctx,
                                      int64_t best_rd_so_far);
77

Dmitry Kovalev's avatar
Dmitry Kovalev committed
78
void vp9_init_me_luts();
79

Dmitry Kovalev's avatar
Dmitry Kovalev committed
80
81
void vp9_set_mbmode_and_mvs(MACROBLOCKD *xd, MB_PREDICTION_MODE mode,
                            const MV *mv);
82

83
84
85
86
void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
                              const struct macroblockd_plane *pd,
                              ENTROPY_CONTEXT t_above[16],
                              ENTROPY_CONTEXT t_left[16]);
87

88
89
90
91
#ifdef __cplusplus
}  // extern "C"
#endif

92
#endif  // VP9_ENCODER_VP9_RDOPT_H_