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

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

Issue 898943004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 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
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/decoder/vp9_decoder.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
11 #ifndef VP9_DECODER_VP9_DECODER_H_ 11 #ifndef VP9_DECODER_VP9_DECODER_H_
12 #define VP9_DECODER_VP9_DECODER_H_ 12 #define VP9_DECODER_VP9_DECODER_H_
13 13
14 #include "./vpx_config.h" 14 #include "./vpx_config.h"
15 15
16 #include "vpx/vpx_codec.h" 16 #include "vpx/vpx_codec.h"
17 #include "vpx_scale/yv12config.h" 17 #include "vpx_scale/yv12config.h"
18 #include "vp9/common/vp9_loopfilter_thread.h" 18 #include "vp9/common/vp9_loopfilter_thread.h"
19 #include "vp9/common/vp9_onyxc_int.h" 19 #include "vp9/common/vp9_onyxc_int.h"
20 #include "vp9/common/vp9_ppflags.h" 20 #include "vp9/common/vp9_ppflags.h"
21 #include "vp9/common/vp9_thread.h" 21 #include "vp9/common/vp9_thread.h"
22 #include "vp9/decoder/vp9_dthread.h"
22 #include "vp9/decoder/vp9_reader.h" 23 #include "vp9/decoder/vp9_reader.h"
23 24
24 #ifdef __cplusplus 25 #ifdef __cplusplus
25 extern "C" { 26 extern "C" {
26 #endif 27 #endif
27 28
28 // TODO(hkuang): combine this with TileWorkerData. 29 // TODO(hkuang): combine this with TileWorkerData.
29 typedef struct TileData { 30 typedef struct TileData {
30 VP9_COMMON *cm; 31 VP9_COMMON *cm;
31 vp9_reader bit_reader; 32 vp9_reader bit_reader;
32 DECLARE_ALIGNED(16, MACROBLOCKD, xd); 33 DECLARE_ALIGNED(16, MACROBLOCKD, xd);
33 } TileData; 34 } TileData;
34 35
35 typedef struct TileWorkerData { 36 typedef struct TileWorkerData {
36 VP9_COMMON *cm; 37 struct VP9Decoder *pbi;
37 vp9_reader bit_reader; 38 vp9_reader bit_reader;
38 DECLARE_ALIGNED(16, MACROBLOCKD, xd); 39 DECLARE_ALIGNED(16, MACROBLOCKD, xd);
39 struct vpx_internal_error_info error_info; 40 struct vpx_internal_error_info error_info;
40 } TileWorkerData; 41 } TileWorkerData;
41 42
42 typedef struct VP9Decoder { 43 typedef struct VP9Decoder {
43 DECLARE_ALIGNED(16, MACROBLOCKD, mb); 44 DECLARE_ALIGNED(16, MACROBLOCKD, mb);
44 45
45 DECLARE_ALIGNED(16, VP9_COMMON, common); 46 DECLARE_ALIGNED(16, VP9_COMMON, common);
46 47
47 int ready_for_new_data; 48 int ready_for_new_data;
48 49
49 int refresh_frame_flags; 50 int refresh_frame_flags;
50 51
51 int frame_parallel_decode; // frame-based threading. 52 int frame_parallel_decode; // frame-based threading.
52 53
54 // TODO(hkuang): Combine this with cur_buf in macroblockd as they are
55 // the same.
56 RefCntBuffer *cur_buf; // Current decoding frame buffer.
57 RefCntBuffer *prev_buf; // Previous decoding frame buffer.
58
59 VP9Worker *frame_worker_owner; // frame_worker that owns this pbi.
53 VP9Worker lf_worker; 60 VP9Worker lf_worker;
54 VP9Worker *tile_workers; 61 VP9Worker *tile_workers;
55 TileWorkerData *tile_worker_data; 62 TileWorkerData *tile_worker_data;
56 TileInfo *tile_worker_info; 63 TileInfo *tile_worker_info;
57 int num_tile_workers; 64 int num_tile_workers;
58 65
59 TileData *tile_data; 66 TileData *tile_data;
60 int total_tiles; 67 int total_tiles;
61 68
62 VP9LfSync lf_row_sync; 69 VP9LfSync lf_row_sync;
63 70
64 vpx_decrypt_cb decrypt_cb; 71 vpx_decrypt_cb decrypt_cb;
65 void *decrypt_state; 72 void *decrypt_state;
66 73
67 int max_threads; 74 int max_threads;
68 int inv_tile_order; 75 int inv_tile_order;
69 int need_resync; // wait for key/intra-only frame 76 int need_resync; // wait for key/intra-only frame.
77 int hold_ref_buf; // hold the reference buffer.
70 } VP9Decoder; 78 } VP9Decoder;
71 79
72 int vp9_receive_compressed_data(struct VP9Decoder *pbi, 80 int vp9_receive_compressed_data(struct VP9Decoder *pbi,
73 size_t size, const uint8_t **dest); 81 size_t size, const uint8_t **dest);
74 82
75 int vp9_get_raw_frame(struct VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd, 83 int vp9_get_raw_frame(struct VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
76 vp9_ppflags_t *flags); 84 vp9_ppflags_t *flags);
77 85
78 vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decoder *pbi, 86 vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decoder *pbi,
79 VP9_REFFRAME ref_frame_flag, 87 VP9_REFFRAME ref_frame_flag,
80 YV12_BUFFER_CONFIG *sd); 88 YV12_BUFFER_CONFIG *sd);
81 89
82 vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm, 90 vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
83 VP9_REFFRAME ref_frame_flag, 91 VP9_REFFRAME ref_frame_flag,
84 YV12_BUFFER_CONFIG *sd); 92 YV12_BUFFER_CONFIG *sd);
85 93
86 struct VP9Decoder *vp9_decoder_create();
87
88 void vp9_decoder_remove(struct VP9Decoder *pbi);
89
90 static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb, 94 static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
91 void *decrypt_state, 95 void *decrypt_state,
92 const uint8_t *data) { 96 const uint8_t *data) {
93 if (decrypt_cb) { 97 if (decrypt_cb) {
94 uint8_t marker; 98 uint8_t marker;
95 decrypt_cb(decrypt_state, data, &marker, 1); 99 decrypt_cb(decrypt_state, data, &marker, 1);
96 return marker; 100 return marker;
97 } 101 }
98 return *data; 102 return *data;
99 } 103 }
100 104
101 // This function is exposed for use in tests, as well as the inlined function 105 // This function is exposed for use in tests, as well as the inlined function
102 // "read_marker". 106 // "read_marker".
103 vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data, 107 vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data,
104 size_t data_sz, 108 size_t data_sz,
105 uint32_t sizes[8], int *count, 109 uint32_t sizes[8], int *count,
106 vpx_decrypt_cb decrypt_cb, 110 vpx_decrypt_cb decrypt_cb,
107 void *decrypt_state); 111 void *decrypt_state);
108 112
113 struct VP9Decoder *vp9_decoder_create(BufferPool *const pool);
114
115 void vp9_decoder_remove(struct VP9Decoder *pbi);
116
117 static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
118 BufferPool *const pool) {
119 if (idx >= 0) {
120 --frame_bufs[idx].ref_count;
121 // A worker may only get a free framebuffer index when calling get_free_fb.
122 // But the private buffer is not set up until finish decoding header.
123 // So any error happens during decoding header, the frame_bufs will not
124 // have valid priv buffer.
125 if (frame_bufs[idx].ref_count == 0 &&
126 frame_bufs[idx].raw_frame_buffer.priv) {
127 pool->release_fb_cb(pool->cb_priv, &frame_bufs[idx].raw_frame_buffer);
128 }
129 }
130 }
131
109 #ifdef __cplusplus 132 #ifdef __cplusplus
110 } // extern "C" 133 } // extern "C"
111 #endif 134 #endif
112 135
113 #endif // VP9_DECODER_VP9_DECODER_H_ 136 #endif // VP9_DECODER_VP9_DECODER_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decodemv.c ('k') | source/libvpx/vp9/decoder/vp9_decoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698