| 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 // VP8 decoder: internal header. | 10 // VP8 decoder: internal header. |
| 11 // | 11 // |
| 12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
| 13 | 13 |
| 14 #ifndef WEBP_DEC_VP8I_H_ | 14 #ifndef WEBP_DEC_VP8I_H_ |
| 15 #define WEBP_DEC_VP8I_H_ | 15 #define WEBP_DEC_VP8I_H_ |
| 16 | 16 |
| 17 #include <string.h> // for memcpy() | 17 #include <string.h> // for memcpy() |
| 18 #include "./vp8li.h" | 18 #include "./vp8li.h" |
| 19 #include "../utils/bit_reader.h" | 19 #include "../utils/bit_reader.h" |
| 20 #include "../utils/random.h" |
| 20 #include "../utils/thread.h" | 21 #include "../utils/thread.h" |
| 21 #include "../dsp/dsp.h" | 22 #include "../dsp/dsp.h" |
| 22 | 23 |
| 23 #if defined(__cplusplus) || defined(c_plusplus) | 24 #ifdef __cplusplus |
| 24 extern "C" { | 25 extern "C" { |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 //------------------------------------------------------------------------------ | 28 //------------------------------------------------------------------------------ |
| 28 // Various defines and enums | 29 // Various defines and enums |
| 29 | 30 |
| 30 // version numbers | 31 // version numbers |
| 31 #define DEC_MAJ_VERSION 0 | 32 #define DEC_MAJ_VERSION 0 |
| 32 #define DEC_MIN_VERSION 3 | 33 #define DEC_MIN_VERSION 4 |
| 33 #define DEC_REV_VERSION 1 | 34 #define DEC_REV_VERSION 0 |
| 34 | |
| 35 #define ONLY_KEYFRAME_CODE // to remove any code related to P-Frames | |
| 36 | 35 |
| 37 // intra prediction modes | 36 // intra prediction modes |
| 38 enum { B_DC_PRED = 0, // 4x4 modes | 37 enum { B_DC_PRED = 0, // 4x4 modes |
| 39 B_TM_PRED, | 38 B_TM_PRED, |
| 40 B_VE_PRED, | 39 B_VE_PRED, |
| 41 B_HE_PRED, | 40 B_HE_PRED, |
| 42 B_RD_PRED, | 41 B_RD_PRED, |
| 43 B_VR_PRED, | 42 B_VR_PRED, |
| 44 B_LD_PRED, | 43 B_LD_PRED, |
| 45 B_VL_PRED, | 44 B_VL_PRED, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // '|' = left sample, '-' = top sample, '+' = top-left sample | 92 // '|' = left sample, '-' = top sample, '+' = top-left sample |
| 94 // 't' = extra top-right sample for 4x4 modes | 93 // 't' = extra top-right sample for 4x4 modes |
| 95 // With this layout, BPS (=Bytes Per Scan-line) is one cacheline size. | 94 // With this layout, BPS (=Bytes Per Scan-line) is one cacheline size. |
| 96 #define BPS 32 // this is the common stride used by yuv[] | 95 #define BPS 32 // this is the common stride used by yuv[] |
| 97 #define YUV_SIZE (BPS * 17 + BPS * 9) | 96 #define YUV_SIZE (BPS * 17 + BPS * 9) |
| 98 #define Y_SIZE (BPS * 17) | 97 #define Y_SIZE (BPS * 17) |
| 99 #define Y_OFF (BPS * 1 + 8) | 98 #define Y_OFF (BPS * 1 + 8) |
| 100 #define U_OFF (Y_OFF + BPS * 16 + BPS) | 99 #define U_OFF (Y_OFF + BPS * 16 + BPS) |
| 101 #define V_OFF (U_OFF + 16) | 100 #define V_OFF (U_OFF + 16) |
| 102 | 101 |
| 102 // minimal width under which lossy multi-threading is always disabled |
| 103 #define MIN_WIDTH_FOR_THREADS 512 |
| 104 |
| 103 //------------------------------------------------------------------------------ | 105 //------------------------------------------------------------------------------ |
| 104 // Headers | 106 // Headers |
| 105 | 107 |
| 106 typedef struct { | 108 typedef struct { |
| 107 uint8_t key_frame_; | 109 uint8_t key_frame_; |
| 108 uint8_t profile_; | 110 uint8_t profile_; |
| 109 uint8_t show_; | 111 uint8_t show_; |
| 110 uint32_t partition_length_; | 112 uint32_t partition_length_; |
| 111 } VP8FrameHeader; | 113 } VP8FrameHeader; |
| 112 | 114 |
| 113 typedef struct { | 115 typedef struct { |
| 114 uint16_t width_; | 116 uint16_t width_; |
| 115 uint16_t height_; | 117 uint16_t height_; |
| 116 uint8_t xscale_; | 118 uint8_t xscale_; |
| 117 uint8_t yscale_; | 119 uint8_t yscale_; |
| 118 uint8_t colorspace_; // 0 = YCbCr | 120 uint8_t colorspace_; // 0 = YCbCr |
| 119 uint8_t clamp_type_; | 121 uint8_t clamp_type_; |
| 120 } VP8PictureHeader; | 122 } VP8PictureHeader; |
| 121 | 123 |
| 122 // segment features | 124 // segment features |
| 123 typedef struct { | 125 typedef struct { |
| 124 int use_segment_; | 126 int use_segment_; |
| 125 int update_map_; // whether to update the segment map or not | 127 int update_map_; // whether to update the segment map or not |
| 126 int absolute_delta_; // absolute or delta values for quantizer and filter | 128 int absolute_delta_; // absolute or delta values for quantizer and filter |
| 127 int8_t quantizer_[NUM_MB_SEGMENTS]; // quantization changes | 129 int8_t quantizer_[NUM_MB_SEGMENTS]; // quantization changes |
| 128 int8_t filter_strength_[NUM_MB_SEGMENTS]; // filter strength for segments | 130 int8_t filter_strength_[NUM_MB_SEGMENTS]; // filter strength for segments |
| 129 } VP8SegmentHeader; | 131 } VP8SegmentHeader; |
| 130 | 132 |
| 133 |
| 134 // probas associated to one of the contexts |
| 135 typedef uint8_t VP8ProbaArray[NUM_PROBAS]; |
| 136 |
| 137 typedef struct { // all the probas associated to one band |
| 138 VP8ProbaArray probas_[NUM_CTX]; |
| 139 } VP8BandProbas; |
| 140 |
| 131 // Struct collecting all frame-persistent probabilities. | 141 // Struct collecting all frame-persistent probabilities. |
| 132 typedef struct { | 142 typedef struct { |
| 133 uint8_t segments_[MB_FEATURE_TREE_PROBS]; | 143 uint8_t segments_[MB_FEATURE_TREE_PROBS]; |
| 134 // Type: 0:Intra16-AC 1:Intra16-DC 2:Chroma 3:Intra4 | 144 // Type: 0:Intra16-AC 1:Intra16-DC 2:Chroma 3:Intra4 |
| 135 uint8_t coeffs_[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS]; | 145 VP8BandProbas bands_[NUM_TYPES][NUM_BANDS]; |
| 136 #ifndef ONLY_KEYFRAME_CODE | |
| 137 uint8_t ymode_[4], uvmode_[3]; | |
| 138 uint8_t mv_[2][NUM_MV_PROBAS]; | |
| 139 #endif | |
| 140 } VP8Proba; | 146 } VP8Proba; |
| 141 | 147 |
| 142 // Filter parameters | 148 // Filter parameters |
| 143 typedef struct { | 149 typedef struct { |
| 144 int simple_; // 0=complex, 1=simple | 150 int simple_; // 0=complex, 1=simple |
| 145 int level_; // [0..63] | 151 int level_; // [0..63] |
| 146 int sharpness_; // [0..7] | 152 int sharpness_; // [0..7] |
| 147 int use_lf_delta_; | 153 int use_lf_delta_; |
| 148 int ref_lf_delta_[NUM_REF_LF_DELTAS]; | 154 int ref_lf_delta_[NUM_REF_LF_DELTAS]; |
| 149 int mode_lf_delta_[NUM_MODE_LF_DELTAS]; | 155 int mode_lf_delta_[NUM_MODE_LF_DELTAS]; |
| 150 } VP8FilterHeader; | 156 } VP8FilterHeader; |
| 151 | 157 |
| 152 //------------------------------------------------------------------------------ | 158 //------------------------------------------------------------------------------ |
| 153 // Informations about the macroblocks. | 159 // Informations about the macroblocks. |
| 154 | 160 |
| 155 typedef struct { // filter specs | 161 typedef struct { // filter specs |
| 156 unsigned int f_level_:6; // filter strength: 0..63 | 162 uint8_t f_limit_; // filter limit in [3..189], or 0 if no filtering |
| 157 unsigned int f_ilevel_:6; // inner limit: 1..63 | 163 uint8_t f_ilevel_; // inner limit in [1..63] |
| 158 unsigned int f_inner_:1; // do inner filtering? | 164 uint8_t f_inner_; // do inner filtering? |
| 165 uint8_t hev_thresh_; // high edge variance threshold in [0..2] |
| 159 } VP8FInfo; | 166 } VP8FInfo; |
| 160 | 167 |
| 161 typedef struct { // used for syntax-parsing | 168 typedef struct { // Top/Left Contexts used for syntax-parsing |
| 162 unsigned int nz_:24; // non-zero AC/DC coeffs (24bit) | 169 uint8_t nz_; // non-zero AC/DC coeffs (4bit for luma + 4bit for chroma) |
| 163 unsigned int dc_nz_:1; // non-zero DC coeffs | 170 uint8_t nz_dc_; // non-zero DC coeff (1bit) |
| 164 unsigned int skip_:1; // block type | |
| 165 } VP8MB; | 171 } VP8MB; |
| 166 | 172 |
| 167 // Dequantization matrices | 173 // Dequantization matrices |
| 168 typedef int quant_t[2]; // [DC / AC]. Can be 'uint16_t[2]' too (~slower). | 174 typedef int quant_t[2]; // [DC / AC]. Can be 'uint16_t[2]' too (~slower). |
| 169 typedef struct { | 175 typedef struct { |
| 170 quant_t y1_mat_, y2_mat_, uv_mat_; | 176 quant_t y1_mat_, y2_mat_, uv_mat_; |
| 177 |
| 178 int uv_quant_; // U/V quantizer value |
| 179 int dither_; // dithering amplitude (0 = off, max=255) |
| 171 } VP8QuantMatrix; | 180 } VP8QuantMatrix; |
| 172 | 181 |
| 182 // Data needed to reconstruct a macroblock |
| 183 typedef struct { |
| 184 int16_t coeffs_[384]; // 384 coeffs = (16+4+4) * 4*4 |
| 185 uint8_t is_i4x4_; // true if intra4x4 |
| 186 uint8_t imodes_[16]; // one 16x16 mode (#0) or sixteen 4x4 modes |
| 187 uint8_t uvmode_; // chroma prediction mode |
| 188 // bit-wise info about the content of each sub-4x4 blocks (in decoding order). |
| 189 // Each of the 4x4 blocks for y/u/v is associated with a 2b code according to: |
| 190 // code=0 -> no coefficient |
| 191 // code=1 -> only DC |
| 192 // code=2 -> first three coefficients are non-zero |
| 193 // code=3 -> more than three coefficients are non-zero |
| 194 // This allows to call specialized transform functions. |
| 195 uint32_t non_zero_y_; |
| 196 uint32_t non_zero_uv_; |
| 197 uint8_t dither_; // local dithering strength (deduced from non_zero_*) |
| 198 } VP8MBData; |
| 199 |
| 173 // Persistent information needed by the parallel processing | 200 // Persistent information needed by the parallel processing |
| 174 typedef struct { | 201 typedef struct { |
| 175 int id_; // cache row to process (in [0..2]) | 202 int id_; // cache row to process (in [0..2]) |
| 176 int mb_y_; // macroblock position of the row | 203 int mb_y_; // macroblock position of the row |
| 177 int filter_row_; // true if row-filtering is needed | 204 int filter_row_; // true if row-filtering is needed |
| 178 VP8FInfo* f_info_; // filter strengths | 205 VP8FInfo* f_info_; // filter strengths (swapped with dec->f_info_) |
| 179 VP8Io io_; // copy of the VP8Io to pass to put() | 206 VP8MBData* mb_data_; // reconstruction data (swapped with dec->mb_data_) |
| 207 VP8Io io_; // copy of the VP8Io to pass to put() |
| 180 } VP8ThreadContext; | 208 } VP8ThreadContext; |
| 181 | 209 |
| 210 // Saved top samples, per macroblock. Fits into a cache-line. |
| 211 typedef struct { |
| 212 uint8_t y[16], u[8], v[8]; |
| 213 } VP8TopSamples; |
| 214 |
| 182 //------------------------------------------------------------------------------ | 215 //------------------------------------------------------------------------------ |
| 183 // VP8Decoder: the main opaque structure handed over to user | 216 // VP8Decoder: the main opaque structure handed over to user |
| 184 | 217 |
| 185 struct VP8Decoder { | 218 struct VP8Decoder { |
| 186 VP8StatusCode status_; | 219 VP8StatusCode status_; |
| 187 int ready_; // true if ready to decode a picture with VP8Decode() | 220 int ready_; // true if ready to decode a picture with VP8Decode() |
| 188 const char* error_msg_; // set when status_ is not OK. | 221 const char* error_msg_; // set when status_ is not OK. |
| 189 | 222 |
| 190 // Main data source | 223 // Main data source |
| 191 VP8BitReader br_; | 224 VP8BitReader br_; |
| 192 | 225 |
| 193 // headers | 226 // headers |
| 194 VP8FrameHeader frm_hdr_; | 227 VP8FrameHeader frm_hdr_; |
| 195 VP8PictureHeader pic_hdr_; | 228 VP8PictureHeader pic_hdr_; |
| 196 VP8FilterHeader filter_hdr_; | 229 VP8FilterHeader filter_hdr_; |
| 197 VP8SegmentHeader segment_hdr_; | 230 VP8SegmentHeader segment_hdr_; |
| 198 | 231 |
| 199 // Worker | 232 // Worker |
| 200 WebPWorker worker_; | 233 WebPWorker worker_; |
| 201 int use_threads_; // use multi-thread | 234 int mt_method_; // multi-thread method: 0=off, 1=[parse+recon][filter] |
| 235 // 2=[parse][recon+filter] |
| 202 int cache_id_; // current cache row | 236 int cache_id_; // current cache row |
| 203 int num_caches_; // number of cached rows of 16 pixels (1, 2 or 3) | 237 int num_caches_; // number of cached rows of 16 pixels (1, 2 or 3) |
| 204 VP8ThreadContext thread_ctx_; // Thread context | 238 VP8ThreadContext thread_ctx_; // Thread context |
| 205 | 239 |
| 206 // dimension, in macroblock units. | 240 // dimension, in macroblock units. |
| 207 int mb_w_, mb_h_; | 241 int mb_w_, mb_h_; |
| 208 | 242 |
| 209 // Macroblock to process/filter, depending on cropping and filter_type. | 243 // Macroblock to process/filter, depending on cropping and filter_type. |
| 210 int tl_mb_x_, tl_mb_y_; // top-left MB that must be in-loop filtered | 244 int tl_mb_x_, tl_mb_y_; // top-left MB that must be in-loop filtered |
| 211 int br_mb_x_, br_mb_y_; // last bottom-right MB that must be decoded | 245 int br_mb_x_, br_mb_y_; // last bottom-right MB that must be decoded |
| 212 | 246 |
| 213 // number of partitions. | 247 // number of partitions. |
| 214 int num_parts_; | 248 int num_parts_; |
| 215 // per-partition boolean decoders. | 249 // per-partition boolean decoders. |
| 216 VP8BitReader parts_[MAX_NUM_PARTITIONS]; | 250 VP8BitReader parts_[MAX_NUM_PARTITIONS]; |
| 217 | 251 |
| 218 // buffer refresh flags | 252 // Dithering strength, deduced from decoding options |
| 219 // bit 0: refresh Gold, bit 1: refresh Alt | 253 int dither_; // whether to use dithering or not |
| 220 // bit 2-3: copy to Gold, bit 4-5: copy to Alt | 254 VP8Random dithering_rg_; // random generator for dithering |
| 221 // bit 6: Gold sign bias, bit 7: Alt sign bias | |
| 222 // bit 8: refresh last frame | |
| 223 uint32_t buffer_flags_; | |
| 224 | 255 |
| 225 // dequantization (one set of DC/AC dequant factor per segment) | 256 // dequantization (one set of DC/AC dequant factor per segment) |
| 226 VP8QuantMatrix dqm_[NUM_MB_SEGMENTS]; | 257 VP8QuantMatrix dqm_[NUM_MB_SEGMENTS]; |
| 227 | 258 |
| 228 // probabilities | 259 // probabilities |
| 229 VP8Proba proba_; | 260 VP8Proba proba_; |
| 230 int use_skip_proba_; | 261 int use_skip_proba_; |
| 231 uint8_t skip_p_; | 262 uint8_t skip_p_; |
| 232 #ifndef ONLY_KEYFRAME_CODE | |
| 233 uint8_t intra_p_, last_p_, golden_p_; | |
| 234 VP8Proba proba_saved_; | |
| 235 int update_proba_; | |
| 236 #endif | |
| 237 | 263 |
| 238 // Boundary data cache and persistent buffers. | 264 // Boundary data cache and persistent buffers. |
| 239 uint8_t* intra_t_; // top intra modes values: 4 * mb_w_ | 265 uint8_t* intra_t_; // top intra modes values: 4 * mb_w_ |
| 240 uint8_t intra_l_[4]; // left intra modes values | 266 uint8_t intra_l_[4]; // left intra modes values |
| 241 uint8_t* y_t_; // top luma samples: 16 * mb_w_ | |
| 242 uint8_t* u_t_, *v_t_; // top u/v samples: 8 * mb_w_ each | |
| 243 | 267 |
| 244 VP8MB* mb_info_; // contextual macroblock info (mb_w_ + 1) | 268 uint8_t segment_; // segment of the currently parsed block |
| 245 VP8FInfo* f_info_; // filter strength info | 269 VP8TopSamples* yuv_t_; // top y/u/v samples |
| 246 uint8_t* yuv_b_; // main block for Y/U/V (size = YUV_SIZE) | |
| 247 int16_t* coeffs_; // 384 coeffs = (16+8+8) * 4*4 | |
| 248 | 270 |
| 249 uint8_t* cache_y_; // macroblock row for storing unfiltered samples | 271 VP8MB* mb_info_; // contextual macroblock info (mb_w_ + 1) |
| 272 VP8FInfo* f_info_; // filter strength info |
| 273 uint8_t* yuv_b_; // main block for Y/U/V (size = YUV_SIZE) |
| 274 |
| 275 uint8_t* cache_y_; // macroblock row for storing unfiltered samples |
| 250 uint8_t* cache_u_; | 276 uint8_t* cache_u_; |
| 251 uint8_t* cache_v_; | 277 uint8_t* cache_v_; |
| 252 int cache_y_stride_; | 278 int cache_y_stride_; |
| 253 int cache_uv_stride_; | 279 int cache_uv_stride_; |
| 254 | 280 |
| 255 // main memory chunk for the above data. Persistent. | 281 // main memory chunk for the above data. Persistent. |
| 256 void* mem_; | 282 void* mem_; |
| 257 size_t mem_size_; | 283 size_t mem_size_; |
| 258 | 284 |
| 259 // Per macroblock non-persistent infos. | 285 // Per macroblock non-persistent infos. |
| 260 int mb_x_, mb_y_; // current position, in macroblock units | 286 int mb_x_, mb_y_; // current position, in macroblock units |
| 261 uint8_t is_i4x4_; // true if intra4x4 | 287 VP8MBData* mb_data_; // parsed reconstruction data |
| 262 uint8_t imodes_[16]; // one 16x16 mode (#0) or sixteen 4x4 modes | |
| 263 uint8_t uvmode_; // chroma prediction mode | |
| 264 uint8_t segment_; // block's segment | |
| 265 | |
| 266 // bit-wise info about the content of each sub-4x4 blocks: there are 16 bits | |
| 267 // for luma (bits #0->#15), then 4 bits for chroma-u (#16->#19) and 4 bits for | |
| 268 // chroma-v (#20->#23), each corresponding to one 4x4 block in decoding order. | |
| 269 // If the bit is set, the 4x4 block contains some non-zero coefficients. | |
| 270 uint32_t non_zero_; | |
| 271 uint32_t non_zero_ac_; | |
| 272 | 288 |
| 273 // Filtering side-info | 289 // Filtering side-info |
| 274 int filter_type_; // 0=off, 1=simple, 2=complex | 290 int filter_type_; // 0=off, 1=simple, 2=complex |
| 275 int filter_row_; // per-row flag | |
| 276 VP8FInfo fstrengths_[NUM_MB_SEGMENTS][2]; // precalculated per-segment/type | 291 VP8FInfo fstrengths_[NUM_MB_SEGMENTS][2]; // precalculated per-segment/type |
| 277 | 292 |
| 278 // extensions | 293 // Alpha |
| 279 const uint8_t* alpha_data_; // compressed alpha data (if present) | 294 struct ALPHDecoder* alph_dec_; // alpha-plane decoder object |
| 295 const uint8_t* alpha_data_; // compressed alpha data (if present) |
| 280 size_t alpha_data_size_; | 296 size_t alpha_data_size_; |
| 281 int is_alpha_decoded_; // true if alpha_data_ is decoded in alpha_plane_ | 297 int is_alpha_decoded_; // true if alpha_data_ is decoded in alpha_plane_ |
| 282 uint8_t* alpha_plane_; // output. Persistent, contains the whole data. | 298 uint8_t* alpha_plane_; // output. Persistent, contains the whole data. |
| 283 | 299 |
| 300 // extensions |
| 284 int layer_colorspace_; | 301 int layer_colorspace_; |
| 285 const uint8_t* layer_data_; // compressed layer data (if present) | 302 const uint8_t* layer_data_; // compressed layer data (if present) |
| 286 size_t layer_data_size_; | 303 size_t layer_data_size_; |
| 287 }; | 304 }; |
| 288 | 305 |
| 289 //------------------------------------------------------------------------------ | 306 //------------------------------------------------------------------------------ |
| 290 // internal functions. Not public. | 307 // internal functions. Not public. |
| 291 | 308 |
| 292 // in vp8.c | 309 // in vp8.c |
| 293 int VP8SetError(VP8Decoder* const dec, | 310 int VP8SetError(VP8Decoder* const dec, |
| 294 VP8StatusCode error, const char* const msg); | 311 VP8StatusCode error, const char* const msg); |
| 295 | 312 |
| 296 // in tree.c | 313 // in tree.c |
| 297 void VP8ResetProba(VP8Proba* const proba); | 314 void VP8ResetProba(VP8Proba* const proba); |
| 298 void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec); | 315 void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec); |
| 299 void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec); | 316 void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec); |
| 300 | 317 |
| 301 // in quant.c | 318 // in quant.c |
| 302 void VP8ParseQuant(VP8Decoder* const dec); | 319 void VP8ParseQuant(VP8Decoder* const dec); |
| 303 | 320 |
| 304 // in frame.c | 321 // in frame.c |
| 305 int VP8InitFrame(VP8Decoder* const dec, VP8Io* io); | 322 int VP8InitFrame(VP8Decoder* const dec, VP8Io* io); |
| 306 // Predict a block and add residual | |
| 307 void VP8ReconstructBlock(VP8Decoder* const dec); | |
| 308 // Call io->setup() and finish setting up scan parameters. | 323 // Call io->setup() and finish setting up scan parameters. |
| 309 // After this call returns, one must always call VP8ExitCritical() with the | 324 // After this call returns, one must always call VP8ExitCritical() with the |
| 310 // same parameters. Both functions should be used in pair. Returns VP8_STATUS_OK | 325 // same parameters. Both functions should be used in pair. Returns VP8_STATUS_OK |
| 311 // if ok, otherwise sets and returns the error status on *dec. | 326 // if ok, otherwise sets and returns the error status on *dec. |
| 312 VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io); | 327 VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io); |
| 313 // Must always be called in pair with VP8EnterCritical(). | 328 // Must always be called in pair with VP8EnterCritical(). |
| 314 // Returns false in case of error. | 329 // Returns false in case of error. |
| 315 int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io); | 330 int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io); |
| 316 // Process the last decoded row (filtering + output) | 331 // Return the multi-threading method to use (0=off), depending |
| 332 // on options and bitstream size. Only for lossy decoding. |
| 333 int VP8GetThreadMethod(const WebPDecoderOptions* const options, |
| 334 const WebPHeaderStructure* const headers, |
| 335 int width, int height); |
| 336 // Initialize dithering post-process if needed. |
| 337 void VP8InitDithering(const WebPDecoderOptions* const options, |
| 338 VP8Decoder* const dec); |
| 339 // Process the last decoded row (filtering + output). |
| 317 int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io); | 340 int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io); |
| 318 // To be called at the start of a new scanline, to initialize predictors. | 341 // To be called at the start of a new scanline, to initialize predictors. |
| 319 void VP8InitScanline(VP8Decoder* const dec); | 342 void VP8InitScanline(VP8Decoder* const dec); |
| 320 // Decode one macroblock. Returns false if there is not enough data. | 343 // Decode one macroblock. Returns false if there is not enough data. |
| 321 int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br); | 344 int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br); |
| 322 | 345 |
| 323 // in alpha.c | 346 // in alpha.c |
| 324 const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, | 347 const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, |
| 325 int row, int num_rows); | 348 int row, int num_rows); |
| 326 | 349 |
| 327 // in layer.c | 350 // in layer.c |
| 328 int VP8DecodeLayer(VP8Decoder* const dec); | 351 int VP8DecodeLayer(VP8Decoder* const dec); |
| 329 | 352 |
| 330 //------------------------------------------------------------------------------ | 353 //------------------------------------------------------------------------------ |
| 331 | 354 |
| 332 #if defined(__cplusplus) || defined(c_plusplus) | 355 #ifdef __cplusplus |
| 333 } // extern "C" | 356 } // extern "C" |
| 334 #endif | 357 #endif |
| 335 | 358 |
| 336 #endif /* WEBP_DEC_VP8I_H_ */ | 359 #endif /* WEBP_DEC_VP8I_H_ */ |
| OLD | NEW |