| 972 | } |
| 973 | |
| 974 | int etc2_decode_image(int format, const etc2_byte* input, etc2_byte* output, etc2_uint32 width, etc2_uint32 height) |
| 975 | { |
| 976 | size_t outputRowPitch = 4 * width; |
| 977 | size_t outputDepthPitch = outputRowPitch * height; |
| 978 | |
| 979 | size_t bytesPerPixel = 0; |
| 980 | LoadTextureFunction loadTexture = nullptr; |
| 981 | switch (format) { |
| 982 | case ETC2_RGBA_NO_MIPMAPS: |
| 983 | bytesPerPixel = 16; |
| 984 | loadTexture = &LoadETC2RGBA8ToRGBA8; |
| 985 | break; |
| 986 | case ETC2_RGB_NO_MIPMAPS: |
| 987 | bytesPerPixel = 8; |
| 988 | loadTexture = &LoadETC2RGB8ToRGBA8; |
| 989 | break; |
| 990 | } |
| 991 | |
| 992 | if (loadTexture) { |
| 993 | size_t inputRowPitch = ComputeETC2RowPitch(width, 4 /*blockWidth*/, bytesPerPixel); |
| 994 | size_t inputDepthPitch = ComputeETC2DepthPitch(height, 4 /*blockHeight*/, inputRowPitch); |
| 995 | loadTexture(width, height, 1, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch); |
| 996 | return 0; |
| 997 | } |
| 998 | |
| 999 | return -1; |
| 1000 | } |
no test coverage detected