Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@
path = project/lib/hashlink
url = https://github.com/HaxeFoundation/hashlink
shallow = true
[submodule "project/lib/webp"]
path = project/lib/webp
url = https://github.com/webmproject/libwebp
shallow = true
4 changes: 4 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ This product bundles pixman 0.32.8, which is available under an
This product bundles libpng 1.6.12, which is available under a
"zlib" (BSD-style) license. For details, see [project/lib/png/](project/lib).

This product bundles libwebp 1.6.0, which is available under a
BSD-3-Clause license. For details, see [project/lib/webp/](project/lib).

This product bundles SDL 2.0.12, which is available under a
"zlib" (BSD-style) license. For details, see [project/lib/sdl/](project/lib).

Expand All @@ -58,6 +61,7 @@ This product bundles libvorbis 1.3.3, which is available under a
This product bundles zlib 1.2.8, which is available under a
"zlib" (BSD-style) license. For details, see [project/lib/zlib/](project/lib).


-------

Modifications and source-repository versions of Haxe core files are included in the
Expand Down
10 changes: 10 additions & 0 deletions project/Build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<set name="LIME_OPENGL" value="1" />
<set name="LIME_PIXMAN" value="1" />
<set name="LIME_PNG" value="1" />
<set name="LIME_WEBP" value="1" />
<set name="LIME_SDL" value="1" />
<!-- <set name="LIME_SDL_ANGLE" value="1" if="windows" unless="static_link" /> -->
<set name="LIME_SDL_ANGLE" value="1" if="windows LIME_SDL_ANGLE" unless="static_link" />
Expand Down Expand Up @@ -214,6 +215,13 @@

</section>

<section if="LIME_WEBP">
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/webp/src" />
<compilerflag value="-DLIME_WEBP" />

<file name="src/graphics/format/WEBP.cpp" />
</section>

<section if="LIME_SDL">

<section if="emscripten">
Expand Down Expand Up @@ -364,6 +372,7 @@
<include name="lib/openal-files.xml" />
<include name="lib/pixman-files.xml" />
<include name="lib/png-files.xml" />
<include name="lib/webp-files.xml" />
<include name="lib/sdl-files.xml" />
<include name="lib/tinyfiledialogs-files.xml" />
<include name="lib/vorbis-files.xml" />
Expand Down Expand Up @@ -397,6 +406,7 @@
<files id="native-toolkit-openal" if="LIME_OPENALSOFT" />
<files id="native-toolkit-pixman" if="LIME_PIXMAN" />
<files id="native-toolkit-png" if="LIME_PNG" />
<files id="native-toolkit-webp" if="LIME_WEBP" />
<files id="native-toolkit-sdl" if="LIME_SDL" unless="emscripten" />
<files id="native-toolkit-tinyfiledialogs" if="LIME_TINYFILEDIALOGS" />
<files id="native-toolkit-vorbis" if="LIME_VORBIS" />
Expand Down
19 changes: 19 additions & 0 deletions project/include/graphics/format/WEBP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef LIME_GRAPHICS_FORMAT_WEBP_H
#define LIME_GRAPHICS_FORMAT_WEBP_H

#include <graphics/ImageBuffer.h>
#include <utils/Bytes.h>
#include <utils/Resource.h>

namespace lime {

class WEBP {

public:
static bool Decode (Resource *resource, ImageBuffer *imageBuffer, bool decodeData = true);
static bool Encode (ImageBuffer *imageBuffer, Bytes *bytes, int quality);
};

}

#endif
1 change: 1 addition & 0 deletions project/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Lime includes code from several other C/C++ libraries, listed below. Lime prefer
- [**OpenAL Soft**](https://openal-soft.org/) | [primary repo](https://github.com/kcat/openal-soft)
- [**Pixman**](http://pixman.org/) | [primary repo](https://gitlab.freedesktop.org/pixman/pixman) | [GitHub mirror](https://github.com/freedesktop/pixman)
- [**libpng**](http://www.libpng.org/pub/png/libpng.html) | [primary repo](https://sourceforge.net/p/libpng/code) | [GitHub mirror](https://github.com/glennrp/libpng)[^1]
- [**libwebp**](https://developers.google.com/speed/webp) | [primary repo](https://chromium.googlesource.com/webm/libwebp) | [GitHub mirror](https://github.com/webmproject/libwebp)
- [**SDL**](https://www.libsdl.org/) | [primary repo](https://github.com/libsdl-org/SDL)
- [**tiny file dialogs**](https://sourceforge.net/projects/tinyfiledialogs/) | [primary repo](https://sourceforge.net/p/tinyfiledialogs/code) | [unofficial GitHub mirror](https://github.com/openfl/libtinyfiledialogs)[^1]
- [**Vorbis**](https://www.xiph.org/vorbis/) | [primary repo](https://github.com/xiph/vorbis)
Expand Down
1 change: 1 addition & 0 deletions project/lib/webp
Submodule webp added at 4fa219
148 changes: 148 additions & 0 deletions project/lib/webp-files.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<xml>

<files id="native-toolkit-webp">

<section>
<!-- include paths -->
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/webp" />
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/webp/src" />
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/webp/sharpyuv" />

<!-- decoder -->
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/alpha_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/buffer_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/frame_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/idec_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/io_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/quant_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/tree_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/vp8_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/vp8l_dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dec/webp_dec.c" />

<!-- encoder -->
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/alpha_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/analysis_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/backward_references_cost_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/backward_references_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/config_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/cost_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/filter_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/frame_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/histogram_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/iterator_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/near_lossless_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/picture_csp_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/picture_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/picture_psnr_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/picture_rescale_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/picture_tools_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/predictor_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/quant_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/syntax_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/token_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/tree_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/vp8l_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/enc/webp_enc.c" />

<!-- dsp scalar -->
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/alpha_processing.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/cost.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/cpu.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/dec.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/dec_clip_tables.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/filters.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_enc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/rescaler.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/ssim.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/upsampling.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/yuv.c" />

<!-- utils -->
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/bit_reader_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/bit_writer_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/color_cache_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/filters_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/huffman_encode_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/huffman_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/palette.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/quant_levels_dec_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/quant_levels_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/random_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/rescaler_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/thread_utils.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/utils/utils.c" />

<!-- SharpyUV base -->
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_cpu.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_csp.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_dsp.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_gamma.c" />
</section>


<section if="HXCPP_M32 || HXCPP_M64" unless="HXCPP_ARM64 || HXCPP_ARMV7">
<compilerflag value="-msse2" if="GCC || CLANG" />
<compilerflag value="/arch:SSE2" if="MSVC HXCPP_M32" />

<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/alpha_processing_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/cost_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/dec_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/enc_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/filters_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_enc_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/rescaler_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/ssim_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/upsampling_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/yuv_sse2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_sse2.c" />
</section>


<section if="HXCPP_M32 || HXCPP_M64" unless="HXCPP_ARM64 || HXCPP_ARMV7">
<compilerflag value="-msse4.1" if="GCC || CLANG" />

<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/alpha_processing_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/dec_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/enc_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_enc_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/upsampling_sse41.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/yuv_sse41.c" />
</section>


<!-- Enable AVX2 on x86 32-bit *only because* we can’t cleanly disable it (webp/src/dsp/cpu.h redefines WEBP_HAVE_AVX2);
without these TUs we hit LNK2019. Runtime CPUID guards execution on non-AVX2 CPUs. -->
<section if="HXCPP_M32 || HXCPP_M64" unless="HXCPP_ARM64 || HXCPP_ARMV7">
<compilerflag value="-mavx" if="GCC || CLANG" />
<compilerflag value="-mavx2" if="GCC || CLANG" />
<compilerflag value="/arch:AVX2" if="MSVC" />

<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_avx2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_enc_avx2.c" />
</section>


<section if="HXCPP_ARM64 || HXCPP_ARMV7">
<compilerflag value="-mfpu=neon" if="android HXCPP_ARMV7" />

<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/alpha_processing_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/dec_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/enc_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/filters_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/lossless_enc_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/rescaler_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/cost_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/upsampling_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/src/dsp/yuv_neon.c" />
<file name="${NATIVE_TOOLKIT_PATH}/webp/sharpyuv/sharpyuv_neon.c" />
</section>

</files>
</xml>
Loading