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

Side by Side Diff: third_party/libwebp/dec/vp8li.h

Issue 116213006: Update libwebp to 0.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After Blink Roll Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/dec/vp8l.c ('k') | third_party/libwebp/dec/webp.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 // Copyright 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 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 // Lossless decoder: internal header. 10 // Lossless decoder: internal header.
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 // Vikas Arora(vikaas.arora@gmail.com) 13 // Vikas Arora(vikaas.arora@gmail.com)
14 14
15 #ifndef WEBP_DEC_VP8LI_H_ 15 #ifndef WEBP_DEC_VP8LI_H_
16 #define WEBP_DEC_VP8LI_H_ 16 #define WEBP_DEC_VP8LI_H_
17 17
18 #include <string.h> // for memcpy() 18 #include <string.h> // for memcpy()
19 #include "./webpi.h" 19 #include "./webpi.h"
20 #include "../utils/bit_reader.h" 20 #include "../utils/bit_reader.h"
21 #include "../utils/color_cache.h" 21 #include "../utils/color_cache.h"
22 #include "../utils/huffman.h" 22 #include "../utils/huffman.h"
23 #include "../webp/format_constants.h" 23 #include "../webp/format_constants.h"
24 24
25 #if defined(__cplusplus) || defined(c_plusplus) 25 #ifdef __cplusplus
26 extern "C" { 26 extern "C" {
27 #endif 27 #endif
28 28
29 typedef enum { 29 typedef enum {
30 READ_DATA = 0, 30 READ_DATA = 0,
31 READ_HDR = 1, 31 READ_HDR = 1,
32 READ_DIM = 2 32 READ_DIM = 2
33 } VP8LDecodeState; 33 } VP8LDecodeState;
34 34
35 typedef struct VP8LTransform VP8LTransform; 35 typedef struct VP8LTransform VP8LTransform;
(...skipping 14 matching lines...) Expand all
50 VP8LColorCache color_cache_; 50 VP8LColorCache color_cache_;
51 51
52 int huffman_mask_; 52 int huffman_mask_;
53 int huffman_subsample_bits_; 53 int huffman_subsample_bits_;
54 int huffman_xsize_; 54 int huffman_xsize_;
55 uint32_t *huffman_image_; 55 uint32_t *huffman_image_;
56 int num_htree_groups_; 56 int num_htree_groups_;
57 HTreeGroup *htree_groups_; 57 HTreeGroup *htree_groups_;
58 } VP8LMetadata; 58 } VP8LMetadata;
59 59
60 typedef struct { 60 typedef struct VP8LDecoder VP8LDecoder;
61 struct VP8LDecoder {
61 VP8StatusCode status_; 62 VP8StatusCode status_;
62 VP8LDecodeState action_; 63 VP8LDecodeState action_;
63 VP8LDecodeState state_; 64 VP8LDecodeState state_;
64 VP8Io *io_; 65 VP8Io *io_;
65 66
66 const WebPDecBuffer *output_; // shortcut to io->opaque->output 67 const WebPDecBuffer *output_; // shortcut to io->opaque->output
67 68
68 uint32_t *pixels_; // Internal data: either uint8_t* for alpha 69 uint32_t *pixels_; // Internal data: either uint8_t* for alpha
69 // or uint32_t* for BGRA. 70 // or uint32_t* for BGRA.
70 uint32_t *argb_cache_; // Scratch buffer for temporary BGRA storage. 71 uint32_t *argb_cache_; // Scratch buffer for temporary BGRA storage.
71 72
72 VP8LBitReader br_; 73 VP8LBitReader br_;
73 74
74 int width_; 75 int width_;
75 int height_; 76 int height_;
76 int last_row_; // last input row decoded so far. 77 int last_row_; // last input row decoded so far.
78 int last_pixel_; // last pixel decoded so far. However, it may
79 // not be transformed, scaled and
80 // color-converted yet.
77 int last_out_row_; // last row output so far. 81 int last_out_row_; // last row output so far.
78 82
79 VP8LMetadata hdr_; 83 VP8LMetadata hdr_;
80 84
81 int next_transform_; 85 int next_transform_;
82 VP8LTransform transforms_[NUM_TRANSFORMS]; 86 VP8LTransform transforms_[NUM_TRANSFORMS];
83 // or'd bitset storing the transforms types. 87 // or'd bitset storing the transforms types.
84 uint32_t transforms_seen_; 88 uint32_t transforms_seen_;
85 89
86 uint8_t *rescaler_memory; // Working memory for rescaling work. 90 uint8_t *rescaler_memory; // Working memory for rescaling work.
87 WebPRescaler *rescaler; // Common rescaler for all channels. 91 WebPRescaler *rescaler; // Common rescaler for all channels.
88 } VP8LDecoder; 92 };
89 93
90 //------------------------------------------------------------------------------ 94 //------------------------------------------------------------------------------
91 // internal functions. Not public. 95 // internal functions. Not public.
92 96
97 struct ALPHDecoder; // Defined in dec/alphai.h.
98
93 // in vp8l.c 99 // in vp8l.c
94 100
95 // Decodes a raw image stream (without header) and store the alpha data 101 // Decodes image header for alpha data stored using lossless compression.
96 // into *output, which must be of size width x height. Returns false in case 102 // Returns false in case of error.
97 // of error. 103 int VP8LDecodeAlphaHeader(struct ALPHDecoder* const alph_dec,
98 int VP8LDecodeAlphaImageStream(int width, int height, const uint8_t* const data, 104 const uint8_t* const data, size_t data_size,
99 size_t data_size, uint8_t* const output); 105 uint8_t* const output);
106
107 // Decodes *at least* 'last_row' rows of alpha. If some of the initial rows are
108 // already decoded in previous call(s), it will resume decoding from where it
109 // was paused.
110 // Returns false in case of bitstream error.
111 int VP8LDecodeAlphaImageStream(struct ALPHDecoder* const alph_dec,
112 int last_row);
100 113
101 // Allocates and initialize a new lossless decoder instance. 114 // Allocates and initialize a new lossless decoder instance.
102 VP8LDecoder* VP8LNew(void); 115 VP8LDecoder* VP8LNew(void);
103 116
104 // Decodes the image header. Returns false in case of error. 117 // Decodes the image header. Returns false in case of error.
105 int VP8LDecodeHeader(VP8LDecoder* const dec, VP8Io* const io); 118 int VP8LDecodeHeader(VP8LDecoder* const dec, VP8Io* const io);
106 119
107 // Decodes an image. It's required to decode the lossless header before calling 120 // Decodes an image. It's required to decode the lossless header before calling
108 // this function. Returns false in case of error, with updated dec->status_. 121 // this function. Returns false in case of error, with updated dec->status_.
109 int VP8LDecodeImage(VP8LDecoder* const dec); 122 int VP8LDecodeImage(VP8LDecoder* const dec);
110 123
111 // Resets the decoder in its initial state, reclaiming memory. 124 // Resets the decoder in its initial state, reclaiming memory.
112 // Preserves the dec->status_ value. 125 // Preserves the dec->status_ value.
113 void VP8LClear(VP8LDecoder* const dec); 126 void VP8LClear(VP8LDecoder* const dec);
114 127
115 // Clears and deallocate a lossless decoder instance. 128 // Clears and deallocate a lossless decoder instance.
116 void VP8LDelete(VP8LDecoder* const dec); 129 void VP8LDelete(VP8LDecoder* const dec);
117 130
118 //------------------------------------------------------------------------------ 131 //------------------------------------------------------------------------------
119 132
120 #if defined(__cplusplus) || defined(c_plusplus) 133 #ifdef __cplusplus
121 } // extern "C" 134 } // extern "C"
122 #endif 135 #endif
123 136
124 #endif /* WEBP_DEC_VP8LI_H_ */ 137 #endif /* WEBP_DEC_VP8LI_H_ */
OLDNEW
« no previous file with comments | « third_party/libwebp/dec/vp8l.c ('k') | third_party/libwebp/dec/webp.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698