Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: source/libvpx/vp9/common/vp9_blockd.h

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_alloccommon.c ('k') | source/libvpx/vp9/common/vp9_blockd.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 void vpx_log(const char *format, ...); 15 void vpx_log(const char *format, ...);
16 16
17 #include "vpx_ports/config.h" 17 #include "./vpx_config.h"
18 #include "vpx_scale/yv12config.h" 18 #include "vpx_scale/yv12config.h"
19 #include "vp9/common/vp9_mv.h" 19 #include "vp9/common/vp9_mv.h"
20 #include "vp9/common/vp9_treecoder.h" 20 #include "vp9/common/vp9_treecoder.h"
21 #include "vp9/common/vp9_subpixel.h" 21 #include "vp9/common/vp9_subpixel.h"
22 #include "vpx_ports/mem.h" 22 #include "vpx_ports/mem.h"
23 #include "vp9/common/vp9_common.h" 23 #include "vp9/common/vp9_common.h"
24 24
25 #define TRUE 1 25 #define TRUE 1
26 #define FALSE 0 26 #define FALSE 0
27 27
(...skipping 10 matching lines...) Expand all
38 38
39 #define MAX_MB_SEGMENTS 4 39 #define MAX_MB_SEGMENTS 4
40 40
41 #define MAX_REF_LF_DELTAS 4 41 #define MAX_REF_LF_DELTAS 4
42 #define MAX_MODE_LF_DELTAS 4 42 #define MAX_MODE_LF_DELTAS 4
43 43
44 /* Segment Feature Masks */ 44 /* Segment Feature Masks */
45 #define SEGMENT_DELTADATA 0 45 #define SEGMENT_DELTADATA 0
46 #define SEGMENT_ABSDATA 1 46 #define SEGMENT_ABSDATA 1
47 #define MAX_MV_REFS 9 47 #define MAX_MV_REFS 9
48 #define MAX_MV_REF_CANDIDATES 4
49
50 #if CONFIG_DWTDCTHYBRID
51 #define DWT_MAX_LENGTH 64
52 #define DWT_TYPE 26 // 26/53/97
53 #define DWT_PRECISION_BITS 2
54 #define DWT_PRECISION_RND ((1 << DWT_PRECISION_BITS) / 2)
55
56 #define DWTDCT16X16 0
57 #define DWTDCT16X16_LEAN 1
58 #define DWTDCT8X8 2
59 #define DWTDCT_TYPE DWTDCT16X16_LEAN
60 #endif
48 61
49 typedef struct { 62 typedef struct {
50 int r, c; 63 int r, c;
51 } POS; 64 } POS;
52 65
53 typedef enum PlaneType { 66 typedef enum PlaneType {
54 PLANE_TYPE_Y_NO_DC = 0, 67 PLANE_TYPE_Y_NO_DC = 0,
55 PLANE_TYPE_Y2, 68 PLANE_TYPE_Y2,
56 PLANE_TYPE_UV, 69 PLANE_TYPE_UV,
57 PLANE_TYPE_Y_WITH_DC, 70 PLANE_TYPE_Y_WITH_DC,
58 } PLANE_TYPE; 71 } PLANE_TYPE;
59 72
60 typedef char ENTROPY_CONTEXT; 73 typedef char ENTROPY_CONTEXT;
61 typedef struct { 74 typedef struct {
62 ENTROPY_CONTEXT y1[4]; 75 ENTROPY_CONTEXT y1[4];
63 ENTROPY_CONTEXT u[2]; 76 ENTROPY_CONTEXT u[2];
64 ENTROPY_CONTEXT v[2]; 77 ENTROPY_CONTEXT v[2];
65 ENTROPY_CONTEXT y2; 78 ENTROPY_CONTEXT y2;
66 } ENTROPY_CONTEXT_PLANES; 79 } ENTROPY_CONTEXT_PLANES;
67 80
68 extern const unsigned char vp9_block2left[25];
69 extern const unsigned char vp9_block2above[25];
70 extern const unsigned char vp9_block2left_8x8[25];
71 extern const unsigned char vp9_block2above_8x8[25];
72
73 #define VP9_COMBINEENTROPYCONTEXTS( Dest, A, B) \ 81 #define VP9_COMBINEENTROPYCONTEXTS( Dest, A, B) \
74 Dest = ((A)!=0) + ((B)!=0); 82 Dest = ((A)!=0) + ((B)!=0);
75 83
76 typedef enum { 84 typedef enum {
77 KEY_FRAME = 0, 85 KEY_FRAME = 0,
78 INTER_FRAME = 1 86 INTER_FRAME = 1
79 } FRAME_TYPE; 87 } FRAME_TYPE;
80 88
81 typedef enum 89 typedef enum
82 { 90 {
83 SIXTAP = 0, 91 #if CONFIG_ENABLE_6TAP
84 BILINEAR = 1, 92 SIXTAP,
85 EIGHTTAP = 2, 93 #endif
86 EIGHTTAP_SHARP = 3, 94 EIGHTTAP_SMOOTH,
95 EIGHTTAP,
96 EIGHTTAP_SHARP,
97 BILINEAR,
87 SWITCHABLE /* should be the last one */ 98 SWITCHABLE /* should be the last one */
88 } INTERPOLATIONFILTERTYPE; 99 } INTERPOLATIONFILTERTYPE;
89 100
90 typedef enum 101 typedef enum
91 { 102 {
92 DC_PRED, /* average of above and left pixels */ 103 DC_PRED, /* average of above and left pixels */
93 V_PRED, /* vertical prediction */ 104 V_PRED, /* vertical prediction */
94 H_PRED, /* horizontal prediction */ 105 H_PRED, /* horizontal prediction */
95 D45_PRED, /* Directional 45 deg prediction [anti-clockwise from 0 d eg hor] */ 106 D45_PRED, /* Directional 45 deg prediction [anti-clockwise from 0 d eg hor] */
96 D135_PRED, /* Directional 135 deg prediction [anti-clockwise from 0 d eg hor] */ 107 D135_PRED, /* Directional 135 deg prediction [anti-clockwise from 0 d eg hor] */
97 D117_PRED, /* Directional 112 deg prediction [anti-clockwise from 0 d eg hor] */ 108 D117_PRED, /* Directional 112 deg prediction [anti-clockwise from 0 d eg hor] */
98 D153_PRED, /* Directional 157 deg prediction [anti-clockwise from 0 d eg hor] */ 109 D153_PRED, /* Directional 157 deg prediction [anti-clockwise from 0 d eg hor] */
99 D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 d eg hor] */ 110 D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 d eg hor] */
100 D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 d eg hor] */ 111 D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 d eg hor] */
101 TM_PRED, /* Truemotion prediction */ 112 TM_PRED, /* Truemotion prediction */
102 I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own prediction m ode */ 113 I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own prediction m ode */
103 B_PRED, /* block based prediction, each block has its own predicti on mode */ 114 B_PRED, /* block based prediction, each block has its own predicti on mode */
104
105 NEARESTMV, 115 NEARESTMV,
106 NEARMV, 116 NEARMV,
107 ZEROMV, 117 ZEROMV,
108 NEWMV, 118 NEWMV,
109 SPLITMV, 119 SPLITMV,
110
111 MB_MODE_COUNT 120 MB_MODE_COUNT
112 } MB_PREDICTION_MODE; 121 } MB_PREDICTION_MODE;
113 122
114 // Segment level features. 123 // Segment level features.
115 typedef enum { 124 typedef enum {
116 SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... 125 SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
117 SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... 126 SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
118 SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame 127 SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
119 SEG_LVL_MODE = 3, // Optional Segment mode 128 SEG_LVL_MODE = 3, // Optional Segment mode
120 SEG_LVL_EOB = 4, // EOB end stop marker. 129 SEG_LVL_EOB = 4, // EOB end stop marker.
121 SEG_LVL_TRANSFORM = 5, // Block transform size. 130 SEG_LVL_TRANSFORM = 5, // Block transform size.
122 SEG_LVL_MAX = 6 // Number of MB level features supported 131 SEG_LVL_MAX = 6 // Number of MB level features supported
123
124 } SEG_LVL_FEATURES; 132 } SEG_LVL_FEATURES;
125 133
126 // Segment level features. 134 // Segment level features.
127 typedef enum { 135 typedef enum {
128 TX_4X4, // 4x4 dct transform 136 TX_4X4 = 0, // 4x4 dct transform
129 TX_8X8, // 8x8 dct transform 137 TX_8X8 = 1, // 8x8 dct transform
130 TX_16X16, // 16x16 dct transform 138 TX_16X16 = 2, // 16x16 dct transform
131 TX_SIZE_MAX // Number of different transforms available 139 TX_SIZE_MAX_MB = 3, // Number of different transforms available
140 TX_32X32 = TX_SIZE_MAX_MB, // 32x32 dct transform
141 TX_SIZE_MAX_SB, // Number of transforms available to SBs
132 } TX_SIZE; 142 } TX_SIZE;
133 143
134 typedef enum { 144 typedef enum {
135 DCT_DCT = 0, // DCT in both horizontal and vertical 145 DCT_DCT = 0, // DCT in both horizontal and vertical
136 ADST_DCT = 1, // ADST in vertical, DCT in horizontal 146 ADST_DCT = 1, // ADST in vertical, DCT in horizontal
137 DCT_ADST = 2, // DCT in vertical, ADST in horizontal 147 DCT_ADST = 2, // DCT in vertical, ADST in horizontal
138 ADST_ADST = 3 // ADST in both directions 148 ADST_ADST = 3 // ADST in both directions
139 } TX_TYPE; 149 } TX_TYPE;
140 150
141 #define VP9_YMODES (B_PRED + 1) 151 #define VP9_YMODES (B_PRED + 1)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } SPLITMV_PARTITIONING_TYPE; 208 } SPLITMV_PARTITIONING_TYPE;
199 209
200 /* For keyframes, intra block modes are predicted by the (already decoded) 210 /* For keyframes, intra block modes are predicted by the (already decoded)
201 modes for the Y blocks to the left and above us; for interframes, there 211 modes for the Y blocks to the left and above us; for interframes, there
202 is a single probability table. */ 212 is a single probability table. */
203 213
204 union b_mode_info { 214 union b_mode_info {
205 struct { 215 struct {
206 B_PREDICTION_MODE first; 216 B_PREDICTION_MODE first;
207 TX_TYPE tx_type; 217 TX_TYPE tx_type;
208 #if CONFIG_COMP_INTRA_PRED
209 B_PREDICTION_MODE second;
210 #endif
211 #if CONFIG_NEWBINTRAMODES 218 #if CONFIG_NEWBINTRAMODES
212 B_PREDICTION_MODE context; 219 B_PREDICTION_MODE context;
213 #endif 220 #endif
214 } as_mode; 221 } as_mode;
215 struct { 222 struct {
216 int_mv first; 223 int_mv first;
217 int_mv second; 224 int_mv second;
218 } as_mv; 225 } as_mv;
219 }; 226 };
220 227
221 typedef enum { 228 typedef enum {
222 NONE = -1, 229 NONE = -1,
223 INTRA_FRAME = 0, 230 INTRA_FRAME = 0,
224 LAST_FRAME = 1, 231 LAST_FRAME = 1,
225 GOLDEN_FRAME = 2, 232 GOLDEN_FRAME = 2,
226 ALTREF_FRAME = 3, 233 ALTREF_FRAME = 3,
227 MAX_REF_FRAMES = 4 234 MAX_REF_FRAMES = 4
228 } MV_REFERENCE_FRAME; 235 } MV_REFERENCE_FRAME;
229 236
237 typedef enum {
238 BLOCK_SIZE_MB16X16 = 0,
239 BLOCK_SIZE_SB32X32 = 1,
240 BLOCK_SIZE_SB64X64 = 2,
241 } BLOCK_SIZE_TYPE;
242
230 typedef struct { 243 typedef struct {
231 MB_PREDICTION_MODE mode, uv_mode; 244 MB_PREDICTION_MODE mode, uv_mode;
232 #if CONFIG_COMP_INTRA_PRED
233 MB_PREDICTION_MODE second_mode, second_uv_mode;
234 #endif
235 #if CONFIG_COMP_INTERINTRA_PRED 245 #if CONFIG_COMP_INTERINTRA_PRED
236 MB_PREDICTION_MODE interintra_mode, interintra_uv_mode; 246 MB_PREDICTION_MODE interintra_mode, interintra_uv_mode;
237 #endif 247 #endif
238 MV_REFERENCE_FRAME ref_frame, second_ref_frame; 248 MV_REFERENCE_FRAME ref_frame, second_ref_frame;
239 TX_SIZE txfm_size; 249 TX_SIZE txfm_size;
240 int_mv mv[2]; // for each reference frame used 250 int_mv mv[2]; // for each reference frame used
241 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REFS]; 251 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
242 int_mv best_mv, best_second_mv; 252 int_mv best_mv, best_second_mv;
243 #if CONFIG_NEW_MVREF 253 #if CONFIG_NEW_MVREF
244 int best_index, best_second_index; 254 int best_index, best_second_index;
245 #endif 255 #endif
246 256
247 int mb_mode_context[MAX_REF_FRAMES]; 257 int mb_mode_context[MAX_REF_FRAMES];
248 258
249 SPLITMV_PARTITIONING_TYPE partitioning; 259 SPLITMV_PARTITIONING_TYPE partitioning;
250 unsigned char mb_skip_coeff; /* does this mb ha s coefficients at all, 1=no coefficients, 0=need decode tokens */ 260 unsigned char mb_skip_coeff; /* does this mb ha s coefficients at all, 1=no coefficients, 0=need decode tokens */
251 unsigned char need_to_clamp_mvs; 261 unsigned char need_to_clamp_mvs;
252 unsigned char need_to_clamp_secondmv; 262 unsigned char need_to_clamp_secondmv;
253 unsigned char segment_id; /* Which set of segmentation parame ters should be used for this MB */ 263 unsigned char segment_id; /* Which set of segmentation parame ters should be used for this MB */
254 264
255 // Flags used for prediction status of various bistream signals 265 // Flags used for prediction status of various bistream signals
256 unsigned char seg_id_predicted; 266 unsigned char seg_id_predicted;
257 unsigned char ref_predicted; 267 unsigned char ref_predicted;
258 268
259 // Indicates if the mb is part of the image (1) vs border (0) 269 // Indicates if the mb is part of the image (1) vs border (0)
260 // This can be useful in determining whether the MB provides 270 // This can be useful in determining whether the MB provides
261 // a valid predictor 271 // a valid predictor
262 unsigned char mb_in_image; 272 unsigned char mb_in_image;
263 273
264 #if CONFIG_PRED_FILTER 274 INTERPOLATIONFILTERTYPE interp_filter;
265 // Flag to turn prediction signal filter on(1)/off(0 ) at the MB level
266 unsigned int pred_filter_enabled;
267 #endif
268 INTERPOLATIONFILTERTYPE interp_filter;
269 275
270 #if CONFIG_SUPERBLOCKS 276 BLOCK_SIZE_TYPE sb_type;
271 // FIXME need a SB array of 4 MB_MODE_INFOs that
272 // only needs one encoded_as_sb.
273 unsigned char encoded_as_sb;
274 #endif
275 } MB_MODE_INFO; 277 } MB_MODE_INFO;
276 278
277 typedef struct { 279 typedef struct {
278 MB_MODE_INFO mbmi; 280 MB_MODE_INFO mbmi;
279 union b_mode_info bmi[16]; 281 union b_mode_info bmi[16];
280 } MODE_INFO; 282 } MODE_INFO;
281 283
282 typedef struct blockd { 284 typedef struct blockd {
283 short *qcoeff; 285 int16_t *qcoeff;
284 short *dqcoeff; 286 int16_t *dqcoeff;
285 unsigned char *predictor; 287 uint8_t *predictor;
286 short *diff; 288 int16_t *diff;
287 short *dequant; 289 int16_t *dequant;
288 290
289 /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ 291 /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
290 unsigned char **base_pre; 292 uint8_t **base_pre;
291 unsigned char **base_second_pre; 293 uint8_t **base_second_pre;
292 int pre; 294 int pre;
293 int pre_stride; 295 int pre_stride;
294 296
295 unsigned char **base_dst; 297 uint8_t **base_dst;
296 int dst; 298 int dst;
297 int dst_stride; 299 int dst_stride;
298 300
299 int eob; 301 int eob;
300 302
301 union b_mode_info bmi; 303 union b_mode_info bmi;
302 } BLOCKD; 304 } BLOCKD;
303 305
306 typedef struct superblockd {
307 /* 32x32 Y and 16x16 U/V. No 2nd order transform yet. */
308 DECLARE_ALIGNED(16, int16_t, diff[32*32+16*16*2]);
309 DECLARE_ALIGNED(16, int16_t, qcoeff[32*32+16*16*2]);
310 DECLARE_ALIGNED(16, int16_t, dqcoeff[32*32+16*16*2]);
311 } SUPERBLOCKD;
312
304 typedef struct macroblockd { 313 typedef struct macroblockd {
305 DECLARE_ALIGNED(16, short, diff[400]); /* from idct diff */ 314 DECLARE_ALIGNED(16, int16_t, diff[400]); /* from idct diff */
306 DECLARE_ALIGNED(16, unsigned char, predictor[384]); 315 DECLARE_ALIGNED(16, uint8_t, predictor[384]);
307 DECLARE_ALIGNED(16, short, qcoeff[400]); 316 DECLARE_ALIGNED(16, int16_t, qcoeff[400]);
308 DECLARE_ALIGNED(16, short, dqcoeff[400]); 317 DECLARE_ALIGNED(16, int16_t, dqcoeff[400]);
309 DECLARE_ALIGNED(16, unsigned short, eobs[25]); 318 DECLARE_ALIGNED(16, uint16_t, eobs[25]);
319
320 SUPERBLOCKD sb_coeff_data;
310 321
311 /* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */ 322 /* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
312 BLOCKD block[25]; 323 BLOCKD block[25];
313 int fullpixel_mask; 324 int fullpixel_mask;
314 325
315 YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */ 326 YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
316 struct { 327 struct {
317 uint8_t *y_buffer, *u_buffer, *v_buffer; 328 uint8_t *y_buffer, *u_buffer, *v_buffer;
318 } second_pre; 329 } second_pre;
319 YV12_BUFFER_CONFIG dst; 330 YV12_BUFFER_CONFIG dst;
(...skipping 23 matching lines...) Expand all
343 /* 0 (do not update) 1 (update) the macroblock segmentation feature data. */ 354 /* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
344 unsigned char mb_segment_abs_delta; 355 unsigned char mb_segment_abs_delta;
345 356
346 /* Per frame flags that define which MB level features (such as quantizer or l oop filter level) */ 357 /* Per frame flags that define which MB level features (such as quantizer or l oop filter level) */
347 /* are enabled and when enabled the proabilities used to decode the per MB fla gs in MB_MODE_INFO */ 358 /* are enabled and when enabled the proabilities used to decode the per MB fla gs in MB_MODE_INFO */
348 359
349 // Probability Tree used to code Segment number 360 // Probability Tree used to code Segment number
350 vp9_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS]; 361 vp9_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
351 362
352 #if CONFIG_NEW_MVREF 363 #if CONFIG_NEW_MVREF
353 vp9_prob mb_mv_ref_id_probs[MAX_REF_FRAMES][3]; 364 vp9_prob mb_mv_ref_probs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES-1];
354 #endif 365 #endif
355 366
356 // Segment features 367 // Segment features
357 signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX]; 368 signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
358 unsigned int segment_feature_mask[MAX_MB_SEGMENTS]; 369 unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
359 370
360 /* mode_based Loop filter adjustment */ 371 /* mode_based Loop filter adjustment */
361 unsigned char mode_ref_lf_delta_enabled; 372 unsigned char mode_ref_lf_delta_enabled;
362 unsigned char mode_ref_lf_delta_update; 373 unsigned char mode_ref_lf_delta_update;
363 374
364 /* Delta values have the range +/- MAX_LOOP_FILTER */ 375 /* Delta values have the range +/- MAX_LOOP_FILTER */
365 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra , Last, GF, ARF */ 376 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra , Last, GF, ARF */
366 signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra , Last, GF, ARF */ 377 signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra , Last, GF, ARF */
367 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED , ZERO_MV, MV, SPLIT */ 378 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED , ZERO_MV, MV, SPLIT */
368 signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED , ZERO_MV, MV, SPLIT */ 379 signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED , ZERO_MV, MV, SPLIT */
369 380
370 /* Distance of MB away from frame edges */ 381 /* Distance of MB away from frame edges */
371 int mb_to_left_edge; 382 int mb_to_left_edge;
372 int mb_to_right_edge; 383 int mb_to_right_edge;
373 int mb_to_top_edge; 384 int mb_to_top_edge;
374 int mb_to_bottom_edge; 385 int mb_to_bottom_edge;
375 386
376 unsigned int frames_since_golden; 387 unsigned int frames_since_golden;
377 unsigned int frames_till_alt_ref_frame; 388 unsigned int frames_till_alt_ref_frame;
378 389
379 /* Inverse transform function pointers. */ 390 /* Inverse transform function pointers. */
380 void (*inv_xform4x4_1_x8)(short *input, short *output, int pitch); 391 void (*inv_xform4x4_1_x8)(int16_t *input, int16_t *output, int pitch);
381 void (*inv_xform4x4_x8)(short *input, short *output, int pitch); 392 void (*inv_xform4x4_x8)(int16_t *input, int16_t *output, int pitch);
382 void (*inv_walsh4x4_1)(short *in, short *out); 393 void (*inv_walsh4x4_1)(int16_t *in, int16_t *out);
383 void (*inv_walsh4x4_lossless)(short *in, short *out); 394 void (*inv_walsh4x4_lossless)(int16_t *in, int16_t *out);
384 395
385 396
386 vp9_subpix_fn_t subpixel_predict; 397 vp9_subpix_fn_t subpixel_predict4x4;
387 vp9_subpix_fn_t subpixel_predict8x4; 398 vp9_subpix_fn_t subpixel_predict8x4;
388 vp9_subpix_fn_t subpixel_predict8x8; 399 vp9_subpix_fn_t subpixel_predict8x8;
389 vp9_subpix_fn_t subpixel_predict16x16; 400 vp9_subpix_fn_t subpixel_predict16x16;
390 vp9_subpix_fn_t subpixel_predict_avg; 401 vp9_subpix_fn_t subpixel_predict_avg4x4;
391 vp9_subpix_fn_t subpixel_predict_avg8x4; 402 vp9_subpix_fn_t subpixel_predict_avg8x4;
392 vp9_subpix_fn_t subpixel_predict_avg8x8; 403 vp9_subpix_fn_t subpixel_predict_avg8x8;
393 vp9_subpix_fn_t subpixel_predict_avg16x16; 404 vp9_subpix_fn_t subpixel_predict_avg16x16;
394 int allow_high_precision_mv; 405 int allow_high_precision_mv;
395 406
396 int corrupted; 407 int corrupted;
397 408
398 #if !CONFIG_SUPERBLOCKS && (ARCH_X86 || ARCH_X86_64) 409 int sb_index;
399 /* This is an intermediate buffer currently used in sub-pixel motion search
400 * to keep a copy of the reference area. This buffer can be used for other
401 * purpose.
402 */
403 DECLARE_ALIGNED(32, unsigned char, y_buf[22 * 32]);
404 #endif
405
406 int mb_index; // Index of the MB in the SB (0..3) 410 int mb_index; // Index of the MB in the SB (0..3)
407 int q_index; 411 int q_index;
408 412
409 } MACROBLOCKD; 413 } MACROBLOCKD;
410 414
411 #define ACTIVE_HT 110 // quantization stepsize threshold 415 #define ACTIVE_HT 110 // quantization stepsize threshold
412 416
413 #define ACTIVE_HT8 300 417 #define ACTIVE_HT8 300
414 418
415 #define ACTIVE_HT16 300 419 #define ACTIVE_HT16 300
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 break; 487 break;
484 #endif 488 #endif
485 489
486 default : 490 default :
487 tx_type = DCT_DCT; 491 tx_type = DCT_DCT;
488 break; 492 break;
489 } 493 }
490 return tx_type; 494 return tx_type;
491 } 495 }
492 496
497 extern const uint8_t vp9_block2left[TX_SIZE_MAX_SB][25];
498 extern const uint8_t vp9_block2above[TX_SIZE_MAX_SB][25];
499
493 #define USE_ADST_FOR_I16X16_8X8 0 500 #define USE_ADST_FOR_I16X16_8X8 0
494 #define USE_ADST_FOR_I16X16_4X4 0 501 #define USE_ADST_FOR_I16X16_4X4 0
495 #define USE_ADST_FOR_I8X8_4X4 1 502 #define USE_ADST_FOR_I8X8_4X4 1
496 #define USE_ADST_PERIPHERY_ONLY 1 503 #define USE_ADST_PERIPHERY_ONLY 1
497 504
498 static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) { 505 static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
499 // TODO(debargha): explore different patterns for ADST usage when blocksize 506 // TODO(debargha): explore different patterns for ADST usage when blocksize
500 // is smaller than the prediction size 507 // is smaller than the prediction size
501 TX_TYPE tx_type = DCT_DCT; 508 TX_TYPE tx_type = DCT_DCT;
502 int ib = (int)(b - xd->block); 509 int ib = (int)(b - xd->block);
503 if (ib >= 16) 510 if (ib >= 16)
504 return tx_type; 511 return tx_type;
505 #if CONFIG_SUPERBLOCKS
506 // TODO(rbultje, debargha): Explore ADST usage for superblocks 512 // TODO(rbultje, debargha): Explore ADST usage for superblocks
507 if (xd->mode_info_context->mbmi.encoded_as_sb) 513 if (xd->mode_info_context->mbmi.sb_type)
508 return tx_type; 514 return tx_type;
509 #endif
510 if (xd->mode_info_context->mbmi.mode == B_PRED && 515 if (xd->mode_info_context->mbmi.mode == B_PRED &&
511 xd->q_index < ACTIVE_HT) { 516 xd->q_index < ACTIVE_HT) {
512 tx_type = txfm_map( 517 tx_type = txfm_map(
513 #if CONFIG_NEWBINTRAMODES 518 #if CONFIG_NEWBINTRAMODES
514 b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context : 519 b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context :
515 #endif 520 #endif
516 b->bmi.as_mode.first); 521 b->bmi.as_mode.first);
517 } else if (xd->mode_info_context->mbmi.mode == I8X8_PRED && 522 } else if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
518 xd->q_index < ACTIVE_HT) { 523 xd->q_index < ACTIVE_HT) {
519 #if USE_ADST_FOR_I8X8_4X4 524 #if USE_ADST_FOR_I8X8_4X4
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 return tx_type; 557 return tx_type;
553 } 558 }
554 559
555 static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) { 560 static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) {
556 // TODO(debargha): explore different patterns for ADST usage when blocksize 561 // TODO(debargha): explore different patterns for ADST usage when blocksize
557 // is smaller than the prediction size 562 // is smaller than the prediction size
558 TX_TYPE tx_type = DCT_DCT; 563 TX_TYPE tx_type = DCT_DCT;
559 int ib = (int)(b - xd->block); 564 int ib = (int)(b - xd->block);
560 if (ib >= 16) 565 if (ib >= 16)
561 return tx_type; 566 return tx_type;
562 #if CONFIG_SUPERBLOCKS
563 // TODO(rbultje, debargha): Explore ADST usage for superblocks 567 // TODO(rbultje, debargha): Explore ADST usage for superblocks
564 if (xd->mode_info_context->mbmi.encoded_as_sb) 568 if (xd->mode_info_context->mbmi.sb_type)
565 return tx_type; 569 return tx_type;
566 #endif
567 if (xd->mode_info_context->mbmi.mode == I8X8_PRED && 570 if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
568 xd->q_index < ACTIVE_HT8) { 571 xd->q_index < ACTIVE_HT8) {
569 // TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged 572 // TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged
570 // or the relationship otherwise modified to address this type conversion. 573 // or the relationship otherwise modified to address this type conversion.
571 tx_type = txfm_map(pred_mode_conv( 574 tx_type = txfm_map(pred_mode_conv(
572 (MB_PREDICTION_MODE)b->bmi.as_mode.first)); 575 (MB_PREDICTION_MODE)b->bmi.as_mode.first));
573 } else if (xd->mode_info_context->mbmi.mode < I8X8_PRED && 576 } else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
574 xd->q_index < ACTIVE_HT8) { 577 xd->q_index < ACTIVE_HT8) {
575 #if USE_ADST_FOR_I8X8_4X4 578 #if USE_ADST_FOR_I8X8_4X4
576 #if USE_ADST_PERIPHERY_ONLY 579 #if USE_ADST_PERIPHERY_ONLY
(...skipping 10 matching lines...) Expand all
587 #endif 590 #endif
588 } 591 }
589 return tx_type; 592 return tx_type;
590 } 593 }
591 594
592 static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) { 595 static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) {
593 TX_TYPE tx_type = DCT_DCT; 596 TX_TYPE tx_type = DCT_DCT;
594 int ib = (int)(b - xd->block); 597 int ib = (int)(b - xd->block);
595 if (ib >= 16) 598 if (ib >= 16)
596 return tx_type; 599 return tx_type;
597 #if CONFIG_SUPERBLOCKS
598 // TODO(rbultje, debargha): Explore ADST usage for superblocks 600 // TODO(rbultje, debargha): Explore ADST usage for superblocks
599 if (xd->mode_info_context->mbmi.encoded_as_sb) 601 if (xd->mode_info_context->mbmi.sb_type)
600 return tx_type; 602 return tx_type;
601 #endif
602 if (xd->mode_info_context->mbmi.mode < I8X8_PRED && 603 if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
603 xd->q_index < ACTIVE_HT16) { 604 xd->q_index < ACTIVE_HT16) {
604 tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)); 605 tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
605 } 606 }
606 return tx_type; 607 return tx_type;
607 } 608 }
608 609
609 static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) { 610 static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) {
610 TX_TYPE tx_type = DCT_DCT; 611 TX_TYPE tx_type = DCT_DCT;
611 int ib = (int)(b - xd->block); 612 int ib = (int)(b - xd->block);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) || 644 is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) ||
644 (xd->mode_info_context->mbmi.mode == I8X8_PRED) || 645 (xd->mode_info_context->mbmi.mode == I8X8_PRED) ||
645 (xd->mode_info_context->mbmi.mode == B_PRED); 646 (xd->mode_info_context->mbmi.mode == B_PRED);
646 647
647 if (is_4x4) { 648 if (is_4x4) {
648 for (i = 0; i < 16; i++) { 649 for (i = 0; i < 16; i++) {
649 xd->block[i].bmi = xd->mode_info_context->bmi[i]; 650 xd->block[i].bmi = xd->mode_info_context->bmi[i];
650 } 651 }
651 } 652 }
652 } 653 }
653 #endif /* __INC_BLOCKD_H */ 654 #endif // VP9_COMMON_VP9_BLOCKD_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_alloccommon.c ('k') | source/libvpx/vp9/common/vp9_blockd.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698