cfeck / imagezero Goto Github PK
View Code? Open in Web Editor NEWFast Lossless Color Image Compression Library
License: BSD 2-Clause "Simplified" License
Fast Lossless Color Image Compression Library
License: BSD 2-Clause "Simplified" License
Please Show Me The Implementation
I want to use this in my own code
How Can I Use This
Kindly Show The Implementation of this project because it is show hard to understand file directory
Anyway The Code and complexity acc. to me is much much good than other
appreciate your hardwork
it would be beneficial if you show us Implementation
Hi Christoph, I was trying to understand how IZ does its magic and stumbled upon the code in table.cpp
that I found interesting and struggle to understand completely.
I understood that you use CONTEXT_BITS = 4
to store the integer values 0..8 (so CONTEXT_COUNT = 9
) that encode how many bits are used to code each color channel of a given pixel.
But what I struggle to understand is the meaning of MAX_CODE_LENGTH = 6
, and how are the entries of staticdCount
are chosen and then used to calculate the entries of staticdBits
(for encoding) and decodeTable
(for decoding). I figured out that you code the current context depending on the last one, but why and how exactly is this done?
Is this a standard approach that I am not aware of? Or have you explained the idea somewhere else?
Any further information is appreciated!
Hi,
macOS compilation error has been fixed.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a88fc42..8ddb9e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,12 @@ set(iz_SRCS
add_definitions(-DHAVE_MMAP)
-set(CMAKE_EXE_LINKER_FLAGS "-Wl,-O1,-s,--no-export-dynamic")
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-O1,-s,--no-export-dynamic")
+else()
+ set(CMAKE_EXE_LINKER_FLAGS "")
+endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mmmx -mtune=atom -Winline -W -Wall -fomit-frame-pointer -fno-rtti -fno-exceptions")
add_executable(iz ${iz_SRCS})
diff --git a/file.cpp b/file.cpp
index 53a295a..cfdb3a0 100644
--- a/file.cpp
+++ b/file.cpp
@@ -14,6 +14,16 @@
#include <sys/mman.h>
#include <sys/stat.h>
+#if (defined(__APPLE__) && defined(__MACH__))
+# if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+# define __PLATFORM_IOS__
+# else
+# define __PLATFORM_MACOS__
+# endif
+#elif defined(macintosh) || defined(Macintosh)
+# define __PLATFORM_MACOS__
+#endif
+
class InputFile::Private
{
public:
@@ -31,7 +41,11 @@ InputFile::InputFile(const char *filename)
struct stat sb;
fstat(fd, &sb);
d->size = sb.st_size;
+#if defined(__PLATFORM_MACOS__)
+ d->addr = mmap(0, d->size, PROT_READ, MAP_PRIVATE, fd, 0);
+#else
d->addr = mmap(0, d->size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, 0);
+#endif
if (d->addr == MAP_FAILED) {
d->addr = mmap(0, d->size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (d->addr != MAP_FAILED) {
what do you think?
P.S. Please understand that I am not good at English.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.