| 1 |
/* |
| 2 |
* Copyright 2015 The Etc2Comp Authors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include "EtcConfig.h" |
| 20 |
#include "EtcImage.h" |
| 21 |
#include "EtcColor.h" |
| 22 |
#include "EtcErrorMetric.h" |
| 23 |
#include <memory> |
| 24 |
|
| 25 |
#define ETCCOMP_MIN_EFFORT_LEVEL (0.0f) |
| 26 |
#define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f) |
| 27 |
#define ETCCOMP_MAX_EFFORT_LEVEL (100.0f) |
| 28 |
|
| 29 |
namespace Etc |
| 30 |
{ |
| 31 |
class Block4x4EncodingBits; |
| 32 |
|
| 33 |
struct RawImage |
| 34 |
{ |
| 35 |
int uiExtendedWidth; |
| 36 |
int uiExtendedHeight; |
| 37 |
unsigned int uiEncodingBitsBytes; |
| 38 |
std::shared_ptr<unsigned char> paucEncodingBits; |
| 39 |
}; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
// C-style inteface to the encoder |
| 44 |
void Encode(float *a_pafSourceRGBA, |
| 45 |
unsigned int a_uiSourceWidth, |
| 46 |
unsigned int a_uiSourceHeight, |
| 47 |
Image::Format a_format, |
| 48 |
ErrorMetric a_eErrMetric, |
| 49 |
float a_fEffort, |
| 50 |
unsigned int a_uiJobs, |
| 51 |
unsigned int a_uimaxJobs, |
| 52 |
unsigned char **a_ppaucEncodingBits, |
| 53 |
unsigned int *a_puiEncodingBitsBytes, |
| 54 |
unsigned int *a_puiExtendedWidth, |
| 55 |
unsigned int *a_puiExtendedHeight, |
| 56 |
int *a_piEncodingTime_ms, bool a_bVerboseOutput = false); |
| 57 |
|
| 58 |
void EncodeMipmaps(float *a_pafSourceRGBA, |
| 59 |
unsigned int a_uiSourceWidth, |
| 60 |
unsigned int a_uiSourceHeight, |
| 61 |
Image::Format a_format, |
| 62 |
ErrorMetric a_eErrMetric, |
| 63 |
float a_fEffort, |
| 64 |
unsigned int a_uiJobs, |
| 65 |
unsigned int a_uiMaxJobs, |
| 66 |
unsigned int a_uiMaxMipmaps, |
| 67 |
unsigned int a_uiMipFilterFlags, |
| 68 |
RawImage* a_pMipmaps, |
| 69 |
int *a_piEncodingTime_ms, bool a_bVerboseOutput = false); |
| 70 |
|
| 71 |
} |