// Copyright 2011 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // Alpha-plane decompression. // // Author: Skal ([email protected]) #include <stdlib.h> #include "src/dec/alphai_dec.h" #include "src/dec/vp8_dec.h" #include "src/dec/vp8i_dec.h" #include "src/dec/vp8li_dec.h" #include "src/dsp/dsp.h" #include "src/utils/quant_levels_dec_utils.h" #include "src/utils/utils.h" #include "src/webp/format_constants.h" #include "src/webp/types.h" //------------------------------------------------------------------------------ // ALPHDecoder object. // Allocates a new alpha decoder instance. WEBP_NODISCARD static ALPHDecoder* ALPHNew(void) { … } // Clears and deallocates an alpha decoder instance. static void ALPHDelete(ALPHDecoder* const dec) { … } //------------------------------------------------------------------------------ // Decoding. // Initialize alpha decoding by parsing the alpha header and decoding the image // header for alpha data stored using lossless compression. // Returns false in case of error in alpha header (data too short, invalid // compression method or filter, error in lossless header data etc). WEBP_NODISCARD static int ALPHInit(ALPHDecoder* const dec, const uint8_t* data, size_t data_size, const VP8Io* const src_io, uint8_t* output) { … } // Decodes, unfilters and dequantizes *at least* 'num_rows' rows of alpha // starting from row number 'row'. It assumes that rows up to (row - 1) have // already been decoded. // Returns false in case of bitstream error. WEBP_NODISCARD static int ALPHDecode(VP8Decoder* const dec, int row, int num_rows) { … } WEBP_NODISCARD static int AllocateAlphaPlane(VP8Decoder* const dec, const VP8Io* const io) { … } void WebPDeallocateAlphaMemory(VP8Decoder* const dec) { … } //------------------------------------------------------------------------------ // Main entry point. WEBP_NODISCARD const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, const VP8Io* const io, int row, int num_rows) { … }