GithubHelp home page GithubHelp logo

cfeck / imagezero Goto Github PK

View Code? Open in Web Editor NEW
51.0 4.0 23.0 171 KB

Fast Lossless Color Image Compression Library

License: BSD 2-Clause "Simplified" License

CMake 1.17% C++ 85.76% Makefile 3.47% Shell 0.94% C 6.95% QMake 1.70%
compress-images image-compression compression image-processing image-decoder image-encoder c-plus-plus bsd-license template-library

imagezero's People

Contributors

cfeck avatar tony2001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

imagezero's Issues

Kindly Show The Implementation

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

Trying to understand context coding

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!

Support macOS

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.