Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4861ae9
Refactor: Updated project to use latest build tools and libraries
keiji Aug 24, 2024
2b8da77
Updated AndroidX dependencies:
keiji Aug 24, 2024
be0d934
Removed versionName and versionCode from library build.gradle.
keiji Aug 24, 2024
74a6353
Use a dedicated variable for library version
keiji Aug 24, 2024
7607011
Enable compatibility with 16kb page sizes introduced in Android 15.
keiji Aug 24, 2024
61d00aa
Enhanced Maven publication metadata
keiji Aug 24, 2024
e3b58ba
Update minSdkVersion to 21 to support NDK 27 requirement
keiji Aug 25, 2024
857dacb
Added javadoc generation task to build.gradle
keiji Aug 25, 2024
deba287
Add signing to Maven publishing
keiji Aug 25, 2024
6cafe13
Update project information
keiji Aug 25, 2024
3a2544d
Bump version
keiji Aug 25, 2024
e87a4a4
Updated package name to dev.keiji.jp2 and bumped version to 1.0.4.
keiji Aug 26, 2024
858d319
Refactor: Moved CMakeLists.txt to root of library module
keiji Aug 26, 2024
088d72b
Refactor: Moved CMakeLists.txt to root of library module
keiji Aug 26, 2024
2d8ec40
Bump OpenJPEG version to 2.5.2
keiji Aug 26, 2024
a483799
Update README.md
keiji Aug 26, 2024
8e18b66
Merge pull request #1 from keiji/bump_openjpeg_version
keiji Aug 26, 2024
3527d62
Bump library version to 1.0.5
keiji Aug 26, 2024
4f9b905
Merge pull request #2 from keiji/bump_libary_version
keiji Aug 26, 2024
8ab270e
Update README.md
keiji Aug 26, 2024
a5c3b03
Update LICENSE
keiji Jan 13, 2025
23ae429
Merge branch 'master' into modernize_project
keiji Dec 27, 2025
d12f7cf
Update README to reflect project relocation
keiji Jan 2, 2026
5fabc1b
Merge pull request #5 from keiji/keiji-patch-1
keiji Jan 2, 2026
91d216d
Merge pull request #3 from keiji/update_license
keiji Jan 2, 2026
5d2719f
Merge branch 'master' of github.com:ThalesGroup/JP2ForAndroid
keiji Jan 2, 2026
f0fb88a
Merge branch 'master' of github.com:keiji/JP2ForAndroid
keiji Jan 2, 2026
e4ef7e1
Merge branch 'master' into modernize_project
keiji Jan 2, 2026
9991ce7
Merge branch 'modernize_project' of github.com:keiji/JP2ForAndroid in…
keiji Jan 2, 2026
22f0c16
Updated LICENSE to remove personal copyright line
keiji Jan 4, 2026
a57985d
Remove deprecation notice/moved project warning from README
keiji Jan 4, 2026
0b644f2
Updated dependency to com.gemalto.jp2:jp2-android:1.0.3
keiji Jan 4, 2026
c35fbd9
Remove ht_dec.c and merge markers from library/CMakeLists.txt
keiji Jan 4, 2026
b260751
Added src/main/cpp/openjpeg/src/lib/openjp2/ht_dec.c to CMakeLists.txt
keiji Jan 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "library/src/main/cpp/openjpeg"]
path = library/src/main/cpp/openjpeg
url = git@github.com:uclouvain/openjpeg.git
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JP2 for Android
---------------------------
An open-source JPEG-2000 image encoder/decoder for Android based on [OpenJPEG](http://www.openjpeg.org/) v2.4.0.
An open-source JPEG-2000 image encoder/decoder for Android based on [OpenJPEG](http://www.openjpeg.org/) v2.5.2.

## Set up
Add dependency to your `build.gradle`:
Expand Down Expand Up @@ -119,3 +119,10 @@ byte[] j2kdata = new JP2Encoder(bmp)
.setOutputFormat(FORMAT_J2K)
.encode();
```

## Prepare build
Sync OpenJPEG submodule.
```
git submodule update
```

8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ buildscript {

repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.android.tools.build:gradle:8.5.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -19,7 +17,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Dec 04 17:55:10 CET 2020
#Sat Aug 24 20:39:15 JST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
27 changes: 16 additions & 11 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
# Since this is the top level CMakeLists.txt, the project name is also accessible
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
# build script scope).
project("openjpeg")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_JPIP")

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
openjpeg

# Sets the library as a shared library.
SHARED

add_library(${CMAKE_PROJECT_NAME} SHARED
# Provides a relative path to your source file(s).
src/main/cpp/openjpeg/src/lib/openjp2/bio.c
src/main/cpp/openjpeg/src/lib/openjp2/cidx_manager.c
Expand All @@ -38,6 +38,7 @@ add_library( # Sets the name of the library.
src/main/cpp/openjpeg/src/lib/openjp2/pi.c
src/main/cpp/openjpeg/src/lib/openjp2/ppix_manager.c
src/main/cpp/openjpeg/src/lib/openjp2/sparse_array.c
src/main/cpp/openjpeg/src/lib/openjp2/ht_dec.c
src/main/cpp/openjpeg/src/lib/openjp2/t1.c
src/main/cpp/openjpeg/src/lib/openjp2/t2.c
src/main/cpp/openjpeg/src/lib/openjp2/tcd.c
Expand All @@ -49,7 +50,12 @@ add_library( # Sets the name of the library.
src/main/cpp/openjpg.cpp
)

target_include_directories(openjpeg PRIVATE src/main/cpp src/main/cpp/openjpeg/src/lib/openjp2 src/main/cpp/openjpeg/src/bin/common)
target_include_directories(${CMAKE_PROJECT_NAME}
PRIVATE
src/main/cpp/
src/main/cpp/openjpeg/src/lib/openjp2
src/main/cpp/openjpeg/src/bin/common
)

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
Expand All @@ -68,10 +74,9 @@ find_library( # Sets the name of the path variable.
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
openjpeg
target_link_libraries(${CMAKE_PROJECT_NAME}

# Links the target library to the log library
# included in the NDK.
${log-lib} )
target_link_options(openjpeg PRIVATE "-Wl,-z,max-page-size=16384")
target_link_options(openjpeg PRIVATE "-Wl,-z,max-page-size=16384")
80 changes: 0 additions & 80 deletions library/bintray.gradle

This file was deleted.

124 changes: 82 additions & 42 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
plugins {
id 'com.android.library'
id 'maven-publish'
id 'signing'
}

def versionName = "1.0.5"

android {
compileSdkVersion 30
namespace = "com.gemalto.jp2"

compileSdk 34
defaultConfig {
minSdkVersion 14
targetSdkVersion 30
versionName "1.0.3"
versionCode 4
minSdkVersion 21
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
}
}
}
Expand All @@ -22,40 +27,95 @@ android {
minifyEnabled false
}
}
buildFeatures {
buildConfig = true
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
version "3.22.1"
}
}
ndkVersion '22.0.7026061'
ndkVersion '27.0.12077973'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.annotation:annotation:1.8.2'
//testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

/*************************************************************/
/******************* PUBLISHING STUFF ************************/
/*************************************************************/
//create a sources jar
task sourceJar(type: Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
classifier 'sources'
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}

tasks.withType(AbstractPublishToMaven) {
dependsOn assemble
}

//publish to a local Maven repository with the sources jar and all dependencies
publishing {
publications {
aarRelease(MavenPublication) {
groupId 'com.gemalto.jp2'
release(MavenPublication) {
groupId 'dev.keiji.jp2'
artifactId 'jp2-android'
version "${android.defaultConfig.versionName}"
version "${versionName}"

artifact("build/outputs/aar/jp2-android-release.aar")
artifact(sourceJar)
artifact("build/outputs/aar/library-release.aar")
artifact(javadocJar)

pom {
name = 'JP2ForAndroid'
description = 'A JPEG-2000 image encoder/decoder for Android. This library is a derivative work of the JP2 for Android library, originally developed by Gemalto s.r.o.'
url = 'https://github.com/keiji/JP2ForAndroid'
licenses {
license {
name = 'The 2-Clause BSD License'
url = 'https://opensource.org/licenses/BSD-2-Clause'
}
}
developers {
developer {
id = 'michal-dvorak-thales'
name = 'Michal Dvorak'
email = 'michal.dvorak@thalesgroup.com'
}
developer {
id = 'keiji'
name = 'ARIYAMA Keiji'
email = 'keiji.ariyama@gmail.com'
}
}
scm {
connection = 'https://github.com/keiji/JP2ForAndroid.git'
developerConnection = 'https://github.com/keiji/JP2ForAndroid.git'
url = 'https://github.com/keiji/JP2ForAndroid'
}
}
}
}
repositories {
Expand All @@ -65,28 +125,8 @@ publishing {
}
}

ext {
bintrayRepo = 'maven'
bintrayName = 'JP2ForAndroid'

publishedGroupId = 'com.gemalto.jp2'
libraryName = 'JP2ForAndroid'
artifact = 'jp2-android'

libraryDescription = 'A JPEG-2000 image encoder/decoder for Android'

siteUrl = 'https://github.com/gemalto/JP2ForAndroid'
gitUrl = 'https://github.com/gemalto/JP2ForAndroid.git'

libraryVersion = "${android.defaultConfig.versionName}"

developerId = 'michal-dvorak-thales'
developerName = 'Michal Dvorak'
developerEmail = 'michal.dvorak@thalesgroup.com'

licenseName = 'The 2-Clause BSD License'
licenseUrl = 'https://opensource.org/licenses/BSD-2-Clause'
allLicenses = ["BSD-2-Clause"]
signing {
useGpgCmd()
sign publishing.publications["release"]
signReleasePublication.dependsOn assemble
}

apply from: 'bintray.gradle'
1 change: 1 addition & 0 deletions library/src/main/cpp/openjpeg
Submodule openjpeg added at 39e8c5
Loading