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

Side by Side Diff: source/libvpx/vp8/decoder/onyxd_if.c

Issue 12077018: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 10 months 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/vp8/common/postproc.c ('k') | source/libvpx/vp8/decoder/onyxd_int.h » ('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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #else 85 #else
86 pbi->ec_enabled = 0; 86 pbi->ec_enabled = 0;
87 #endif 87 #endif
88 /* Error concealment is activated after a key frame has been 88 /* Error concealment is activated after a key frame has been
89 * decoded without errors when error concealment is enabled. 89 * decoded without errors when error concealment is enabled.
90 */ 90 */
91 pbi->ec_active = 0; 91 pbi->ec_active = 0;
92 92
93 pbi->decoded_key_frame = 0; 93 pbi->decoded_key_frame = 0;
94 94
95 pbi->input_fragments = oxcf->input_fragments;
96 pbi->num_fragments = 0;
97
98 /* Independent partitions is activated when a frame updates the 95 /* Independent partitions is activated when a frame updates the
99 * token probability table to have equal probabilities over the 96 * token probability table to have equal probabilities over the
100 * PREV_COEF context. 97 * PREV_COEF context.
101 */ 98 */
102 pbi->independent_partitions = 0; 99 pbi->independent_partitions = 0;
103 100
104 vp8_setup_block_dptrs(&pbi->mb); 101 vp8_setup_block_dptrs(&pbi->mb);
105 102
106 return pbi; 103 return pbi;
107 } 104 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx]; 272 cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx];
276 } 273 }
277 else 274 else
278 cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx]; 275 cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
279 276
280 cm->fb_idx_ref_cnt[cm->new_fb_idx]--; 277 cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
281 278
282 return err; 279 return err;
283 } 280 }
284 281
285 int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size, 282 int check_fragments_for_errors(VP8D_COMP *pbi)
286 const uint8_t *source,
287 int64_t time_stamp)
288 { 283 {
289 #if HAVE_NEON
290 int64_t dx_store_reg[8];
291 #endif
292 VP8_COMMON *cm = &pbi->common;
293 int retcode = -1;
294
295 pbi->common.error.error_code = VPX_CODEC_OK;
296
297 if (pbi->num_fragments == 0)
298 {
299 /* New frame, reset fragment pointers and sizes */
300 vpx_memset((void*)pbi->fragments, 0, sizeof(pbi->fragments));
301 vpx_memset(pbi->fragment_sizes, 0, sizeof(pbi->fragment_sizes));
302 }
303 if (pbi->input_fragments && !(source == NULL && size == 0))
304 {
305 /* Store a pointer to this fragment and return. We haven't
306 * received the complete frame yet, so we will wait with decoding.
307 */
308 assert(pbi->num_fragments < MAX_PARTITIONS);
309 pbi->fragments[pbi->num_fragments] = source;
310 pbi->fragment_sizes[pbi->num_fragments] = size;
311 pbi->num_fragments++;
312 if (pbi->num_fragments > (1 << EIGHT_PARTITION) + 1)
313 {
314 pbi->common.error.error_code = VPX_CODEC_UNSUP_BITSTREAM;
315 pbi->common.error.setjmp = 0;
316 pbi->num_fragments = 0;
317 return -1;
318 }
319 return 0;
320 }
321
322 if (!pbi->input_fragments)
323 {
324 pbi->fragments[0] = source;
325 pbi->fragment_sizes[0] = size;
326 pbi->num_fragments = 1;
327 }
328 assert(pbi->common.multi_token_partition <= EIGHT_PARTITION);
329 if (pbi->num_fragments == 0)
330 {
331 pbi->num_fragments = 1;
332 pbi->fragments[0] = NULL;
333 pbi->fragment_sizes[0] = 0;
334 }
335
336 if (!pbi->ec_active && 284 if (!pbi->ec_active &&
337 pbi->num_fragments <= 1 && pbi->fragment_sizes[0] == 0) 285 pbi->num_fragments <= 1 && pbi->fragment_sizes[0] == 0)
338 { 286 {
287 VP8_COMMON *cm = &pbi->common;
288
339 /* If error concealment is disabled we won't signal missing frames 289 /* If error concealment is disabled we won't signal missing frames
340 * to the decoder. 290 * to the decoder.
341 */ 291 */
342 if (cm->fb_idx_ref_cnt[cm->lst_fb_idx] > 1) 292 if (cm->fb_idx_ref_cnt[cm->lst_fb_idx] > 1)
343 { 293 {
344 /* The last reference shares buffer with another reference 294 /* The last reference shares buffer with another reference
345 * buffer. Move it to its own buffer before setting it as 295 * buffer. Move it to its own buffer before setting it as
346 * corrupt, otherwise we will make multiple buffers corrupt. 296 * corrupt, otherwise we will make multiple buffers corrupt.
347 */ 297 */
348 const int prev_idx = cm->lst_fb_idx; 298 const int prev_idx = cm->lst_fb_idx;
349 cm->fb_idx_ref_cnt[prev_idx]--; 299 cm->fb_idx_ref_cnt[prev_idx]--;
350 cm->lst_fb_idx = get_free_fb(cm); 300 cm->lst_fb_idx = get_free_fb(cm);
351 vp8_yv12_copy_frame(&cm->yv12_fb[prev_idx], 301 vp8_yv12_copy_frame(&cm->yv12_fb[prev_idx],
352 &cm->yv12_fb[cm->lst_fb_idx]); 302 &cm->yv12_fb[cm->lst_fb_idx]);
353 } 303 }
354 /* This is used to signal that we are missing frames. 304 /* This is used to signal that we are missing frames.
355 * We do not know if the missing frame(s) was supposed to update 305 * We do not know if the missing frame(s) was supposed to update
356 * any of the reference buffers, but we act conservative and 306 * any of the reference buffers, but we act conservative and
357 * mark only the last buffer as corrupted. 307 * mark only the last buffer as corrupted.
358 */ 308 */
359 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1; 309 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
360 310
361 /* Signal that we have no frame to show. */ 311 /* Signal that we have no frame to show. */
362 cm->show_frame = 0; 312 cm->show_frame = 0;
363 313
364 pbi->num_fragments = 0;
365
366 /* Nothing more to do. */ 314 /* Nothing more to do. */
367 return 0; 315 return 0;
368 } 316 }
369 317
318 return 1;
319 }
320
321 int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size,
322 const uint8_t *source,
323 int64_t time_stamp)
324 {
325 #if HAVE_NEON
326 int64_t dx_store_reg[8];
327 #endif
328 VP8_COMMON *cm = &pbi->common;
329 int retcode = -1;
330
331 pbi->common.error.error_code = VPX_CODEC_OK;
332
333 retcode = check_fragments_for_errors(pbi);
334 if(retcode <= 0)
335 return retcode;
336
370 #if HAVE_NEON 337 #if HAVE_NEON
371 #if CONFIG_RUNTIME_CPU_DETECT 338 #if CONFIG_RUNTIME_CPU_DETECT
372 if (cm->cpu_caps & HAS_NEON) 339 if (cm->cpu_caps & HAS_NEON)
373 #endif 340 #endif
374 { 341 {
375 vp8_push_neon(dx_store_reg); 342 vp8_push_neon(dx_store_reg);
376 } 343 }
377 #endif 344 #endif
378 345
379 cm->new_fb_idx = get_free_fb (cm); 346 cm->new_fb_idx = get_free_fb (cm);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 379 }
413 380
414 if (swap_frame_buffers (cm)) 381 if (swap_frame_buffers (cm))
415 { 382 {
416 pbi->common.error.error_code = VPX_CODEC_ERROR; 383 pbi->common.error.error_code = VPX_CODEC_ERROR;
417 goto decode_exit; 384 goto decode_exit;
418 } 385 }
419 386
420 vp8_clear_system_state(); 387 vp8_clear_system_state();
421 388
422 #if CONFIG_ERROR_CONCEALMENT 389 if (cm->show_frame)
390 {
391 cm->current_video_frame++;
392 cm->show_frame_mi = cm->mi;
393 }
394
395 #if CONFIG_ERROR_CONCEALMENT
423 /* swap the mode infos to storage for future error concealment */ 396 /* swap the mode infos to storage for future error concealment */
424 if (pbi->ec_enabled && pbi->common.prev_mi) 397 if (pbi->ec_enabled && pbi->common.prev_mi)
425 { 398 {
426 MODE_INFO* tmp = pbi->common.prev_mi; 399 MODE_INFO* tmp = pbi->common.prev_mi;
427 int row, col; 400 int row, col;
428 pbi->common.prev_mi = pbi->common.mi; 401 pbi->common.prev_mi = pbi->common.mi;
429 pbi->common.mi = tmp; 402 pbi->common.mi = tmp;
430 403
431 /* Propagate the segment_ids to the next frame */ 404 /* Propagate the segment_ids to the next frame */
432 for (row = 0; row < pbi->common.mb_rows; ++row) 405 for (row = 0; row < pbi->common.mb_rows; ++row)
433 { 406 {
434 for (col = 0; col < pbi->common.mb_cols; ++col) 407 for (col = 0; col < pbi->common.mb_cols; ++col)
435 { 408 {
436 const int i = row*pbi->common.mode_info_stride + col; 409 const int i = row*pbi->common.mode_info_stride + col;
437 pbi->common.mi[i].mbmi.segment_id = 410 pbi->common.mi[i].mbmi.segment_id =
438 pbi->common.prev_mi[i].mbmi.segment_id; 411 pbi->common.prev_mi[i].mbmi.segment_id;
439 } 412 }
440 } 413 }
441 } 414 }
442 #endif 415 #endif
443 416
444 if (cm->show_frame)
445 cm->current_video_frame++;
446
447 pbi->ready_for_new_data = 0; 417 pbi->ready_for_new_data = 0;
448 pbi->last_time_stamp = time_stamp; 418 pbi->last_time_stamp = time_stamp;
449 419
450 decode_exit: 420 decode_exit:
451 #if HAVE_NEON 421 #if HAVE_NEON
452 #if CONFIG_RUNTIME_CPU_DETECT 422 #if CONFIG_RUNTIME_CPU_DETECT
453 if (cm->cpu_caps & HAS_NEON) 423 if (cm->cpu_caps & HAS_NEON)
454 #endif 424 #endif
455 { 425 {
456 vp8_pop_neon(dx_store_reg); 426 vp8_pop_neon(dx_store_reg);
457 } 427 }
458 #endif 428 #endif
459 429
460 pbi->common.error.setjmp = 0; 430 pbi->common.error.setjmp = 0;
461 pbi->num_fragments = 0;
462 return retcode; 431 return retcode;
463 } 432 }
464 int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd, int64_t *time_st amp, int64_t *time_end_stamp, vp8_ppflags_t *flags) 433 int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd, int64_t *time_st amp, int64_t *time_end_stamp, vp8_ppflags_t *flags)
465 { 434 {
466 int ret = -1; 435 int ret = -1;
467 436
468 if (pbi->ready_for_new_data == 1) 437 if (pbi->ready_for_new_data == 1)
469 return ret; 438 return ret;
470 439
471 /* ie no raw frame to show!!! */ 440 /* ie no raw frame to show!!! */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++) 483 for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++)
515 { 484 {
516 if( mi->mbmi.ref_frame == ref_frame) 485 if( mi->mbmi.ref_frame == ref_frame)
517 return 1; 486 return 1;
518 } 487 }
519 mi++; 488 mi++;
520 } 489 }
521 return 0; 490 return 0;
522 491
523 } 492 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/common/postproc.c ('k') | source/libvpx/vp8/decoder/onyxd_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698