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 26 matching lines...) Expand all Loading... |
37 if (cm->frame_bufs[i].ref_count > 0 && | 37 if (cm->frame_bufs[i].ref_count > 0 && |
38 cm->frame_bufs[i].raw_frame_buffer.data != NULL) { | 38 cm->frame_bufs[i].raw_frame_buffer.data != NULL) { |
39 cm->release_fb_cb(cm->cb_priv, &cm->frame_bufs[i].raw_frame_buffer); | 39 cm->release_fb_cb(cm->cb_priv, &cm->frame_bufs[i].raw_frame_buffer); |
40 cm->frame_bufs[i].ref_count = 0; | 40 cm->frame_bufs[i].ref_count = 0; |
41 } | 41 } |
42 vpx_free(cm->frame_bufs[i].mvs); | 42 vpx_free(cm->frame_bufs[i].mvs); |
43 cm->frame_bufs[i].mvs = NULL; | 43 cm->frame_bufs[i].mvs = NULL; |
44 vp9_free_frame_buffer(&cm->frame_bufs[i].buf); | 44 vp9_free_frame_buffer(&cm->frame_bufs[i].buf); |
45 } | 45 } |
46 | 46 |
| 47 #if CONFIG_VP9_POSTPROC |
47 vp9_free_frame_buffer(&cm->post_proc_buffer); | 48 vp9_free_frame_buffer(&cm->post_proc_buffer); |
| 49 vp9_free_frame_buffer(&cm->post_proc_buffer_int); |
| 50 #endif |
48 } | 51 } |
49 | 52 |
50 void vp9_free_context_buffers(VP9_COMMON *cm) { | 53 void vp9_free_context_buffers(VP9_COMMON *cm) { |
51 cm->free_mi(cm); | 54 cm->free_mi(cm); |
52 vpx_free(cm->last_frame_seg_map); | 55 vpx_free(cm->last_frame_seg_map); |
53 cm->last_frame_seg_map = NULL; | 56 cm->last_frame_seg_map = NULL; |
54 vpx_free(cm->above_context); | 57 vpx_free(cm->above_context); |
55 cm->above_context = NULL; | 58 cm->above_context = NULL; |
56 vpx_free(cm->above_seg_context); | 59 vpx_free(cm->above_seg_context); |
57 cm->above_seg_context = NULL; | 60 cm->above_seg_context = NULL; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 105 |
103 vp9_free_ref_frame_buffers(cm); | 106 vp9_free_ref_frame_buffers(cm); |
104 | 107 |
105 for (i = 0; i < FRAME_BUFFERS; ++i) { | 108 for (i = 0; i < FRAME_BUFFERS; ++i) { |
106 cm->frame_bufs[i].ref_count = 0; | 109 cm->frame_bufs[i].ref_count = 0; |
107 if (vp9_alloc_frame_buffer(&cm->frame_bufs[i].buf, width, height, | 110 if (vp9_alloc_frame_buffer(&cm->frame_bufs[i].buf, width, height, |
108 ss_x, ss_y, | 111 ss_x, ss_y, |
109 #if CONFIG_VP9_HIGHBITDEPTH | 112 #if CONFIG_VP9_HIGHBITDEPTH |
110 cm->use_highbitdepth, | 113 cm->use_highbitdepth, |
111 #endif | 114 #endif |
112 VP9_ENC_BORDER_IN_PIXELS) < 0) | 115 VP9_ENC_BORDER_IN_PIXELS, |
| 116 cm->byte_alignment) < 0) |
113 goto fail; | 117 goto fail; |
114 if (cm->frame_bufs[i].mvs == NULL) { | 118 if (cm->frame_bufs[i].mvs == NULL) { |
115 cm->frame_bufs[i].mvs = | 119 cm->frame_bufs[i].mvs = |
116 (MV_REF *)vpx_calloc(cm->mi_rows * cm->mi_cols, | 120 (MV_REF *)vpx_calloc(cm->mi_rows * cm->mi_cols, |
117 sizeof(*cm->frame_bufs[i].mvs)); | 121 sizeof(*cm->frame_bufs[i].mvs)); |
118 if (cm->frame_bufs[i].mvs == NULL) | 122 if (cm->frame_bufs[i].mvs == NULL) |
119 goto fail; | 123 goto fail; |
120 | 124 |
121 cm->frame_bufs[i].mi_rows = cm->mi_rows; | 125 cm->frame_bufs[i].mi_rows = cm->mi_rows; |
122 cm->frame_bufs[i].mi_cols = cm->mi_cols; | 126 cm->frame_bufs[i].mi_cols = cm->mi_cols; |
123 } | 127 } |
124 } | 128 } |
125 | 129 |
126 init_frame_bufs(cm); | 130 init_frame_bufs(cm); |
127 | 131 |
128 #if CONFIG_INTERNAL_STATS || CONFIG_VP9_POSTPROC | 132 #if CONFIG_VP9_POSTPROC |
129 if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y, | 133 if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y, |
130 #if CONFIG_VP9_HIGHBITDEPTH | 134 #if CONFIG_VP9_HIGHBITDEPTH |
131 cm->use_highbitdepth, | 135 cm->use_highbitdepth, |
132 #endif | 136 #endif |
133 VP9_ENC_BORDER_IN_PIXELS) < 0) | 137 VP9_ENC_BORDER_IN_PIXELS, |
| 138 cm->byte_alignment) < 0) |
134 goto fail; | 139 goto fail; |
135 #endif | 140 #endif |
136 | 141 |
137 return 0; | 142 return 0; |
138 | 143 |
139 fail: | 144 fail: |
140 vp9_free_ref_frame_buffers(cm); | 145 vp9_free_ref_frame_buffers(cm); |
141 return 1; | 146 return 1; |
142 } | 147 } |
143 | 148 |
144 void vp9_remove_common(VP9_COMMON *cm) { | 149 void vp9_remove_common(VP9_COMMON *cm) { |
145 vp9_free_ref_frame_buffers(cm); | 150 vp9_free_ref_frame_buffers(cm); |
146 vp9_free_context_buffers(cm); | 151 vp9_free_context_buffers(cm); |
147 vp9_free_internal_frame_buffers(&cm->int_frame_buffers); | 152 vp9_free_internal_frame_buffers(&cm->int_frame_buffers); |
148 | 153 |
149 vpx_free(cm->fc); | 154 vpx_free(cm->fc); |
150 cm->fc = NULL; | 155 cm->fc = NULL; |
151 vpx_free(cm->frame_contexts); | 156 vpx_free(cm->frame_contexts); |
152 cm->frame_contexts = NULL; | 157 cm->frame_contexts = NULL; |
153 } | 158 } |
154 | 159 |
155 void vp9_init_context_buffers(VP9_COMMON *cm) { | 160 void vp9_init_context_buffers(VP9_COMMON *cm) { |
156 cm->setup_mi(cm); | 161 cm->setup_mi(cm); |
157 if (cm->last_frame_seg_map) | 162 if (cm->last_frame_seg_map) |
158 vpx_memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols); | 163 vpx_memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols); |
159 } | 164 } |
OLD | NEW |