OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 | 11 |
12 #ifndef VP9_COMMON_VP9_BLOCKD_H_ | 12 #ifndef VP9_COMMON_VP9_BLOCKD_H_ |
13 #define VP9_COMMON_VP9_BLOCKD_H_ | 13 #define VP9_COMMON_VP9_BLOCKD_H_ |
14 | 14 |
15 #include "./vpx_config.h" | 15 #include "./vpx_config.h" |
16 | 16 |
17 #include "vpx_ports/mem.h" | 17 #include "vpx_ports/mem.h" |
18 #include "vpx_scale/yv12config.h" | 18 #include "vpx_scale/yv12config.h" |
19 | 19 |
20 #include "vp9/common/vp9_common.h" | |
21 #include "vp9/common/vp9_common_data.h" | 20 #include "vp9/common/vp9_common_data.h" |
22 #include "vp9/common/vp9_enums.h" | |
23 #include "vp9/common/vp9_filter.h" | 21 #include "vp9/common/vp9_filter.h" |
24 #include "vp9/common/vp9_idct.h" | |
25 #include "vp9/common/vp9_mv.h" | 22 #include "vp9/common/vp9_mv.h" |
26 #include "vp9/common/vp9_scale.h" | 23 #include "vp9/common/vp9_scale.h" |
27 #include "vp9/common/vp9_seg_common.h" | |
28 | 24 |
29 #ifdef __cplusplus | 25 #ifdef __cplusplus |
30 extern "C" { | 26 extern "C" { |
31 #endif | 27 #endif |
32 | 28 |
33 #define BLOCK_SIZE_GROUPS 4 | 29 #define BLOCK_SIZE_GROUPS 4 |
34 #define SKIP_CONTEXTS 3 | 30 #define SKIP_CONTEXTS 3 |
35 #define INTER_MODE_CONTEXTS 7 | 31 #define INTER_MODE_CONTEXTS 7 |
36 | 32 |
37 /* Segment Feature Masks */ | 33 /* Segment Feature Masks */ |
38 #define MAX_MV_REF_CANDIDATES 2 | 34 #define MAX_MV_REF_CANDIDATES 2 |
39 | 35 |
40 #define INTRA_INTER_CONTEXTS 4 | 36 #define INTRA_INTER_CONTEXTS 4 |
41 #define COMP_INTER_CONTEXTS 5 | 37 #define COMP_INTER_CONTEXTS 5 |
42 #define REF_CONTEXTS 5 | 38 #define REF_CONTEXTS 5 |
43 | 39 |
44 typedef enum { | 40 typedef enum { |
45 PLANE_TYPE_Y = 0, | 41 PLANE_TYPE_Y = 0, |
46 PLANE_TYPE_UV = 1, | 42 PLANE_TYPE_UV = 1, |
47 PLANE_TYPES | 43 PLANE_TYPES |
48 } PLANE_TYPE; | 44 } PLANE_TYPE; |
49 | 45 |
| 46 #define MAX_MB_PLANE 3 |
| 47 |
50 typedef char ENTROPY_CONTEXT; | 48 typedef char ENTROPY_CONTEXT; |
51 | 49 |
52 typedef char PARTITION_CONTEXT; | |
53 | |
54 static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a, | 50 static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a, |
55 ENTROPY_CONTEXT b) { | 51 ENTROPY_CONTEXT b) { |
56 return (a != 0) + (b != 0); | 52 return (a != 0) + (b != 0); |
57 } | 53 } |
58 | 54 |
59 typedef enum { | 55 typedef enum { |
60 KEY_FRAME = 0, | 56 KEY_FRAME = 0, |
61 INTER_FRAME = 1, | 57 INTER_FRAME = 1, |
62 FRAME_TYPES, | 58 FRAME_TYPES, |
63 } FRAME_TYPE; | 59 } FRAME_TYPE; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // specified herein. They should be refactored concurrently. | 100 // specified herein. They should be refactored concurrently. |
105 typedef enum { | 101 typedef enum { |
106 NONE = -1, | 102 NONE = -1, |
107 INTRA_FRAME = 0, | 103 INTRA_FRAME = 0, |
108 LAST_FRAME = 1, | 104 LAST_FRAME = 1, |
109 GOLDEN_FRAME = 2, | 105 GOLDEN_FRAME = 2, |
110 ALTREF_FRAME = 3, | 106 ALTREF_FRAME = 3, |
111 MAX_REF_FRAMES = 4 | 107 MAX_REF_FRAMES = 4 |
112 } MV_REFERENCE_FRAME; | 108 } MV_REFERENCE_FRAME; |
113 | 109 |
114 static INLINE int b_width_log2(BLOCK_SIZE sb_type) { | |
115 return b_width_log2_lookup[sb_type]; | |
116 } | |
117 static INLINE int b_height_log2(BLOCK_SIZE sb_type) { | |
118 return b_height_log2_lookup[sb_type]; | |
119 } | |
120 | |
121 static INLINE int mi_width_log2(BLOCK_SIZE sb_type) { | |
122 return mi_width_log2_lookup[sb_type]; | |
123 } | |
124 | |
125 // This structure now relates to 8x8 block regions. | 110 // This structure now relates to 8x8 block regions. |
126 typedef struct { | 111 typedef struct { |
127 // Common for both INTER and INTRA blocks | 112 // Common for both INTER and INTRA blocks |
128 BLOCK_SIZE sb_type; | 113 BLOCK_SIZE sb_type; |
129 PREDICTION_MODE mode; | 114 PREDICTION_MODE mode; |
130 TX_SIZE tx_size; | 115 TX_SIZE tx_size; |
131 int8_t skip; | 116 int8_t skip; |
132 int8_t segment_id; | 117 int8_t segment_id; |
133 int8_t seg_id_predicted; // valid only when temporal_update is enabled | 118 int8_t seg_id_predicted; // valid only when temporal_update is enabled |
134 | 119 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const MODE_INFO *left_mi, int b); | 151 const MODE_INFO *left_mi, int b); |
167 | 152 |
168 PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, | 153 PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi, |
169 const MODE_INFO *above_mi, int b); | 154 const MODE_INFO *above_mi, int b); |
170 | 155 |
171 enum mv_precision { | 156 enum mv_precision { |
172 MV_PRECISION_Q3, | 157 MV_PRECISION_Q3, |
173 MV_PRECISION_Q4 | 158 MV_PRECISION_Q4 |
174 }; | 159 }; |
175 | 160 |
176 enum { MAX_MB_PLANE = 3 }; | |
177 | |
178 struct buf_2d { | 161 struct buf_2d { |
179 uint8_t *buf; | 162 uint8_t *buf; |
180 int stride; | 163 int stride; |
181 }; | 164 }; |
182 | 165 |
183 struct macroblockd_plane { | 166 struct macroblockd_plane { |
184 tran_low_t *dqcoeff; | 167 tran_low_t *dqcoeff; |
185 PLANE_TYPE plane_type; | 168 PLANE_TYPE plane_type; |
186 int subsampling_x; | 169 int subsampling_x; |
187 int subsampling_y; | 170 int subsampling_y; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 foreach_transformed_block_visitor visit, void *arg); | 288 foreach_transformed_block_visitor visit, void *arg); |
306 | 289 |
307 | 290 |
308 void vp9_foreach_transformed_block( | 291 void vp9_foreach_transformed_block( |
309 const MACROBLOCKD* const xd, BLOCK_SIZE bsize, | 292 const MACROBLOCKD* const xd, BLOCK_SIZE bsize, |
310 foreach_transformed_block_visitor visit, void *arg); | 293 foreach_transformed_block_visitor visit, void *arg); |
311 | 294 |
312 static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize, | 295 static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize, |
313 TX_SIZE tx_size, int block, | 296 TX_SIZE tx_size, int block, |
314 int *x, int *y) { | 297 int *x, int *y) { |
315 const int bwl = b_width_log2(plane_bsize); | 298 const int bwl = b_width_log2_lookup[plane_bsize]; |
316 const int tx_cols_log2 = bwl - tx_size; | 299 const int tx_cols_log2 = bwl - tx_size; |
317 const int tx_cols = 1 << tx_cols_log2; | 300 const int tx_cols = 1 << tx_cols_log2; |
318 const int raster_mb = block >> (tx_size << 1); | 301 const int raster_mb = block >> (tx_size << 1); |
319 *x = (raster_mb & (tx_cols - 1)) << tx_size; | 302 *x = (raster_mb & (tx_cols - 1)) << tx_size; |
320 *y = (raster_mb >> tx_cols_log2) << tx_size; | 303 *y = (raster_mb >> tx_cols_log2) << tx_size; |
321 } | 304 } |
322 | 305 |
323 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, | 306 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, |
324 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, | 307 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, |
325 int aoff, int loff); | 308 int aoff, int loff); |
326 | 309 |
327 #ifdef __cplusplus | 310 #ifdef __cplusplus |
328 } // extern "C" | 311 } // extern "C" |
329 #endif | 312 #endif |
330 | 313 |
331 #endif // VP9_COMMON_VP9_BLOCKD_H_ | 314 #endif // VP9_COMMON_VP9_BLOCKD_H_ |
OLD | NEW |