|
|
951c22 |
diff -Nur libkdcraw-4.10.0/libraw/CMakeLists.txt libkdcraw-4.10.0-libjpeg-turbo/libraw/CMakeLists.txt
|
|
|
951c22 |
--- libkdcraw-4.10.0/libraw/CMakeLists.txt 2013-01-23 23:00:43.000000000 +0100
|
|
|
951c22 |
+++ libkdcraw-4.10.0-libjpeg-turbo/libraw/CMakeLists.txt 2013-03-09 23:58:25.000000000 +0100
|
|
|
951c22 |
@@ -88,29 +88,26 @@
|
|
|
951c22 |
|
|
|
951c22 |
FIND_PACKAGE(JPEG)
|
|
|
951c22 |
IF(JPEG_FOUND)
|
|
|
951c22 |
- # check version of libjpeg
|
|
|
951c22 |
- # inspired from digikam/CMakeLists.txt
|
|
|
951c22 |
- SET(_jpeglib_version_source "#include <stddef.h>\n#include<stdio.h>\n#include <jpeglib.h>\n int main()\n {\n #if (JPEG_LIB_VERSION >= 80) \n #error JPEG_LIB_VERSION >= 80 found \n #endif \n }\n")
|
|
|
951c22 |
- SET(_jpeglib_version_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/cmake_jpeglib_version_check.cpp)
|
|
|
951c22 |
- FILE(WRITE "${_jpeglib_version_source_file}" "${_jpeglib_version_source}")
|
|
|
951c22 |
- SET(_jpeglib_version_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${JPEG_INCLUDE_DIR}")
|
|
|
951c22 |
+ INCLUDE(CheckSymbolExists)
|
|
|
951c22 |
|
|
|
951c22 |
- TRY_COMPILE(_jpeglib_version_compile_result ${CMAKE_BINARY_DIR} ${_jpeglib_version_source_file}
|
|
|
951c22 |
- CMAKE_FLAGS "${_jpeglib_version_include_dirs}"
|
|
|
951c22 |
- COMPILE_OUTPUT_VARIABLE _jpeglib_version_compile_output_var
|
|
|
951c22 |
- )
|
|
|
951c22 |
- IF(_jpeglib_version_compile_result)
|
|
|
951c22 |
- MESSAGE(STATUS "Identified libjpeg version less than 80 (too low)")
|
|
|
951c22 |
- SET(JPEG_FOUND FALSE)
|
|
|
951c22 |
- ENDIF()
|
|
|
951c22 |
+ # check for the jpeg_mem_src function
|
|
|
951c22 |
+ SET(OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
|
|
|
951c22 |
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}")
|
|
|
951c22 |
+ SET(OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
|
|
951c22 |
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARY}")
|
|
|
951c22 |
+ CHECK_SYMBOL_EXISTS(jpeg_mem_src "stddef.h;stdio.h;jpeglib.h" HAVE_JPEG_MEM_SRC)
|
|
|
951c22 |
+ SET(CMAKE_REQUIRED_INCLUDES "${OLD_CMAKE_REQUIRED_INCLUDES}")
|
|
|
951c22 |
+ SET(CMAKE_REQUIRED_LIBRARIES "${OLD_CMAKE_REQUIRED_LIBRARIES}")
|
|
|
951c22 |
ENDIF(JPEG_FOUND)
|
|
|
951c22 |
|
|
|
951c22 |
-MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "80" "needed for the LibRaw DNG lossy codec")
|
|
|
951c22 |
+MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "" "needed for the LibRaw DNG lossy codec")
|
|
|
951c22 |
|
|
|
951c22 |
# Flag to use libjpeg with LibRaw DNG lossy codec
|
|
|
951c22 |
IF(JPEG_FOUND)
|
|
|
951c22 |
ADD_DEFINITIONS(-DUSE_JPEG)
|
|
|
951c22 |
- ADD_DEFINITIONS(-DUSE_JPEG8)
|
|
|
951c22 |
+ IF(HAVE_JPEG_MEM_SRC)
|
|
|
951c22 |
+ ADD_DEFINITIONS(-DUSE_JPEG8)
|
|
|
951c22 |
+ ENDIF(HAVE_JPEG_MEM_SRC)
|
|
|
951c22 |
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
|
|
|
951c22 |
ENDIF()
|
|
|
951c22 |
|
|
|
951c22 |
diff -Nur libkdcraw-4.10.0/libraw/RawSpeed/DngDecoderSlices.cpp libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/DngDecoderSlices.cpp
|
|
|
951c22 |
--- libkdcraw-4.10.0/libraw/RawSpeed/DngDecoderSlices.cpp 2013-01-23 23:00:43.000000000 +0100
|
|
|
951c22 |
+++ libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/DngDecoderSlices.cpp 2013-03-09 23:48:29.000000000 +0100
|
|
|
951c22 |
@@ -88,7 +88,7 @@
|
|
|
951c22 |
|
|
|
951c22 |
}
|
|
|
951c22 |
|
|
|
951c22 |
-#if JPEG_LIB_VERSION < 80
|
|
|
951c22 |
+#ifndef USE_JPEG8
|
|
|
951c22 |
/* Read JPEG image from a memory segment */
|
|
|
951c22 |
|
|
|
951c22 |
static void init_source (j_decompress_ptr cinfo) {}
|
|
|
951c22 |
diff -Nur libkdcraw-4.10.0/libraw/RawSpeed/rawspeed.jpeg-version.patch libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/rawspeed.jpeg-version.patch
|
|
|
951c22 |
--- libkdcraw-4.10.0/libraw/RawSpeed/rawspeed.jpeg-version.patch 1970-01-01 01:00:00.000000000 +0100
|
|
|
951c22 |
+++ libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/rawspeed.jpeg-version.patch 2013-03-09 23:48:29.000000000 +0100
|
|
|
951c22 |
@@ -0,0 +1,13 @@
|
|
|
951c22 |
+diff --git a/RawSpeed/DngDecoderSlices.cpp b/RawSpeed/DngDecoderSlices.cpp
|
|
|
951c22 |
+index 28a137e..617b4b3 100644
|
|
|
951c22 |
+--- a/RawSpeed/DngDecoderSlices.cpp
|
|
|
951c22 |
++++ b/RawSpeed/DngDecoderSlices.cpp
|
|
|
951c22 |
+@@ -88,7 +88,7 @@ void DngDecoderSlices::startDecoding() {
|
|
|
951c22 |
+
|
|
|
951c22 |
+ }
|
|
|
951c22 |
+
|
|
|
951c22 |
+-#if JPEG_LIB_VERSION < 80
|
|
|
951c22 |
++#ifndef USE_JPEG8
|
|
|
951c22 |
+ /* Read JPEG image from a memory segment */
|
|
|
951c22 |
+
|
|
|
951c22 |
+ static void init_source (j_decompress_ptr cinfo) {}
|
|
|
951c22 |
diff -Nur libkdcraw-4.10.0/libraw/src/libraw_datastream.cpp libkdcraw-4.10.0-libjpeg-turbo/libraw/src/libraw_datastream.cpp
|
|
|
951c22 |
--- libkdcraw-4.10.0/libraw/src/libraw_datastream.cpp 2013-01-23 23:00:44.000000000 +0100
|
|
|
951c22 |
+++ libkdcraw-4.10.0-libjpeg-turbo/libraw/src/libraw_datastream.cpp 2013-03-10 00:22:15.000000000 +0100
|
|
|
951c22 |
@@ -443,9 +443,52 @@
|
|
|
951c22 |
#endif
|
|
|
951c22 |
}
|
|
|
951c22 |
|
|
|
951c22 |
+#if !defined(NO_JPEG) && !defined(USE_JPEG8)
|
|
|
951c22 |
+/* Read JPEG image from a memory segment
|
|
|
951c22 |
+ (from libraw/RawSpeed/DngDecoderSlices.cpp, LGPLv2+) */
|
|
|
951c22 |
+
|
|
|
951c22 |
+static void init_source (j_decompress_ptr cinfo) {}
|
|
|
951c22 |
+static boolean fill_input_buffer (j_decompress_ptr cinfo)
|
|
|
951c22 |
+{
|
|
|
951c22 |
+ struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
|
|
|
951c22 |
+ return !!src->bytes_in_buffer;
|
|
|
951c22 |
+}
|
|
|
951c22 |
+static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
|
|
951c22 |
+{
|
|
|
951c22 |
+ struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
|
|
|
951c22 |
+
|
|
|
951c22 |
+ if (num_bytes > (int)src->bytes_in_buffer)
|
|
|
951c22 |
+ throw LIBRAW_EXCEPTION_IO_EOF;
|
|
|
951c22 |
+ if (num_bytes > 0) {
|
|
|
951c22 |
+ src->next_input_byte += (size_t) num_bytes;
|
|
|
951c22 |
+ src->bytes_in_buffer -= (size_t) num_bytes;
|
|
|
951c22 |
+ }
|
|
|
951c22 |
+}
|
|
|
951c22 |
+static void term_source (j_decompress_ptr cinfo) {}
|
|
|
951c22 |
+static void jpeg_mem_src (j_decompress_ptr cinfo, unsigned char* buffer, long nbytes)
|
|
|
951c22 |
+{
|
|
|
951c22 |
+ struct jpeg_source_mgr* src;
|
|
|
951c22 |
+
|
|
|
951c22 |
+ if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
|
|
951c22 |
+ cinfo->src = (struct jpeg_source_mgr *)
|
|
|
951c22 |
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
|
|
951c22 |
+ sizeof(struct jpeg_source_mgr));
|
|
|
951c22 |
+ }
|
|
|
951c22 |
+
|
|
|
951c22 |
+ src = (struct jpeg_source_mgr*) cinfo->src;
|
|
|
951c22 |
+ src->init_source = init_source;
|
|
|
951c22 |
+ src->fill_input_buffer = fill_input_buffer;
|
|
|
951c22 |
+ src->skip_input_data = skip_input_data;
|
|
|
951c22 |
+ src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
|
|
951c22 |
+ src->term_source = term_source;
|
|
|
951c22 |
+ src->bytes_in_buffer = nbytes;
|
|
|
951c22 |
+ src->next_input_byte = (JOCTET*)buffer;
|
|
|
951c22 |
+}
|
|
|
951c22 |
+#endif
|
|
|
951c22 |
+
|
|
|
951c22 |
int LibRaw_buffer_datastream::jpeg_src(void *jpegdata)
|
|
|
951c22 |
{
|
|
|
951c22 |
-#if defined(NO_JPEG) || !defined (USE_JPEG8)
|
|
|
951c22 |
+#if defined(NO_JPEG)
|
|
|
951c22 |
return -1;
|
|
|
951c22 |
#else
|
|
|
951c22 |
j_decompress_ptr cinfo = (j_decompress_ptr) jpegdata;
|