Skip to content

Commit

Permalink
Squashed 'src/charls/' content from commit 25160a4
Browse files Browse the repository at this point in the history
git-subtree-dir: src/charls
git-subtree-split: 25160a42fb62e71e4b0ce081f5cb3f8bb73938b5
  • Loading branch information
vasole committed Apr 23, 2020
0 parents commit 676791f
Show file tree
Hide file tree
Showing 117 changed files with 7,299 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[{src}/**.{h,cpp}]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Explicit define text files types.
*.c text diff=cpp
*.cpp text diff=cpp
*.h text diff=cpp

# Explicit exclude binary files from the line ending normalization.
*.png binary
*.JLS binary
*.jls binary
*.bmp binary
*.raw binary

# Export ignore all files that are only needed for git and CI (used when downloading the repository as a zip file).
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
.appveyor.yml export-ignore
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# GIT ignore file for CharLS

obj/
bin/
Win32/
x64/
.vscode/
.vs/
[Dd]ebug/
[Rr]elease/
[Cc]hecked/
build/

# Ignore files created by Visual Studio
*.suo
*.user
*.ipch
*.opensdf
*.sdf
*.opendb
*.VC.db
*.aps
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: cpp

compiler:
- gcc
- clang

install:
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- gcc-4.8
- g++-4.8
- clang-3.7

sudo: false

before_script:
- mkdir debug
- cd debug
- cmake -DCMAKE_BUILD_TYPE=Debug ..

script: make
61 changes: 61 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cmake_minimum_required(VERSION 2.6)
project(charls)

# The following compiler option are only meant for GCC:
if (CMAKE_COMPILER_IS_GNUCC)
# the following is optimization micromanagement that made better code for x86
# SET(CMAKE_CXX_FLAGS "-D NDEBUG -O3 -Wall -Wextra -pedantic -fvisibility=hidden -fomit-frame-pointer -momit-leaf-frame-pointer -fweb -ftracer" )

# Define GNU C++ defines for both Debug and Release
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -Wall -Wextra")

# Define specific Debug settings.
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")

# Define specific Release settings.
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D NDEBUG -O3")
ENDIF ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Define clang C++ defines for both Debug and Release
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -Wall -Wextra")

# Define specific Debug settings.
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")

# Define specific Release settings.
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D NDEBUG -O3")
endif()

option (BUILD_SHARED_LIBS "Build CharLS with shared libraries." OFF)
option (BUILD_TESTING "Build tests" ON)

if (WIN32)
if (BUILD_SHARED_LIBS)
add_definitions(-D CHARLS_DLL)
else()
add_definitions(-D CHARLS_STATIC)
endif()
endif()

set (charls_HEADERS
src/context.h src/defaulttraits.h src/jpegimagedatasegment.h src/jpegsegment.h src/lookuptable.h src/publictypes.h
src/colortransform.h src/contextrunmode.h src/encoderstrategy.h src/jpegmarker.h src/losslesstraits.h src/scan.h
src/config.h src/decoderstrategy.h src/header.h src/jpegmarkersegment.h src/jpegstreamwriter.h src/processline.h src/util.h)

add_library(CharLS src/interface.cpp src/jpegls.cpp src/jpegmarkersegment.cpp src/header.cpp src/jpegstreamwriter.cpp)
set (CHARLS_LIB_MAJOR_VERSION 1)
set (CHARLS_LIB_MINOR_VERSION 0)
set_target_properties( CharLS PROPERTIES
VERSION ${CHARLS_LIB_MAJOR_VERSION}.${CHARLS_LIB_MINOR_VERSION}
SOVERSION ${CHARLS_LIB_MAJOR_VERSION})

install (TARGETS CharLS RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
install (FILES ${charls_HEADERS} DESTINATION include/CharLS)

if (BUILD_TESTING)
add_executable(charlstest test/main.cpp test/time.cpp test/util.cpp test/bitstreamdamage.cpp test/compliance.cpp test/performance.cpp test/dicomsamples.cpp)
target_link_libraries (charlstest CharLS)
endif ()
57 changes: 57 additions & 0 deletions CharLS.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{1C1CF63C-A53A-449F-90D3-63321015FD65}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CharLS", "src\CharLS.vcxproj", "{FF506D97-CF63-4268-97B8-6195E13A0114}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CharLSTest", "test\CharLSTest.vcxproj", "{3E349E7B-30C2-4791-81B7-1108014291B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Checked|Win32 = Checked|Win32
Checked|x64 = Checked|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FF506D97-CF63-4268-97B8-6195E13A0114}.Checked|Win32.ActiveCfg = Checked|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Checked|Win32.Build.0 = Checked|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Checked|x64.ActiveCfg = Checked|x64
{FF506D97-CF63-4268-97B8-6195E13A0114}.Checked|x64.Build.0 = Checked|x64
{FF506D97-CF63-4268-97B8-6195E13A0114}.Debug|Win32.ActiveCfg = Debug|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Debug|Win32.Build.0 = Debug|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Debug|x64.ActiveCfg = Debug|x64
{FF506D97-CF63-4268-97B8-6195E13A0114}.Debug|x64.Build.0 = Debug|x64
{FF506D97-CF63-4268-97B8-6195E13A0114}.Release|Win32.ActiveCfg = Release|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Release|Win32.Build.0 = Release|Win32
{FF506D97-CF63-4268-97B8-6195E13A0114}.Release|x64.ActiveCfg = Release|x64
{FF506D97-CF63-4268-97B8-6195E13A0114}.Release|x64.Build.0 = Release|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Checked|Win32.ActiveCfg = Checked|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Checked|Win32.Build.0 = Checked|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Checked|x64.ActiveCfg = Checked|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Checked|x64.Build.0 = Checked|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Debug|Win32.ActiveCfg = Debug|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Debug|Win32.Build.0 = Debug|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Debug|x64.ActiveCfg = Debug|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Debug|x64.Build.0 = Debug|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Release|Win32.ActiveCfg = Release|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Release|Win32.Build.0 = Release|Win32
{3E349E7B-30C2-4791-81B7-1108014291B7}.Release|x64.ActiveCfg = Release|x64
{3E349E7B-30C2-4791-81B7-1108014291B7}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FF506D97-CF63-4268-97B8-6195E13A0114} = {1C1CF63C-A53A-449F-90D3-63321015FD65}
{3E349E7B-30C2-4791-81B7-1108014291B7} = {1C1CF63C-A53A-449F-90D3-63321015FD65}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6B5B8C0F-1C78-4C88-AC5A-83B14B01F46A}
EndGlobalSection
EndGlobal
37 changes: 37 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Build to a folder outside the source folders, making it easier to clean. -->
<OutDir>$(SolutionDir)bin\$(Configuration)\$(Platform)\</OutDir>
<OutDir Condition="'$(Platform)'=='Win32'">$(SolutionDir)bin\$(Configuration)\x86\</OutDir>

<!-- C++ temp files can be redirected. -->
<IntDir>$(SolutionDir)intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\</IntDir>

<!-- The C runtime is provided by the OS on the Windows platform (Universal C Runtime (CRT))
MSBuild v15 requires an explicit SDK version number, MSBuild 16 can use "latest". -->
<WindowsTargetPlatformVersion Condition="'$(MSBuildVersion)' &lt; '16.0'">10.0.17763.0</WindowsTargetPlatformVersion>

<!-- Default character set is Unicode (UTF16), defines _UNICODE and UNICODE. -->
<CharacterSet>Unicode</CharacterSet>

<!-- Vcpkg should threat the checked build as a debug build. -->
<VcpkgConfiguration Condition="'$(Configuration)' == 'Checked'">Debug</VcpkgConfiguration>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<!-- To ensure high quality C++ code use Warning level 4 and treat warnings as errors to ensure warnings are fixed promptly. -->
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>

<!-- Enable some more level 4 warnings that are disabled by default but are usefull. -->
<AdditionalOptions>/w44296 /w44548 /w44555 /w44777 /w44917 %(AdditionalOptions)</AdditionalOptions>

<!-- Use all cores to speed up the compilation (MS recommended best practice). -->
<MultiProcessorCompilation>true</MultiProcessorCompilation>

<!-- Don't use precompiled header as code needs to be multi platform compatible. -->
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
</ItemDefinitionGroup>
</Project>
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[![Build status](https://ci.appveyor.com/api/projects/status/yq0naf3v2m8nfa8r/branch/1.x-master?svg=true)](https://ci.appveyor.com/project/vbaderks/charls/branch/1.x-master)
[![Build Status](https://travis-ci.org/team-charls/charls.svg?branch=1.x-master)](https://travis-ci.org/team-charls/charls)

# CharLS 1.x, a JPEG-LS library

## Project Description

An optimized implementation of the JPEG-LS standard for lossless
and near-lossless image compression. JPEG-LS is a low-complexity
standard that matches JPEG 2000 compression ratios.
In terms of speed, CharLS outperforms open source and
commercial JPEG LS implementations.

IMPORTANT: this is the 1.x branch, which is C++03 compatible and in maintenaince mode to support platforms on which a C++14 compiler is not available. The general recommendation is to use the releases from the master branch.

### Features

* High performance C++03 implementation with a C interface to ensure maximum interopability.
* Supports Windows, Linux and Solaris in 32 bit and 64 bit.

## About JPEG-LS

JPEG-LS (ISO-14495-1:1999/ITU-T.87) is a standard derived from the Hewlett Packard LOCO algorithm. JPEG LS has low complexity (meaning fast compression) and high compression ratios, similar to JPEG 2000. JPEG-LS is more similar to the old Lossless JPEG than to JPEG 2000, but interestingly the two different techniques result in vastly different performance characteristics.
[Wikipedia on lossless JPEG and JPEG-LS](en.wikipedia.org/wiki/Lossless_JPEG)
[Benchmarks JPEG-LS-Performance](charls.codeplex.com/wikipage?title=JPEG-LS-Performance&referringTitle=Home)

## Building CHARLS

### Primary development

Primary development is done on Windows with Visual Studio 2017.
Optimized projects and solution files are available for this environment.

All other platforms are supported by cmake. CMake is a cross platform
open source build system that generate project\make files for a large
set of environments.
14 changes: 14 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 1.00.{build}
os: Visual Studio 2017
configuration:
- Debug
- Release
- Checked
platform:
- Win32
- x64
before_build:
- set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin;%PATH%
build:
project: CharLS.sln
verbosity: minimal
3 changes: 3 additions & 0 deletions check.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -I "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include"

"C:\Program Files\Cppcheck\cppcheck.exe" --enable=all --inconclusive --platform=win32A -D_WIN32 -D_M_X64 -D_M_AMD64 -D__cplusplus -D_MSC_VER=1900 --verbose --report-progress src
Loading

0 comments on commit 676791f

Please sign in to comment.