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 "./vpx_scale_rtcd.h" | 15 #include "./vpx_scale_rtcd.h" |
16 | 16 |
17 #include "vpx_mem/vpx_mem.h" | 17 #include "vpx_mem/vpx_mem.h" |
18 #include "vpx_ports/vpx_timer.h" | 18 #include "vpx_ports/vpx_timer.h" |
19 #include "vpx_scale/vpx_scale.h" | 19 #include "vpx_scale/vpx_scale.h" |
20 | 20 |
21 #include "vp9/common/vp9_alloccommon.h" | 21 #include "vp9/common/vp9_alloccommon.h" |
22 #include "vp9/common/vp9_loopfilter.h" | 22 #include "vp9/common/vp9_loopfilter.h" |
23 #include "vp9/common/vp9_onyxc_int.h" | 23 #include "vp9/common/vp9_onyxc_int.h" |
24 #if CONFIG_VP9_POSTPROC | 24 #if CONFIG_VP9_POSTPROC |
25 #include "vp9/common/vp9_postproc.h" | 25 #include "vp9/common/vp9_postproc.h" |
26 #endif | 26 #endif |
27 #include "vp9/common/vp9_quant_common.h" | 27 #include "vp9/common/vp9_quant_common.h" |
| 28 #include "vp9/common/vp9_reconintra.h" |
28 #include "vp9/common/vp9_systemdependent.h" | 29 #include "vp9/common/vp9_systemdependent.h" |
29 | 30 |
30 #include "vp9/decoder/vp9_decodeframe.h" | 31 #include "vp9/decoder/vp9_decodeframe.h" |
31 #include "vp9/decoder/vp9_decoder.h" | 32 #include "vp9/decoder/vp9_decoder.h" |
32 #include "vp9/decoder/vp9_detokenize.h" | 33 #include "vp9/decoder/vp9_detokenize.h" |
33 #include "vp9/decoder/vp9_dthread.h" | 34 #include "vp9/decoder/vp9_dthread.h" |
34 | 35 |
35 static void initialize_dec() { | 36 static void initialize_dec() { |
36 static int init_done = 0; | 37 static int init_done = 0; |
37 | 38 |
38 if (!init_done) { | 39 if (!init_done) { |
| 40 vp9_rtcd(); |
39 vp9_init_neighbors(); | 41 vp9_init_neighbors(); |
| 42 vp9_init_intra_predictors(); |
40 init_done = 1; | 43 init_done = 1; |
41 } | 44 } |
42 } | 45 } |
43 | 46 |
44 VP9Decoder *vp9_decoder_create() { | 47 VP9Decoder *vp9_decoder_create() { |
45 VP9Decoder *const pbi = vpx_memalign(32, sizeof(*pbi)); | 48 VP9Decoder *const pbi = vpx_memalign(32, sizeof(*pbi)); |
46 VP9_COMMON *const cm = pbi ? &pbi->common : NULL; | 49 VP9_COMMON *const cm = pbi ? &pbi->common : NULL; |
47 | 50 |
48 if (!cm) | 51 if (!cm) |
49 return NULL; | 52 return NULL; |
50 | 53 |
51 vp9_zero(*pbi); | 54 vp9_zero(*pbi); |
52 | 55 |
53 if (setjmp(cm->error.jmp)) { | 56 if (setjmp(cm->error.jmp)) { |
54 cm->error.setjmp = 0; | 57 cm->error.setjmp = 0; |
55 vp9_decoder_remove(pbi); | 58 vp9_decoder_remove(pbi); |
56 return NULL; | 59 return NULL; |
57 } | 60 } |
58 | 61 |
59 cm->error.setjmp = 1; | 62 cm->error.setjmp = 1; |
60 initialize_dec(); | 63 initialize_dec(); |
61 | 64 |
62 vp9_rtcd(); | |
63 | |
64 // Initialize the references to not point to any frame buffers. | 65 // Initialize the references to not point to any frame buffers. |
65 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)); |
66 | 67 |
67 cm->current_video_frame = 0; | 68 cm->current_video_frame = 0; |
68 pbi->ready_for_new_data = 1; | 69 pbi->ready_for_new_data = 1; |
| 70 cm->bit_depth = VPX_BITS_8; |
69 | 71 |
70 // vp9_init_dequantizer() is first called here. Add check in | 72 // vp9_init_dequantizer() is first called here. Add check in |
71 // frame_init_dequantizer() to avoid unnecessary calling of | 73 // frame_init_dequantizer() to avoid unnecessary calling of |
72 // vp9_init_dequantizer() for every frame. | 74 // vp9_init_dequantizer() for every frame. |
73 vp9_init_dequantizer(cm); | 75 vp9_init_dequantizer(cm); |
74 | 76 |
75 vp9_loop_filter_init(cm); | 77 vp9_loop_filter_init(cm); |
76 | 78 |
77 cm->error.setjmp = 0; | 79 cm->error.setjmp = 0; |
78 | 80 |
(...skipping 10 matching lines...) Expand all Loading... |
89 vpx_free(pbi->lf_worker.data1); | 91 vpx_free(pbi->lf_worker.data1); |
90 vpx_free(pbi->tile_data); | 92 vpx_free(pbi->tile_data); |
91 for (i = 0; i < pbi->num_tile_workers; ++i) { | 93 for (i = 0; i < pbi->num_tile_workers; ++i) { |
92 VP9Worker *const worker = &pbi->tile_workers[i]; | 94 VP9Worker *const worker = &pbi->tile_workers[i]; |
93 vp9_get_worker_interface()->end(worker); | 95 vp9_get_worker_interface()->end(worker); |
94 vpx_free(worker->data1); | 96 vpx_free(worker->data1); |
95 vpx_free(worker->data2); | 97 vpx_free(worker->data2); |
96 } | 98 } |
97 vpx_free(pbi->tile_workers); | 99 vpx_free(pbi->tile_workers); |
98 | 100 |
99 if (pbi->num_tile_workers) { | 101 if (pbi->num_tile_workers > 0) { |
100 const int sb_rows = | 102 vp9_loop_filter_dealloc(&pbi->lf_row_sync); |
101 mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; | |
102 vp9_loop_filter_dealloc(&pbi->lf_row_sync, sb_rows); | |
103 } | 103 } |
104 | 104 |
105 vp9_remove_common(cm); | 105 vp9_remove_common(cm); |
106 vpx_free(pbi); | 106 vpx_free(pbi); |
107 } | 107 } |
108 | 108 |
109 static int equal_dimensions(const YV12_BUFFER_CONFIG *a, | 109 static int equal_dimensions(const YV12_BUFFER_CONFIG *a, |
110 const YV12_BUFFER_CONFIG *b) { | 110 const YV12_BUFFER_CONFIG *b) { |
111 return a->y_height == b->y_height && a->y_width == b->y_width && | 111 return a->y_height == b->y_height && a->y_width == b->y_width && |
112 a->uv_height == b->uv_height && a->uv_width == b->uv_width; | 112 a->uv_height == b->uv_height && a->uv_width == b->uv_width; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 for (j = 0; j < mag; ++j) | 372 for (j = 0; j < mag; ++j) |
373 this_sz |= (*x++) << (j * 8); | 373 this_sz |= (*x++) << (j * 8); |
374 sizes[i] = this_sz; | 374 sizes[i] = this_sz; |
375 } | 375 } |
376 *count = frames; | 376 *count = frames; |
377 } | 377 } |
378 } | 378 } |
379 return VPX_CODEC_OK; | 379 return VPX_CODEC_OK; |
380 } | 380 } |
OLD | NEW |