diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90b90406..4a72f018 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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")
###########################################################
diff --git a/docs/building.md b/docs/building.md
index 0376c2a2..2c5db9d5 100644
--- a/docs/building.md
+++ b/docs/building.md
@@ -61,6 +61,7 @@ Following is a list of available options:
| `UHDR_ENABLE_INSTALL` | ON | Enable install and uninstall targets for libuhdr package.
- 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.
- For x86/x86_64 architectures currently no SIMD acceleration is present. Consequently this option has no effect.
- This parameter has no effect no SIMD configuration settings of dependencies.
|
| `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. - 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.
|
| | | |
diff --git a/examples/ultrahdr_app.cpp b/examples/ultrahdr_app.cpp
index 1bd36858..90f83ba4 100644
--- a/examples/ultrahdr_app.cpp
+++ b/examples/ultrahdr_app.cpp
@@ -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,
@@ -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");
diff --git a/java/UltraHdrApp.java b/java/UltraHdrApp.java
index e93e5294..e6376e51 100644
--- a/java/UltraHdrApp.java
+++ b/java/UltraHdrApp.java
@@ -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= -jar uhdr-java.jar");
System.out.println(" -m mode of operation. [0:encode, 1:decode]");
System.out.println("\n## encoder options :");
@@ -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 :");
diff --git a/java/com/google/media/codecs/ultrahdr/UltraHDRCommon.java b/java/com/google/media/codecs/ultrahdr/UltraHDRCommon.java
index 2d66e7dc..4deb1176 100644
--- a/java/com/google/media/codecs/ultrahdr/UltraHDRCommon.java
+++ b/java/com/google/media/codecs/ultrahdr/UltraHDRCommon.java
@@ -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");
+ }
}
diff --git a/java/jni/com_google_media_codecs_ultrahdr_UltraHDRCommon.h b/java/jni/com_google_media_codecs_ultrahdr_UltraHDRCommon.h
new file mode 100644
index 00000000..25376864
--- /dev/null
+++ b/java/jni/com_google_media_codecs_ultrahdr_UltraHDRCommon.h
@@ -0,0 +1,75 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include
+/* Header for class com_google_media_codecs_ultrahdr_UltraHDRCommon */
+
+#ifndef _Included_com_google_media_codecs_ultrahdr_UltraHDRCommon
+#define _Included_com_google_media_codecs_ultrahdr_UltraHDRCommon
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_UNSPECIFIED
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_UNSPECIFIED -1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_24bppYCbCrP010
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_24bppYCbCrP010 0L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_12bppYCbCr420
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_12bppYCbCr420 1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_8bppYCbCr400
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_8bppYCbCr400 2L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_32bppRGBA8888
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_32bppRGBA8888 3L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_64bppRGBAHalfFloat
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_64bppRGBAHalfFloat 4L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_32bppRGBA1010102
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_IMG_FMT_32bppRGBA1010102 5L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_UNSPECIFIED
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_UNSPECIFIED -1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_BT709
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_BT709 0L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_DISPlAY_P3
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_DISPlAY_P3 1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_BT2100
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CG_BT2100 2L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_UNSPECIFIED
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_UNSPECIFIED -1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_LINEAR
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_LINEAR 0L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_HLG
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_HLG 1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_PQ
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_PQ 2L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_SRGB
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CT_SRGB 3L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_UNSPECIFIED
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_UNSPECIFIED -1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_LIMITED_RANGE
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_LIMITED_RANGE 0L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_FULL_RANGE
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_CR_FULL_RANGE 1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_HDR_IMG
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_HDR_IMG 0L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_SDR_IMG
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_SDR_IMG 1L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_BASE_IMG
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_BASE_IMG 2L
+#undef com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_GAIN_MAP_IMG
+#define com_google_media_codecs_ultrahdr_UltraHDRCommon_UHDR_GAIN_MAP_IMG 3L
+/*
+ * Class: com_google_media_codecs_ultrahdr_UltraHDRCommon
+ * Method: getVersionStringNative
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_google_media_codecs_ultrahdr_UltraHDRCommon_getVersionStringNative
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_google_media_codecs_ultrahdr_UltraHDRCommon
+ * Method: getVersionNative
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_google_media_codecs_ultrahdr_UltraHDRCommon_getVersionNative
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/java/jni/ultrahdr-jni.cpp b/java/jni/ultrahdr-jni.cpp
index 10f8dd12..c5454625 100644
--- a/java/jni/ultrahdr-jni.cpp
+++ b/java/jni/ultrahdr-jni.cpp
@@ -15,9 +15,11 @@
*/
#include
+#include
-#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),
@@ -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;
+}
diff --git a/lib/src/jpegencoderhelper.cpp b/lib/src/jpegencoderhelper.cpp
index 39500888..dc2e94d1 100644
--- a/lib/src/jpegencoderhelper.cpp
+++ b/lib/src/jpegencoderhelper.cpp
@@ -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(comment), strlen(comment));
}
if (format == UHDR_IMG_FMT_24bppRGB888) {
diff --git a/ultrahdr_api.h b/ultrahdr_api.h
index 6fbd832a..d2d36276 100644
--- a/ultrahdr_api.h
+++ b/ultrahdr_api.h
@@ -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