1 // Copyright 2010 Google Inc. All Rights Reserved.
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
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
10 // main entry for the decoder
12 // Author: Skal (pascal.massimino@gmail.com)
20 #include "../utils/bit_reader.h"
22 //------------------------------------------------------------------------------
24 int WebPGetDecoderVersion(void) {
25 return (DEC_MAJ_VERSION
<< 16) | (DEC_MIN_VERSION
<< 8) | DEC_REV_VERSION
;
28 //------------------------------------------------------------------------------
31 static void SetOk(VP8Decoder
* const dec
) {
32 dec
->status_
= VP8_STATUS_OK
;
33 dec
->error_msg_
= "OK";
36 int VP8InitIoInternal(VP8Io
* const io
, int version
) {
37 if (WEBP_ABI_IS_INCOMPATIBLE(version
, WEBP_DECODER_ABI_VERSION
)) {
38 return 0; // mismatch error
41 memset(io
, 0, sizeof(*io
));
46 VP8Decoder
* VP8New(void) {
47 VP8Decoder
* const dec
= (VP8Decoder
*)calloc(1, sizeof(*dec
));
50 WebPWorkerInit(&dec
->worker_
);
57 VP8StatusCode
VP8Status(VP8Decoder
* const dec
) {
58 if (!dec
) return VP8_STATUS_INVALID_PARAM
;
62 const char* VP8StatusMessage(VP8Decoder
* const dec
) {
63 if (dec
== NULL
) return "no object";
64 if (!dec
->error_msg_
) return "OK";
65 return dec
->error_msg_
;
68 void VP8Delete(VP8Decoder
* const dec
) {
75 int VP8SetError(VP8Decoder
* const dec
,
76 VP8StatusCode error
, const char* const msg
) {
77 // TODO This check would be unnecessary if alpha decompression was separated
78 // from VP8ProcessRow/FinishRow. This avoids setting 'dec->status_' to
79 // something other than VP8_STATUS_BITSTREAM_ERROR on alpha decompression
81 if (dec
->status_
== VP8_STATUS_OK
) {
83 dec
->error_msg_
= msg
;
89 //------------------------------------------------------------------------------
91 int VP8CheckSignature(const uint8_t* const data
, size_t data_size
) {
92 return (data_size
>= 3 &&
93 data
[0] == 0x9d && data
[1] == 0x01 && data
[2] == 0x2a);
96 int VP8GetInfo(const uint8_t* data
, size_t data_size
, size_t chunk_size
,
97 int* const width
, int* const height
) {
98 if (data
== NULL
|| data_size
< VP8_FRAME_HEADER_SIZE
) {
99 return 0; // not enough data
102 if (!VP8CheckSignature(data
+ 3, data_size
- 3)) {
103 return 0; // Wrong signature.
105 const uint32_t bits
= data
[0] | (data
[1] << 8) | (data
[2] << 16);
106 const int key_frame
= !(bits
& 1);
107 const int w
= ((data
[7] << 8) | data
[6]) & 0x3fff;
108 const int h
= ((data
[9] << 8) | data
[8]) & 0x3fff;
110 if (!key_frame
) { // Not a keyframe.
114 if (((bits
>> 1) & 7) > 3) {
115 return 0; // unknown profile
117 if (!((bits
>> 4) & 1)) {
118 return 0; // first frame is invisible!
120 if (((bits
>> 5)) >= chunk_size
) { // partition_length
121 return 0; // inconsistent size information.
123 if (w
== 0 || h
== 0) {
124 return 0; // We don't support both width and height to be zero.
138 //------------------------------------------------------------------------------
141 static void ResetSegmentHeader(VP8SegmentHeader
* const hdr
) {
143 hdr
->use_segment_
= 0;
144 hdr
->update_map_
= 0;
145 hdr
->absolute_delta_
= 1;
146 memset(hdr
->quantizer_
, 0, sizeof(hdr
->quantizer_
));
147 memset(hdr
->filter_strength_
, 0, sizeof(hdr
->filter_strength_
));
151 static int ParseSegmentHeader(VP8BitReader
* br
,
152 VP8SegmentHeader
* hdr
, VP8Proba
* proba
) {
155 hdr
->use_segment_
= VP8Get(br
);
156 if (hdr
->use_segment_
) {
157 hdr
->update_map_
= VP8Get(br
);
158 if (VP8Get(br
)) { // update data
160 hdr
->absolute_delta_
= VP8Get(br
);
161 for (s
= 0; s
< NUM_MB_SEGMENTS
; ++s
) {
162 hdr
->quantizer_
[s
] = VP8Get(br
) ? VP8GetSignedValue(br
, 7) : 0;
164 for (s
= 0; s
< NUM_MB_SEGMENTS
; ++s
) {
165 hdr
->filter_strength_
[s
] = VP8Get(br
) ? VP8GetSignedValue(br
, 6) : 0;
168 if (hdr
->update_map_
) {
170 for (s
= 0; s
< MB_FEATURE_TREE_PROBS
; ++s
) {
171 proba
->segments_
[s
] = VP8Get(br
) ? VP8GetValue(br
, 8) : 255u;
175 hdr
->update_map_
= 0;
181 // This function returns VP8_STATUS_SUSPENDED if we don't have all the
182 // necessary data in 'buf'.
183 // This case is not necessarily an error (for incremental decoding).
184 // Still, no bitreader is ever initialized to make it possible to read
185 // unavailable memory.
186 // If we don't even have the partitions' sizes, than VP8_STATUS_NOT_ENOUGH_DATA
187 // is returned, and this is an unrecoverable error.
188 // If the partitions were positioned ok, VP8_STATUS_OK is returned.
189 static VP8StatusCode
ParsePartitions(VP8Decoder
* const dec
,
190 const uint8_t* buf
, size_t size
) {
191 VP8BitReader
* const br
= &dec
->br_
;
192 const uint8_t* sz
= buf
;
193 const uint8_t* buf_end
= buf
+ size
;
194 const uint8_t* part_start
;
198 dec
->num_parts_
= 1 << VP8GetValue(br
, 2);
199 last_part
= dec
->num_parts_
- 1;
200 part_start
= buf
+ last_part
* 3;
201 if (buf_end
< part_start
) {
202 // we can't even read the sizes with sz[]! That's a failure.
203 return VP8_STATUS_NOT_ENOUGH_DATA
;
205 for (p
= 0; p
< last_part
; ++p
) {
206 const uint32_t psize
= sz
[0] | (sz
[1] << 8) | (sz
[2] << 16);
207 const uint8_t* part_end
= part_start
+ psize
;
208 if (part_end
> buf_end
) part_end
= buf_end
;
209 VP8InitBitReader(dec
->parts_
+ p
, part_start
, part_end
);
210 part_start
= part_end
;
213 VP8InitBitReader(dec
->parts_
+ last_part
, part_start
, buf_end
);
214 return (part_start
< buf_end
) ? VP8_STATUS_OK
:
215 VP8_STATUS_SUSPENDED
; // Init is ok, but there's not enough data
219 static int ParseFilterHeader(VP8BitReader
* br
, VP8Decoder
* const dec
) {
220 VP8FilterHeader
* const hdr
= &dec
->filter_hdr_
;
221 hdr
->simple_
= VP8Get(br
);
222 hdr
->level_
= VP8GetValue(br
, 6);
223 hdr
->sharpness_
= VP8GetValue(br
, 3);
224 hdr
->use_lf_delta_
= VP8Get(br
);
225 if (hdr
->use_lf_delta_
) {
226 if (VP8Get(br
)) { // update lf-delta?
228 for (i
= 0; i
< NUM_REF_LF_DELTAS
; ++i
) {
230 hdr
->ref_lf_delta_
[i
] = VP8GetSignedValue(br
, 6);
233 for (i
= 0; i
< NUM_MODE_LF_DELTAS
; ++i
) {
235 hdr
->mode_lf_delta_
[i
] = VP8GetSignedValue(br
, 6);
240 dec
->filter_type_
= (hdr
->level_
== 0) ? 0 : hdr
->simple_
? 1 : 2;
245 int VP8GetHeaders(VP8Decoder
* const dec
, VP8Io
* const io
) {
248 VP8FrameHeader
* frm_hdr
;
249 VP8PictureHeader
* pic_hdr
;
251 VP8StatusCode status
;
258 return VP8SetError(dec
, VP8_STATUS_INVALID_PARAM
,
259 "null VP8Io passed to VP8GetHeaders()");
262 buf_size
= io
->data_size
;
264 return VP8SetError(dec
, VP8_STATUS_NOT_ENOUGH_DATA
,
265 "Truncated header.");
270 const uint32_t bits
= buf
[0] | (buf
[1] << 8) | (buf
[2] << 16);
271 frm_hdr
= &dec
->frm_hdr_
;
272 frm_hdr
->key_frame_
= !(bits
& 1);
273 frm_hdr
->profile_
= (bits
>> 1) & 7;
274 frm_hdr
->show_
= (bits
>> 4) & 1;
275 frm_hdr
->partition_length_
= (bits
>> 5);
276 if (frm_hdr
->profile_
> 3)
277 return VP8SetError(dec
, VP8_STATUS_BITSTREAM_ERROR
,
278 "Incorrect keyframe parameters.");
280 return VP8SetError(dec
, VP8_STATUS_UNSUPPORTED_FEATURE
,
281 "Frame not displayable.");
286 pic_hdr
= &dec
->pic_hdr_
;
287 if (frm_hdr
->key_frame_
) {
290 return VP8SetError(dec
, VP8_STATUS_NOT_ENOUGH_DATA
,
291 "cannot parse picture header");
293 if (!VP8CheckSignature(buf
, buf_size
)) {
294 return VP8SetError(dec
, VP8_STATUS_BITSTREAM_ERROR
,
297 pic_hdr
->width_
= ((buf
[4] << 8) | buf
[3]) & 0x3fff;
298 pic_hdr
->xscale_
= buf
[4] >> 6; // ratio: 1, 5/4 5/3 or 2
299 pic_hdr
->height_
= ((buf
[6] << 8) | buf
[5]) & 0x3fff;
300 pic_hdr
->yscale_
= buf
[6] >> 6;
304 dec
->mb_w_
= (pic_hdr
->width_
+ 15) >> 4;
305 dec
->mb_h_
= (pic_hdr
->height_
+ 15) >> 4;
306 // Setup default output area (can be later modified during io->setup())
307 io
->width
= pic_hdr
->width_
;
308 io
->height
= pic_hdr
->height_
;
310 io
->use_cropping
= 0;
313 io
->crop_right
= io
->width
;
314 io
->crop_bottom
= io
->height
;
315 io
->mb_w
= io
->width
; // sanity check
316 io
->mb_h
= io
->height
; // ditto
318 VP8ResetProba(&dec
->proba_
);
319 ResetSegmentHeader(&dec
->segment_hdr_
);
320 dec
->segment_
= 0; // default for intra
323 // Check if we have all the partition #0 available, and initialize dec->br_
324 // to read this partition (and this partition only).
325 if (frm_hdr
->partition_length_
> buf_size
) {
326 return VP8SetError(dec
, VP8_STATUS_NOT_ENOUGH_DATA
,
327 "bad partition length");
331 VP8InitBitReader(br
, buf
, buf
+ frm_hdr
->partition_length_
);
332 buf
+= frm_hdr
->partition_length_
;
333 buf_size
-= frm_hdr
->partition_length_
;
335 if (frm_hdr
->key_frame_
) {
336 pic_hdr
->colorspace_
= VP8Get(br
);
337 pic_hdr
->clamp_type_
= VP8Get(br
);
339 if (!ParseSegmentHeader(br
, &dec
->segment_hdr_
, &dec
->proba_
)) {
340 return VP8SetError(dec
, VP8_STATUS_BITSTREAM_ERROR
,
341 "cannot parse segment header");
344 if (!ParseFilterHeader(br
, dec
)) {
345 return VP8SetError(dec
, VP8_STATUS_BITSTREAM_ERROR
,
346 "cannot parse filter header");
348 status
= ParsePartitions(dec
, buf
, buf_size
);
349 if (status
!= VP8_STATUS_OK
) {
350 return VP8SetError(dec
, status
, "cannot parse partitions");
356 // Frame buffer marking
357 if (!frm_hdr
->key_frame_
) {
358 return VP8SetError(dec
, VP8_STATUS_UNSUPPORTED_FEATURE
,
362 VP8Get(br
); // ignore the value of update_proba_
364 VP8ParseProba(br
, dec
);
366 #ifdef WEBP_EXPERIMENTAL_FEATURES
368 if (dec
->pic_hdr_
.colorspace_
) {
369 const size_t kTrailerSize
= 8;
370 const uint8_t kTrailerMarker
= 0x01;
371 const uint8_t* ext_buf
= buf
- kTrailerSize
;
374 if (frm_hdr
->partition_length_
< kTrailerSize
||
375 ext_buf
[kTrailerSize
- 1] != kTrailerMarker
) {
376 return VP8SetError(dec
, VP8_STATUS_BITSTREAM_ERROR
,
377 "RIFF: Inconsistent extra information.");
381 size
= (ext_buf
[0] << 0) | (ext_buf
[1] << 8) | (ext_buf
[2] << 16);
382 dec
->layer_data_size_
= size
;
383 dec
->layer_data_
= NULL
; // will be set later
384 dec
->layer_colorspace_
= ext_buf
[3];
393 //------------------------------------------------------------------------------
394 // Residual decoding (Paragraph 13.2 / 13.3)
396 static const int kBands
[16 + 1] = {
397 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7,
398 0 // extra entry as sentinel
401 static const uint8_t kCat3
[] = { 173, 148, 140, 0 };
402 static const uint8_t kCat4
[] = { 176, 155, 140, 135, 0 };
403 static const uint8_t kCat5
[] = { 180, 157, 141, 134, 130, 0 };
404 static const uint8_t kCat6
[] =
405 { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
406 static const uint8_t* const kCat3456
[] = { kCat3
, kCat4
, kCat5
, kCat6
};
407 static const uint8_t kZigzag
[16] = {
408 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
411 // See section 13-2: http://tools.ietf.org/html/rfc6386#section-13.2
412 static int GetLargeValue(VP8BitReader
* const br
, const uint8_t* const p
) {
414 if (!VP8GetBit(br
, p
[3])) {
415 if (!VP8GetBit(br
, p
[4])) {
418 v
= 3 + VP8GetBit(br
, p
[5]);
421 if (!VP8GetBit(br
, p
[6])) {
422 if (!VP8GetBit(br
, p
[7])) {
423 v
= 5 + VP8GetBit(br
, 159);
425 v
= 7 + 2 * VP8GetBit(br
, 165);
426 v
+= VP8GetBit(br
, 145);
430 const int bit1
= VP8GetBit(br
, p
[8]);
431 const int bit0
= VP8GetBit(br
, p
[9 + bit1
]);
432 const int cat
= 2 * bit1
+ bit0
;
434 for (tab
= kCat3456
[cat
]; *tab
; ++tab
) {
435 v
+= v
+ VP8GetBit(br
, *tab
);
443 // Returns the position of the last non-zero coeff plus one
444 static int GetCoeffs(VP8BitReader
* const br
, const VP8BandProbas
* const prob
,
445 int ctx
, const quant_t dq
, int n
, int16_t* out
) {
446 // n is either 0 or 1 here. kBands[n] is not necessary for extracting '*p'.
447 const uint8_t* p
= prob
[n
].probas_
[ctx
];
448 for (; n
< 16; ++n
) {
449 if (!VP8GetBit(br
, p
[0])) {
450 return n
; // previous coeff was last non-zero coeff
452 while (!VP8GetBit(br
, p
[1])) { // sequence of zero coeffs
453 p
= prob
[kBands
[++n
]].probas_
[0];
454 if (n
== 16) return 16;
457 const VP8ProbaArray
* const p_ctx
= &prob
[kBands
[n
+ 1]].probas_
[0];
459 if (!VP8GetBit(br
, p
[2])) {
463 v
= GetLargeValue(br
, p
);
466 out
[kZigzag
[n
]] = VP8GetSigned(br
, v
) * dq
[n
> 0];
472 static WEBP_INLINE
uint32_t NzCodeBits(uint32_t nz_coeffs
, int nz
, int dc_nz
) {
474 nz_coeffs
|= (nz
> 3) ? 3 : (nz
> 1) ? 2 : dc_nz
;
478 static int ParseResiduals(VP8Decoder
* const dec
,
479 VP8MB
* const mb
, VP8BitReader
* const token_br
) {
480 VP8BandProbas (* const bands
)[NUM_BANDS
] = dec
->proba_
.bands_
;
481 const VP8BandProbas
* ac_proba
;
482 const VP8QuantMatrix
* const q
= &dec
->dqm_
[dec
->segment_
];
483 VP8MBData
* const block
= dec
->mb_data_
+ dec
->mb_x_
;
484 int16_t* dst
= block
->coeffs_
;
485 VP8MB
* const left_mb
= dec
->mb_info_
- 1;
487 uint32_t non_zero_y
= 0;
488 uint32_t non_zero_uv
= 0;
490 uint32_t out_t_nz
, out_l_nz
;
493 memset(dst
, 0, 384 * sizeof(*dst
));
494 if (!block
->is_i4x4_
) { // parse DC
495 int16_t dc
[16] = { 0 };
496 const int ctx
= mb
->nz_dc_
+ left_mb
->nz_dc_
;
497 const int nz
= GetCoeffs(token_br
, bands
[1], ctx
, q
->y2_mat_
, 0, dc
);
498 mb
->nz_dc_
= left_mb
->nz_dc_
= (nz
> 0);
499 if (nz
> 1) { // more than just the DC -> perform the full transform
500 VP8TransformWHT(dc
, dst
);
501 } else { // only DC is non-zero -> inlined simplified transform
503 const int dc0
= (dc
[0] + 3) >> 3;
504 for (i
= 0; i
< 16 * 16; i
+= 16) dst
[i
] = dc0
;
513 tnz
= mb
->nz_
& 0x0f;
514 lnz
= left_mb
->nz_
& 0x0f;
515 for (y
= 0; y
< 4; ++y
) {
517 uint32_t nz_coeffs
= 0;
518 for (x
= 0; x
< 4; ++x
) {
519 const int ctx
= l
+ (tnz
& 1);
520 const int nz
= GetCoeffs(token_br
, ac_proba
, ctx
, q
->y1_mat_
, first
, dst
);
522 tnz
= (tnz
>> 1) | (l
<< 7);
523 nz_coeffs
= NzCodeBits(nz_coeffs
, nz
, dst
[0] != 0);
527 lnz
= (lnz
>> 1) | (l
<< 7);
528 non_zero_y
= (non_zero_y
<< 8) | nz_coeffs
;
533 for (ch
= 0; ch
< 4; ch
+= 2) {
534 uint32_t nz_coeffs
= 0;
535 tnz
= mb
->nz_
>> (4 + ch
);
536 lnz
= left_mb
->nz_
>> (4 + ch
);
537 for (y
= 0; y
< 2; ++y
) {
539 for (x
= 0; x
< 2; ++x
) {
540 const int ctx
= l
+ (tnz
& 1);
541 const int nz
= GetCoeffs(token_br
, bands
[2], ctx
, q
->uv_mat_
, 0, dst
);
543 tnz
= (tnz
>> 1) | (l
<< 3);
544 nz_coeffs
= NzCodeBits(nz_coeffs
, nz
, dst
[0] != 0);
548 lnz
= (lnz
>> 1) | (l
<< 5);
550 // Note: we don't really need the per-4x4 details for U/V blocks.
551 non_zero_uv
|= nz_coeffs
<< (4 * ch
);
552 out_t_nz
|= (tnz
<< 4) << ch
;
553 out_l_nz
|= (lnz
& 0xf0) << ch
;
556 left_mb
->nz_
= out_l_nz
;
558 block
->non_zero_y_
= non_zero_y
;
559 block
->non_zero_uv_
= non_zero_uv
;
561 // We look at the mode-code of each block and check if some blocks have less
562 // than three non-zero coeffs (code < 2). This is to avoid dithering flat and
564 block
->dither_
= (non_zero_uv
& 0xaaaa) ? 0 : q
->dither_
;
566 return !(non_zero_y
| non_zero_uv
); // will be used for further optimization
569 //------------------------------------------------------------------------------
572 int VP8DecodeMB(VP8Decoder
* const dec
, VP8BitReader
* const token_br
) {
573 VP8BitReader
* const br
= &dec
->br_
;
574 VP8MB
* const left
= dec
->mb_info_
- 1;
575 VP8MB
* const mb
= dec
->mb_info_
+ dec
->mb_x_
;
576 VP8MBData
* const block
= dec
->mb_data_
+ dec
->mb_x_
;
579 // Note: we don't save segment map (yet), as we don't expect
580 // to decode more than 1 keyframe.
581 if (dec
->segment_hdr_
.update_map_
) {
582 // Hardcoded tree parsing
583 dec
->segment_
= !VP8GetBit(br
, dec
->proba_
.segments_
[0]) ?
584 VP8GetBit(br
, dec
->proba_
.segments_
[1]) :
585 2 + VP8GetBit(br
, dec
->proba_
.segments_
[2]);
587 skip
= dec
->use_skip_proba_
? VP8GetBit(br
, dec
->skip_p_
) : 0;
589 VP8ParseIntraMode(br
, dec
);
595 skip
= ParseResiduals(dec
, mb
, token_br
);
597 left
->nz_
= mb
->nz_
= 0;
598 if (!block
->is_i4x4_
) {
599 left
->nz_dc_
= mb
->nz_dc_
= 0;
601 block
->non_zero_y_
= 0;
602 block
->non_zero_uv_
= 0;
605 if (dec
->filter_type_
> 0) { // store filter info
606 VP8FInfo
* const finfo
= dec
->f_info_
+ dec
->mb_x_
;
607 *finfo
= dec
->fstrengths_
[dec
->segment_
][block
->is_i4x4_
];
608 finfo
->f_inner_
|= !skip
;
611 return !token_br
->eof_
;
614 void VP8InitScanline(VP8Decoder
* const dec
) {
615 VP8MB
* const left
= dec
->mb_info_
- 1;
618 memset(dec
->intra_l_
, B_DC_PRED
, sizeof(dec
->intra_l_
));
622 static int ParseFrame(VP8Decoder
* const dec
, VP8Io
* io
) {
623 for (dec
->mb_y_
= 0; dec
->mb_y_
< dec
->br_mb_y_
; ++dec
->mb_y_
) {
624 // Parse bitstream for this row.
625 VP8BitReader
* const token_br
=
626 &dec
->parts_
[dec
->mb_y_
& (dec
->num_parts_
- 1)];
627 for (; dec
->mb_x_
< dec
->mb_w_
; ++dec
->mb_x_
) {
628 if (!VP8DecodeMB(dec
, token_br
)) {
629 return VP8SetError(dec
, VP8_STATUS_NOT_ENOUGH_DATA
,
630 "Premature end-of-file encountered.");
633 VP8InitScanline(dec
); // Prepare for next scanline
635 // Reconstruct, filter and emit the row.
636 if (!VP8ProcessRow(dec
, io
)) {
637 return VP8SetError(dec
, VP8_STATUS_USER_ABORT
, "Output aborted.");
640 if (dec
->mt_method_
> 0) {
641 if (!WebPWorkerSync(&dec
->worker_
)) return 0;
645 #ifdef WEBP_EXPERIMENTAL_FEATURES
646 if (dec
->layer_data_size_
> 0) {
647 if (!VP8DecodeLayer(dec
)) {
657 int VP8Decode(VP8Decoder
* const dec
, VP8Io
* const io
) {
663 return VP8SetError(dec
, VP8_STATUS_INVALID_PARAM
,
664 "NULL VP8Io parameter in VP8Decode().");
668 if (!VP8GetHeaders(dec
, io
)) {
674 // Finish setting up the decoding parameter. Will call io->setup().
675 ok
= (VP8EnterCritical(dec
, io
) == VP8_STATUS_OK
);
676 if (ok
) { // good to go.
677 // Will allocate memory and prepare everything.
678 if (ok
) ok
= VP8InitFrame(dec
, io
);
680 // Main decoding loop
681 if (ok
) ok
= ParseFrame(dec
, io
);
684 ok
&= VP8ExitCritical(dec
, io
);
696 void VP8Clear(VP8Decoder
* const dec
) {
700 if (dec
->mt_method_
> 0) {
701 WebPWorkerEnd(&dec
->worker_
);
703 ALPHDelete(dec
->alph_dec_
);
704 dec
->alph_dec_
= NULL
;
708 memset(&dec
->br_
, 0, sizeof(dec
->br_
));
712 //------------------------------------------------------------------------------