Port of FLIF (Free Lossless Image Format) library
http://flif.info/ _ ____ _(_)____ (___ | | | ___) (__ | |_| __) (_|___|_) Ref #97
This commit is contained in:
committed by
Norman Feske
parent
80fca9e122
commit
dc26a48a63
1
lib/import/import-libflif.mk
Normal file
1
lib/import/import-libflif.mk
Normal file
@@ -0,0 +1 @@
|
||||
INC_DIR += $(call select_from_ports,flif)/include/flif
|
||||
40
lib/mk/libflif.mk
Normal file
40
lib/mk/libflif.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
SHARED_LIB = yes
|
||||
|
||||
LIBS += stdcxx libpng zlib
|
||||
|
||||
CC_OPT += \
|
||||
-std=gnu++11 \
|
||||
-DLODEPNG_NO_COMPILE_PNG -DLODEPNG_NO_COMPILE_DISK \
|
||||
-DNDEBUG -ftree-vectorize \
|
||||
-DINT16_MAX=0x7fff \
|
||||
-D__GENODE__ \
|
||||
|
||||
FLIF_SRC_DIR = $(call select_from_ports,flif)/src/lib/flif
|
||||
|
||||
SRC_CC = \
|
||||
flif-interface.cpp \
|
||||
chance.cpp \
|
||||
symbol.cpp \
|
||||
crc32k.cpp \
|
||||
image.cpp \
|
||||
image-png.cpp \
|
||||
image-pnm.cpp \
|
||||
image-pam.cpp \
|
||||
image-rggb.cpp \
|
||||
image-metadata.cpp \
|
||||
color_range.cpp \
|
||||
factory.cpp \
|
||||
common.cpp \
|
||||
flif-enc.cpp \
|
||||
flif-dec.cpp \
|
||||
lodepng.cpp \
|
||||
io.cpp \
|
||||
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/src
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/src/image
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/src/library
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/src/maniac
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/src/transform
|
||||
vpath %.cpp $(FLIF_SRC_DIR)/extern
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
81
lib/symbols/libflif
Normal file
81
lib/symbols/libflif
Normal file
@@ -0,0 +1,81 @@
|
||||
flif_abort_decoder T
|
||||
flif_create_decoder T
|
||||
flif_create_encoder T
|
||||
flif_create_image_GRAY16 T
|
||||
flif_create_image_GRAY T
|
||||
flif_create_image_HDR T
|
||||
flif_create_image_PALETTE T
|
||||
flif_create_image_RGB T
|
||||
flif_create_image T
|
||||
flif_decoder_decode_filepointer T
|
||||
flif_decoder_decode_file T
|
||||
flif_decoder_decode_memory T
|
||||
flif_decoder_generate_preview T
|
||||
flif_decoder_get_image T
|
||||
flif_decoder_num_images T
|
||||
flif_decoder_num_loops T
|
||||
flif_decoder_set_callback T
|
||||
flif_decoder_set_crc_check T
|
||||
flif_decoder_set_first_callback_quality T
|
||||
flif_decoder_set_fit T
|
||||
flif_decoder_set_quality T
|
||||
flif_decoder_set_resize T
|
||||
flif_decoder_set_scale T
|
||||
flif_destroy_decoder T
|
||||
flif_destroy_encoder T
|
||||
flif_destroy_image T
|
||||
flif_destroy_info T
|
||||
flif_encoder_add_image_move T
|
||||
flif_encoder_add_image T
|
||||
flif_encoder_encode_file T
|
||||
flif_encoder_encode_memory T
|
||||
flif_encoder_set_alpha_zero_lossless T
|
||||
flif_encoder_set_auto_color_buckets T
|
||||
flif_encoder_set_chance_alpha T
|
||||
flif_encoder_set_chance_cutoff T
|
||||
flif_encoder_set_channel_compact T
|
||||
flif_encoder_set_crc_check T
|
||||
flif_encoder_set_divisor T
|
||||
flif_encoder_set_frame_shape T
|
||||
flif_encoder_set_interlaced T
|
||||
flif_encoder_set_learn_repeat T
|
||||
flif_encoder_set_lookback T
|
||||
flif_encoder_set_lossy T
|
||||
flif_encoder_set_min_size T
|
||||
flif_encoder_set_palette_size T
|
||||
flif_encoder_set_split_threshold T
|
||||
flif_encoder_set_ycocg T
|
||||
flif_free_memory T
|
||||
flif_image_free_metadata T
|
||||
flif_image_get_depth T
|
||||
flif_image_get_frame_delay T
|
||||
flif_image_get_height T
|
||||
flif_image_get_metadata T
|
||||
flif_image_get_nb_channels T
|
||||
flif_image_get_palette_size T
|
||||
flif_image_get_palette T
|
||||
flif_image_get_width T
|
||||
flif_image_read_row_GRAY16 T
|
||||
flif_image_read_row_GRAY8 T
|
||||
flif_image_read_row_PALETTE8 T
|
||||
flif_image_read_row_RGBA16 T
|
||||
flif_image_read_row_RGBA8 T
|
||||
flif_image_set_frame_delay T
|
||||
flif_image_set_metadata T
|
||||
flif_image_set_palette T
|
||||
flif_image_write_row_GRAY16 T
|
||||
flif_image_write_row_GRAY8 T
|
||||
flif_image_write_row_PALETTE8 T
|
||||
flif_image_write_row_RGBA16 T
|
||||
flif_image_write_row_RGBA8 T
|
||||
flif_import_image_GRAY16 T
|
||||
flif_import_image_GRAY T
|
||||
flif_import_image_PALETTE T
|
||||
flif_import_image_RGBA T
|
||||
flif_import_image_RGB T
|
||||
flif_info_get_depth T
|
||||
flif_info_get_height T
|
||||
flif_info_get_nb_channels T
|
||||
flif_info_get_width T
|
||||
flif_info_num_images T
|
||||
flif_read_info_from_memory T
|
||||
1
ports/flif.hash
Normal file
1
ports/flif.hash
Normal file
@@ -0,0 +1 @@
|
||||
1143105e4986bbac4461138e4cab81c8b531c7d2
|
||||
14
ports/flif.port
Normal file
14
ports/flif.port
Normal file
@@ -0,0 +1,14 @@
|
||||
LICENSE := LGPLv3
|
||||
VERSION := 0.3
|
||||
DOWNLOADS := flif.archive
|
||||
|
||||
URL(flif) := https://github.com/FLIF-hub/FLIF/archive/v$(VERSION).tar.gz
|
||||
SHA(flif) := 10918ea2695fdc97ad70d2e4cde021fcaa22838c
|
||||
DIR(flif) := src/lib/flif
|
||||
|
||||
DIRS := include/flif
|
||||
|
||||
DIR_CONTENT(include/flif) := src/lib/flif/src/library/*.h
|
||||
|
||||
PATCHES := src/lib/flif/getc.patch
|
||||
PATCH_OPT := -p1 -d src/lib/flif
|
||||
13
recipes/api/libflif/content.mk
Normal file
13
recipes/api/libflif/content.mk
Normal file
@@ -0,0 +1,13 @@
|
||||
content: include lib/symbols/libflif LICENSE
|
||||
|
||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/flif)
|
||||
|
||||
include:
|
||||
mkdir $@
|
||||
cp -r $(PORT_DIR)/include/flif/* $@/
|
||||
|
||||
lib/symbols/libflif:
|
||||
$(mirror_from_rep_dir)
|
||||
|
||||
LICENSE:
|
||||
cp $(PORT_DIR)/src/lib/flif/LICENSE $@
|
||||
1
recipes/api/libflif/hash
Normal file
1
recipes/api/libflif/hash
Normal file
@@ -0,0 +1 @@
|
||||
2018-01-08 e29fbd904d0be604a4dc106496d008ddaf22ef21
|
||||
1
recipes/src/libflif/api
Normal file
1
recipes/src/libflif/api
Normal file
@@ -0,0 +1 @@
|
||||
libflif
|
||||
15
recipes/src/libflif/content.mk
Normal file
15
recipes/src/libflif/content.mk
Normal file
@@ -0,0 +1,15 @@
|
||||
content: src/lib/flif lib/mk/libflif.mk LICENSE
|
||||
|
||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/flif)
|
||||
|
||||
src/lib/flif:
|
||||
$(mirror_from_rep_dir)
|
||||
cp -r $(PORT_DIR)/src/lib/flif/* $@
|
||||
echo "LIBS = libflif" > $@/target.mk
|
||||
|
||||
lib/mk/libflif.mk:
|
||||
$(mirror_from_rep_dir)
|
||||
|
||||
LICENSE:
|
||||
cp $(PORT_DIR)/src/lib/flif/LICENSE $@
|
||||
|
||||
1
recipes/src/libflif/hash
Normal file
1
recipes/src/libflif/hash
Normal file
@@ -0,0 +1 @@
|
||||
2018-01-18 27afe64571626a3dd503fa285bddb48142b1e4d4
|
||||
5
recipes/src/libflif/used_apis
Normal file
5
recipes/src/libflif/used_apis
Normal file
@@ -0,0 +1,5 @@
|
||||
libc
|
||||
libpng
|
||||
so
|
||||
stdcxx
|
||||
zlib
|
||||
88
src/lib/flif/getc.patch
Normal file
88
src/lib/flif/getc.patch
Normal file
@@ -0,0 +1,88 @@
|
||||
diff --git a/src/fileio.hpp b/src/fileio.hpp
|
||||
index 6e38b3b..3ac2975 100644
|
||||
--- a/src/fileio.hpp
|
||||
+++ b/src/fileio.hpp
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
long ftell() {
|
||||
return ::ftell(file);
|
||||
}
|
||||
- int getc() {
|
||||
+ int get_c() {
|
||||
return fgetc(file);
|
||||
}
|
||||
char * gets(char *buf, int n) {
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
long ftell() const {
|
||||
return seek_pos;
|
||||
}
|
||||
- int getc() {
|
||||
+ int get_c() {
|
||||
if(seek_pos >= data_array_size)
|
||||
return EOS;
|
||||
return data[seek_pos++];
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
int ftell() const {
|
||||
return seek_pos;
|
||||
}
|
||||
- int getc() {
|
||||
+ int get_c() {
|
||||
if(seek_pos >= bytes_used)
|
||||
return EOS;
|
||||
return data[seek_pos++];
|
||||
diff --git a/src/flif-dec.cpp b/src/flif-dec.cpp
|
||||
index 1439701..de68509 100644
|
||||
--- a/src/flif-dec.cpp
|
||||
+++ b/src/flif-dec.cpp
|
||||
@@ -925,7 +925,7 @@ size_t read_big_endian_varint(IO& io) {
|
||||
size_t result = 0;
|
||||
int bytes_read = 0;
|
||||
while (bytes_read++ < 10) {
|
||||
- int number = io.getc();
|
||||
+ int number = io.get_c();
|
||||
if (number < 0) break;
|
||||
if (number < 128) return result+number;
|
||||
number -= 128;
|
||||
@@ -938,7 +938,7 @@ size_t read_big_endian_varint(IO& io) {
|
||||
|
||||
template <typename IO>
|
||||
int read_chunk(IO& io, MetaData& metadata) {
|
||||
- metadata.name[0] = io.getc();
|
||||
+ metadata.name[0] = io.get_c();
|
||||
// printf("chunk: %s\n", metadata.name);
|
||||
if (metadata.name[0] < 32) {
|
||||
if (metadata.name[0] > 0) {
|
||||
@@ -958,7 +958,7 @@ int read_chunk(IO& io, MetaData& metadata) {
|
||||
// printf("chunk length: %lu\n", metadata.length);
|
||||
metadata.contents.resize(metadata.length);
|
||||
for(size_t i = 0; i < metadata.length; i++) {
|
||||
- metadata.contents[i] = io.getc();
|
||||
+ metadata.contents[i] = io.get_c();
|
||||
}
|
||||
return 0; // read next chunk
|
||||
}
|
||||
diff --git a/src/io.hpp b/src/io.hpp
|
||||
index a356011..811f16e 100644
|
||||
--- a/src/io.hpp
|
||||
+++ b/src/io.hpp
|
||||
@@ -29,7 +29,7 @@ int get_verbosity();
|
||||
template<class IO>
|
||||
bool ioget_int_8bit (IO& io, int* result)
|
||||
{
|
||||
- int c = io.getc();
|
||||
+ int c = io.get_c();
|
||||
if (c == io.EOS) {
|
||||
e_printf ("Unexpected EOS");
|
||||
return false;
|
||||
diff --git a/src/maniac/rac.hpp b/src/maniac/rac.hpp
|
||||
index ca4e8fa..3bdc1e6 100644
|
||||
--- a/src/maniac/rac.hpp
|
||||
+++ b/src/maniac/rac.hpp
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
rac_t low;
|
||||
private:
|
||||
rac_t read_catch_eof() {
|
||||
- rac_t c = io.getc();
|
||||
+ rac_t c = io.get_c();
|
||||
// no reason to branch here to catch end-of-stream, just return garbage (0xFF I guess) if a premature EOS happens
|
||||
//if(c == io.EOS) return 0;
|
||||
return c;
|
||||
Reference in New Issue
Block a user