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