forked from baAlex/Ako
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
19 changed files
with
6,931 additions
and
0 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,19 @@ | ||
|
||
ColumnLimit: 120 | ||
|
||
UseTab: ForIndentation | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
|
||
BreakBeforeBraces: Allman | ||
AlignAfterOpenBracket: Align | ||
|
||
MaxEmptyLinesToKeep: 2 | ||
|
||
PointerAlignment: Left | ||
SortIncludes: true | ||
|
||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLoopsOnASingleLine: 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,15 @@ | ||
/akoenc | ||
/akodec | ||
|
||
/*.a | ||
/*.so | ||
|
||
/.ninja_log | ||
/.ninja_deps | ||
|
||
/build/ | ||
/build-debug/ | ||
/build-release/ | ||
/objects/ | ||
/dev/ | ||
/.vscode/ |
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,25 @@ | ||
Code of Conduct | ||
=============== | ||
|
||
We are Human. | ||
To be Human is to be limited. | ||
In our limitation, we make choices that are unwise or are flawed. | ||
|
||
If we make unwise choices because of our limitation, | ||
we cannot judge others for the same reason. | ||
|
||
So, we cannot judge, | ||
thus we forgive. | ||
|
||
This project and its results are intended as: | ||
a place of learning, | ||
a place of understanding, | ||
a place of teaching, | ||
a place of sharing, | ||
a place of creators creating the tools for other creators to create complicated things elegantly. | ||
|
||
Be well, Creator. Be well and create. | ||
|
||
--- | ||
|
||
Based on the [Creator's Code v0](https://github.com/Xe/creators-code). Please read the link for more information. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Alexander Brandt | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
LZ4 Library | ||
Copyright (c) 2011-2016, Yann Collet | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this | ||
list of conditions and the following disclaimer in the documentation and/or | ||
other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,70 @@ | ||
|
||
|
||
# Release flags: | ||
cflags = -flto -O3 -Wall -Wextra -pedantic -Wconversion -fvisibility=hidden -DAKO_EXPORT_SYMBOLS -DLZ4LIB_VISIBILITY="" -fdiagnostics-color=always -I./include | ||
lflags = -fdiagnostics-color=always | ||
|
||
# Debug flags: | ||
# cflags = -g -O0 -std=c11 -Wall -Wextra -pedantic -Wconversion -fdiagnostics-color=always -I./include | ||
# lflags = -fdiagnostics-color=always | ||
|
||
|
||
### | ||
|
||
rule SharedCompile | ||
command = clang -c -fpic $cflags $in -o $out | ||
rule SharedLink | ||
command = clang -fuse-ld=lld -shared $lflags $in -o $out | ||
|
||
rule StaticCompile | ||
command = clang -c $cflags $in -o $out | ||
rule StaticLink | ||
command = ar rcs $out $in | ||
|
||
rule ToolCompile | ||
command = clang -c $cflags $in -o $out | ||
rule ToolLink | ||
command = clang -fuse-ld=lld -lpng -lm $lflags $in -o $out | ||
|
||
### | ||
|
||
build ./objects/shared/lz4.o: SharedCompile ./source/thirdparty/lz4.c | ||
build ./objects/shared/lz4hc.o: SharedCompile ./source/thirdparty/lz4hc.c | ||
build ./objects/shared/ako-decode.o: SharedCompile ./source/ako-decode.c | ||
build ./objects/shared/ako-encode.o: SharedCompile ./source/ako-encode.c | ||
build ./objects/shared/ako-devthings.o: SharedCompile ./source/ako-devthings.c | ||
|
||
build libako.so: SharedLink $ | ||
./objects/shared/lz4.o $ | ||
./objects/shared/lz4hc.o $ | ||
./objects/shared/ako-decode.o $ | ||
./objects/shared/ako-encode.o $ | ||
./objects/shared/ako-devthings.o | ||
|
||
### | ||
|
||
build ./objects/static/lz4.o: StaticCompile ./source/thirdparty/lz4.c | ||
build ./objects/static/lz4hc.o: StaticCompile ./source/thirdparty/lz4hc.c | ||
build ./objects/static/ako-decode.o: StaticCompile ./source/ako-decode.c | ||
build ./objects/static/ako-encode.o: StaticCompile ./source/ako-encode.c | ||
build ./objects/static/ako-devthings.o: StaticCompile ./source/ako-devthings.c | ||
|
||
build libako.a: StaticLink $ | ||
./objects/static/lz4.o $ | ||
./objects/static/lz4hc.o $ | ||
./objects/static/ako-decode.o $ | ||
./objects/static/ako-encode.o $ | ||
./objects/static/ako-devthings.o | ||
|
||
### | ||
|
||
build ./objects/tools/akoenc.o: ToolCompile ./tools/akoenc.c | ||
build ./objects/tools/akodec.o: ToolCompile ./tools/akodec.c | ||
|
||
build akoenc: ToolLink $ | ||
./objects/tools/akoenc.o $ | ||
./libako.a | ||
|
||
build akodec: ToolLink $ | ||
./objects/tools/akodec.o $ | ||
./libako.a |
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,62 @@ | ||
/*----------------------------- | ||
[ako.h] | ||
- Alexander Brandt 2021 | ||
-----------------------------*/ | ||
|
||
#ifndef AKO_H | ||
#define AKO_H | ||
|
||
#ifdef AKO_EXPORT_SYMBOLS | ||
#if defined(__clang__) || defined(__GNUC__) | ||
#define AKO_EXPORT __attribute__((visibility("default"))) | ||
#elif defined(_MSC_VER) | ||
#define AKO_EXPORT __declspec(dllexport) | ||
#endif | ||
#else | ||
#define AKO_EXPORT // Whitespace | ||
#endif | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
|
||
#define AKO_VER_MAJOR 0 // Library version | ||
#define AKO_VER_MINOR 1 // Ditto | ||
#define AKO_FORMAT 1 // Format version this library handles | ||
|
||
|
||
struct AkoSettings | ||
{ | ||
float uniform_gate[4]; | ||
float detail_gate[4]; // Applied on high frequencies | ||
}; | ||
|
||
struct AkoHead | ||
{ | ||
char magic[5]; | ||
|
||
uint8_t major; | ||
uint8_t minor; | ||
uint8_t format; | ||
|
||
uint32_t compressed_size; | ||
uint32_t info; // Bits 0-4 = Dimension, Bits 5-6 = Channels | ||
}; | ||
|
||
|
||
AKO_EXPORT size_t AkoEncode(size_t dimension, size_t channels, const struct AkoSettings*, const uint8_t* input, | ||
uint8_t** output); | ||
AKO_EXPORT uint8_t* AkoDecode(size_t input_size, const uint8_t* input, size_t* out_dimension, size_t* out_channels); | ||
|
||
|
||
// ######## Static-library only ######## | ||
|
||
#define AKO_COMPRESSION 1 // 0 = None, 1 = LZ4 | ||
#define AKO_COLOR_TRANSFORMATION 1 // 0 = None, 1 = YCoCg | ||
#define AKO_WAVELET_TRANSFORMATION 1 // 0,1 = Activate/desactivate | ||
|
||
#define AKO_DEV_TINY_BENCHMARK 1 | ||
#define AKO_DEV_SAVE_IMAGES 0 | ||
|
||
#endif |
Oops, something went wrong.