OLD | NEW |
1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright 2010 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // Low-level API for VP8 decoder | 10 // Low-level API for VP8 decoder |
11 // | 11 // |
12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
13 | 13 |
14 #ifndef WEBP_WEBP_DECODE_VP8_H_ | 14 #ifndef WEBP_WEBP_DECODE_VP8_H_ |
15 #define WEBP_WEBP_DECODE_VP8_H_ | 15 #define WEBP_WEBP_DECODE_VP8_H_ |
16 | 16 |
17 #include "../webp/decode.h" | 17 #include "../webp/decode.h" |
18 | 18 |
19 #if defined(__cplusplus) || defined(c_plusplus) | 19 #ifdef __cplusplus |
20 extern "C" { | 20 extern "C" { |
21 #endif | 21 #endif |
22 | 22 |
23 //------------------------------------------------------------------------------ | 23 //------------------------------------------------------------------------------ |
24 // Lower-level API | 24 // Lower-level API |
25 // | 25 // |
26 // These functions provide fine-grained control of the decoding process. | 26 // These functions provide fine-grained control of the decoding process. |
27 // The call flow should resemble: | 27 // The call flow should resemble: |
28 // | 28 // |
29 // VP8Io io; | 29 // VP8Io io; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Create a new decoder object. | 125 // Create a new decoder object. |
126 VP8Decoder* VP8New(void); | 126 VP8Decoder* VP8New(void); |
127 | 127 |
128 // Must be called to make sure 'io' is initialized properly. | 128 // Must be called to make sure 'io' is initialized properly. |
129 // Returns false in case of version mismatch. Upon such failure, no other | 129 // Returns false in case of version mismatch. Upon such failure, no other |
130 // decoding function should be called (VP8Decode, VP8GetHeaders, ...) | 130 // decoding function should be called (VP8Decode, VP8GetHeaders, ...) |
131 static WEBP_INLINE int VP8InitIo(VP8Io* const io) { | 131 static WEBP_INLINE int VP8InitIo(VP8Io* const io) { |
132 return VP8InitIoInternal(io, WEBP_DECODER_ABI_VERSION); | 132 return VP8InitIoInternal(io, WEBP_DECODER_ABI_VERSION); |
133 } | 133 } |
134 | 134 |
135 // Start decoding a new picture. Returns true if ok. | 135 // Decode the VP8 frame header. Returns true if ok. |
| 136 // Note: 'io->data' must be pointing to the start of the VP8 frame header. |
136 int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io); | 137 int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io); |
137 | 138 |
138 // Decode a picture. Will call VP8GetHeaders() if it wasn't done already. | 139 // Decode a picture. Will call VP8GetHeaders() if it wasn't done already. |
139 // Returns false in case of error. | 140 // Returns false in case of error. |
140 int VP8Decode(VP8Decoder* const dec, VP8Io* const io); | 141 int VP8Decode(VP8Decoder* const dec, VP8Io* const io); |
141 | 142 |
142 // Return current status of the decoder: | 143 // Return current status of the decoder: |
143 VP8StatusCode VP8Status(VP8Decoder* const dec); | 144 VP8StatusCode VP8Status(VP8Decoder* const dec); |
144 | 145 |
145 // return readable string corresponding to the last status. | 146 // return readable string corresponding to the last status. |
(...skipping 24 matching lines...) Expand all Loading... |
170 // Returns true if the next byte(s) in data is a VP8L signature. | 171 // Returns true if the next byte(s) in data is a VP8L signature. |
171 WEBP_EXTERN(int) VP8LCheckSignature(const uint8_t* const data, size_t size); | 172 WEBP_EXTERN(int) VP8LCheckSignature(const uint8_t* const data, size_t size); |
172 | 173 |
173 // Validates the VP8L data-header and retrieves basic header information viz | 174 // Validates the VP8L data-header and retrieves basic header information viz |
174 // width, height and alpha. Returns 0 in case of formatting error. | 175 // width, height and alpha. Returns 0 in case of formatting error. |
175 // width/height/has_alpha can be passed NULL. | 176 // width/height/has_alpha can be passed NULL. |
176 WEBP_EXTERN(int) VP8LGetInfo( | 177 WEBP_EXTERN(int) VP8LGetInfo( |
177 const uint8_t* data, size_t data_size, // data available so far | 178 const uint8_t* data, size_t data_size, // data available so far |
178 int* const width, int* const height, int* const has_alpha); | 179 int* const width, int* const height, int* const has_alpha); |
179 | 180 |
180 #if defined(__cplusplus) || defined(c_plusplus) | 181 #ifdef __cplusplus |
181 } // extern "C" | 182 } // extern "C" |
182 #endif | 183 #endif |
183 | 184 |
184 #endif /* WEBP_WEBP_DECODE_VP8_H_ */ | 185 #endif /* WEBP_WEBP_DECODE_VP8_H_ */ |
OLD | NEW |