Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
| 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 | class ETC_Decoder |
| 16 | { |
| 17 | public: |
| 18 | enum InputType |
| 19 | { |
| 20 | ETC_R_SIGNED, |
| 21 | ETC_R_UNSIGNED, |
| 22 | ETC_RG_SIGNED, |
| 23 | ETC_RG_UNSIGNED, |
| 24 | ETC_RGB, |
| 25 | ETC_RGB_PUNCHTHROUGH_ALPHA, |
| 26 | ETC_RGBA |
| 27 | }; |
| 28 | |
| 29 | /// ETC_Decoder::Decode - Decodes 1 to 4 channel images to 8 bit output |
| 30 | /// @param src Pointer to ETC2 encoded image |
| 31 | /// @param dst Pointer to BGRA, 8 bit output |
| 32 | /// @param w src image width |
| 33 | /// @param h src image height |
| 34 | /// @param dstW dst image width |
| 35 | /// @param dstH dst image height |
| 36 | /// @param dstPitch dst image pitch (bytes per row) |
| 37 | /// @param dstBpp dst image bytes per pixel |
| 38 | /// @param inputType src's format |
| 39 | /// @return true if the decoding was performed |
| 40 | static bool Decode(const unsigned char* src, unsigned char *dst, int w, int h, int dstW, int dstH, int dstPitch, int dstBpp, InputType inputType); |
| 41 | }; |