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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index], | 204 ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index], |
205 cm->new_fb_idx); | 205 cm->new_fb_idx); |
206 if (old_idx >= 0 && cm->frame_bufs[old_idx].ref_count == 0) | 206 if (old_idx >= 0 && cm->frame_bufs[old_idx].ref_count == 0) |
207 cm->release_fb_cb(cm->cb_priv, | 207 cm->release_fb_cb(cm->cb_priv, |
208 &cm->frame_bufs[old_idx].raw_frame_buffer); | 208 &cm->frame_bufs[old_idx].raw_frame_buffer); |
209 } | 209 } |
210 ++ref_index; | 210 ++ref_index; |
211 } | 211 } |
212 | 212 |
213 cm->frame_to_show = get_frame_new_buffer(cm); | 213 cm->frame_to_show = get_frame_new_buffer(cm); |
214 | 214 cm->frame_bufs[cm->new_fb_idx].ref_count--; |
215 if (!pbi->frame_parallel_decode || !cm->show_frame) { | |
216 --cm->frame_bufs[cm->new_fb_idx].ref_count; | |
217 } | |
218 | 215 |
219 // Invalidate these references until the next frame starts. | 216 // Invalidate these references until the next frame starts. |
220 for (ref_index = 0; ref_index < 3; ref_index++) | 217 for (ref_index = 0; ref_index < 3; ref_index++) |
221 cm->frame_refs[ref_index].idx = INT_MAX; | 218 cm->frame_refs[ref_index].idx = INT_MAX; |
222 } | 219 } |
223 | 220 |
224 int vp9_receive_compressed_data(VP9Decoder *pbi, | 221 int vp9_receive_compressed_data(VP9Decoder *pbi, |
225 size_t size, const uint8_t **psource) { | 222 size_t size, const uint8_t **psource) { |
226 VP9_COMMON *const cm = &pbi->common; | 223 VP9_COMMON *const cm = &pbi->common; |
227 const uint8_t *source = *psource; | 224 const uint8_t *source = *psource; |
228 int retcode = 0; | 225 int retcode = 0; |
229 | 226 |
230 cm->error.error_code = VPX_CODEC_OK; | 227 cm->error.error_code = VPX_CODEC_OK; |
231 | 228 |
232 if (size == 0) { | 229 if (size == 0) { |
233 // This is used to signal that we are missing frames. | 230 // This is used to signal that we are missing frames. |
234 // We do not know if the missing frame(s) was supposed to update | 231 // We do not know if the missing frame(s) was supposed to update |
235 // any of the reference buffers, but we act conservative and | 232 // any of the reference buffers, but we act conservative and |
236 // mark only the last buffer as corrupted. | 233 // mark only the last buffer as corrupted. |
237 // | 234 // |
238 // TODO(jkoleszar): Error concealment is undefined and non-normative | 235 // TODO(jkoleszar): Error concealment is undefined and non-normative |
239 // at this point, but if it becomes so, [0] may not always be the correct | 236 // at this point, but if it becomes so, [0] may not always be the correct |
240 // thing to do here. | 237 // thing to do here. |
241 if (cm->frame_refs[0].idx != INT_MAX) | 238 if (cm->frame_refs[0].idx != INT_MAX) |
242 cm->frame_refs[0].buf->corrupted = 1; | 239 cm->frame_refs[0].buf->corrupted = 1; |
243 } | 240 } |
244 | 241 |
245 // Check if the previous frame was a frame without any references to it. | 242 // Check if the previous frame was a frame without any references to it. |
246 // Release frame buffer if not decoding in frame parallel mode. | 243 if (cm->new_fb_idx >= 0 && cm->frame_bufs[cm->new_fb_idx].ref_count == 0) |
247 if (!pbi->frame_parallel_decode && cm->new_fb_idx >= 0 && | |
248 cm->frame_bufs[cm->new_fb_idx].ref_count == 0) | |
249 cm->release_fb_cb(cm->cb_priv, | 244 cm->release_fb_cb(cm->cb_priv, |
250 &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer); | 245 &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer); |
251 cm->new_fb_idx = get_free_fb(cm); | 246 cm->new_fb_idx = get_free_fb(cm); |
252 | 247 |
253 if (setjmp(cm->error.jmp)) { | 248 if (setjmp(cm->error.jmp)) { |
254 cm->error.setjmp = 0; | 249 cm->error.setjmp = 0; |
255 | 250 |
256 // We do not know if the missing frame(s) was supposed to update | 251 // We do not know if the missing frame(s) was supposed to update |
257 // any of the reference buffers, but we act conservative and | 252 // any of the reference buffers, but we act conservative and |
258 // mark only the last buffer as corrupted. | 253 // mark only the last buffer as corrupted. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 308 |
314 #if CONFIG_VP9_POSTPROC | 309 #if CONFIG_VP9_POSTPROC |
315 ret = vp9_post_proc_frame(&pbi->common, sd, flags); | 310 ret = vp9_post_proc_frame(&pbi->common, sd, flags); |
316 #else | 311 #else |
317 *sd = *pbi->common.frame_to_show; | 312 *sd = *pbi->common.frame_to_show; |
318 ret = 0; | 313 ret = 0; |
319 #endif /*!CONFIG_POSTPROC*/ | 314 #endif /*!CONFIG_POSTPROC*/ |
320 vp9_clear_system_state(); | 315 vp9_clear_system_state(); |
321 return ret; | 316 return ret; |
322 } | 317 } |
OLD | NEW |