| 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 |
| 11 #include <assert.h> | 11 #include <assert.h> |
| 12 #include <limits.h> | 12 #include <limits.h> |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 | 14 |
| 15 #include "./vp9_rtcd.h" | 15 #include "./vp9_rtcd.h" |
| 16 #include "./vpx_dsp_rtcd.h" | 16 #include "./vpx_dsp_rtcd.h" |
| 17 #include "./vpx_scale_rtcd.h" | 17 #include "./vpx_scale_rtcd.h" |
| 18 | 18 |
| 19 #include "vpx_mem/vpx_mem.h" | 19 #include "vpx_mem/vpx_mem.h" |
| 20 #include "vpx_ports/system_state.h" |
| 20 #include "vpx_ports/vpx_once.h" | 21 #include "vpx_ports/vpx_once.h" |
| 21 #include "vpx_ports/vpx_timer.h" | 22 #include "vpx_ports/vpx_timer.h" |
| 22 #include "vpx_scale/vpx_scale.h" | 23 #include "vpx_scale/vpx_scale.h" |
| 23 #include "vpx_util/vpx_thread.h" | 24 #include "vpx_util/vpx_thread.h" |
| 24 | 25 |
| 25 #include "vp9/common/vp9_alloccommon.h" | 26 #include "vp9/common/vp9_alloccommon.h" |
| 26 #include "vp9/common/vp9_loopfilter.h" | 27 #include "vp9/common/vp9_loopfilter.h" |
| 27 #include "vp9/common/vp9_onyxc_int.h" | 28 #include "vp9/common/vp9_onyxc_int.h" |
| 28 #if CONFIG_VP9_POSTPROC | 29 #if CONFIG_VP9_POSTPROC |
| 29 #include "vp9/common/vp9_postproc.h" | 30 #include "vp9/common/vp9_postproc.h" |
| 30 #endif | 31 #endif |
| 31 #include "vp9/common/vp9_quant_common.h" | 32 #include "vp9/common/vp9_quant_common.h" |
| 32 #include "vp9/common/vp9_reconintra.h" | 33 #include "vp9/common/vp9_reconintra.h" |
| 33 #include "vp9/common/vp9_systemdependent.h" | |
| 34 | 34 |
| 35 #include "vp9/decoder/vp9_decodeframe.h" | 35 #include "vp9/decoder/vp9_decodeframe.h" |
| 36 #include "vp9/decoder/vp9_decoder.h" | 36 #include "vp9/decoder/vp9_decoder.h" |
| 37 #include "vp9/decoder/vp9_detokenize.h" | 37 #include "vp9/decoder/vp9_detokenize.h" |
| 38 | 38 |
| 39 static void initialize_dec(void) { | 39 static void initialize_dec(void) { |
| 40 static volatile int init_done = 0; | 40 static volatile int init_done = 0; |
| 41 | 41 |
| 42 if (!init_done) { | 42 if (!init_done) { |
| 43 vp9_rtcd(); | 43 vp9_rtcd(); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 for (; ref_index < REF_FRAMES && !cm->show_existing_frame; ++ref_index) { | 358 for (; ref_index < REF_FRAMES && !cm->show_existing_frame; ++ref_index) { |
| 359 const int old_idx = cm->ref_frame_map[ref_index]; | 359 const int old_idx = cm->ref_frame_map[ref_index]; |
| 360 decrease_ref_count(old_idx, frame_bufs, pool); | 360 decrease_ref_count(old_idx, frame_bufs, pool); |
| 361 } | 361 } |
| 362 pbi->hold_ref_buf = 0; | 362 pbi->hold_ref_buf = 0; |
| 363 } | 363 } |
| 364 // Release current frame. | 364 // Release current frame. |
| 365 decrease_ref_count(cm->new_fb_idx, frame_bufs, pool); | 365 decrease_ref_count(cm->new_fb_idx, frame_bufs, pool); |
| 366 unlock_buffer_pool(pool); | 366 unlock_buffer_pool(pool); |
| 367 | 367 |
| 368 vp9_clear_system_state(); | 368 vpx_clear_system_state(); |
| 369 return -1; | 369 return -1; |
| 370 } | 370 } |
| 371 | 371 |
| 372 cm->error.setjmp = 1; | 372 cm->error.setjmp = 1; |
| 373 vp9_decode_frame(pbi, source, source + size, psource); | 373 vp9_decode_frame(pbi, source, source + size, psource); |
| 374 | 374 |
| 375 swap_frame_buffers(pbi); | 375 swap_frame_buffers(pbi); |
| 376 | 376 |
| 377 vp9_clear_system_state(); | 377 vpx_clear_system_state(); |
| 378 | 378 |
| 379 if (!cm->show_existing_frame) { | 379 if (!cm->show_existing_frame) { |
| 380 cm->last_show_frame = cm->show_frame; | 380 cm->last_show_frame = cm->show_frame; |
| 381 cm->prev_frame = cm->cur_frame; | 381 cm->prev_frame = cm->cur_frame; |
| 382 if (cm->seg.enabled && !pbi->frame_parallel_decode) | 382 if (cm->seg.enabled && !pbi->frame_parallel_decode) |
| 383 vp9_swap_current_and_last_seg_map(cm); | 383 vp9_swap_current_and_last_seg_map(cm); |
| 384 } | 384 } |
| 385 | 385 |
| 386 // Update progress in frame parallel decode. | 386 // Update progress in frame parallel decode. |
| 387 if (pbi->frame_parallel_decode) { | 387 if (pbi->frame_parallel_decode) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if (!cm->show_existing_frame) { | 433 if (!cm->show_existing_frame) { |
| 434 ret = vp9_post_proc_frame(cm, sd, flags); | 434 ret = vp9_post_proc_frame(cm, sd, flags); |
| 435 } else { | 435 } else { |
| 436 *sd = *cm->frame_to_show; | 436 *sd = *cm->frame_to_show; |
| 437 ret = 0; | 437 ret = 0; |
| 438 } | 438 } |
| 439 #else | 439 #else |
| 440 *sd = *cm->frame_to_show; | 440 *sd = *cm->frame_to_show; |
| 441 ret = 0; | 441 ret = 0; |
| 442 #endif /*!CONFIG_POSTPROC*/ | 442 #endif /*!CONFIG_POSTPROC*/ |
| 443 vp9_clear_system_state(); | 443 vpx_clear_system_state(); |
| 444 return ret; | 444 return ret; |
| 445 } | 445 } |
| 446 | 446 |
| 447 vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data, | 447 vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data, |
| 448 size_t data_sz, | 448 size_t data_sz, |
| 449 uint32_t sizes[8], int *count, | 449 uint32_t sizes[8], int *count, |
| 450 vpx_decrypt_cb decrypt_cb, | 450 vpx_decrypt_cb decrypt_cb, |
| 451 void *decrypt_state) { | 451 void *decrypt_state) { |
| 452 // A chunk ending with a byte matching 0xc0 is an invalid chunk unless | 452 // A chunk ending with a byte matching 0xc0 is an invalid chunk unless |
| 453 // it is a super frame index. If the last byte of real video compression | 453 // it is a super frame index. If the last byte of real video compression |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 for (j = 0; j < mag; ++j) | 501 for (j = 0; j < mag; ++j) |
| 502 this_sz |= (*x++) << (j * 8); | 502 this_sz |= (*x++) << (j * 8); |
| 503 sizes[i] = this_sz; | 503 sizes[i] = this_sz; |
| 504 } | 504 } |
| 505 *count = frames; | 505 *count = frames; |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 return VPX_CODEC_OK; | 508 return VPX_CODEC_OK; |
| 509 } | 509 } |
| OLD | NEW |