Skip to content

Commit

Permalink
Merge pull request #2 from FLIF-hub/master
Browse files Browse the repository at this point in the history
Update from FLIF-Hub
  • Loading branch information
psykauze committed Nov 21, 2015
2 parents 2fae52d + fa98632 commit cb1caa2
Show file tree
Hide file tree
Showing 81 changed files with 3,569 additions and 2,336 deletions.
18 changes: 7 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ compiler:

sudo: true


before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-add-repository --yes ppa:zoogie/sdl2-snapshots
- sudo apt-get update -qq
- sudo apt-get install g++-4.8 libpng12-dev imagemagick


- sudo apt-get install g++-4.8 libpng12-dev imagemagick libsdl2-dev

env:
matrix:
- BUILDTYPE=CMAKE
- BUILDTYPE=GNUMAKE
- BUILDTYPE=ASAN
- BUILDTYPE=SHARED

script:
- if [[ "$BUILDTYPE" == "ASAN" ]] && [[ "$CXX" == "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8"; cmake -DUSE_ASAN=ON . ; make ; fi
- cd src
- if [[ "$CXX" == "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
- if [[ "$BUILDTYPE" == "CMAKE" ]]; then cmake . ; make ; fi
- if [[ "$BUILDTYPE" == "GNUMAKE" ]]; then make ; make test ; fi
- if [[ "$BUILDTYPE" == "SHARED" ]] ; then cmake -DSHARED=ON .; make ; fi
- if [[ "$BUILDTYPE" == "GNUMAKE" ]]; then make && make test ; fi
- if [[ "$BUILDTYPE" == "ASAN" ]]; then cmake -DUSE_ASAN=ON . && make ; fi
- if [[ "$BUILDTYPE" == "CMAKE" ]]; then cmake . && make ; fi
- if [[ "$BUILDTYPE" == "SHARED" ]] ; then cmake -DFLIF_SHARED=ON . && make ; fi
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@

Thanks for you interest in contributing to FLIF!

Do you want to contribute, but you do not know where to start?
Take a look here:
- The open issues in the main FLIF repository: https://github.com/FLIF-hub/FLIF/issues (mostly C++ / C)
- poly-flif is a browser poly-fill for FLIF: https://github.com/UprootLabs/poly-flif (JS / emscripten)
- UGUI: FLIF is a graphical user interface wrapper for the command-line utility: https://github.com/FLIF-hub/UGUI_FLIF (HTML / CSS / JS)
- http://flif.info is the official FLIF website. It is hosted on github, and you're invited to contribute to it! https://github.com/FLIF-hub/FLIF-hub.github.io (Jekyll / HTML / CSS)
- Benchmarks are useful not just to compare FLIF to other formats, but also to evaluate modifications in FLIF itself. Test images and benchmark scripts are collected here: https://github.com/FLIF-hub/benchmarks (Shell scripts / Gnuplot)
- Documentation related to FLIF (including, eventually, the detailed format specification) is here: https://github.com/FLIF-hub/FLIF-doc (LaTeX)

FLIF is currently licensed under the GNU GPL v3+.
However, when the project is more mature, we (Jon Sneyers and Pieter Wuille, the primary authors of FLIF) will want to release it under a more permissive license.
However, when the project is more mature, we (Jon Sneyers and Pieter Wuille, the primary/initial authors of FLIF) will want to release it under a more permissive license.

For this reason, we ask contributors (i.e. authors of a pull request) to agree to the Contributor License Agreement (CLA) you can
find in the file FLIF-CLA-template.txt in this repository. That allows us to relicense FLIF, including your contributions, under a more
Expand All @@ -12,4 +21,4 @@ are the GPL-Compatible Free Software Licenses as listed on this page:
https://gnu.org/licenses/license-list.html#GPLCompatibleLicenses

Please add your signed CLA to http://github.com/jonsneyers/FLIF-CLAs/
(you can find a template in FLIF-CLA-template.txt)
(you can find a template in FLIF-CLA-template.txt)
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/FLIF-hub/FLIF.svg?branch=master)](https://travis-ci.org/FLIF-hub/FLIF)
[![Join the chat at https://gitter.im/jonsneyers/FLIF](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jonsneyers/FLIF?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Donate via Gratipay](https://img.shields.io/gratipay/flif.svg)](https://gratipay.com/flif/)

FLIF is a lossless image format based on MANIAC compression. MANIAC (Meta-Adaptive Near-zero Integer Arithmetic Coding) is a variant of CABAC (context-adaptive binary arithmetic coding), where the contexts are nodes of decision trees which are dynamically learned at encode time.

Expand All @@ -16,24 +16,32 @@ For more information on FLIF, visit http://flif.info

###Build Instructions

**GNU/Linux**

* Install the dependencies:
* for the encoder/decoder: `sudo apt-get install libpng-dev`
* for the viewer: `sudo apt-get install libsdl2-dev`
* Navigate to the FLIF/src directory and run `make` to compile everything, or
* `make flif` to build just the `flif` tool
* `make libflif.so` to build the shared library
* `make viewflif` to build the example viewer (it depends on the library)
* `sudo make install` if you want to install it globally

**Windows**

* Install Visual Studio
([VS Community 2015](https://www.visualstudio.com/en-us/products/free-developer-offers-vs.aspx)
is free for open source projects)
* Click Start > All Programs > Visual Studio > Tools > `Developer Command Prompt`
* In the command prompt, navigate to the FLIF repo and run `make_vs.bat`
* Open the `build\MSVC` folder and Double click the `dl_make_vs.bat`. This will download required libraries and run `nmake` to build `flif.exe`
* `nmake libflif.dll` to build the shared library
* `nmake viewflif.exe` to build the example viewer

**OS X**

* Install [homebrew](http://brew.sh)
* Install kegs named `pkg-config` and `libpng`
* Run `make` in the FLIF directory

**Ubuntu**
* Run `make` in the FLIF/src directory

* Install libpng-dev: `sudo apt-get install libpng-dev`
* Navigate to the FLIF directory and run `make`

* * *

Expand All @@ -45,7 +53,7 @@ These will be available on the Release page

* * *

###Other Projects
###Related Projects

* **[Poly-FLIF](https://uprootlabs.github.io/poly-flif)** - A javascript polyfill that allows you to use FLIF files in the browser.
* **[Poly FLIF](https://github.com/UprootLabs/poly-flif)** - A javascript polyfill that allows you to use FLIF files in the browser. ([Demo](https://uprootlabs.github.io/poly-flif))
* **[UGUI: FLIF](https://github.com/FLIF-hub/UGUI_FLIF/releases)** - A GUI that allows you to convert and view FLIF files.
9 changes: 0 additions & 9 deletions TODO

This file was deleted.

12 changes: 12 additions & 0 deletions build/MSVC/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*/

*.zip
*.dll
*.exe

!getopt/

!include/
include/*
!include/sdl2v140.h

109 changes: 109 additions & 0 deletions build/MSVC/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
lpngdir = lpng1618
zlibdir = zlib-1.2.8
sdl2dir = SDL2-2.0.3

Incdir = include

!ifndef PLATFORM
PLATFORM=x86
!endif

Rt = MD
LibDir = $(PLATFORM)_$(Rt)
SrcDir = ..\..\src

!if "$(Rt)" == "MT" || "$(Rt)" == "MD"
CFLAGS = /nologo /WX /EHsc /GL /Ox /Oy /Gy /DNDEBUG /$(Rt)
LDFLAGS= /nologo /LTCG
!elseif "$(Rt)" == "MTd" || "$(Rt)" == "MDd"
CFLAGS = /nologo /WX /EHsc /Zi /DDEBUG /$(Rt)
LDFLAGS= /nologo /DEBUG
!else
!ERROR Rt=[MT|MD|MTd|MDd]
!endif

OBJDIR = $(LibDir)\Obj
O = $(OBJDIR)\\

OBJ1 = $Oflif-dec.obj $Oflif-enc.obj $Oio.obj $Ocommon.obj $Ocolor_range.obj $Ocrc32k.obj $Obit.obj $Ochance.obj $Ofactory.obj
OBJ2 = $Oimage.obj $Oimage-pam.obj $Oimage-png.obj $Oimage-pnm.obj $Oimage-rggb.obj
LIBOBJS = $(OBJ1)
FLIFOBJS = $(OBJ1) $(OBJ2)

flif.exe: $(OBJDIR) $(LibDir)\zlib.lib $(LibDir)\libpng.lib $(FLIFOBJS)
cl $(CFLAGS) /I$(Incdir) /Igetopt $(SrcDir)\flif.cpp getopt\getopt.c /DSTATIC_GETOPT /Fd$O /Fo$O -c
link /out:$(LibDir)\$@ $Oflif.obj $Ogetopt.obj $(FLIFOBJS) $(LibDir)\zlib.lib $(LibDir)\libpng.lib $(LDFLAGS)
copy "$(LibDir)\$@" $@

libflif.dll: $(OBJDIR) $(LIBOBJS)
cl $(CFLAGS) $(SrcDir)\flif-interface.cpp /DFLIF_BUILD_DLL /Fd$O /Fo$O -c
link /dll /out:"$(LibDir)\$@" $Oflif-interface.obj $(LIBOBJS) $(LDFLAGS)
copy "$(LibDir)\$@" $@

viewflif.exe: libflif.dll
cl $(CFLAGS) /I$(SrcDir)\ /I$(sdl2dir)\include /Tp $(SrcDir)\viewflif.c /FI..\build\MSVC\$(Incdir)\sdl2v140.h /DFLIF_USE_DLL /Fd$O /Fo$O -c
link /out:$(LibDir)\$@ $Oviewer.obj libflif.lib SDL2.lib SDL2main.lib $(LDFLAGS) /SUBSYSTEM:CONSOLE /LIBPATH:$(LibDir) /LIBPATH:$(sdl2dir)\lib\$(PLATFORM)\
copy "$(LibDir)\$@" $@
copy $(sdl2dir)\lib\$(PLATFORM)\SDL2.dll SDL2.dll

test: test-interface.exe
if exist output.flif del output.flif
@echo ./flif.exe ../../tools/kodim01.png output.flif
@powershell "Measure-Command{ ./flif.exe ../../tools/kodim01.png output.flif}"
if exist output.png del output.png
flif output.flif output.png
@if exist "viewflif.exe" viewflif.exe output.flif
@if not exist "testFiles/" mkdir testFiles
if exist "test-interface.exe" test-interface.exe
start output.png

test-interface.exe: libflif.dll
cl $(CFLAGS) /I$(Incdir) /I$(SrcDir)\ ..\..\tools\test.c /DFLIF_USE_DLL /Fd$O /Fo$O -c
link /out:$(LibDir)\$@ $Otest.obj libflif.lib $(LDFLAGS) /LIBPATH:$(LibDir)
copy "$(LibDir)\$@" $@

$(OBJDIR):
@if not exist "$(@)/" mkdir "$(@)"

$(LibDir)\zlib.lib: $(OBJDIR)
cd $(zlibdir)
@nmake -f win32\Makefile.msc clean
nmake -f win32\Makefile.msc zlib.lib CFLAGS="$(CFLAGS) /TC /Fdzlib" ARFLAGS="$(LDFLAGS)"
copy zlib.lib ..\$(LibDir)\\
copy zlib.h ..\$(Incdir)\\
copy zconf.h ..\$(Incdir)\\
cd ..

$(LibDir)\libpng.lib: $(LibDir)\zlib.lib
cd $(lpngdir)
@nmake -f scripts\Makefile.vcwin32 clean
nmake -f scripts\Makefile.vcwin32 libpng.lib CPPFLAGS="/I..\$(Incdir) " CFLAGS="$(CFLAGS) /TC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS" ARFLAGS="$(LDFLAGS)"
copy libpng.lib ..\$(LibDir)\\
copy png.h ..\$(Incdir)\\
copy pngconf.h ..\$(Incdir)\\
copy pnglibconf.h ..\$(Incdir)\\
cd ..

{$(SrcDir)\}.cpp{$(O)}.obj:
cl $(CFLAGS) /Fd$O /Fo$O -c $<
{getopt\}.c{$(O)}.obj:
cl $(CFLAGS) /DSTATIC_GETOPT /Fd$O /Fo$O -c $<
{$(SrcDir)\image\}.cpp{$(O)}.obj:
cl $(CFLAGS) /I$(Incdir) /Fd$O /Fo$O -c $<
{$(SrcDir)\maniac\}.cpp{$(O)}.obj:
cl $(CFLAGS) /Fd$O /Fo$O -c $<
{$(SrcDir)\transform\}.cpp{$(O)}.obj:
cl $(CFLAGS) /Fd$O /Fo$O -c $<

all: flif.exe viewflif.exe test-interface.exe

clean:
-del flif.exe
-del test-interface.exe
-del viewflif.exe
-del SDL2.dll
-del libflif.dll
-del output.png
-del output.flif
-rd /s /q testFiles
-rd /s /q $(LibDir)
61 changes: 61 additions & 0 deletions build/MSVC/dl_make_vs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@echo off

set lpngurl=http://sourceforge.net/projects/libpng/files/libpng16/1.6.18/lpng1618.zip/download
set lpngzip=lpng1618.zip
set lpngdir=lpng1618

set zliburl=http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib128.zip/download
set zlibzip=zlib128.zip
set zlibdir=zlib-1.2.8

set sdl2url=https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip
set sdl2zip=SDL2-devel-2.0.3-VC.zip
set sdl2dir=SDL2-2.0.3


if not defined VISUALSTUDIOVERSION (
CALL "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %1
)
if not defined VISUALSTUDIOVERSION (
echo need VS2015
goto end
)
if not defined PLATFORM set PLATFORM=x86

cd /d %~dp0

if not exist "%lpngzip%" (
echo download %lpngzip%
PowerShell "(New-Object System.Net.WebClient).DownloadFile('%lpngurl%', '%lpngzip%')"
)
if not exist "%lpngdir%\\" (
echo unzip %lpngzip%
PowerShell "(New-Object -ComObject shell.application).NameSpace('%CD%').CopyHere((New-Object -ComObject shell.application).NameSpace('%CD%\%lpngzip%').Items())"
)

if not exist "%zlibzip%" (
echo download %zlibzip%
PowerShell "(New-Object System.Net.WebClient).DownloadFile('%zliburl%', '%zlibzip%')"
)
if not exist "%zlibdir%\\" (
echo unzip %zlibzip%
PowerShell "$s=New-Object -Com shell.application;$s.NameSpace('%CD%').CopyHere($s.NameSpace('%CD%\%zlibzip%').Items())"
)

if not exist "%sdl2zip%" (
echo download %sdl2zip%
PowerShell "(New-Object System.Net.WebClient).DownloadFile('%sdl2url%', '%sdl2zip%')"
)
if not exist "%sdl2dir%\\" (
echo unzip %sdl2zip%
PowerShell "$s=New-Object -Com shell.application;$s.NameSpace('%CD%').CopyHere($s.NameSpace('%CD%\%sdl2zip%').Items())"
)

nmake Rt=MD
nmake Rt=MD test
rem nmake Rt=MT flif.exe
rem debug MTd|MDd
rem nmake Rt=MDd all

:end
cmd
3 changes: 3 additions & 0 deletions build/MSVC/dl_make_vs_x64.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
cd /d %~dp0
call dl_make_vs.bat amd64
Loading

0 comments on commit cb1caa2

Please sign in to comment.