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 #include "./vpx_config.h" | 11 #include "./vpx_config.h" |
12 #include "vpx_mem/vpx_mem.h" | 12 #include "vpx_mem/vpx_mem.h" |
13 | 13 |
14 #include "vp9/common/vp9_alloccommon.h" | 14 #include "vp9/common/vp9_alloccommon.h" |
15 #include "vp9/common/vp9_blockd.h" | 15 #include "vp9/common/vp9_blockd.h" |
16 #include "vp9/common/vp9_entropymode.h" | 16 #include "vp9/common/vp9_entropymode.h" |
17 #include "vp9/common/vp9_entropymv.h" | 17 #include "vp9/common/vp9_entropymv.h" |
18 #include "vp9/common/vp9_onyxc_int.h" | 18 #include "vp9/common/vp9_onyxc_int.h" |
19 #include "vp9/common/vp9_systemdependent.h" | |
20 | 19 |
21 // TODO(hkuang): Don't need to lock the whole pool after implementing atomic | 20 // TODO(hkuang): Don't need to lock the whole pool after implementing atomic |
22 // frame reference count. | 21 // frame reference count. |
23 void lock_buffer_pool(BufferPool *const pool) { | 22 void lock_buffer_pool(BufferPool *const pool) { |
24 #if CONFIG_MULTITHREAD | 23 #if CONFIG_MULTITHREAD |
25 pthread_mutex_lock(&pool->pool_mutex); | 24 pthread_mutex_lock(&pool->pool_mutex); |
26 #else | 25 #else |
27 (void)pool; | 26 (void)pool; |
28 #endif | 27 #endif |
29 } | 28 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int i; | 88 int i; |
90 | 89 |
91 for (i = 0; i < FRAME_BUFFERS; ++i) { | 90 for (i = 0; i < FRAME_BUFFERS; ++i) { |
92 if (pool->frame_bufs[i].ref_count > 0 && | 91 if (pool->frame_bufs[i].ref_count > 0 && |
93 pool->frame_bufs[i].raw_frame_buffer.data != NULL) { | 92 pool->frame_bufs[i].raw_frame_buffer.data != NULL) { |
94 pool->release_fb_cb(pool->cb_priv, &pool->frame_bufs[i].raw_frame_buffer); | 93 pool->release_fb_cb(pool->cb_priv, &pool->frame_bufs[i].raw_frame_buffer); |
95 pool->frame_bufs[i].ref_count = 0; | 94 pool->frame_bufs[i].ref_count = 0; |
96 } | 95 } |
97 vpx_free(pool->frame_bufs[i].mvs); | 96 vpx_free(pool->frame_bufs[i].mvs); |
98 pool->frame_bufs[i].mvs = NULL; | 97 pool->frame_bufs[i].mvs = NULL; |
99 vp9_free_frame_buffer(&pool->frame_bufs[i].buf); | 98 vpx_free_frame_buffer(&pool->frame_bufs[i].buf); |
100 } | 99 } |
101 } | 100 } |
102 | 101 |
103 void vp9_free_postproc_buffers(VP9_COMMON *cm) { | 102 void vp9_free_postproc_buffers(VP9_COMMON *cm) { |
104 #if CONFIG_VP9_POSTPROC | 103 #if CONFIG_VP9_POSTPROC |
105 vp9_free_frame_buffer(&cm->post_proc_buffer); | 104 vpx_free_frame_buffer(&cm->post_proc_buffer); |
106 vp9_free_frame_buffer(&cm->post_proc_buffer_int); | 105 vpx_free_frame_buffer(&cm->post_proc_buffer_int); |
107 #else | 106 #else |
108 (void)cm; | 107 (void)cm; |
109 #endif | 108 #endif |
110 } | 109 } |
111 | 110 |
112 void vp9_free_context_buffers(VP9_COMMON *cm) { | 111 void vp9_free_context_buffers(VP9_COMMON *cm) { |
113 cm->free_mi(cm); | 112 cm->free_mi(cm); |
114 free_seg_map(cm); | 113 free_seg_map(cm); |
115 vpx_free(cm->above_context); | 114 vpx_free(cm->above_context); |
116 cm->above_context = NULL; | 115 cm->above_context = NULL; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 173 |
175 void vp9_swap_current_and_last_seg_map(VP9_COMMON *cm) { | 174 void vp9_swap_current_and_last_seg_map(VP9_COMMON *cm) { |
176 // Swap indices. | 175 // Swap indices. |
177 const int tmp = cm->seg_map_idx; | 176 const int tmp = cm->seg_map_idx; |
178 cm->seg_map_idx = cm->prev_seg_map_idx; | 177 cm->seg_map_idx = cm->prev_seg_map_idx; |
179 cm->prev_seg_map_idx = tmp; | 178 cm->prev_seg_map_idx = tmp; |
180 | 179 |
181 cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx]; | 180 cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx]; |
182 cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx]; | 181 cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx]; |
183 } | 182 } |
OLD | NEW |