// 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. // ----------------------------------------------------------------------------- // // Everything about WebPDecBuffer // // Author: Skal ([email protected]) #include <stdlib.h> #include "src/dec/vp8i_dec.h" #include "src/dec/webpi_dec.h" #include "src/utils/utils.h" //------------------------------------------------------------------------------ // WebPDecBuffer // Number of bytes per pixel for the different color-spaces. static const uint8_t kModeBpp[MODE_LAST] = …; // Check that webp_csp_mode is within the bounds of WEBP_CSP_MODE. // Convert to an integer to handle both the unsigned/signed enum cases // without the need for casting to remove type limit warnings. static int IsValidColorspace(int webp_csp_mode) { … } // strictly speaking, the very last (or first, if flipped) row // doesn't require padding. #define MIN_BUFFER_SIZE … static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) { … } #undef MIN_BUFFER_SIZE static VP8StatusCode AllocateBuffer(WebPDecBuffer* const buffer) { … } VP8StatusCode WebPFlipBuffer(WebPDecBuffer* const buffer) { … } VP8StatusCode WebPAllocateDecBuffer(int width, int height, const WebPDecoderOptions* const options, WebPDecBuffer* const buffer) { … } //------------------------------------------------------------------------------ // constructors / destructors int WebPInitDecBufferInternal(WebPDecBuffer* buffer, int version) { … } void WebPFreeDecBuffer(WebPDecBuffer* buffer) { … } void WebPCopyDecBuffer(const WebPDecBuffer* const src, WebPDecBuffer* const dst) { … } // Copy and transfer ownership from src to dst (beware of parameter order!) void WebPGrabDecBuffer(WebPDecBuffer* const src, WebPDecBuffer* const dst) { … } VP8StatusCode WebPCopyDecBufferPixels(const WebPDecBuffer* const src_buf, WebPDecBuffer* const dst_buf) { … } int WebPAvoidSlowMemory(const WebPDecBuffer* const output, const WebPBitstreamFeatures* const features) { … } //------------------------------------------------------------------------------