OLD | NEW |
---|---|
1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright 2010 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
7 // | 7 // |
8 // VP8 decoder: internal header. | 8 // VP8 decoder: internal header. |
9 // | 9 // |
10 // Author: Skal (pascal.massimino@gmail.com) | 10 // Author: Skal (pascal.massimino@gmail.com) |
11 | 11 |
12 #ifndef WEBP_DEC_VP8I_H_ | 12 #ifndef WEBP_DEC_VP8I_H_ |
13 #define WEBP_DEC_VP8I_H_ | 13 #define WEBP_DEC_VP8I_H_ |
14 | 14 |
15 #include <string.h> // for memcpy() | 15 #include <string.h> // for memcpy() |
16 #include "./vp8li.h" | 16 #include "./vp8li.h" |
17 #include "../utils/bit_reader.h" | 17 #include "../utils/bit_reader.h" |
18 #include "../utils/thread.h" | 18 #include "../utils/thread.h" |
19 #include "../dsp/dsp.h" | 19 #include "../dsp/dsp.h" |
20 | 20 |
21 #if defined(__cplusplus) || defined(c_plusplus) | 21 #if defined(__cplusplus) || defined(c_plusplus) |
22 extern "C" { | 22 extern "C" { |
23 #endif | 23 #endif |
24 | 24 |
25 //------------------------------------------------------------------------------ | 25 //------------------------------------------------------------------------------ |
26 // Various defines and enums | 26 // Various defines and enums |
27 | 27 |
28 // version numbers | 28 // version numbers |
29 #define DEC_MAJ_VERSION 0 | 29 #define DEC_MAJ_VERSION 0 |
30 #define DEC_MIN_VERSION 2 | 30 #define DEC_MIN_VERSION 3 |
31 #define DEC_REV_VERSION 0 | 31 #define DEC_REV_VERSION 0 |
32 | 32 |
33 #define ONLY_KEYFRAME_CODE // to remove any code related to P-Frames | 33 #define ONLY_KEYFRAME_CODE // to remove any code related to P-Frames |
34 | 34 |
35 // intra prediction modes | 35 // intra prediction modes |
36 enum { B_DC_PRED = 0, // 4x4 modes | 36 enum { B_DC_PRED = 0, // 4x4 modes |
37 B_TM_PRED, | 37 B_TM_PRED, |
38 B_VE_PRED, | 38 B_VE_PRED, |
39 B_HE_PRED, | 39 B_HE_PRED, |
40 B_RD_PRED, | 40 B_RD_PRED, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 //------------------------------------------------------------------------------ | 150 //------------------------------------------------------------------------------ |
151 // Informations about the macroblocks. | 151 // Informations about the macroblocks. |
152 | 152 |
153 typedef struct { // filter specs | 153 typedef struct { // filter specs |
154 unsigned int f_level_:6; // filter strength: 0..63 | 154 unsigned int f_level_:6; // filter strength: 0..63 |
155 unsigned int f_ilevel_:6; // inner limit: 1..63 | 155 unsigned int f_ilevel_:6; // inner limit: 1..63 |
156 unsigned int f_inner_:1; // do inner filtering? | 156 unsigned int f_inner_:1; // do inner filtering? |
157 } VP8FInfo; | 157 } VP8FInfo; |
158 | 158 |
159 typedef struct { // used for syntax-parsing | 159 typedef struct { // used for syntax-parsing |
160 unsigned int nz_; // non-zero AC/DC coeffs | 160 unsigned int nz_:24; // non-zero AC/DC coeffs (24bit) |
161 unsigned int dc_nz_:1; // non-zero DC coeffs | 161 unsigned int dc_nz_:1; // non-zero DC coeffs |
162 unsigned int skip_:1; // block type | 162 unsigned int skip_:1; // block type |
fbarchard
2013/03/22 18:56:44
consider padding explicitely to 32 bits.
| |
163 } VP8MB; | 163 } VP8MB; |
164 | 164 |
165 // Dequantization matrices | 165 // Dequantization matrices |
166 typedef int quant_t[2]; // [DC / AC]. Can be 'uint16_t[2]' too (~slower). | 166 typedef int quant_t[2]; // [DC / AC]. Can be 'uint16_t[2]' too (~slower). |
167 typedef struct { | 167 typedef struct { |
168 quant_t y1_mat_, y2_mat_, uv_mat_; | 168 quant_t y1_mat_, y2_mat_, uv_mat_; |
169 } VP8QuantMatrix; | 169 } VP8QuantMatrix; |
170 | 170 |
171 // Persistent information needed by the parallel processing | 171 // Persistent information needed by the parallel processing |
172 typedef struct { | 172 typedef struct { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 uint8_t segment_; // block's segment | 262 uint8_t segment_; // block's segment |
263 | 263 |
264 // bit-wise info about the content of each sub-4x4 blocks: there are 16 bits | 264 // bit-wise info about the content of each sub-4x4 blocks: there are 16 bits |
265 // for luma (bits #0->#15), then 4 bits for chroma-u (#16->#19) and 4 bits for | 265 // for luma (bits #0->#15), then 4 bits for chroma-u (#16->#19) and 4 bits for |
266 // chroma-v (#20->#23), each corresponding to one 4x4 block in decoding order. | 266 // chroma-v (#20->#23), each corresponding to one 4x4 block in decoding order. |
267 // If the bit is set, the 4x4 block contains some non-zero coefficients. | 267 // If the bit is set, the 4x4 block contains some non-zero coefficients. |
268 uint32_t non_zero_; | 268 uint32_t non_zero_; |
269 uint32_t non_zero_ac_; | 269 uint32_t non_zero_ac_; |
270 | 270 |
271 // Filtering side-info | 271 // Filtering side-info |
272 int filter_type_; // 0=off, 1=simple, 2=complex | 272 int filter_type_; // 0=off, 1=simple, 2=complex |
273 int filter_row_; // per-row flag | 273 int filter_row_; // per-row flag |
274 uint8_t filter_levels_[NUM_MB_SEGMENTS]; // precalculated per-segment | 274 VP8FInfo fstrengths_[NUM_MB_SEGMENTS][2]; // precalculated per-segment/type |
275 | 275 |
276 // extensions | 276 // extensions |
277 const uint8_t* alpha_data_; // compressed alpha data (if present) | 277 const uint8_t* alpha_data_; // compressed alpha data (if present) |
278 size_t alpha_data_size_; | 278 size_t alpha_data_size_; |
279 uint8_t* alpha_plane_; // output. Persistent, contains the whole data. | 279 uint8_t* alpha_plane_; // output. Persistent, contains the whole data. |
280 | 280 |
281 int layer_colorspace_; | 281 int layer_colorspace_; |
282 const uint8_t* layer_data_; // compressed layer data (if present) | 282 const uint8_t* layer_data_; // compressed layer data (if present) |
283 size_t layer_data_size_; | 283 size_t layer_data_size_; |
284 }; | 284 }; |
(...skipping 20 matching lines...) Expand all Loading... | |
305 // Call io->setup() and finish setting up scan parameters. | 305 // Call io->setup() and finish setting up scan parameters. |
306 // After this call returns, one must always call VP8ExitCritical() with the | 306 // After this call returns, one must always call VP8ExitCritical() with the |
307 // same parameters. Both functions should be used in pair. Returns VP8_STATUS_OK | 307 // same parameters. Both functions should be used in pair. Returns VP8_STATUS_OK |
308 // if ok, otherwise sets and returns the error status on *dec. | 308 // if ok, otherwise sets and returns the error status on *dec. |
309 VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io); | 309 VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io); |
310 // Must always be called in pair with VP8EnterCritical(). | 310 // Must always be called in pair with VP8EnterCritical(). |
311 // Returns false in case of error. | 311 // Returns false in case of error. |
312 int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io); | 312 int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io); |
313 // Process the last decoded row (filtering + output) | 313 // Process the last decoded row (filtering + output) |
314 int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io); | 314 int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io); |
315 // Store a block, along with filtering params | |
316 void VP8StoreBlock(VP8Decoder* const dec); | |
317 // To be called at the start of a new scanline, to initialize predictors. | 315 // To be called at the start of a new scanline, to initialize predictors. |
318 void VP8InitScanline(VP8Decoder* const dec); | 316 void VP8InitScanline(VP8Decoder* const dec); |
319 // Decode one macroblock. Returns false if there is not enough data. | 317 // Decode one macroblock. Returns false if there is not enough data. |
320 int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br); | 318 int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br); |
321 | 319 |
322 // in alpha.c | 320 // in alpha.c |
323 const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, | 321 const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, |
324 int row, int num_rows); | 322 int row, int num_rows); |
325 | 323 |
326 // in layer.c | 324 // in layer.c |
327 int VP8DecodeLayer(VP8Decoder* const dec); | 325 int VP8DecodeLayer(VP8Decoder* const dec); |
328 | 326 |
329 //------------------------------------------------------------------------------ | 327 //------------------------------------------------------------------------------ |
330 | 328 |
331 #if defined(__cplusplus) || defined(c_plusplus) | 329 #if defined(__cplusplus) || defined(c_plusplus) |
332 } // extern "C" | 330 } // extern "C" |
333 #endif | 331 #endif |
334 | 332 |
335 #endif /* WEBP_DEC_VP8I_H_ */ | 333 #endif /* WEBP_DEC_VP8I_H_ */ |
OLD | NEW |