• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <stdint.h>
18 #include <cstddef>
19 
20 enum RGTCImageFormat { BC4_UNORM, BC4_SNORM, BC5_UNORM, BC5_SNORM };
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 // Decode an entire image.
27 // pIn - pointer to encoded data.
28 // pOut - pointer to the image data. Will be written such that
29 //        pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
30 //        large enough to store entire image.
31 //        (pixelSize=3 for rgb images, pixelSize=4 for images with alpha channel)
32 // returns non-zero if there is an error.
33 int rgtc_decode_image(const uint8_t* pIn, RGTCImageFormat format, uint8_t* pOut, uint32_t width,
34                       uint32_t height, uint32_t stride);
35 
36 size_t rgtc_get_encoded_image_size(RGTCImageFormat format, uint32_t width, uint32_t height);
37 
38 size_t rgtc_get_decoded_pixel_size(RGTCImageFormat format);
39 
40 #ifdef __cplusplus
41 }
42 #endif