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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 VP9_REFFRAME ref_frame_flag, | 116 VP9_REFFRAME ref_frame_flag, |
117 YV12_BUFFER_CONFIG *sd) { | 117 YV12_BUFFER_CONFIG *sd) { |
118 VP9_COMMON *cm = &pbi->common; | 118 VP9_COMMON *cm = &pbi->common; |
119 | 119 |
120 /* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the | 120 /* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the |
121 * encoder is using the frame buffers for. This is just a stub to keep the | 121 * encoder is using the frame buffers for. This is just a stub to keep the |
122 * vpxenc --test-decode functionality working, and will be replaced in a | 122 * vpxenc --test-decode functionality working, and will be replaced in a |
123 * later commit that adds VP9-specific controls for this functionality. | 123 * later commit that adds VP9-specific controls for this functionality. |
124 */ | 124 */ |
125 if (ref_frame_flag == VP9_LAST_FLAG) { | 125 if (ref_frame_flag == VP9_LAST_FLAG) { |
126 const YV12_BUFFER_CONFIG *const cfg = | 126 const YV12_BUFFER_CONFIG *const cfg = get_ref_frame(cm, 0); |
127 &cm->frame_bufs[cm->ref_frame_map[0]].buf; | 127 if (cfg == NULL) { |
| 128 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |
| 129 "No 'last' reference frame"); |
| 130 return VPX_CODEC_ERROR; |
| 131 } |
128 if (!equal_dimensions(cfg, sd)) | 132 if (!equal_dimensions(cfg, sd)) |
129 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, | 133 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |
130 "Incorrect buffer dimensions"); | 134 "Incorrect buffer dimensions"); |
131 else | 135 else |
132 vp8_yv12_copy_frame(cfg, sd); | 136 vp8_yv12_copy_frame(cfg, sd); |
133 } else { | 137 } else { |
134 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, | 138 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |
135 "Invalid reference frame"); | 139 "Invalid reference frame"); |
136 } | 140 } |
137 | 141 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 178 |
175 // Manage the reference counters and copy image. | 179 // Manage the reference counters and copy image. |
176 ref_cnt_fb(cm->frame_bufs, ref_fb_ptr, free_fb); | 180 ref_cnt_fb(cm->frame_bufs, ref_fb_ptr, free_fb); |
177 ref_buf->buf = &cm->frame_bufs[*ref_fb_ptr].buf; | 181 ref_buf->buf = &cm->frame_bufs[*ref_fb_ptr].buf; |
178 vp8_yv12_copy_frame(sd, ref_buf->buf); | 182 vp8_yv12_copy_frame(sd, ref_buf->buf); |
179 } | 183 } |
180 | 184 |
181 return cm->error.error_code; | 185 return cm->error.error_code; |
182 } | 186 } |
183 | 187 |
184 | |
185 int vp9_get_reference_dec(VP9Decoder *pbi, int index, YV12_BUFFER_CONFIG **fb) { | |
186 VP9_COMMON *cm = &pbi->common; | |
187 | |
188 if (index < 0 || index >= REF_FRAMES) | |
189 return -1; | |
190 | |
191 *fb = &cm->frame_bufs[cm->ref_frame_map[index]].buf; | |
192 return 0; | |
193 } | |
194 | |
195 /* If any buffer updating is signaled it should be done here. */ | 188 /* If any buffer updating is signaled it should be done here. */ |
196 static void swap_frame_buffers(VP9Decoder *pbi) { | 189 static void swap_frame_buffers(VP9Decoder *pbi) { |
197 int ref_index = 0, mask; | 190 int ref_index = 0, mask; |
198 VP9_COMMON *const cm = &pbi->common; | 191 VP9_COMMON *const cm = &pbi->common; |
199 | 192 |
200 for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) { | 193 for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) { |
201 if (mask & 1) { | 194 if (mask & 1) { |
202 const int old_idx = cm->ref_frame_map[ref_index]; | 195 const int old_idx = cm->ref_frame_map[ref_index]; |
203 ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index], | 196 ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index], |
204 cm->new_fb_idx); | 197 cm->new_fb_idx); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 *sd = *cm->frame_to_show; | 307 *sd = *cm->frame_to_show; |
315 ret = 0; | 308 ret = 0; |
316 } | 309 } |
317 #else | 310 #else |
318 *sd = *cm->frame_to_show; | 311 *sd = *cm->frame_to_show; |
319 ret = 0; | 312 ret = 0; |
320 #endif /*!CONFIG_POSTPROC*/ | 313 #endif /*!CONFIG_POSTPROC*/ |
321 vp9_clear_system_state(); | 314 vp9_clear_system_state(); |
322 return ret; | 315 return ret; |
323 } | 316 } |
OLD | NEW |