Skip to content

Commit

Permalink
bump to 1.2.0
Browse files Browse the repository at this point in the history
Test: Build
  • Loading branch information
ram-mohan authored and DichenZhang1 committed Sep 20, 2024
1 parent 3a0fb6d commit 2188c35
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if(POLICY CMP0091)
cmake_policy(SET CMP0091 OLD)
endif()

project(libuhdr VERSION 1.1.1 LANGUAGES C CXX
project(libuhdr VERSION 1.2.0 LANGUAGES C CXX
DESCRIPTION "Library for encoding and decoding ultrahdr images")

###########################################################
Expand Down
1 change: 1 addition & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Following is a list of available options:
| `UHDR_ENABLE_INSTALL` | ON | Enable install and uninstall targets for libuhdr package. <ul><li> For system wide installation it is best if dependencies are acquired from OS package manager instead of building from source. This is to avoid conflicts with software that is using a different version of the said dependency and also links to libuhdr. So if `UHDR_BUILD_DEPS` is **ON** then `UHDR_ENABLE_INSTALL` is forced to **OFF** internally. |
| `UHDR_ENABLE_INTRINSICS` | ON | Build with SIMD acceleration. Sections of libuhdr are accelerated for Arm Neon architectures and these are enabled. <ul><li> For x86/x86_64 architectures currently no SIMD acceleration is present. Consequently this option has no effect. </li><li> This parameter has no effect no SIMD configuration settings of dependencies. </li></ul> |
| `UHDR_ENABLE_GLES` | OFF | Build with GPU acceleration. |
| `UHDR_MAX_DIMENSION` | 8192 | Maximum dimension supported by the library. The library defaults to handling images upto resolution 8192x8192. For different resolution needs use this option. For example, `-DUHDR_MAX_DIMENSION=4096`. |
| `UHDR_BUILD_JAVA` | OFF | Build JNI wrapper, Java front-end classes and Java sample application. |
| `UHDR_SANITIZE_OPTIONS` | OFF | Build library with sanitize options. Values set to this parameter are passed to directly to compilation option `-fsanitize`. For example, `-DUHDR_SANITIZE_OPTIONS=address,undefined` adds `-fsanitize=address,undefined` to the list of compilation options. CMake configuration errors are raised if the compiler does not support these flags. This is useful during fuzz testing. <ul><li> As `-fsanitize` is an instrumentation option, dependencies are also built from source instead of using pre-builts. This is done by forcing `UHDR_BUILD_DEPS` to **ON** internally. </li></ul> |
| | | |
Expand Down
9 changes: 6 additions & 3 deletions examples/ultrahdr_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,8 @@ void UltraHdrAppInput::computeYUVSdrPSNR() {
}

static void usage(const char* name) {
fprintf(stderr, "\n## ultra hdr demo application.\nUsage : %s \n", name);
fprintf(stderr, "\n## ultra hdr demo application. lib version: v%s \nUsage : %s \n",
UHDR_LIB_VERSION_STR, name);
fprintf(stderr, " -m mode of operation. [0:encode, 1:decode] \n");
fprintf(stderr, "\n## encoder options : \n");
fprintf(stderr,
Expand Down Expand Up @@ -1370,9 +1371,11 @@ static void usage(const char* name) {
stderr,
" -D select encoding preset, optional. [0:real time, 1:best quality (default)]. \n");
fprintf(stderr,
" -k min content boost recommendation, must be in linear scale, optional \n");
" -k min content boost recommendation, must be in linear scale, optional. [any "
"positive real number] \n");
fprintf(stderr,
" -K max content boost recommendation, must be in linear scale, optional \n");
" -K max content boost recommendation, must be in linear scale, optional.[any "
"positive real number] \n");
fprintf(stderr, " -x binary input resource containing exif data to insert, optional. \n");
fprintf(stderr, "\n## decoder options : \n");
fprintf(stderr, " -j ultra hdr compressed input resource, required. \n");
Expand Down
10 changes: 5 additions & 5 deletions java/UltraHdrApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public void decode() throws Exception {
}

public static void usage() {
System.out.println("\n## uhdr demo application.");
System.out.println("\n## uhdr demo application. lib version: " + getVersionString());
System.out.println("Usage : java -Djava.library.path=<path> -jar uhdr-java.jar");
System.out.println(" -m mode of operation. [0:encode, 1:decode]");
System.out.println("\n## encoder options :");
Expand Down Expand Up @@ -455,10 +455,10 @@ public static void usage() {
+ " 1:enable (default)].");
System.out.println(" -D select encoding preset, optional. [0:real time,"
+ " 1:best quality (default)].");
System.out.println(
" -k min content boost recommendation, must be in linear scale, optional.");
System.out.println(
" -K max content boost recommendation, must be in linear scale, optional.");
System.out.println(" -k min content boost recommendation, must be in linear scale,"
+ " optional. any positive real number");
System.out.println(" -K max content boost recommendation, must be in linear scale,"
+ " optional. any positive real number");
System.out.println(" -x binary input resource containing exif data to insert, "
+ "optional.");
System.out.println("\n## decoder options :");
Expand Down
24 changes: 24 additions & 0 deletions java/com/google/media/codecs/ultrahdr/UltraHDRCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,28 @@ public class UltraHDRCommon {

private UltraHDRCommon() {
}

/**
* Get library version in string format
* @return version string
*/
public static String getVersionString() {
return getVersionStringNative();
}

/**
* Get library version
* @return version
*/
public static int getVersion() {
return getVersionNative();
}

private static native String getVersionStringNative();

private static native int getVersionNative();

static {
System.loadLibrary("uhdrjni");
}
}
75 changes: 75 additions & 0 deletions java/jni/com_google_media_codecs_ultrahdr_UltraHDRCommon.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion java/jni/ultrahdr-jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
*/

#include <cstring>
#include <string>

#include "com_google_media_codecs_ultrahdr_UltraHDREncoder.h"
#include "com_google_media_codecs_ultrahdr_UltraHDRCommon.h"
#include "com_google_media_codecs_ultrahdr_UltraHDRDecoder.h"
#include "com_google_media_codecs_ultrahdr_UltraHDREncoder.h"
#include "ultrahdr_api.h"

static_assert(sizeof(void *) <= sizeof(jlong),
Expand Down Expand Up @@ -664,3 +666,15 @@ Java_com_google_media_codecs_ultrahdr_UltraHDRDecoder_resetNative(JNIEnv *env, j
RET_IF_TRUE(handle == 0, "java/io/IOException", "invalid decoder instance")
uhdr_reset_decoder((uhdr_codec_private_t *)handle);
}

extern "C" JNIEXPORT jstring JNICALL
Java_com_google_media_codecs_ultrahdr_UltraHDRCommon_getVersionStringNative(JNIEnv *env,
jclass clazz) {
std::string version{"v" UHDR_LIB_VERSION_STR};
return env->NewStringUTF(version.c_str());
}

extern "C" JNIEXPORT jint JNICALL
Java_com_google_media_codecs_ultrahdr_UltraHDRCommon_getVersionNative(JNIEnv *env, jclass clazz) {
return UHDR_LIB_VERSION;
}
2 changes: 1 addition & 1 deletion lib/src/jpegencoderhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ uhdr_error_info_t JpegEncoderHelper::encode(const uint8_t* planes[3], const size
char comment[255];
snprintf(comment, sizeof comment,
"Source: google libuhdr v%s, Coder: libjpeg v%d, Attrib: GainMap Image",
UHDR_LIB_VERSION, JPEG_LIB_VERSION);
UHDR_LIB_VERSION_STR, JPEG_LIB_VERSION);
jpeg_write_marker(&cinfo, JPEG_COM, reinterpret_cast<JOCTET*>(comment), strlen(comment));
}
if (format == UHDR_IMG_FMT_24bppRGB888) {
Expand Down
16 changes: 15 additions & 1 deletion ultrahdr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,23 @@
* string. Some bug fixes and introduced one new API
* which warrants a minor version update. But
* indicated as a patch update.
* 1.2.0 1.2.0 Some bug fixes, introduced new API and renamed
* existing API which warrants a major version update.
* But indicated as a minor update.
*/

// This needs to be kept in sync with version in CMakeLists.txt
#define UHDR_LIB_VERSION "1.1.1"
#define UHDR_LIB_VER_MAJOR 1
#define UHDR_LIB_VER_MINOR 2
#define UHDR_LIB_VER_PATCH 0

#define UHDR_LIB_VERSION \
((UHDR_LIB_VER_MAJOR * 10000) + (UHDR_LIB_VER_MINOR * 100) + UHDR_LIB_VER_PATCH)

#define XSTR(s) STR(s)
#define STR(s) #s
#define UHDR_LIB_VERSION_STR \
XSTR(UHDR_LIB_VER_MAJOR) "." XSTR(UHDR_LIB_VER_MINOR) "." XSTR(UHDR_LIB_VER_PATCH)

// ===============================================================================================
// Enum Definitions
Expand Down

0 comments on commit 2188c35

Please sign in to comment.