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 #ifndef VP9_COMMON_VP9_ONYXC_INT_H_ | 11 #ifndef VP9_COMMON_VP9_ONYXC_INT_H_ |
12 #define VP9_COMMON_VP9_ONYXC_INT_H_ | 12 #define VP9_COMMON_VP9_ONYXC_INT_H_ |
13 | 13 |
14 #include "./vpx_config.h" | 14 #include "./vpx_config.h" |
15 #include "vpx/internal/vpx_codec_internal.h" | 15 #include "vpx/internal/vpx_codec_internal.h" |
16 #include "./vp9_rtcd.h" | 16 #include "./vp9_rtcd.h" |
| 17 #include "vp9/common/vp9_alloccommon.h" |
17 #include "vp9/common/vp9_loopfilter.h" | 18 #include "vp9/common/vp9_loopfilter.h" |
18 #include "vp9/common/vp9_entropymv.h" | 19 #include "vp9/common/vp9_entropymv.h" |
19 #include "vp9/common/vp9_entropy.h" | 20 #include "vp9/common/vp9_entropy.h" |
20 #include "vp9/common/vp9_entropymode.h" | 21 #include "vp9/common/vp9_entropymode.h" |
21 #include "vp9/common/vp9_frame_buffers.h" | 22 #include "vp9/common/vp9_frame_buffers.h" |
22 #include "vp9/common/vp9_quant_common.h" | 23 #include "vp9/common/vp9_quant_common.h" |
23 #include "vp9/common/vp9_thread.h" | 24 #include "vp9/common/vp9_thread.h" |
24 #include "vp9/common/vp9_tile_common.h" | 25 #include "vp9/common/vp9_tile_common.h" |
25 | 26 |
26 #if CONFIG_VP9_POSTPROC | 27 #if CONFIG_VP9_POSTPROC |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Whether to use previous frame's motion vectors for prediction. | 214 // Whether to use previous frame's motion vectors for prediction. |
214 int use_prev_frame_mvs; | 215 int use_prev_frame_mvs; |
215 | 216 |
216 // Persistent mb segment id map used in prediction. | 217 // Persistent mb segment id map used in prediction. |
217 int seg_map_idx; | 218 int seg_map_idx; |
218 int prev_seg_map_idx; | 219 int prev_seg_map_idx; |
219 | 220 |
220 uint8_t *seg_map_array[NUM_PING_PONG_BUFFERS]; | 221 uint8_t *seg_map_array[NUM_PING_PONG_BUFFERS]; |
221 uint8_t *last_frame_seg_map; | 222 uint8_t *last_frame_seg_map; |
222 uint8_t *current_frame_seg_map; | 223 uint8_t *current_frame_seg_map; |
| 224 int seg_map_alloc_size; |
223 | 225 |
224 INTERP_FILTER interp_filter; | 226 INTERP_FILTER interp_filter; |
225 | 227 |
226 loop_filter_info_n lf_info; | 228 loop_filter_info_n lf_info; |
227 | 229 |
228 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ | 230 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ |
229 | 231 |
230 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ | 232 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ |
231 | 233 |
232 struct loopfilter lf; | 234 struct loopfilter lf; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 vpx_release_frame_buffer_cb_fn_t release_fb_cb; | 271 vpx_release_frame_buffer_cb_fn_t release_fb_cb; |
270 | 272 |
271 // Handles memory for the codec. | 273 // Handles memory for the codec. |
272 InternalFrameBufferList int_frame_buffers; | 274 InternalFrameBufferList int_frame_buffers; |
273 | 275 |
274 // External BufferPool passed from outside. | 276 // External BufferPool passed from outside. |
275 BufferPool *buffer_pool; | 277 BufferPool *buffer_pool; |
276 | 278 |
277 PARTITION_CONTEXT *above_seg_context; | 279 PARTITION_CONTEXT *above_seg_context; |
278 ENTROPY_CONTEXT *above_context; | 280 ENTROPY_CONTEXT *above_context; |
| 281 int above_context_alloc_cols; |
279 } VP9_COMMON; | 282 } VP9_COMMON; |
280 | 283 |
281 // TODO(hkuang): Don't need to lock the whole pool after implementing atomic | 284 // TODO(hkuang): Don't need to lock the whole pool after implementing atomic |
282 // frame reference count. | 285 // frame reference count. |
283 void lock_buffer_pool(BufferPool *const pool); | 286 void lock_buffer_pool(BufferPool *const pool); |
284 void unlock_buffer_pool(BufferPool *const pool); | 287 void unlock_buffer_pool(BufferPool *const pool); |
285 | 288 |
286 static INLINE YV12_BUFFER_CONFIG *get_ref_frame(VP9_COMMON *cm, int index) { | 289 static INLINE YV12_BUFFER_CONFIG *get_ref_frame(VP9_COMMON *cm, int index) { |
287 if (index < 0 || index >= REF_FRAMES) | 290 if (index < 0 || index >= REF_FRAMES) |
288 return NULL; | 291 return NULL; |
289 if (cm->ref_frame_map[index] < 0) | 292 if (cm->ref_frame_map[index] < 0) |
290 return NULL; | 293 return NULL; |
291 assert(cm->ref_frame_map[index] < FRAME_BUFFERS); | 294 assert(cm->ref_frame_map[index] < FRAME_BUFFERS); |
292 return &cm->buffer_pool->frame_bufs[cm->ref_frame_map[index]].buf; | 295 return &cm->buffer_pool->frame_bufs[cm->ref_frame_map[index]].buf; |
293 } | 296 } |
294 | 297 |
295 static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) { | 298 static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) { |
296 return &cm->buffer_pool->frame_bufs[cm->new_fb_idx].buf; | 299 return &cm->buffer_pool->frame_bufs[cm->new_fb_idx].buf; |
297 } | 300 } |
298 | 301 |
299 static INLINE int get_free_fb(VP9_COMMON *cm) { | 302 static INLINE int get_free_fb(VP9_COMMON *cm) { |
300 RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs; | 303 RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs; |
301 int i; | 304 int i; |
302 | 305 |
303 lock_buffer_pool(cm->buffer_pool); | 306 lock_buffer_pool(cm->buffer_pool); |
304 for (i = 0; i < FRAME_BUFFERS; ++i) | 307 for (i = 0; i < FRAME_BUFFERS; ++i) |
305 if (frame_bufs[i].ref_count == 0) | 308 if (frame_bufs[i].ref_count == 0) |
306 break; | 309 break; |
307 | 310 |
308 assert(i < FRAME_BUFFERS); | 311 if (i != FRAME_BUFFERS) { |
309 frame_bufs[i].ref_count = 1; | 312 frame_bufs[i].ref_count = 1; |
| 313 } else { |
| 314 // Reset i to be INVALID_IDX to indicate no free buffer found. |
| 315 i = INVALID_IDX; |
| 316 } |
| 317 |
310 unlock_buffer_pool(cm->buffer_pool); | 318 unlock_buffer_pool(cm->buffer_pool); |
311 return i; | 319 return i; |
312 } | 320 } |
313 | 321 |
314 static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { | 322 static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { |
315 const int ref_index = *idx; | 323 const int ref_index = *idx; |
316 | 324 |
317 if (ref_index >= 0 && bufs[ref_index].ref_count > 0) | 325 if (ref_index >= 0 && bufs[ref_index].ref_count > 0) |
318 bufs[ref_index].ref_count--; | 326 bufs[ref_index].ref_count--; |
319 | 327 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 assert(bsl >= 0); | 434 assert(bsl >= 0); |
427 | 435 |
428 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 436 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
429 } | 437 } |
430 | 438 |
431 #ifdef __cplusplus | 439 #ifdef __cplusplus |
432 } // extern "C" | 440 } // extern "C" |
433 #endif | 441 #endif |
434 | 442 |
435 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 443 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
OLD | NEW |