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 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */ | 105 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */ |
106 | 106 |
107 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and | 107 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and |
108 // roll new_fb_idx into it. | 108 // roll new_fb_idx into it. |
109 | 109 |
110 // Each frame can reference REFS_PER_FRAME buffers | 110 // Each frame can reference REFS_PER_FRAME buffers |
111 RefBuffer frame_refs[REFS_PER_FRAME]; | 111 RefBuffer frame_refs[REFS_PER_FRAME]; |
112 | 112 |
113 int new_fb_idx; | 113 int new_fb_idx; |
114 | 114 |
| 115 #if CONFIG_VP9_POSTPROC |
115 YV12_BUFFER_CONFIG post_proc_buffer; | 116 YV12_BUFFER_CONFIG post_proc_buffer; |
| 117 YV12_BUFFER_CONFIG post_proc_buffer_int; |
| 118 #endif |
116 | 119 |
117 FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/ | 120 FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/ |
118 FRAME_TYPE frame_type; | 121 FRAME_TYPE frame_type; |
119 | 122 |
120 int show_frame; | 123 int show_frame; |
121 int last_show_frame; | 124 int last_show_frame; |
122 int show_existing_frame; | 125 int show_existing_frame; |
123 | 126 |
124 // Flag signaling that the frame is encoded using only INTRA modes. | 127 // Flag signaling that the frame is encoded using only INTRA modes. |
125 int intra_only; | 128 int intra_only; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 loop_filter_info_n lf_info; | 177 loop_filter_info_n lf_info; |
175 | 178 |
176 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ | 179 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ |
177 | 180 |
178 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ | 181 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ |
179 | 182 |
180 struct loopfilter lf; | 183 struct loopfilter lf; |
181 struct segmentation seg; | 184 struct segmentation seg; |
182 | 185 |
183 // Context probabilities for reference frame prediction | 186 // Context probabilities for reference frame prediction |
184 int allow_comp_inter_inter; | |
185 MV_REFERENCE_FRAME comp_fixed_ref; | 187 MV_REFERENCE_FRAME comp_fixed_ref; |
186 MV_REFERENCE_FRAME comp_var_ref[2]; | 188 MV_REFERENCE_FRAME comp_var_ref[2]; |
187 REFERENCE_MODE reference_mode; | 189 REFERENCE_MODE reference_mode; |
188 | 190 |
189 FRAME_CONTEXT *fc; /* this frame entropy */ | 191 FRAME_CONTEXT *fc; /* this frame entropy */ |
190 FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS | 192 FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS |
191 unsigned int frame_context_idx; /* Context to use/update */ | 193 unsigned int frame_context_idx; /* Context to use/update */ |
192 FRAME_COUNTS counts; | 194 FRAME_COUNTS counts; |
193 | 195 |
194 unsigned int current_video_frame; | 196 unsigned int current_video_frame; |
195 BITSTREAM_PROFILE profile; | 197 BITSTREAM_PROFILE profile; |
196 | 198 |
197 // VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3. | 199 // VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3. |
198 vpx_bit_depth_t bit_depth; | 200 vpx_bit_depth_t bit_depth; |
199 vpx_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer | 201 vpx_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer |
200 | 202 |
201 #if CONFIG_VP9_POSTPROC | 203 #if CONFIG_VP9_POSTPROC |
202 struct postproc_state postproc_state; | 204 struct postproc_state postproc_state; |
203 #endif | 205 #endif |
204 | 206 |
205 int error_resilient_mode; | 207 int error_resilient_mode; |
206 int frame_parallel_decoding_mode; | 208 int frame_parallel_decoding_mode; |
207 | 209 |
208 int log2_tile_cols, log2_tile_rows; | 210 int log2_tile_cols, log2_tile_rows; |
| 211 int byte_alignment; |
209 | 212 |
210 // Private data associated with the frame buffer callbacks. | 213 // Private data associated with the frame buffer callbacks. |
211 void *cb_priv; | 214 void *cb_priv; |
212 vpx_get_frame_buffer_cb_fn_t get_fb_cb; | 215 vpx_get_frame_buffer_cb_fn_t get_fb_cb; |
213 vpx_release_frame_buffer_cb_fn_t release_fb_cb; | 216 vpx_release_frame_buffer_cb_fn_t release_fb_cb; |
214 | 217 |
215 // Handles memory for the codec. | 218 // Handles memory for the codec. |
216 InternalFrameBufferList int_frame_buffers; | 219 InternalFrameBufferList int_frame_buffers; |
217 | 220 |
218 PARTITION_CONTEXT *above_seg_context; | 221 PARTITION_CONTEXT *above_seg_context; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 258 } |
256 | 259 |
257 static INLINE int mi_cols_aligned_to_sb(int n_mis) { | 260 static INLINE int mi_cols_aligned_to_sb(int n_mis) { |
258 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); | 261 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); |
259 } | 262 } |
260 | 263 |
261 static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { | 264 static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { |
262 int i; | 265 int i; |
263 | 266 |
264 for (i = 0; i < MAX_MB_PLANE; ++i) { | 267 for (i = 0; i < MAX_MB_PLANE; ++i) { |
265 xd->plane[i].dqcoeff = xd->dqcoeff[i]; | 268 xd->plane[i].dqcoeff = xd->dqcoeff; |
266 xd->above_context[i] = cm->above_context + | 269 xd->above_context[i] = cm->above_context + |
267 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); | 270 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); |
268 } | 271 } |
269 | 272 |
270 xd->above_seg_context = cm->above_seg_context; | 273 xd->above_seg_context = cm->above_seg_context; |
271 xd->mi_stride = cm->mi_stride; | 274 xd->mi_stride = cm->mi_stride; |
| 275 xd->error_info = &cm->error; |
272 } | 276 } |
273 | 277 |
274 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { | 278 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { |
275 return cm->frame_type == KEY_FRAME || cm->intra_only; | 279 return cm->frame_type == KEY_FRAME || cm->intra_only; |
276 } | 280 } |
277 | 281 |
278 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, | 282 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, |
279 int ctx) { | 283 int ctx) { |
280 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] | 284 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] |
281 : cm->fc->partition_prob[ctx]; | 285 : cm->fc->partition_prob[ctx]; |
(...skipping 20 matching lines...) Expand all Loading... |
302 int mi_col, int bw, | 306 int mi_col, int bw, |
303 int mi_rows, int mi_cols) { | 307 int mi_rows, int mi_cols) { |
304 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); | 308 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); |
305 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; | 309 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; |
306 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); | 310 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); |
307 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; | 311 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; |
308 | 312 |
309 // Are edges available for intra prediction? | 313 // Are edges available for intra prediction? |
310 xd->up_available = (mi_row != 0); | 314 xd->up_available = (mi_row != 0); |
311 xd->left_available = (mi_col > tile->mi_col_start); | 315 xd->left_available = (mi_col > tile->mi_col_start); |
312 } | 316 if (xd->up_available) { |
| 317 xd->above_mi = xd->mi[-xd->mi_stride].src_mi; |
| 318 xd->above_mbmi = xd->above_mi ? &xd->above_mi->mbmi : NULL; |
| 319 } else { |
| 320 xd->above_mi = NULL; |
| 321 xd->above_mbmi = NULL; |
| 322 } |
313 | 323 |
314 static INLINE void set_prev_mi(VP9_COMMON *cm) { | 324 if (xd->left_available) { |
315 const int use_prev_in_find_mv_refs = cm->width == cm->last_width && | 325 xd->left_mi = xd->mi[-1].src_mi; |
316 cm->height == cm->last_height && | 326 xd->left_mbmi = xd->left_mi ? &xd->left_mi->mbmi : NULL; |
317 !cm->intra_only && | 327 } else { |
318 cm->last_show_frame; | 328 xd->left_mi = NULL; |
319 // Special case: set prev_mi to NULL when the previous mode info | 329 xd->left_mbmi = NULL; |
320 // context cannot be used. | 330 } |
321 cm->prev_mi = use_prev_in_find_mv_refs ? | |
322 cm->prev_mip + cm->mi_stride + 1 : NULL; | |
323 } | 331 } |
324 | 332 |
325 static INLINE void update_partition_context(MACROBLOCKD *xd, | 333 static INLINE void update_partition_context(MACROBLOCKD *xd, |
326 int mi_row, int mi_col, | 334 int mi_row, int mi_col, |
327 BLOCK_SIZE subsize, | 335 BLOCK_SIZE subsize, |
328 BLOCK_SIZE bsize) { | 336 BLOCK_SIZE bsize) { |
329 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; | 337 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; |
330 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); | 338 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); |
331 | 339 |
332 // num_4x4_blocks_wide_lookup[bsize] / 2 | 340 // num_4x4_blocks_wide_lookup[bsize] / 2 |
(...skipping 27 matching lines...) Expand all Loading... |
360 left = (left & bs) > 0; | 368 left = (left & bs) > 0; |
361 | 369 |
362 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 370 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
363 } | 371 } |
364 | 372 |
365 #ifdef __cplusplus | 373 #ifdef __cplusplus |
366 } // extern "C" | 374 } // extern "C" |
367 #endif | 375 #endif |
368 | 376 |
369 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 377 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
OLD | NEW |