Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: source/libvpx/vp9/decoder/vp9_decoder.c

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/decoder/vp9_detokenize.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 #include "vp9/decoder/vp9_decodeframe.h" 31 #include "vp9/decoder/vp9_decodeframe.h"
32 #include "vp9/decoder/vp9_decoder.h" 32 #include "vp9/decoder/vp9_decoder.h"
33 #include "vp9/decoder/vp9_detokenize.h" 33 #include "vp9/decoder/vp9_detokenize.h"
34 #include "vp9/decoder/vp9_dthread.h" 34 #include "vp9/decoder/vp9_dthread.h"
35 35
36 static void initialize_dec() { 36 static void initialize_dec() {
37 static int init_done = 0; 37 static int init_done = 0;
38 38
39 if (!init_done) { 39 if (!init_done) {
40 vp9_rtcd(); 40 vp9_rtcd();
41 vp9_init_neighbors();
42 vp9_init_intra_predictors(); 41 vp9_init_intra_predictors();
43 init_done = 1; 42 init_done = 1;
44 } 43 }
45 } 44 }
46 45
47 VP9Decoder *vp9_decoder_create() { 46 VP9Decoder *vp9_decoder_create() {
48 VP9Decoder *const pbi = vpx_memalign(32, sizeof(*pbi)); 47 VP9Decoder *const pbi = vpx_memalign(32, sizeof(*pbi));
49 VP9_COMMON *const cm = pbi ? &pbi->common : NULL; 48 VP9_COMMON *const cm = pbi ? &pbi->common : NULL;
50 49
51 if (!cm) 50 if (!cm)
(...skipping 10 matching lines...) Expand all
62 cm->error.setjmp = 1; 61 cm->error.setjmp = 1;
63 pbi->need_resync = 1; 62 pbi->need_resync = 1;
64 initialize_dec(); 63 initialize_dec();
65 64
66 // Initialize the references to not point to any frame buffers. 65 // Initialize the references to not point to any frame buffers.
67 vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map)); 66 vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
68 67
69 cm->current_video_frame = 0; 68 cm->current_video_frame = 0;
70 pbi->ready_for_new_data = 1; 69 pbi->ready_for_new_data = 1;
71 cm->bit_depth = VPX_BITS_8; 70 cm->bit_depth = VPX_BITS_8;
71 cm->dequant_bit_depth = VPX_BITS_8;
72 72
73 // vp9_init_dequantizer() is first called here. Add check in 73 // vp9_init_dequantizer() is first called here. Add check in
74 // frame_init_dequantizer() to avoid unnecessary calling of 74 // frame_init_dequantizer() to avoid unnecessary calling of
75 // vp9_init_dequantizer() for every frame. 75 // vp9_init_dequantizer() for every frame.
76 vp9_init_dequantizer(cm); 76 vp9_init_dequantizer(cm);
77 77
78 vp9_loop_filter_init(cm); 78 vp9_loop_filter_init(cm);
79 79
80 cm->error.setjmp = 0; 80 cm->error.setjmp = 0;
81 81
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // any of the reference buffers, but we act conservative and 225 // any of the reference buffers, but we act conservative and
226 // mark only the last buffer as corrupted. 226 // mark only the last buffer as corrupted.
227 // 227 //
228 // TODO(jkoleszar): Error concealment is undefined and non-normative 228 // TODO(jkoleszar): Error concealment is undefined and non-normative
229 // at this point, but if it becomes so, [0] may not always be the correct 229 // at this point, but if it becomes so, [0] may not always be the correct
230 // thing to do here. 230 // thing to do here.
231 if (cm->frame_refs[0].idx != INT_MAX) 231 if (cm->frame_refs[0].idx != INT_MAX)
232 cm->frame_refs[0].buf->corrupted = 1; 232 cm->frame_refs[0].buf->corrupted = 1;
233 } 233 }
234 234
235 pbi->ready_for_new_data = 0;
236
235 // Check if the previous frame was a frame without any references to it. 237 // Check if the previous frame was a frame without any references to it.
236 if (cm->new_fb_idx >= 0 && cm->frame_bufs[cm->new_fb_idx].ref_count == 0) 238 if (cm->new_fb_idx >= 0 && cm->frame_bufs[cm->new_fb_idx].ref_count == 0)
237 cm->release_fb_cb(cm->cb_priv, 239 cm->release_fb_cb(cm->cb_priv,
238 &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer); 240 &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer);
239 cm->new_fb_idx = get_free_fb(cm); 241 cm->new_fb_idx = get_free_fb(cm);
240 242
241 if (setjmp(cm->error.jmp)) { 243 if (setjmp(cm->error.jmp)) {
242 pbi->need_resync = 1; 244 pbi->need_resync = 1;
243 cm->error.setjmp = 0; 245 cm->error.setjmp = 0;
244 vp9_clear_system_state(); 246 vp9_clear_system_state();
(...skipping 27 matching lines...) Expand all
272 274
273 if (!cm->show_existing_frame) 275 if (!cm->show_existing_frame)
274 cm->last_show_frame = cm->show_frame; 276 cm->last_show_frame = cm->show_frame;
275 if (cm->show_frame) { 277 if (cm->show_frame) {
276 if (!cm->show_existing_frame) 278 if (!cm->show_existing_frame)
277 vp9_swap_mi_and_prev_mi(cm); 279 vp9_swap_mi_and_prev_mi(cm);
278 280
279 cm->current_video_frame++; 281 cm->current_video_frame++;
280 } 282 }
281 283
282 pbi->ready_for_new_data = 0;
283
284 cm->error.setjmp = 0; 284 cm->error.setjmp = 0;
285 return retcode; 285 return retcode;
286 } 286 }
287 287
288 int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd, 288 int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
289 vp9_ppflags_t *flags) { 289 vp9_ppflags_t *flags) {
290 VP9_COMMON *const cm = &pbi->common; 290 VP9_COMMON *const cm = &pbi->common;
291 int ret = -1; 291 int ret = -1;
292 #if !CONFIG_VP9_POSTPROC 292 #if !CONFIG_VP9_POSTPROC
293 (void)*flags; 293 (void)*flags;
294 #endif 294 #endif
295 295
296 if (pbi->ready_for_new_data == 1) 296 if (pbi->ready_for_new_data == 1)
297 return ret; 297 return ret;
298 298
299 pbi->ready_for_new_data = 1;
300
299 /* no raw frame to show!!! */ 301 /* no raw frame to show!!! */
300 if (!cm->show_frame) 302 if (!cm->show_frame)
301 return ret; 303 return ret;
302 304
303 pbi->ready_for_new_data = 1;
304
305 #if CONFIG_VP9_POSTPROC 305 #if CONFIG_VP9_POSTPROC
306 if (!cm->show_existing_frame) { 306 if (!cm->show_existing_frame) {
307 ret = vp9_post_proc_frame(cm, sd, flags); 307 ret = vp9_post_proc_frame(cm, sd, flags);
308 } else { 308 } else {
309 *sd = *cm->frame_to_show; 309 *sd = *cm->frame_to_show;
310 ret = 0; 310 ret = 0;
311 } 311 }
312 #else 312 #else
313 *sd = *cm->frame_to_show; 313 *sd = *cm->frame_to_show;
314 ret = 0; 314 ret = 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 for (j = 0; j < mag; ++j) 374 for (j = 0; j < mag; ++j)
375 this_sz |= (*x++) << (j * 8); 375 this_sz |= (*x++) << (j * 8);
376 sizes[i] = this_sz; 376 sizes[i] = this_sz;
377 } 377 }
378 *count = frames; 378 *count = frames;
379 } 379 }
380 } 380 }
381 return VPX_CODEC_OK; 381 return VPX_CODEC_OK;
382 } 382 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/decoder/vp9_detokenize.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698