chromium/third_party/angle/src/image_util/loadimage.inc

//
// Copyright 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#include "common/mathutil.h"

#include <string.h>

namespace angle
{

namespace priv
{

template <typename T>
inline T *OffsetDataPointer(uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
{}

template <typename T>
inline const T *OffsetDataPointer(const uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
{}

}  // namespace priv

template <typename type, size_t componentCount>
inline void LoadToNative(const ImageLoadContext &context, size_t width, size_t height, size_t depth,
                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
{}

template <typename type>
inline void LoadToNative3To4Impl(const ImageLoadContext &context,
                                 const uint32_t fourthComponentBits,
                                 size_t width,
                                 size_t height,
                                 size_t depth,
                                 const uint8_t *input,
                                 size_t inputRowPitch,
                                 size_t inputDepthPitch,
                                 uint8_t *output,
                                 size_t outputRowPitch,
                                 size_t outputDepthPitch)
{}

template <typename type, uint32_t fourthComponentBits>
inline void LoadToNative3To4(const ImageLoadContext &context,
                             size_t width,
                             size_t height,
                             size_t depth,
                             const uint8_t *input,
                             size_t inputRowPitch,
                             size_t inputDepthPitch,
                             uint8_t *output,
                             size_t outputRowPitch,
                             size_t outputDepthPitch)
{}

inline void LoadToNativeByte3To4Impl(const ImageLoadContext &context,
                                      const uint8_t fourthValue,
                                      size_t width,
                                      size_t height,
                                      size_t depth,
                                      const uint8_t *input,
                                      size_t inputRowPitch,
                                      size_t inputDepthPitch,
                                      uint8_t *output,
                                      size_t outputRowPitch,
                                      size_t outputDepthPitch)
{}

template <>
inline void LoadToNative3To4<uint8_t, 0xFF>(const ImageLoadContext &context,
                                            size_t width,
                                            size_t height,
                                            size_t depth,
                                            const uint8_t *input,
                                            size_t inputRowPitch,
                                            size_t inputDepthPitch,
                                            uint8_t *output,
                                            size_t outputRowPitch,
                                            size_t outputDepthPitch)
{}

template <>
inline void LoadToNative3To4<uint8_t, 0x01>(const ImageLoadContext &context,
                                            size_t width,
                                            size_t height,
                                            size_t depth,
                                            const uint8_t *input,
                                            size_t inputRowPitch,
                                            size_t inputDepthPitch,
                                            uint8_t *output,
                                            size_t outputRowPitch,
                                            size_t outputDepthPitch)
{}

template <>
inline void LoadToNative3To4<int8_t, 0x01>(const ImageLoadContext &context,
                                            size_t width,
                                            size_t height,
                                            size_t depth,
                                            const uint8_t *input,
                                            size_t inputRowPitch,
                                            size_t inputDepthPitch,
                                            uint8_t *output,
                                            size_t outputRowPitch,
                                            size_t outputDepthPitch)
{}

template <>
inline void LoadToNative3To4<int8_t, 0x7F>(const ImageLoadContext &context,
                                            size_t width,
                                            size_t height,
                                            size_t depth,
                                            const uint8_t *input,
                                            size_t inputRowPitch,
                                            size_t inputDepthPitch,
                                            uint8_t *output,
                                            size_t outputRowPitch,
                                            size_t outputDepthPitch)
{}

template <size_t componentCount>
inline void Load32FTo16F(const ImageLoadContext &context, size_t width, size_t height, size_t depth,
                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
{}

template <typename type,
          size_t inputComponentCount,
          size_t outputComponentCount,
          bool normalized>
inline void LoadToFloat(const ImageLoadContext &context, size_t width, size_t height, size_t depth,
                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch) {}

template <size_t blockWidth, size_t blockHeight, size_t blockDepth, size_t blockSize>
inline void LoadCompressedToNative(const ImageLoadContext &context, size_t width, size_t height,
                                   size_t depth, const uint8_t *input, size_t inputRowPitch,
                                   size_t inputDepthPitch, uint8_t *output, size_t outputRowPitch,
                                   size_t outputDepthPitch)
{}

template <typename type, uint32_t firstBits, uint32_t secondBits, uint32_t thirdBits, uint32_t fourthBits>
inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
                                     uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
{}

template <size_t blockWidth, size_t blockHeight>
inline void LoadASTCToRGBA8(const ImageLoadContext &context,
                            size_t width,
                            size_t height,
                            size_t depth,
                            const uint8_t *input,
                            size_t inputRowPitch,
                            size_t inputDepthPitch,
                            uint8_t *output,
                            size_t outputRowPitch,
                            size_t outputDepthPitch)
{}

template <uint32_t indexBits, uint32_t redBlueBits, uint32_t greenBits, uint32_t alphaBits>
inline void LoadPalettedToRGBA8(const ImageLoadContext &context,
                                size_t width,
                                size_t height,
                                size_t depth,
                                const uint8_t *input,
                                size_t inputRowPitch,
                                size_t inputDepthPitch,
                                uint8_t *output,
                                size_t outputRowPitch,
                                size_t outputDepthPitch)
{}

// Temporary overload functions; need to have no-context overloads of the following functions used
// by Chromium.  A Chromium change will switch to the with-context overloads, and then these can be
// removed.
inline void LoadEACR11ToR8(size_t width,
                           size_t height,
                           size_t depth,
                           const uint8_t *input,
                           size_t inputRowPitch,
                           size_t inputDepthPitch,
                           uint8_t *output,
                           size_t outputRowPitch,
                           size_t outputDepthPitch)
{}

inline void LoadEACR11SToR8(size_t width,
                            size_t height,
                            size_t depth,
                            const uint8_t *input,
                            size_t inputRowPitch,
                            size_t inputDepthPitch,
                            uint8_t *output,
                            size_t outputRowPitch,
                            size_t outputDepthPitch)
{}

inline void LoadEACRG11ToRG8(size_t width,
                             size_t height,
                             size_t depth,
                             const uint8_t *input,
                             size_t inputRowPitch,
                             size_t inputDepthPitch,
                             uint8_t *output,
                             size_t outputRowPitch,
                             size_t outputDepthPitch)
{}

inline void LoadEACRG11SToRG8(size_t width,
                              size_t height,
                              size_t depth,
                              const uint8_t *input,
                              size_t inputRowPitch,
                              size_t inputDepthPitch,
                              uint8_t *output,
                              size_t outputRowPitch,
                              size_t outputDepthPitch)
{}

inline void LoadETC2RGB8ToRGBA8(size_t width,
                                size_t height,
                                size_t depth,
                                const uint8_t *input,
                                size_t inputRowPitch,
                                size_t inputDepthPitch,
                                uint8_t *output,
                                size_t outputRowPitch,
                                size_t outputDepthPitch)
{}

inline void LoadETC2SRGB8ToRGBA8(size_t width,
                                 size_t height,
                                 size_t depth,
                                 const uint8_t *input,
                                 size_t inputRowPitch,
                                 size_t inputDepthPitch,
                                 uint8_t *output,
                                 size_t outputRowPitch,
                                 size_t outputDepthPitch)
{}

inline void LoadETC2RGBA8ToRGBA8(size_t width,
                                 size_t height,
                                 size_t depth,
                                 const uint8_t *input,
                                 size_t inputRowPitch,
                                 size_t inputDepthPitch,
                                 uint8_t *output,
                                 size_t outputRowPitch,
                                 size_t outputDepthPitch)
{}

inline void LoadETC2RGB8A1ToRGBA8(size_t width,
                                  size_t height,
                                  size_t depth,
                                  const uint8_t *input,
                                  size_t inputRowPitch,
                                  size_t inputDepthPitch,
                                  uint8_t *output,
                                  size_t outputRowPitch,
                                  size_t outputDepthPitch)
{}

inline void LoadETC2SRGBA8ToSRGBA8(size_t width,
                                   size_t height,
                                   size_t depth,
                                   const uint8_t *input,
                                   size_t inputRowPitch,
                                   size_t inputDepthPitch,
                                   uint8_t *output,
                                   size_t outputRowPitch,
                                   size_t outputDepthPitch)
{}

inline void LoadETC2SRGB8A1ToRGBA8(size_t width,
                                   size_t height,
                                   size_t depth,
                                   const uint8_t *input,
                                   size_t inputRowPitch,
                                   size_t inputDepthPitch,
                                   uint8_t *output,
                                   size_t outputRowPitch,
                                   size_t outputDepthPitch)
{}

} // namespace angle