This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcbc9f3
commit 38dd7fb
Showing
59 changed files
with
22,549 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2015 Etc2Comp Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
x64/ | ||
Release/ | ||
Debug/ | ||
ipch/ | ||
*.sdf | ||
.vs/ | ||
*Debug/ | ||
*Release/ | ||
*debug*/ | ||
*release*/ | ||
*.db | ||
Analysis/ | ||
CMakeFiles/ | ||
*.vcxproj* | ||
*.sln | ||
*.cmake | ||
CmakeCache.txt | ||
build_*/* | ||
!build_*/gen_xcode.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This is the list of Etc2Comp authors for copyright purposes. | ||
# | ||
# This does not necessarily list everyone who has contributed code, since in | ||
# some cases, their employer may be the copyright holder. To see the full list | ||
# of contributors, see the revision history in source control. | ||
Google Inc. | ||
Blue Shift Inc. | ||
# This is the list of Etc2Comp authors for copyright purposes. | ||
# | ||
# This does not necessarily list everyone who has contributed code, since in | ||
# some cases, their employer may be the copyright holder. To see the full list | ||
# of contributors, see the revision history in source control. | ||
Google Inc. | ||
Blue Shift Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2015 Etc2Comp Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 2.8.9) | ||
project(EtcTest) | ||
|
||
set (CMAKE_CXX_STANDARD 11) | ||
IF (APPLE) | ||
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -std=c++11 -g3 -Wall -O3") | ||
ELSE () | ||
IF (WIN32) | ||
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -W4 /EHsc") | ||
ELSE() | ||
set (CMAKE_CXX_FLAGS "-I/usr/include/i386-linux-gnu/c++/4.8 -I/usr/include/c++/4.8 -std=c++11 -pthread -g3 -Wall -O2") | ||
ENDIF() | ||
ENDIF () | ||
ADD_SUBDIRECTORY(EtcLib) | ||
ADD_SUBDIRECTORY(EtcTool) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
# Contributing | Etc2Comp | ||
|
||
Thank you for contributing to the Etc2Comp community! | ||
|
||
- [Have a usage question?](#question) | ||
- [Think you found a bug?](#issue) | ||
- [Have a feature request?](#feature) | ||
- [Want to submit a pull request?](#submit) | ||
- [Small print](#smallprint) | ||
|
||
## <a name="question"></a> Have a usage question? | ||
|
||
- Review the README.md to make sure you're building the binary correctly. | ||
- Execute the binary with -h to show the usage help. | ||
- Search through [old issues](https://github.com/google/etc2comp/issues) | ||
for an answer to your question. | ||
- If you still haven't found an answer to your question, [open a new issue](https://github.com/google/etc2comp/issues/new). | ||
Please use the provided bug report template and include a minimal repro. | ||
|
||
## <a name="issue"></a> Think you found a bug? | ||
|
||
The library is experimental so that's highly likely. Follow the same | ||
procedure above for questions. If you are up to the challenge, | ||
[submit a Pull Request](#submit) with a fix! | ||
|
||
## <a name="feature"></a> Have a feature request? | ||
|
||
Great! Make sure the feature request isn't already listed in | ||
[existing issues](https://github.com/google/etc2comp/issues), | ||
then go ahead and [open a new issue](https://github.com/google/etc2comp/issues/new). | ||
Remove the default template information and specify what you are requesting | ||
technically, as well as, specifying what use cases it supports. | ||
|
||
## <a name="submit"></a> Want to submit a pull request? | ||
|
||
Sweet, we'd love to accept your contribution! [Open a new pull request](https://github.com/google/etc2comp/compare). | ||
|
||
If you want to implement a new feature, please open an issue with a | ||
proposal first to discuss the change. | ||
|
||
You will need to sign our [Contributor License Agreement](https://cla.developers.google.com/about/google-individual) | ||
before we can accept your pull request. | ||
|
||
## <a name="smallprint"></a> The small print | ||
Contributions made by corporations are covered by a different | ||
agreement than the one above, the | ||
[Software Grant and Corporate Contributor License Agreement] | ||
# Contributing | Etc2Comp | ||
|
||
Thank you for contributing to the Etc2Comp community! | ||
|
||
- [Have a usage question?](#question) | ||
- [Think you found a bug?](#issue) | ||
- [Have a feature request?](#feature) | ||
- [Want to submit a pull request?](#submit) | ||
- [Small print](#smallprint) | ||
|
||
## <a name="question"></a> Have a usage question? | ||
|
||
- Review the README.md to make sure you're building the binary correctly. | ||
- Execute the binary with -h to show the usage help. | ||
- Search through [old issues](https://github.com/google/etc2comp/issues) | ||
for an answer to your question. | ||
- If you still haven't found an answer to your question, [open a new issue](https://github.com/google/etc2comp/issues/new). | ||
Please use the provided bug report template and include a minimal repro. | ||
|
||
## <a name="issue"></a> Think you found a bug? | ||
|
||
The library is experimental so that's highly likely. Follow the same | ||
procedure above for questions. If you are up to the challenge, | ||
[submit a Pull Request](#submit) with a fix! | ||
|
||
## <a name="feature"></a> Have a feature request? | ||
|
||
Great! Make sure the feature request isn't already listed in | ||
[existing issues](https://github.com/google/etc2comp/issues), | ||
then go ahead and [open a new issue](https://github.com/google/etc2comp/issues/new). | ||
Remove the default template information and specify what you are requesting | ||
technically, as well as, specifying what use cases it supports. | ||
|
||
## <a name="submit"></a> Want to submit a pull request? | ||
|
||
Sweet, we'd love to accept your contribution! [Open a new pull request](https://github.com/google/etc2comp/compare). | ||
|
||
If you want to implement a new feature, please open an issue with a | ||
proposal first to discuss the change. | ||
|
||
You will need to sign our [Contributor License Agreement](https://cla.developers.google.com/about/google-individual) | ||
before we can accept your pull request. | ||
|
||
## <a name="smallprint"></a> The small print | ||
Contributions made by corporations are covered by a different | ||
agreement than the one above, the | ||
[Software Grant and Corporate Contributor License Agreement] | ||
(https://cla.developers.google.com/about/google-corporate). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2015 The Etc2Comp Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
project(EtcLib) | ||
include_directories(./Etc) | ||
include_directories(./EtcCodec) | ||
|
||
file(GLOB SOURCES | ||
${PROJECT_SOURCE_DIR}/Etc/*.h | ||
${PROJECT_SOURCE_DIR}/EtcCodec/*.h | ||
${PROJECT_SOURCE_DIR}/Etc/*.cpp | ||
${PROJECT_SOURCE_DIR}/EtcCodec/*.cpp) | ||
ADD_LIBRARY(EtcLib ${SOURCES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2015 The Etc2Comp Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "EtcConfig.h" | ||
#include "Etc.h" | ||
|
||
#include <string.h> | ||
|
||
namespace Etc | ||
{ | ||
// ---------------------------------------------------------------------------------------------------- | ||
// C-style inteface to the encoder | ||
// | ||
void Encode(float *a_pafSourceRGBA, | ||
unsigned int a_uiSourceWidth, | ||
unsigned int a_uiSourceHeight, | ||
Image::Format a_format, | ||
ErrorMetric a_eErrMetric, | ||
float a_fEffort, | ||
unsigned int a_uiJobs, | ||
unsigned int a_uiMaxJobs, | ||
unsigned char **a_ppaucEncodingBits, | ||
unsigned int *a_puiEncodingBitsBytes, | ||
unsigned int *a_puiExtendedWidth, | ||
unsigned int *a_puiExtendedHeight, | ||
int *a_piEncodingTime_ms, bool a_bVerboseOutput) | ||
{ | ||
|
||
Image image(a_pafSourceRGBA, a_uiSourceWidth, | ||
a_uiSourceHeight, | ||
a_eErrMetric); | ||
image.m_bVerboseOutput = a_bVerboseOutput; | ||
image.Encode(a_format, a_eErrMetric, a_fEffort, a_uiJobs, a_uiMaxJobs); | ||
|
||
*a_ppaucEncodingBits = image.GetEncodingBits(); | ||
*a_puiEncodingBitsBytes = image.GetEncodingBitsBytes(); | ||
*a_puiExtendedWidth = image.GetExtendedWidth(); | ||
*a_puiExtendedHeight = image.GetExtendedHeight(); | ||
*a_piEncodingTime_ms = image.GetEncodingTimeMs(); | ||
} | ||
|
||
// ---------------------------------------------------------------------------------------------------- | ||
// | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2015 The Etc2Comp Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "EtcConfig.h" | ||
#include "EtcImage.h" | ||
#include "EtcColor.h" | ||
#include "EtcErrorMetric.h" | ||
|
||
namespace Etc | ||
{ | ||
class Block4x4EncodingBits; | ||
|
||
// C-style inteface to the encoder | ||
void Encode(float *a_pafSourceRGBA, | ||
unsigned int a_uiSourceWidth, | ||
unsigned int a_uiSourceHeight, | ||
Image::Format a_format, | ||
ErrorMetric a_eErrMetric, | ||
float a_fEffort, | ||
unsigned int a_uiJobs, | ||
unsigned int a_uimaxJobs, | ||
unsigned char **a_ppaucEncodingBits, | ||
unsigned int *a_puiEncodingBitsBytes, | ||
unsigned int *a_puiExtendedWidth, | ||
unsigned int *a_puiExtendedHeight, | ||
int *a_piEncodingTime_ms, bool a_bVerboseOutput = false); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2015 The Etc2Comp Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <math.h> | ||
|
||
namespace Etc | ||
{ | ||
|
||
inline float LogToLinear(float a_fLog) | ||
{ | ||
static const float ALPHA = 0.055f; | ||
static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; | ||
|
||
if (a_fLog <= 0.04045f) | ||
{ | ||
return a_fLog / 12.92f; | ||
} | ||
else | ||
{ | ||
return powf((a_fLog + ALPHA) / ONE_PLUS_ALPHA, 2.4f); | ||
} | ||
} | ||
|
||
inline float LinearToLog(float &a_fLinear) | ||
{ | ||
static const float ALPHA = 0.055f; | ||
static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; | ||
|
||
if (a_fLinear <= 0.0031308f) | ||
{ | ||
return 12.92f * a_fLinear; | ||
} | ||
else | ||
{ | ||
return ONE_PLUS_ALPHA * powf(a_fLinear, (1.0f/2.4f)) - ALPHA; | ||
} | ||
} | ||
|
||
class ColorR8G8B8A8 | ||
{ | ||
public: | ||
|
||
unsigned char ucR; | ||
unsigned char ucG; | ||
unsigned char ucB; | ||
unsigned char ucA; | ||
|
||
}; | ||
} |
Oops, something went wrong.