// Copyright 2014 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. // ----------------------------------------------------------------------------- // // Specific inlined methods for boolean decoder [VP8GetBit() ...] // This file should be included by the .c sources that actually need to call // these methods. // // Author: Skal ([email protected]) #ifndef WEBP_UTILS_BIT_READER_INL_UTILS_H_ #define WEBP_UTILS_BIT_READER_INL_UTILS_H_ #ifdef HAVE_CONFIG_H #include "src/webp/config.h" #endif #include <string.h> // for memcpy #include "src/dsp/dsp.h" #include "src/utils/bit_reader_utils.h" #include "src/utils/endian_inl_utils.h" #include "src/utils/utils.h" #ifdef __cplusplus extern "C" { #endif //------------------------------------------------------------------------------ // Derived type lbit_t = natural type for memory I/O #if (BITS > 32) lbit_t; #elif (BITS > 16) typedef uint32_t lbit_t; #elif (BITS > 8) typedef uint16_t lbit_t; #else typedef uint8_t lbit_t; #endif extern const uint8_t kVP8Log2Range[128]; extern const uint8_t kVP8NewRange[128]; // special case for the tail byte-reading void VP8LoadFinalBytes(VP8BitReader* const br); //------------------------------------------------------------------------------ // Inlined critical functions // makes sure br->value_ has at least BITS bits worth of data static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* WEBP_RESTRICT const br) { … } // Read a bit with proba 'prob'. Speed-critical function! static WEBP_INLINE int VP8GetBit(VP8BitReader* WEBP_RESTRICT const br, int prob, const char label[]) { … } // simplified version of VP8GetBit() for prob=0x80 (note shift is always 1 here) static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE int VP8GetSigned(VP8BitReader* WEBP_RESTRICT const br, int v, const char label[]) { … } static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* WEBP_RESTRICT const br, int prob, const char label[]) { … } #ifdef __cplusplus } // extern "C" #endif #endif // WEBP_UTILS_BIT_READER_INL_UTILS_H_