]> granicus.if.org Git - libvpx/blob - vp10/encoder/block.h
Changes to exhaustive motion search.
[libvpx] / vp10 / encoder / block.h
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 VP10_ENCODER_BLOCK_H_
12 #define VP10_ENCODER_BLOCK_H_
13
14 #include "vp10/common/entropymv.h"
15 #include "vp10/common/entropy.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 typedef struct {
22   unsigned int sse;
23   int sum;
24   unsigned int var;
25 } diff;
26
27 struct macroblock_plane {
28   DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
29   tran_low_t *qcoeff;
30   tran_low_t *coeff;
31   uint16_t *eobs;
32   struct buf_2d src;
33
34   // Quantizer setings
35   int16_t *quant_fp;
36   int16_t *round_fp;
37   int16_t *quant;
38   int16_t *quant_shift;
39   int16_t *zbin;
40   int16_t *round;
41
42   int64_t quant_thred[2];
43 };
44
45 /* The [2] dimension is for whether we skip the EOB node (i.e. if previous
46  * coefficient in this block was zero) or not. */
47 typedef unsigned int vp10_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2]
48                                    [COEFF_CONTEXTS][ENTROPY_TOKENS];
49
50 typedef struct {
51   int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
52   uint8_t mode_context[MAX_REF_FRAMES];
53 } MB_MODE_INFO_EXT;
54
55 typedef struct macroblock MACROBLOCK;
56 struct macroblock {
57   struct macroblock_plane plane[MAX_MB_PLANE];
58
59   MACROBLOCKD e_mbd;
60   MB_MODE_INFO_EXT *mbmi_ext;
61   int skip_block;
62   int select_tx_size;
63   int skip_recode;
64   int skip_optimize;
65   int q_index;
66
67   int errorperbit;
68   int sadperbit16;
69   int sadperbit4;
70   int rddiv;
71   int rdmult;
72   int mb_energy;
73   int * m_search_count_ptr;
74   int * ex_search_count_ptr;
75
76   // These are set to their default values at the beginning, and then adjusted
77   // further in the encoding process.
78   BLOCK_SIZE min_partition_size;
79   BLOCK_SIZE max_partition_size;
80
81   int mv_best_ref_index[MAX_REF_FRAMES];
82   unsigned int max_mv_context[MAX_REF_FRAMES];
83   unsigned int source_variance;
84   unsigned int pred_sse[MAX_REF_FRAMES];
85   int pred_mv_sad[MAX_REF_FRAMES];
86
87   int nmvjointcost[MV_JOINTS];
88   int *nmvcost[2];
89   int *nmvcost_hp[2];
90   int **mvcost;
91
92   int nmvjointsadcost[MV_JOINTS];
93   int *nmvsadcost[2];
94   int *nmvsadcost_hp[2];
95   int **mvsadcost;
96
97   // These define limits to motion vector components to prevent them
98   // from extending outside the UMV borders
99   int mv_col_min;
100   int mv_col_max;
101   int mv_row_min;
102   int mv_row_max;
103
104   // Notes transform blocks where no coefficents are coded.
105   // Set during mode selection. Read during block encoding.
106   uint8_t zcoeff_blk[TX_SIZES][256];
107
108   int skip;
109
110   int encode_breakout;
111
112   // note that token_costs is the cost when eob node is skipped
113   vp10_coeff_cost token_costs[TX_SIZES];
114
115   int optimize;
116
117   // indicate if it is in the rd search loop or encoding process
118   int use_lp32x32fdct;
119
120   // use fast quantization process
121   int quant_fp;
122
123   // skip forward transform and quantization
124   uint8_t skip_txfm[MAX_MB_PLANE << 2];
125   #define SKIP_TXFM_NONE 0
126   #define SKIP_TXFM_AC_DC 1
127   #define SKIP_TXFM_AC_ONLY 2
128
129   int64_t bsse[MAX_MB_PLANE << 2];
130
131   // Used to store sub partition's choices.
132   MV pred_mv[MAX_REF_FRAMES];
133
134   // Strong color activity detection. Used in RTC coding mode to enhance
135   // the visual quality at the boundary of moving color objects.
136   uint8_t color_sensitivity[2];
137 };
138
139 #ifdef __cplusplus
140 }  // extern "C"
141 #endif
142
143 #endif  // VP10_ENCODER_BLOCK_H_