summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <bremner@debian.org>2018-05-07 18:27:09 -0400
committerDavid Bremner <bremner@debian.org>2018-05-07 18:27:09 -0400
commit0be266f9b095de7ab4d3e9728c98ba77ba756fa4 (patch)
tree3ec628d11877c0c7a6f386ed1ba0afe0d1b5a8be
parentad674e77c03d176df2d4e816f73578428d2984c2 (diff)
Importing darktable_2.4.3.orig.tar.xz
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/external/rawspeed/.ci/Dockerfile2
-rw-r--r--src/external/rawspeed/.clang-tidy6
-rw-r--r--src/external/rawspeed/.travis.yml8
-rw-r--r--src/external/rawspeed/CMakeLists.txt2
-rw-r--r--src/external/rawspeed/README.rst2
-rw-r--r--src/external/rawspeed/bench/librawspeed/interpolators/Cr2sRawInterpolatorBenchmark.cpp2
-rw-r--r--src/external/rawspeed/cmake/Modules/FindLLVMClangTidy.cmake2
-rw-r--r--src/external/rawspeed/cmake/Modules/FindLibFuzzingEngine.cmake2
-rw-r--r--src/external/rawspeed/cmake/Modules/FindPugixml.cmake2
-rw-r--r--src/external/rawspeed/cmake/OpenMP.cmake2
-rw-r--r--src/external/rawspeed/cmake/build-type.cmake2
-rw-r--r--src/external/rawspeed/cmake/compiler-versions.cmake8
-rw-r--r--src/external/rawspeed/cmake/compiler-warnings-clang.cmake9
-rw-r--r--src/external/rawspeed/cmake/gcc-gcov.cmake4
-rw-r--r--src/external/rawspeed/data/cameras.xml92
-rw-r--r--src/external/rawspeed/fuzz/librawspeed/decompressors/Cr2Decompressor.cpp15
-rw-r--r--src/external/rawspeed/fuzz/librawspeed/fuzz/Common.cpp4
-rw-r--r--src/external/rawspeed/src/config.h.in33
-rw-r--r--src/external/rawspeed/src/external/AddressSanitizer.h87
-rw-r--r--src/external/rawspeed/src/external/MemorySanitizer.h67
-rw-r--r--src/external/rawspeed/src/librawspeed/README.md2
-rw-r--r--src/external/rawspeed/src/librawspeed/common/DngOpcodes.cpp6
-rw-r--r--src/external/rawspeed/src/librawspeed/common/Memory.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/common/RawImage.cpp24
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/AbstractTiffDecoder.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/ArwDecoder.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/Cr2Decoder.cpp18
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/DngDecoder.cpp7
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/IiqDecoder.cpp4
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/KdcDecoder.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decoders/MrwDecoder.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/AbstractParallelizedDecompressor.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.cpp45
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.h50
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/HuffmanTable.h2
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/KodakDecompressor.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/NikonDecompressor.cpp4
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/SonyArw1Decompressor.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/decompressors/UncompressedDecompressor.cpp2
-rw-r--r--src/external/rawspeed/src/librawspeed/io/BitStream.h2
-rw-r--r--src/external/rawspeed/src/librawspeed/io/Buffer.cpp25
-rw-r--r--src/external/rawspeed/src/librawspeed/io/Buffer.h35
-rw-r--r--src/external/rawspeed/src/librawspeed/io/ByteStream.h26
-rw-r--r--src/external/rawspeed/src/librawspeed/io/Endianness.h2
-rw-r--r--src/external/rawspeed/src/utilities/rstest/MD5Benchmark.cpp2
-rw-r--r--src/external/rawspeed/src/utilities/rstest/rstest.cpp9
-rw-r--r--src/external/rawspeed/test/librawspeed/metadata/ColorFilterArrayTest.cpp2
-rw-r--r--src/version_gen.c6
49 files changed, 454 insertions, 188 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a7cc689b..11a483872 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -220,7 +220,7 @@ else(DEFINED PROJECT_VERSION)
else(NOT SOURCE_PACKAGE)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/src/version_gen.c)
# should be expanded by git archive due to export-subst in .gitattributes
- set(PROJECT_VERSION "archive-6305f8363de0e349f7947b701efb54e035ac0709")
+ set(PROJECT_VERSION "archive-a09bf23d6c61aec66643cd05f7d7784c33047988")
# but was it expanded?
if(PROJECT_VERSION MATCHES Format)
set(PROJECT_VERSION "unknown-version")
diff --git a/src/external/rawspeed/.ci/Dockerfile b/src/external/rawspeed/.ci/Dockerfile
index 146ddae72..1d00e2441 100644
--- a/src/external/rawspeed/.ci/Dockerfile
+++ b/src/external/rawspeed/.ci/Dockerfile
@@ -37,7 +37,7 @@ RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes
RUN echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissin
ENV GCC_VER=7
-ENV LLVM_VER=5.0
+ENV LLVM_VER=6.0
# pls keep sorted :)
RUN rm -rf /var/lib/apt/lists/* && apt-get update && \
diff --git a/src/external/rawspeed/.clang-tidy b/src/external/rawspeed/.clang-tidy
index 7999c79cf..a986d7883 100644
--- a/src/external/rawspeed/.clang-tidy
+++ b/src/external/rawspeed/.clang-tidy
@@ -1,5 +1,5 @@
---
-Checks: '*,-clang-analyzer-*,-clang-diagnostic-*,-cert-dcl50-cpp,-cert-env33-c,-cert-err58-cpp,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-google-default-arguments,-google-readability-todo,-google-runtime-int,-hicpp-member-init,-hicpp-special-member-functions,-llvm-header-guard,-llvm-include-order,-misc-unused-parameters,-readability-implicit-bool-cast,-readability-inconsistent-declaration-parameter-name,-android-*,-hicpp-braces-around-statements,-hicpp-function-size,-google-readability-braces-around-statements,-google-readability-function-size,-readability-implicit-bool-conversion,-hicpp-signed-bitwise,-hicpp-no-array-decay,-hicpp-vararg,-cppcoreguidelines-owning-memory,-fuchsia-*,-readability-simd-intrinsics'
+Checks: '*,-clang-analyzer-*,-clang-diagnostic-*,-cert-dcl50-cpp,-cert-env33-c,-cert-err58-cpp,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-google-default-arguments,-google-readability-todo,-google-runtime-int,-hicpp-member-init,-hicpp-special-member-functions,-llvm-header-guard,-llvm-include-order,-misc-unused-parameters,-readability-implicit-bool-cast,-readability-inconsistent-declaration-parameter-name,-android-*,-hicpp-braces-around-statements,-hicpp-function-size,-google-readability-braces-around-statements,-google-readability-function-size,-readability-implicit-bool-conversion,-hicpp-signed-bitwise,-hicpp-no-array-decay,-hicpp-vararg,-hicpp-multiway-paths-covered,-cppcoreguidelines-owning-memory,-fuchsia-*,-portability-simd-intrinsics'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
@@ -17,6 +17,8 @@ CheckOptions:
value: '7'
- key: readability-function-size.NestingThreshold
value: '6'
+ - key: readability-function-size.VariableThreshold
+ value: '30'
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
value: '1'
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
@@ -31,6 +33,8 @@ CheckOptions:
value: 'h,hh,hpp,hxx,'
- key: misc-definitions-in-headers.UseHeaderFileExtension
value: '1'
+ - key: modernize-use-auto.MinTypeNameLength
+ value: '0'
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: google-runtime-references.WhiteListTypes
diff --git a/src/external/rawspeed/.travis.yml b/src/external/rawspeed/.travis.yml
index 4dcf259d7..559d8f061 100644
--- a/src/external/rawspeed/.travis.yml
+++ b/src/external/rawspeed/.travis.yml
@@ -88,13 +88,13 @@ jobs:
sudo: required
services:
- docker
- env: CC=clang-5.0 CXX=clang++-5.0 TARGET=STATICANALYSIS
+ env: CC=clang-6.0 CXX=clang++-6.0 TARGET=STATICANALYSIS ECO="-DUSE_CLANG_TIDY=ON"
- os: linux
dist: trusty
sudo: required
services:
- docker
- env: CC=clang-5.0 CXX=clang++-5.0 ECO="-DWITH_PTHREADS=OFF"
+ env: CC=clang-6.0 CXX=clang++-6.0 ECO="-DWITH_PTHREADS=OFF"
- os: linux
dist: trusty
sudo: required
@@ -117,7 +117,7 @@ jobs:
sudo: required
services:
- docker
- env: CC=clang-5.0 CXX=clang++-5.0 TARGET=WWW
+ env: CC=clang-6.0 CXX=clang++-6.0 TARGET=WWW
# linux clang Coverage build OOM's in gcov during final codecov report collection
# OSX gcc Coverage build produces invalid .gcno files
@@ -146,7 +146,7 @@ script:
export CMD="$SRC_DIR/.ci/ci-script.sh";
if [[ "$TARGET" == "STATICANALYSIS" ]]; then
export TARGET="build";
- export CMD="scan-build-5.0 --use-cc=\"$CC\" --use-c++=\"$CXX\" --force-analyze-debug-code --status-bugs -disable-checker deadcode.DeadStores $CMD";
+ export CMD="scan-build-6.0 --use-cc=\"$CC\" --use-c++=\"$CXX\" --force-analyze-debug-code --status-bugs -disable-checker deadcode.DeadStores $CMD";
fi;
if [[ "$TARGET" == "SONARQUBE" ]]; then
export TARGET="build";
diff --git a/src/external/rawspeed/CMakeLists.txt b/src/external/rawspeed/CMakeLists.txt
index 931dab1c4..5d8638595 100644
--- a/src/external/rawspeed/CMakeLists.txt
+++ b/src/external/rawspeed/CMakeLists.txt
@@ -39,7 +39,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BINARY_PACKAGE_BUILD "Sets march optimization to generic" OFF)
-option(WITH_SSE2 "If SSE2 support is avaliable, do build SSE2 codepaths" ON)
+option(WITH_SSE2 "If SSE2 support is available, do build SSE2 codepaths" ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
option(RAWSPEED_USE_LIBCXX "(Clang only) Build using libc++ as the standard library." OFF)
diff --git a/src/external/rawspeed/README.rst b/src/external/rawspeed/README.rst
index 535697015..4f7ff7fdb 100644
--- a/src/external/rawspeed/README.rst
+++ b/src/external/rawspeed/README.rst
@@ -81,7 +81,7 @@ The main objectives were to make a very fast loader that worked for 75% of the c
RawSpeed is not at the moment a separate library, so you have to include it in your project directly.
Please see <http://rawspeed.org/> for documentation.
-Doxygen-generated documentation is avaliable at <http://rawspeed.org/doxygen>
+Doxygen-generated documentation is available at <http://rawspeed.org/doxygen>
Submitting Requests and Patches
--------------------------------------------------------------------------------
diff --git a/src/external/rawspeed/bench/librawspeed/interpolators/Cr2sRawInterpolatorBenchmark.cpp b/src/external/rawspeed/bench/librawspeed/interpolators/Cr2sRawInterpolatorBenchmark.cpp
index afef1354c..74fbe1ffd 100644
--- a/src/external/rawspeed/bench/librawspeed/interpolators/Cr2sRawInterpolatorBenchmark.cpp
+++ b/src/external/rawspeed/bench/librawspeed/interpolators/Cr2sRawInterpolatorBenchmark.cpp
@@ -75,4 +75,4 @@ static constexpr const iPoint2D S420(2, 2);
BENCHMARK_TEMPLATE(BM_Cr2sRawInterpolator, S420, v<1>)->Apply(CustomArguments);
BENCHMARK_TEMPLATE(BM_Cr2sRawInterpolator, S420, v<2>)->Apply(CustomArguments);
-BENCHMARK_MAIN();
+BENCHMARK_MAIN()
diff --git a/src/external/rawspeed/cmake/Modules/FindLLVMClangTidy.cmake b/src/external/rawspeed/cmake/Modules/FindLLVMClangTidy.cmake
index 311226fc8..019b20c3b 100644
--- a/src/external/rawspeed/cmake/Modules/FindLLVMClangTidy.cmake
+++ b/src/external/rawspeed/cmake/Modules/FindLLVMClangTidy.cmake
@@ -1,4 +1,4 @@
-find_program(CLANGTIDY_PATH NAMES clang-tidy clang-tidy-5.0 clang-tidy-4.0)
+find_program(CLANGTIDY_PATH NAMES clang-tidy clang-tidy-6.0)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LLVMClangTidy
diff --git a/src/external/rawspeed/cmake/Modules/FindLibFuzzingEngine.cmake b/src/external/rawspeed/cmake/Modules/FindLibFuzzingEngine.cmake
index b9a9ba393..d7c33fbdf 100644
--- a/src/external/rawspeed/cmake/Modules/FindLibFuzzingEngine.cmake
+++ b/src/external/rawspeed/cmake/Modules/FindLibFuzzingEngine.cmake
@@ -13,7 +13,7 @@ else()
endif()
# Set the include dir variables and the libraries and let libfind_process do the rest.
-# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+# NOTE: Singular variables for this library, plural for libraries this lib depends on.
set(LibFuzzingEngine_PROCESS_LIBS LibFuzzingEngine_LIBRARY)
libfind_process(LibFuzzingEngine)
diff --git a/src/external/rawspeed/cmake/Modules/FindPugixml.cmake b/src/external/rawspeed/cmake/Modules/FindPugixml.cmake
index 012a89c18..0b6b2d49b 100644
--- a/src/external/rawspeed/cmake/Modules/FindPugixml.cmake
+++ b/src/external/rawspeed/cmake/Modules/FindPugixml.cmake
@@ -24,7 +24,7 @@ elseif(Pugixml_INCLUDE_DIR)
endif()
# Set the include dir variables and the libraries and let libfind_process do the rest.
-# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+# NOTE: Singular variables for this library, plural for libraries this lib depends on.
set(Pugixml_PROCESS_INCLUDES Pugixml_INCLUDE_DIR)
set(Pugixml_PROCESS_LIBS Pugixml_LIBRARY)
libfind_process(Pugixml)
diff --git a/src/external/rawspeed/cmake/OpenMP.cmake b/src/external/rawspeed/cmake/OpenMP.cmake
index 099fb6ce8..e9902f603 100644
--- a/src/external/rawspeed/cmake/OpenMP.cmake
+++ b/src/external/rawspeed/cmake/OpenMP.cmake
@@ -20,4 +20,4 @@ if(WITH_OPENMP)
else()
message(STATUS "OpenMP is disabled, utilities will not use openmp-based parallelization")
endif()
-add_feature_info("OpenMP-based utilites threading" HAVE_OPENMP "used for parallelization of utilities only, NOT library!")
+add_feature_info("OpenMP-based utilities threading" HAVE_OPENMP "used for parallelization of utilities only, NOT library!")
diff --git a/src/external/rawspeed/cmake/build-type.cmake b/src/external/rawspeed/cmake/build-type.cmake
index cb57d610a..c04263c5d 100644
--- a/src/external/rawspeed/cmake/build-type.cmake
+++ b/src/external/rawspeed/cmake/build-type.cmake
@@ -20,7 +20,7 @@ endif(NOT CMAKE_BUILD_TYPE)
# yes, these build types need to be specified here in upper-case.
set(SPECIAL_BUILD_TYPES COVERAGE SANITIZE TSAN FUZZ)
set(CMAKE_CONFIGURATION_TYPES DEBUG RELWITHDEBINFO RELEASE ${SPECIAL_BUILD_TYPES})
-set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "All the avaliable build types" FORCE)
+set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "All the available build types" FORCE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}." FORCE )
diff --git a/src/external/rawspeed/cmake/compiler-versions.cmake b/src/external/rawspeed/cmake/compiler-versions.cmake
index b0fffe384..c3458e905 100644
--- a/src/external/rawspeed/cmake/compiler-versions.cmake
+++ b/src/external/rawspeed/cmake/compiler-versions.cmake
@@ -8,12 +8,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_L
message(FATAL_ERROR "GNU C++ compiler version ${CMAKE_CXX_COMPILER_VERSION} is too old. Need 5.0+")
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- message(FATAL_ERROR "LLVM Clang C compiler version ${CMAKE_C_COMPILER_VERSION} is too old. Need 3.4+")
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 3.5)
+ message(FATAL_ERROR "LLVM Clang C compiler version ${CMAKE_C_COMPILER_VERSION} is too old. Need 3.5+")
endif()
-if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
- message(FATAL_ERROR "LLVM Clang C++ compiler version ${CMAKE_CXX_COMPILER_VERSION} is too old. Need 3.4+")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+ message(FATAL_ERROR "LLVM Clang C++ compiler version ${CMAKE_CXX_COMPILER_VERSION} is too old. Need 3.5+")
endif()
# if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
diff --git a/src/external/rawspeed/cmake/compiler-warnings-clang.cmake b/src/external/rawspeed/cmake/compiler-warnings-clang.cmake
index 55a275773..aee1873eb 100644
--- a/src/external/rawspeed/cmake/compiler-warnings-clang.cmake
+++ b/src/external/rawspeed/cmake/compiler-warnings-clang.cmake
@@ -29,6 +29,11 @@ set (CLANG_DISABLED_WARNING_FLAGS
"zero-as-null-pointer-constant" # temporary
)
+# Yes, these have to be *re-enabled* after CLANG_DISABLED_WARNING_FLAGS.
+set (CLANG_REENABLED_WARNING_FLAGS
+ "extra-semi"
+)
+
set(CMAKE_REQUIRED_FLAGS_ORIG "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "-c -Wunreachable-code -Werror=unreachable-code")
# see https://reviews.llvm.org/D25321
@@ -60,3 +65,7 @@ endforeach()
foreach(warning ${CLANG_DISABLED_WARNING_FLAGS})
CHECK_CXX_COMPILER_FLAG_AND_ENABLE_IT(-Wno-${warning})
endforeach()
+
+foreach(warning ${CLANG_REENABLED_WARNING_FLAGS})
+ CHECK_CXX_COMPILER_FLAG_AND_ENABLE_IT(-W${warning})
+endforeach()
diff --git a/src/external/rawspeed/cmake/gcc-gcov.cmake b/src/external/rawspeed/cmake/gcc-gcov.cmake
index bd4f0e8f8..af4b8a1d9 100644
--- a/src/external/rawspeed/cmake/gcc-gcov.cmake
+++ b/src/external/rawspeed/cmake/gcc-gcov.cmake
@@ -17,7 +17,7 @@ find_package(Find REQUIRED)
set(GCOV_OPTS "-pb")
if(NOT APPLE)
- # DONT elide source prefix.
+ # DON'T elide source prefix.
set(GCOV_OPTS ${GCOV_OPTS} -aflu)
endif()
@@ -29,7 +29,7 @@ add_custom_target(
USES_TERMINAL
)
-# DONT remove *.gcov files here!
+# DON'T remove *.gcov files here!
add_custom_target(
gcov-clean
COMMAND "${FIND_PATH}" "${CMAKE_BINARY_DIR}" -type f -name '*.gcda' -delete > /dev/null
diff --git a/src/external/rawspeed/data/cameras.xml b/src/external/rawspeed/data/cameras.xml
index 9870ee732..89e012a07 100644
--- a/src/external/rawspeed/data/cameras.xml
+++ b/src/external/rawspeed/data/cameras.xml
@@ -4294,6 +4294,17 @@
<Crop x="8" y="8" width="-24" height="-8"/>
<Sensor black="0" white="4095"/>
</Camera>
+ <Camera make="OLYMPUS CORPORATION" model="E-PL9">
+ <ID make="Olympus" model="E-PL9">Olympus E-PL9</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">RED</Color>
+ <Color x="1" y="0">GREEN</Color>
+ <Color x="0" y="1">GREEN</Color>
+ <Color x="1" y="1">BLUE</Color>
+ </CFA>
+ <Crop x="8" y="8" width="-24" height="-8"/>
+ <Sensor black="248" white="4000"/>
+ </Camera>
<Camera make="OLYMPUS IMAGING CORP." model="E-P5">
<ID make="Olympus" model="E-P5">Olympus E-P5</ID>
<CFA width="2" height="2">
@@ -7265,6 +7276,28 @@
<Crop x="0" y="0" width="-58" height="0"/>
<Sensor black="148" white="4095"/>
</Camera>
+ <Camera make="Panasonic" model="DC-GX9">
+ <ID make="Panasonic" model="DC-GX9">Panasonic DC-GX9</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">BLUE</Color>
+ <Color x="1" y="0">GREEN</Color>
+ <Color x="0" y="1">GREEN</Color>
+ <Color x="1" y="1">RED</Color>
+ </CFA>
+ <Crop x="0" y="0" width="-66" height="0"/>
+ <Sensor black="143" white="4095"/>
+ </Camera>
+ <Camera make="Panasonic" model="DC-GX9" mode="4:3">
+ <ID make="Panasonic" model="DC-GX9">Panasonic DC-GX9</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">BLUE</Color>
+ <Color x="1" y="0">GREEN</Color>
+ <Color x="0" y="1">GREEN</Color>
+ <Color x="1" y="1">RED</Color>
+ </CFA>
+ <Crop x="0" y="0" width="-66" height="0"/>
+ <Sensor black="143" white="4095"/>
+ </Camera>
<Camera make="Panasonic" model="DC-TZ90">
<ID make="Panasonic" model="DC-TZ90">Panasonic DC-ZS70</ID>
<CFA width="2" height="2">
@@ -8027,6 +8060,17 @@
<Vertical x="6032" width="14"/>
</BlackAreas>
</Camera>
+ <Camera make="SONY" model="DSC-RX1RM2">
+ <ID make="Sony" model="DSC-RX1RM2">Sony DSC-RX1RM2</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">RED</Color>
+ <Color x="1" y="0">GREEN</Color>
+ <Color x="0" y="1">GREEN</Color>
+ <Color x="1" y="1">BLUE</Color>
+ </CFA>
+ <Crop x="0" y="0" width="-40" height="0"/>
+ <Sensor black="512" white="16300"/>
+ </Camera>
<Camera make="SONY" model="DSLR-A100" decoder_version="1">
<ID make="Sony" model="DSLR-A100">Sony DSLR-A100</ID>
<CFA width="2" height="2">
@@ -8424,6 +8468,17 @@
<Crop x="0" y="0" width="-26" height="0"/>
<Sensor black="512" white="16300"/>
</Camera>
+ <Camera make="SONY" model="ILCE-7M3">
+ <ID make="Sony" model="ILCE-7M3">Sony ILCE-7M3</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">RED</Color>
+ <Color x="1" y="0">GREEN</Color>
+ <Color x="0" y="1">GREEN</Color>
+ <Color x="1" y="1">BLUE</Color>
+ </CFA>
+ <Crop x="0" y="0" width="0" height="0"/>
+ <Sensor black="512" white="16300"/>
+ </Camera>
<Camera make="SONY" model="ILCE-7R">
<ID make="Sony" model="ILCE-7R">Sony ILCE-7R</ID>
<CFA width="2" height="2">
@@ -9150,6 +9205,32 @@
<Crop x="4" y="0" width="-52" height="0"/>
<Sensor black="1024" white="16383"/>
</Camera>
+ <Camera make="FUJIFILM" model="X-H1">
+ <ID make="Fujifilm" model="X-H1">Fujifilm X-H1</ID>
+ <CFA2 width="6" height="6">
+ <ColorRow y="0">RBGBRG</ColorRow>
+ <ColorRow y="1">GGRGGB</ColorRow>
+ <ColorRow y="2">GGBGGR</ColorRow>
+ <ColorRow y="3">BRGRBG</ColorRow>
+ <ColorRow y="4">GGBGGR</ColorRow>
+ <ColorRow y="5">GGRGGB</ColorRow>
+ </CFA2>
+ <Crop x="0" y="0" width="-132" height="0"/>
+ <Sensor black="1024" white="16383"/>
+ </Camera>
+ <Camera make="FUJIFILM" model="X-H1" mode="compressed">
+ <ID make="Fujifilm" model="X-H1">Fujifilm X-H1</ID>
+ <CFA2 width="6" height="6">
+ <ColorRow y="0">GGRGGB</ColorRow>
+ <ColorRow y="1">GGBGGR</ColorRow>
+ <ColorRow y="2">BRGRBG</ColorRow>
+ <ColorRow y="3">GGBGGR</ColorRow>
+ <ColorRow y="4">GGRGGB</ColorRow>
+ <ColorRow y="5">RBGBRG</ColorRow>
+ </CFA2>
+ <Crop x="0" y="18" width="-18" height="-6"/>
+ <Sensor black="1024" white="16383"/>
+ </Camera>
<Camera make="FUJIFILM" model="X-M1">
<ID make="Fujifilm" model="X-M1">Fujifilm X-M1</ID>
<CFA2 width="6" height="6">
@@ -9685,6 +9766,17 @@
<Crop x="3" y="0" width="-3" height="0"/>
<Sensor black="19" white="7638"/>
</Camera>
+ <Camera make="KODAK" model="EOSDCS3C FILE VERSION 3">
+ <ID make="Kodak" model="EOS DCS 3">Kodak EOSDCS3</ID>
+ <CFA width="2" height="2">
+ <Color x="0" y="0">GREEN</Color>
+ <Color x="1" y="0">RED</Color>
+ <Color x="0" y="1">BLUE</Color>
+ <Color x="1" y="1">GREEN</Color>
+ </CFA>
+ <Crop x="6" y="0" width="-6" height="0"/>
+ <Sensor black="0" white="7855"/>
+ </Camera>
<Camera make="EASTMAN KODAK COMPANY" model="KODAK P880 ZOOM DIGITAL CAMERA">
<ID make="Kodak" model="P880">Kodak P880</ID>
<CFA width="2" height="2">
diff --git a/src/external/rawspeed/fuzz/librawspeed/decompressors/Cr2Decompressor.cpp b/src/external/rawspeed/fuzz/librawspeed/decompressors/Cr2Decompressor.cpp
index 90ddc041e..f07a791b4 100644
--- a/src/external/rawspeed/fuzz/librawspeed/decompressors/Cr2Decompressor.cpp
+++ b/src/external/rawspeed/fuzz/librawspeed/decompressors/Cr2Decompressor.cpp
@@ -44,17 +44,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
rawspeed::RawImage mRaw(CreateRawImage(&bs));
- using slice_type = int;
- std::vector<slice_type> slicesWidths;
- const unsigned sliceCount = bs.getU32();
- bs.check(sliceCount, sizeof(slice_type));
- slicesWidths.reserve(sliceCount);
- std::generate_n(std::back_inserter(slicesWidths), sliceCount,
- [&bs]() -> slice_type { return bs.get<slice_type>(); });
+ using slice_type = rawspeed::ushort16;
+ const auto numSlices = bs.get<slice_type>();
+ const auto sliceWidth = bs.get<slice_type>();
+ const auto lastSliceWidth = bs.get<slice_type>();
+
+ const rawspeed::Cr2Slicing slicing(numSlices, sliceWidth, lastSliceWidth);
rawspeed::Cr2Decompressor c(bs, mRaw);
mRaw->createData();
- c.decode(std::move(slicesWidths));
+ c.decode(slicing);
mRaw->checkMemIsInitialized();
} catch (rawspeed::RawspeedException&) {
diff --git a/src/external/rawspeed/fuzz/librawspeed/fuzz/Common.cpp b/src/external/rawspeed/fuzz/librawspeed/fuzz/Common.cpp
index e98cc6c2f..6b92db812 100644
--- a/src/external/rawspeed/fuzz/librawspeed/fuzz/Common.cpp
+++ b/src/external/rawspeed/fuzz/librawspeed/fuzz/Common.cpp
@@ -46,7 +46,7 @@ rawspeed::RawImage CreateRawImage(rawspeed::ByteStream* bs) {
mRaw->isCFA = isCFA;
return mRaw;
-};
+}
rawspeed::ColorFilterArray CreateCFA(rawspeed::ByteStream* bs) {
assert(bs);
@@ -74,4 +74,4 @@ rawspeed::ColorFilterArray CreateCFA(rawspeed::ByteStream* bs) {
}
return cfa;
-};
+}
diff --git a/src/external/rawspeed/src/config.h.in b/src/external/rawspeed/src/config.h.in
index 05c8c6573..adde14a4b 100644
--- a/src/external/rawspeed/src/config.h.in
+++ b/src/external/rawspeed/src/config.h.in
@@ -1,7 +1,7 @@
/*
RawSpeed - RAW file decoder.
- Copyright (C) 2016-2017 Roman Lebedev
+ Copyright (C) 2016-2018 Roman Lebedev
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -40,7 +40,7 @@
#cmakedefine HAVE_CXX_THREAD_LOCAL
#cmakedefine HAVE_GCC_THREAD_LOCAL
-// which aligned memory allocation function is avaliable, if any?
+// which aligned memory allocation function is available, if any?
// only the first one found will be enabled
#cmakedefine HAVE_POSIX_MEMALIGN
#cmakedefine HAVE_ALIGNED_ALLOC
@@ -62,32 +62,3 @@
#ifndef __has_extension
#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif
-
-// see https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
-#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
-#include <sanitizer/asan_interface.h> // IWYU pragma: export
-#include <type_traits> // for remove_cv
-template <typename T> struct remove_all_const : std::remove_const<T> {};
-template <typename T> struct remove_all_const<T *> {
- using type = typename remove_all_const<T>::type *;
-};
-template <typename T> struct remove_all_const<T *const> {
- using type = typename remove_all_const<T>::type *;
-};
-#define ASAN_REGION_IS_POISONED(addr, size) \
- __asan_region_is_poisoned( \
- const_cast<remove_all_const<decltype(addr)>::type>(addr), /* NOLINT */ \
- (size))
-#else
-#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
-#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
-#define ASAN_REGION_IS_POISONED(addr, size) (0)
-#endif
-
-#if __has_feature(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
-#include <sanitizer/msan_interface.h> // IWYU pragma: export
-#define MSAN_MEM_IS_INITIALIZED(addr, size) \
- __msan_check_mem_is_initialized(addr, size)
-#else
-#define MSAN_MEM_IS_INITIALIZED(addr, size) (0)
-#endif
diff --git a/src/external/rawspeed/src/external/AddressSanitizer.h b/src/external/rawspeed/src/external/AddressSanitizer.h
new file mode 100644
index 000000000..8daf619fa
--- /dev/null
+++ b/src/external/rawspeed/src/external/AddressSanitizer.h
@@ -0,0 +1,87 @@
+/*
+ RawSpeed - RAW file decoder.
+
+ Copyright (C) 2018 Roman Lebedev
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#pragma once
+
+#include <cstddef> // for size_t
+
+// see http://clang.llvm.org/docs/LanguageExtensions.html
+#ifndef __has_feature // Optional of course.
+#define __has_feature(x) 0 // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_extension
+#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
+#endif
+
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+#include <sanitizer/asan_interface.h>
+#endif
+
+namespace rawspeed {
+
+struct ASan final {
+ // Do not instantiate.
+ ASan() = delete;
+ ASan(const ASan&) = delete;
+ ASan(ASan&&) = delete;
+ ASan& operator=(const ASan&) = delete;
+ ASan& operator=(ASan&&) = delete;
+ ~ASan() = delete;
+
+ // Marks memory region [addr, addr+size) as unaddressable.
+ static void PoisonMemoryRegion(void const volatile* addr, size_t size);
+ // Marks memory region [addr, addr+size) as addressable.
+ static void UnPoisonMemoryRegion(void const volatile* addr, size_t size);
+
+ // If at least one byte in [beg, beg+size) is poisoned, return true
+ // Otherwise return 0.
+ static bool RegionIsPoisoned(void const volatile* addr, size_t size);
+};
+
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+inline void ASan::PoisonMemoryRegion(void const volatile* addr, size_t size) {
+ __asan_poison_memory_region(addr, size);
+}
+inline void ASan::UnPoisonMemoryRegion(void const volatile* addr, size_t size) {
+ __asan_unpoison_memory_region(addr, size);
+}
+inline bool ASan::RegionIsPoisoned(void const volatile* addr, size_t size) {
+ auto* beg = const_cast<void*>(addr); // NOLINT
+ return nullptr != __asan_region_is_poisoned(beg, size);
+}
+#else
+inline void ASan::PoisonMemoryRegion(void const volatile* addr, size_t size) {
+ // If we are building without ASan, then there is no way to have a non-empty
+ // body of this function. It's better than to have a macros, or to use
+ // preprocessor in every place it is called.
+}
+inline void ASan::UnPoisonMemoryRegion(void const volatile* addr, size_t size) {
+ // If we are building without ASan, then there is no way to have a non-empty
+ // body of this function. It's better than to have a macros, or to use
+ // preprocessor in every place it is called.
+}
+inline bool ASan::RegionIsPoisoned(void const volatile* addr, size_t size) {
+ // If we are building without ASan, then there is no way to have a poisoned
+ // memory region.
+ return false;
+}
+#endif
+
+} // namespace rawspeed
diff --git a/src/external/rawspeed/src/external/MemorySanitizer.h b/src/external/rawspeed/src/external/MemorySanitizer.h
new file mode 100644
index 000000000..a0b7433e1
--- /dev/null
+++ b/src/external/rawspeed/src/external/MemorySanitizer.h
@@ -0,0 +1,67 @@
+/*
+ RawSpeed - RAW file decoder.
+
+ Copyright (C) 2018 Roman Lebedev
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#pragma once
+
+#include <cstddef> // for size_t
+
+// see http://clang.llvm.org/docs/LanguageExtensions.html
+#ifndef __has_feature // Optional of course.
+#define __has_feature(x) 0 // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_extension
+#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
+#endif
+
+#if __has_feature(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
+#include <sanitizer/msan_interface.h>
+#endif
+
+namespace rawspeed {
+
+struct MSan final {
+ // Do not instantiate.
+ MSan() = delete;
+ MSan(const MSan&) = delete;
+ MSan(MSan&&) = delete;
+ MSan& operator=(const MSan&) = delete;
+ MSan& operator=(MSan&&) = delete;
+ ~MSan() = delete;
+
+ /* Checks that memory range is fully initialized, and reports an error if it
+ * is not. */
+ static void CheckMemIsInitialized(const volatile void* addr, size_t size);
+};
+
+#if __has_feature(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
+inline void MSan::CheckMemIsInitialized(const volatile void* addr,
+ size_t size) {
+ __msan_check_mem_is_initialized(addr, size);
+}
+#else
+inline void MSan::CheckMemIsInitialized(const volatile void* addr,
+ size_t size) {
+ // If we are building without MSAN, then there is no way to have a non-empty
+ // body of this function. It's better than to have a macros, or to use
+ // preprocessor in every place it is called.
+}
+#endif
+
+} // namespace rawspeed
diff --git a/src/external/rawspeed/src/librawspeed/README.md b/src/external/rawspeed/src/librawspeed/README.md
index e23903f50..d48165c6d 100644
--- a/src/external/rawspeed/src/librawspeed/README.md
+++ b/src/external/rawspeed/src/librawspeed/README.md
@@ -228,7 +228,7 @@ If you enable this on the decoder before calling RawDecoder->decodeRaw(), you wi
### RawImage.mDitherScale
-This option will determine whether dither is applied when values are scaled to 16 bits. Dither is applied as a random value between "+-scalefactor/2". This will make it so that images with less number of bits/pixel doesn't have a big tendency for posterization, since values close to eachother will be spaced out a bit.
+This option will determine whether dither is applied when values are scaled to 16 bits. Dither is applied as a random value between "+-scalefactor/2". This will make it so that images with less number of bits/pixel doesn't have a big tendency for posterization, since values close to each other will be spaced out a bit.
Another way of putting it, is that if your camera saves 12 bit per pixel, when RawSpeed upscales this to 16 bits, the 4 "new" bits will be random instead of always the same value.
diff --git a/src/external/rawspeed/src/librawspeed/common/DngOpcodes.cpp b/src/external/rawspeed/src/librawspeed/common/DngOpcodes.cpp
index 7f10741cf..049ce3d3c 100644
--- a/src/external/rawspeed/src/librawspeed/common/DngOpcodes.cpp
+++ b/src/external/rawspeed/src/librawspeed/common/DngOpcodes.cpp
@@ -253,7 +253,7 @@ protected:
auto* src = reinterpret_cast<T*>(ri->getData(0, y));
// Add offset, so this is always first plane
src += firstPlane;
- // FIXME: is op() really supposed to recieve global image coordinates,
+ // FIXME: is op() really supposed to receive global image coordinates,
// and not [0..ROI.getHeight()-1][0..ROI.getWidth()-1] ?
for (auto x = ROI.getLeft(); x < ROI.getRight(); x += colPitch) {
for (auto p = 0U; p < planes; ++p)
@@ -527,8 +527,8 @@ DngOpcodes::DngOpcodes(const RawImage& ri, TiffEntry* entry) {
#endif
}
-// defined here as empty destrutor, otherwise we'd need a complete definition
-// of the the DngOpcode type in DngOpcodes.h
+// Defined here as empty destructor, otherwise we'd need a complete definition
+// of the DngOpcode type in DngOpcodes.h
DngOpcodes::~DngOpcodes() = default;
void DngOpcodes::applyOpCodes(const RawImage& ri) {
diff --git a/src/external/rawspeed/src/librawspeed/common/Memory.cpp b/src/external/rawspeed/src/librawspeed/common/Memory.cpp
index e110e44af..1f8350b3d 100644
--- a/src/external/rawspeed/src/librawspeed/common/Memory.cpp
+++ b/src/external/rawspeed/src/librawspeed/common/Memory.cpp
@@ -68,7 +68,7 @@ void* alignedMalloc(size_t size, size_t alignment) {
#elif defined(HAVE_ALIGNED_MALLOC)
ptr = _aligned_malloc(size, alignment);
#else
-#pragma message "No aligned malloc() implementation avaliable!"
+#pragma message "No aligned malloc() implementation available!"
assert(alignment <= alignof(std::max_align_t));
#ifdef __APPLE__
// apple malloc() aligns to 16 by default
diff --git a/src/external/rawspeed/src/librawspeed/common/RawImage.cpp b/src/external/rawspeed/src/librawspeed/common/RawImage.cpp
index 4b57eb124..de7a0e81e 100644
--- a/src/external/rawspeed/src/librawspeed/common/RawImage.cpp
+++ b/src/external/rawspeed/src/librawspeed/common/RawImage.cpp
@@ -20,6 +20,8 @@
#include "rawspeedconfig.h" // for WITH_SSE2
#include "common/RawImage.h"
+#include "AddressSanitizer.h" // for ASan::...
+#include "MemorySanitizer.h" // for MSan::CheckMemIsInitialized
#include "common/Memory.h" // for alignedFree, alignedMalloc...
#include "decoders/RawDecoderException.h" // for ThrowRDE, RawDecoderException
#include "io/IOException.h" // for IOException
@@ -131,7 +133,7 @@ void RawImageData::poisonPadding() {
getDataUncropped(uncropped_dim.x - 1, j) + bpp;
// and now poison the padding.
- ASAN_POISON_MEMORY_REGION(curr_line_end, padding);
+ ASan::PoisonMemoryRegion(curr_line_end, padding);
}
}
#else
@@ -152,7 +154,7 @@ void RawImageData::unpoisonPadding() {
getDataUncropped(uncropped_dim.x - 1, j) + bpp;
// and now unpoison the padding.
- ASAN_UNPOISON_MEMORY_REGION(curr_line_end, padding);
+ ASan::UnPoisonMemoryRegion(curr_line_end, padding);
}
}
#else
@@ -163,7 +165,6 @@ void RawImageData::unpoisonPadding() {
}
#endif
-#if __has_feature(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
void RawImageData::checkRowIsInitialized(int row) {
const auto rowsize = bpp * uncropped_dim.x;
@@ -171,16 +172,8 @@ void RawImageData::checkRowIsInitialized(int row) {
// and check that image line is initialized.
// do note that we are avoiding padding here.
- MSAN_MEM_IS_INITIALIZED(curr_line, rowsize);
+ MSan::CheckMemIsInitialized(curr_line, rowsize);
}
-#else
-void RawImageData::checkRowIsInitialized(int row) {
- // if we are building without MSAN, then there is no way to check whether
- // the image row was fully initialized. however, i think it is better to
- // have such an empty function rather than making this whole function not
- // exist in MSAN-less builds
-}
-#endif
#if __has_feature(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
void RawImageData::checkMemIsInitialized() {
@@ -189,10 +182,9 @@ void RawImageData::checkMemIsInitialized() {
}
#else
void RawImageData::checkMemIsInitialized() {
- // if we are building without MSAN, then there is no way to check whether
- // the image data was fully initialized. however, i think it is better to
- // have such an empty function rather than making this whole function not
- // exist in MSAN-less builds
+ // While we could use the same version for non-MSAN build, even though it
+ // does not do anything, i don't think it will be fully optimized away,
+ // the getDataUncropped() call may still be there. To be re-evaluated.
}
#endif
diff --git a/src/external/rawspeed/src/librawspeed/decoders/AbstractTiffDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/AbstractTiffDecoder.cpp
index 58c2b7686..8f840861b 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/AbstractTiffDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/AbstractTiffDecoder.cpp
@@ -38,7 +38,7 @@ const TiffIFD* AbstractTiffDecoder::getIFDWithLargestImage(TiffTag filter) const
uint32 width = res->getEntry(IMAGEWIDTH)->getU32();
for (auto ifd : ifds) {
TiffEntry* widthE = ifd->getEntry(IMAGEWIDTH);
- // guard agains random maker note entries with the same tag
+ // guard against random maker note entries with the same tag
if (widthE->count == 1 && widthE->getU32() > width) {
res = ifd;
width = widthE->getU32();
diff --git a/src/external/rawspeed/src/librawspeed/decoders/ArwDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/ArwDecoder.cpp
index 3a8ee0819..728e260ea 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/ArwDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/ArwDecoder.cpp
@@ -312,7 +312,7 @@ void ArwDecoder::ParseA100WB() {
len = bs.getU32();
bs.check(len);
if (!len)
- ThrowRDE("Found entry of zero lenght, corrupt.");
+ ThrowRDE("Found entry of zero length, corrupt.");
if (0x574247 != tag) { // WBG
// not the tag we are interested in, skip
diff --git a/src/external/rawspeed/src/librawspeed/decoders/Cr2Decoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/Cr2Decoder.cpp
index 5dfa6102f..ff5812c93 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/Cr2Decoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/Cr2Decoder.cpp
@@ -40,11 +40,9 @@
#include <cassert> // for assert
#include <memory> // for unique_ptr, allocator
#include <string> // for string, operator==
-#include <vector> // for vector
// IWYU pragma: no_include <ext/alloc_traits.h>
using std::string;
-using std::vector;
namespace rawspeed {
@@ -91,7 +89,10 @@ RawImage Cr2Decoder::decodeOldFormat() {
Cr2Decompressor l(bs, mRaw);
mRaw->createData();
- l.decode({width});
+
+ Cr2Slicing slicing(/*numSlices=*/1, /*sliceWidth=don't care*/ 0,
+ /*lastSliceWidth=*/width);
+ l.decode(slicing);
// deal with D2000 GrayResponseCurve
TiffEntry* curve = mRootIFD->getEntryRecursive(static_cast<TiffTag>(0x123));
@@ -129,7 +130,7 @@ RawImage Cr2Decoder::decodeNewFormat() {
mRaw->setCpp(componentsPerPixel);
mRaw->isCFA = (mRaw->getCpp() == 1);
- vector<int> s_width;
+ Cr2Slicing slicing;
// there are four cases:
// * there is a tag with three components,
// $ last two components are non-zero: all fine then.
@@ -148,10 +149,9 @@ RawImage Cr2Decoder::decodeNewFormat() {
if (cr2SliceEntry->getU16(1) != 0 && cr2SliceEntry->getU16(2) != 0) {
// first component can be either zero or non-zero, don't care
- s_width.reserve(1 + cr2SliceEntry->getU16(0));
- for (int i = 0; i < cr2SliceEntry->getU16(0); i++)
- s_width.emplace_back(cr2SliceEntry->getU16(1));
- s_width.emplace_back(cr2SliceEntry->getU16(2));
+ slicing = Cr2Slicing(/*numSlices=*/1 + cr2SliceEntry->getU16(0),
+ /*sliceWidth=*/cr2SliceEntry->getU16(1),
+ /*lastSliceWidth=*/cr2SliceEntry->getU16(2));
} else if (cr2SliceEntry->getU16(0) == 0 && cr2SliceEntry->getU16(1) == 0 &&
cr2SliceEntry->getU16(2) != 0) {
// PowerShot G16, PowerShot S120, let Cr2Decompressor guess.
@@ -169,7 +169,7 @@ RawImage Cr2Decoder::decodeNewFormat() {
Cr2Decompressor d(bs, mRaw);
mRaw->createData();
- d.decode(s_width);
+ d.decode(slicing);
if (mRaw->metadata.subsampling.x > 1 || mRaw->metadata.subsampling.y > 1)
sRawInterpolate();
diff --git a/src/external/rawspeed/src/librawspeed/decoders/DngDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/DngDecoder.cpp
index 0897ad574..80729b2cb 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/DngDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/DngDecoder.cpp
@@ -22,6 +22,7 @@
#include "decoders/DngDecoder.h"
#include "common/Common.h" // for uint32, writeLog
#include "common/DngOpcodes.h" // for DngOpcodes
+#include "common/NORangesSet.h" // for NORangesSet
#include "common/Point.h" // for iPoint2D, iRectan...
#include "common/RawspeedException.h" // for RawspeedException
#include "decoders/RawDecoderException.h" // for ThrowRDE, RawDeco...
@@ -292,6 +293,7 @@ void DngDecoder::decodeData(const TiffIFD* raw, uint32 sample_format) {
assert(slices.dsc.numTiles == offsets->count);
assert(slices.dsc.numTiles == counts->count);
+ NORangesSet<Buffer> tilesLegality;
for (auto n = 0U; n < slices.dsc.numTiles; n++) {
const auto offset = offsets->getU32(n);
const auto count = counts->getU32(n);
@@ -302,6 +304,9 @@ void DngDecoder::decodeData(const TiffIFD* raw, uint32 sample_format) {
ByteStream bs(mFile->getSubView(offset, count), 0,
mRootIFD->rootBuffer.getByteOrder());
+ if (!tilesLegality.emplace(bs).second)
+ ThrowTPE("Two tiles overlap. Raw corrupt!");
+
slices.slices.emplace_back(slices.dsc, n, bs);
}
@@ -309,6 +314,8 @@ void DngDecoder::decodeData(const TiffIFD* raw, uint32 sample_format) {
if (slices.slices.empty())
ThrowRDE("No valid slices found.");
+ // FIXME: should we sort the tiles, to linearize the input reading?
+
mRaw->createData();
slices.decompress();
diff --git a/src/external/rawspeed/src/librawspeed/decoders/IiqDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/IiqDecoder.cpp
index 7afa70f4f..027df1a3a 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/IiqDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/IiqDecoder.cpp
@@ -234,9 +234,9 @@ void IiqDecoder::DecodeStrip(const IiqStrip& strip, uint32 width,
for (; j < 5; j++) {
if (pump.getBits(1) != 0) {
if (col == 0)
- ThrowRDE("Can not initialize lenghts. Data is corrupt.");
+ ThrowRDE("Can not initialize lengths. Data is corrupt.");
- // else, we have previously initialized lenghts, so we are fine
+ // else, we have previously initialized lengths, so we are fine
break;
}
}
diff --git a/src/external/rawspeed/src/librawspeed/decoders/KdcDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/KdcDecoder.cpp
index 6c83d073a..53f962e7a 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/KdcDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/KdcDecoder.cpp
@@ -26,7 +26,7 @@
#include "decoders/RawDecoderException.h" // for RawDecoderExcept...
#include "decompressors/UncompressedDecompressor.h" // for UncompressedDeco...
#include "io/Buffer.h" // for Buffer
-#include "io/Endianness.h" // for Endiannes
+#include "io/Endianness.h" // for Endianness
#include "metadata/Camera.h" // for Hints
#include "parsers/TiffParserException.h" // for TiffParserException
#include "tiff/TiffEntry.h" // for TiffEntry
diff --git a/src/external/rawspeed/src/librawspeed/decoders/MrwDecoder.cpp b/src/external/rawspeed/src/librawspeed/decoders/MrwDecoder.cpp
index 5aa07ccf0..6e91d8062 100644
--- a/src/external/rawspeed/src/librawspeed/decoders/MrwDecoder.cpp
+++ b/src/external/rawspeed/src/librawspeed/decoders/MrwDecoder.cpp
@@ -79,7 +79,7 @@ void MrwDecoder::parseHeader() {
uint32 len = bs.getU32();
bs.check(len);
if (!len)
- ThrowRDE("Found entry of zero lenght, MRW is corrupt.");
+ ThrowRDE("Found entry of zero length, MRW is corrupt.");
const auto origPos = bs.getPosition();
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/AbstractParallelizedDecompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/AbstractParallelizedDecompressor.cpp
index bcf5ff8fe..7eb04a7f2 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/AbstractParallelizedDecompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/AbstractParallelizedDecompressor.cpp
@@ -43,7 +43,7 @@ void AbstractParallelizedDecompressor::decompressOne(uint32 pieces) const {
ThrowRDE("Too many errors encountered. Giving up. First Error:\n%s",
firstErr.c_str());
}
-};
+}
#ifdef HAVE_PTHREAD
void AbstractParallelizedDecompressor::startThreading(uint32 pieces) const {
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.cpp
index 02a53eced..e43a0ed54 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.cpp
@@ -55,12 +55,13 @@ void Cr2Decompressor::decodeScan()
if (predictorMode != 1)
ThrowRDE("Unsupported predictor mode.");
- if (slicesWidths.empty()) {
+ if (slicing.empty()) {
const int slicesWidth = frame.w * frame.cps;
if (slicesWidth > mRaw->dim.x)
ThrowRDE("Don't know slicing pattern, and failed to guess it.");
- slicesWidths.push_back(slicesWidth);
+ slicing = Cr2Slicing(/*numSlices=*/1, /*sliceWidth=don't care*/ 0,
+ /*lastSliceWidth=*/slicesWidth);
}
bool isSubSampled = false;
@@ -115,12 +116,12 @@ void Cr2Decompressor::decodeScan()
}
}
-void Cr2Decompressor::decode(std::vector<int> slicesWidths_)
-{
- slicesWidths = move(slicesWidths_);
- for (auto slicesWidth : slicesWidths) {
- if (slicesWidth <= 0)
- ThrowRDE("Bad slice width: %i", slicesWidth);
+void Cr2Decompressor::decode(const Cr2Slicing& slicing_) {
+ slicing = slicing_;
+ for (auto sliceId = 0; sliceId < slicing.numSlices; sliceId++) {
+ const auto sliceWidth = slicing.widthOfSlice(sliceId);
+ if (sliceWidth <= 0)
+ ThrowRDE("Bad slice width: %i", sliceWidth);
}
AbstractLJpegDecompressor::decode();
@@ -163,32 +164,28 @@ void Cr2Decompressor::decodeN_X_Y()
if (X_S_F == 2 && Y_S_F == 1)
{
// fix the inconsistent slice width in sRaw mode, ask Canon.
- for (auto& sliceWidth : slicesWidths)
- sliceWidth = sliceWidth * 3 / 2;
+ for (auto* width : {&slicing.sliceWidth, &slicing.lastSliceWidth})
+ *width = (*width) * 3 / 2;
}
- for (const auto& slicesWidth : slicesWidths) {
- if (slicesWidth > mRaw->dim.x)
+ for (const auto& width : {slicing.sliceWidth, slicing.lastSliceWidth}) {
+ if (width > mRaw->dim.x)
ThrowRDE("Slice is longer than image's height, which is unsupported.");
- if (slicesWidth % xStepSize != 0) {
+ if (width % xStepSize != 0) {
ThrowRDE("Slice width (%u) should be multiple of pixel group size (%u)",
- slicesWidth, xStepSize);
+ width, xStepSize);
}
}
- if (frame.h * std::accumulate(slicesWidths.begin(), slicesWidths.end(), 0) <
+ if (iPoint2D::area_type(frame.h) * slicing.totalWidth() <
mRaw->getCpp() * mRaw->dim.area())
ThrowRDE("Incorrrect slice height / slice widths! Less than image size.");
- // Do we have completely unneeded slices at the end? Drop them.
- while (frame.h *
- std::accumulate(slicesWidths.begin(), slicesWidths.end() - 1, 0) >=
- mRaw->getCpp() * mRaw->dim.area())
- slicesWidths.pop_back();
-
unsigned processedPixels = 0;
unsigned processedLineSlices = 0;
- for (unsigned sliceWidth : slicesWidths) {
+ for (auto sliceId = 0; sliceId < slicing.numSlices; sliceId++) {
+ const unsigned sliceWidth = slicing.widthOfSlice(sliceId);
+
assert(frame.h % yStepSize == 0);
for (unsigned y = 0; y < frame.h; y += yStepSize) {
// Fix for Canon 80D mraw format.
@@ -198,8 +195,8 @@ void Cr2Decompressor::decodeN_X_Y()
// Those would overflow, hence the break.
// see FIX_CANON_FRAME_VS_IMAGE_SIZE_MISMATCH
unsigned destY = processedLineSlices % mRaw->dim.y;
- unsigned destX =
- processedLineSlices / mRaw->dim.y * slicesWidths[0] / mRaw->getCpp();
+ unsigned destX = processedLineSlices / mRaw->dim.y *
+ slicing.widthOfSlice(0) / mRaw->getCpp();
if (destX >= static_cast<unsigned>(mRaw->dim.x))
break;
auto dest =
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.h b/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.h
index 07718ecf4..4607f3ed8 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.h
+++ b/src/external/rawspeed/src/librawspeed/decompressors/Cr2Decompressor.h
@@ -2,6 +2,7 @@
RawSpeed - RAW file decoder.
Copyright (C) 2017 Axel Waggershauser
+ Copyright (C) 2018 Roman Lebedev
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,28 +21,67 @@
#pragma once
+#include "common/Common.h" // ushort16
+#include "decoders/RawDecoderException.h" // for ThrowRDE
#include "decompressors/AbstractLJpegDecompressor.h" // for AbstractLJpegDe...
#include "io/Buffer.h" // for Buffer, Buffer:...
#include "io/ByteStream.h" // for ByteStream
-#include <vector> // for vector
+#include <cassert> // for assert
namespace rawspeed {
class RawImage;
-
+class Cr2Decompressor;
// Decompresses Lossless JPEGs, with 2-4 components and optional X/Y subsampling
+class Cr2Slicing {
+ int numSlices = 0;
+ int sliceWidth = 0;
+ int lastSliceWidth = 0;
+
+ friend class Cr2Decompressor;
+
+public:
+ Cr2Slicing() = default;
+
+ Cr2Slicing(ushort16 numSlices_, ushort16 sliceWidth_,
+ ushort16 lastSliceWidth_)
+ : numSlices(numSlices_), sliceWidth(sliceWidth_),
+ lastSliceWidth(lastSliceWidth_) {
+ if (numSlices < 1)
+ ThrowRDE("Bad slice count: %u", numSlices);
+ }
+
+ bool empty() const {
+ return 0 == numSlices && 0 == sliceWidth && 0 == lastSliceWidth;
+ }
+
+ unsigned widthOfSlice(int sliceId) const {
+ assert(sliceId >= 0);
+ assert(sliceId < numSlices);
+ if ((sliceId + 1) == numSlices)
+ return lastSliceWidth;
+ return sliceWidth;
+ }
+
+ unsigned totalWidth() const {
+ int width = 0;
+ for (auto sliceId = 0; sliceId < numSlices; sliceId++)
+ width += widthOfSlice(sliceId);
+ return width;
+ }
+};
+
class Cr2Decompressor final : public AbstractLJpegDecompressor
{
- // CR2 slices
- std::vector<int> slicesWidths;
+ Cr2Slicing slicing;
void decodeScan() override;
template<int N_COMP, int X_S_F, int Y_S_F> void decodeN_X_Y();
public:
Cr2Decompressor(const ByteStream& bs, const RawImage& img);
- void decode(std::vector<int> slicesWidths);
+ void decode(const Cr2Slicing& slicing);
};
} // namespace rawspeed
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/HuffmanTable.h b/src/external/rawspeed/src/librawspeed/decompressors/HuffmanTable.h
index 3e758e6a0..260df3814 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/HuffmanTable.h
+++ b/src/external/rawspeed/src/librawspeed/decompressors/HuffmanTable.h
@@ -183,7 +183,7 @@ public:
// store the code lengths in bits, valid values are 0..16
std::vector<uchar8> code_len; // index is just sequential number
- // store the codes themselfs (bit patterns found inside the stream)
+ // store the codes themselves (bit patterns found inside the stream)
std::vector<ushort16> codes; // index is just sequential number
assert(!nCodesPerLength.empty());
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/KodakDecompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/KodakDecompressor.cpp
index b7bf29d95..81388f8e3 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/KodakDecompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/KodakDecompressor.cpp
@@ -134,6 +134,6 @@ void KodakDecompressor::decompress() {
}
}
}
-};
+}
} // namespace rawspeed
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/NikonDecompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/NikonDecompressor.cpp
index d472985af..d8c0d7962 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/NikonDecompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/NikonDecompressor.cpp
@@ -58,9 +58,9 @@ std::vector<ushort16> NikonDecompressor::createCurve(ByteStream* metadata,
uint32 bitsPS, uint32 v0,
uint32 v1, uint32* split) {
// 'curve' will hold a peace wise linearly interpolated function.
- // there are 'csize' segements, each is 'step' values long.
+ // there are 'csize' segments, each is 'step' values long.
// the very last value is not part of the used table but necessary
- // to linearly interpolate the last segment, therefor the '+1/-1'
+ // to linearly interpolate the last segment, therefore the '+1/-1'
// size adjustments of 'curve'.
std::vector<ushort16> curve((1 << bitsPS & 0x7fff) + 1);
assert(curve.size() > 1);
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/SonyArw1Decompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/SonyArw1Decompressor.cpp
index 7328a3594..0d6bddc30 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/SonyArw1Decompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/SonyArw1Decompressor.cpp
@@ -84,6 +84,6 @@ void SonyArw1Decompressor::decompress(const ByteStream& input) const {
dest[x + y * pitch] = sum;
}
}
-};
+}
} // namespace rawspeed
diff --git a/src/external/rawspeed/src/librawspeed/decompressors/UncompressedDecompressor.cpp b/src/external/rawspeed/src/librawspeed/decompressors/UncompressedDecompressor.cpp
index 3f843fe92..962355784 100644
--- a/src/external/rawspeed/src/librawspeed/decompressors/UncompressedDecompressor.cpp
+++ b/src/external/rawspeed/src/librawspeed/decompressors/UncompressedDecompressor.cpp
@@ -78,7 +78,7 @@ int UncompressedDecompressor::bytesPerLine(int w, bool skips) {
if ((12 * w) % 8 != 0)
ThrowIOE("Bad image width");
- // Calulate expected bytes per line.
+ // Calculate expected bytes per line.
auto perline = (12 * w) / 8;
if (!skips)
diff --git a/src/external/rawspeed/src/librawspeed/io/BitStream.h b/src/external/rawspeed/src/librawspeed/io/BitStream.h
index be6146732..6c151e01d 100644
--- a/src/external/rawspeed/src/librawspeed/io/BitStream.h
+++ b/src/external/rawspeed/src/librawspeed/io/BitStream.h
@@ -39,7 +39,7 @@ namespace rawspeed {
struct BitStreamCacheBase
{
- uint64 cache = 0; // the acutal bits stored in the cache
+ uint64 cache = 0; // the actual bits stored in the cache
unsigned int fillLevel = 0; // bits left in cache
static constexpr unsigned Size = sizeof(cache)*8;
diff --git a/src/external/rawspeed/src/librawspeed/io/Buffer.cpp b/src/external/rawspeed/src/librawspeed/io/Buffer.cpp
index e80732506..0ce16b7df 100644
--- a/src/external/rawspeed/src/librawspeed/io/Buffer.cpp
+++ b/src/external/rawspeed/src/librawspeed/io/Buffer.cpp
@@ -21,11 +21,12 @@
#include "rawspeedconfig.h"
#include "io/Buffer.h"
-#include "common/Common.h" // for uchar8, roundUp
-#include "common/Memory.h" // for alignedFree, alignedMalloc
-#include "io/IOException.h" // for IOException (ptr only), ThrowIOE
-#include <cassert> // for assert
-#include <memory> // for unique_ptr
+#include "AddressSanitizer.h" // for ASan::RegionIsPoisoned
+#include "common/Common.h" // for uchar8, roundUp
+#include "common/Memory.h" // for alignedFree, alignedMalloc
+#include "io/IOException.h" // for IOException (ptr only), ThrowIOE
+#include <cassert> // for assert
+#include <memory> // for unique_ptr
using std::unique_ptr;
@@ -41,7 +42,7 @@ unique_ptr<uchar8, decltype(&alignedFree)> Buffer::Create(size_type size) {
if (!data)
ThrowIOE("Failed to allocate %uz bytes memory buffer.", size);
- assert(!ASAN_REGION_IS_POISONED(data.get(), size));
+ assert(!ASan::RegionIsPoisoned(data.get(), size));
return data;
}
@@ -57,9 +58,9 @@ Buffer::Buffer(unique_ptr<uchar8, decltype(&alignedFree)> data_,
data = data_.release();
if (!data)
- ThrowIOE("Memory buffer is nonexistant");
+ ThrowIOE("Memory buffer is nonexistent");
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
isOwner = true;
}
@@ -72,7 +73,7 @@ Buffer::~Buffer() {
Buffer& Buffer::operator=(Buffer&& rhs) noexcept {
if (this == &rhs) {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
return *this;
}
@@ -83,7 +84,7 @@ Buffer& Buffer::operator=(Buffer&& rhs) noexcept {
size = rhs.size;
isOwner = rhs.isOwner;
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
rhs.isOwner = false;
@@ -92,14 +93,14 @@ Buffer& Buffer::operator=(Buffer&& rhs) noexcept {
Buffer& Buffer::operator=(const Buffer& rhs) {
if (this == &rhs) {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
return *this;
}
Buffer unOwningTmp(rhs.data, rhs.size);
*this = std::move(unOwningTmp);
assert(!isOwner);
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
return *this;
}
diff --git a/src/external/rawspeed/src/librawspeed/io/Buffer.h b/src/external/rawspeed/src/librawspeed/io/Buffer.h
index 8576646d3..77e655e9d 100644
--- a/src/external/rawspeed/src/librawspeed/io/Buffer.h
+++ b/src/external/rawspeed/src/librawspeed/io/Buffer.h
@@ -22,13 +22,14 @@
#pragma once
#include "rawspeedconfig.h"
-#include "common/Common.h" // for uchar8, uint32, uint64
-#include "common/Memory.h" // for alignedFree
-#include "io/Endianness.h" // for getByteSwapped
-#include "io/IOException.h" // for ThrowIOE
-#include <algorithm> // for swap
-#include <cassert> // for assert
-#include <memory> // for unique_ptr
+#include "AddressSanitizer.h" // for ASan::RegionIsPoisoned
+#include "common/Common.h" // for uchar8, uint32, uint64
+#include "common/Memory.h" // for alignedFree
+#include "io/Endianness.h" // for getByteSwapped
+#include "io/IOException.h" // for ThrowIOE
+#include <algorithm> // for swap
+#include <cassert> // for assert
+#include <memory> // for unique_ptr
namespace rawspeed {
@@ -73,7 +74,7 @@ public:
// Allocates the memory
explicit Buffer(size_type size_) : Buffer(Create(size_), size_) {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
}
// creates buffer from owning unique_ptr
@@ -86,18 +87,18 @@ public:
static_assert(BUFFER_PADDING == 0, "please do make sure that you do NOT "
"call this function from YOUR code, and "
"then comment-out this assert.");
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
}
// creates a (non-owning) copy / view of rhs
Buffer(const Buffer& rhs) : data(rhs.data), size(rhs.size) {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
}
// Move data and ownership from rhs to this
Buffer(Buffer&& rhs) noexcept
: data(rhs.data), size(rhs.size), isOwner(rhs.isOwner) {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
rhs.isOwner = false;
}
@@ -122,13 +123,13 @@ public:
return getSubView(offset, newSize);
}
- // get pointer to memory at 'offset', make sure at least 'count' bytes are accessable
+ // get pointer to memory at 'offset', make sure at least 'count' bytes are accessible
const uchar8* getData(size_type offset, size_type count) const {
if (!isValid(offset, count))
ThrowIOE("Buffer overflow: image file may be truncated");
assert(data);
- assert(!ASAN_REGION_IS_POISONED(data + offset, count));
+ assert(!ASan::RegionIsPoisoned(data + offset, count));
return data + offset;
}
@@ -141,12 +142,12 @@ public:
// std begin/end iterators to allow for range loop
const uchar8* begin() const {
assert(data);
- assert(!ASAN_REGION_IS_POISONED(data, 0));
+ assert(!ASan::RegionIsPoisoned(data, 0));
return data;
}
const uchar8* end() const {
assert(data);
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
return data + size;
}
@@ -159,7 +160,7 @@ public:
}
inline size_type getSize() const {
- assert(!ASAN_REGION_IS_POISONED(data, size));
+ assert(!ASan::RegionIsPoisoned(data, size));
return size;
}
@@ -175,7 +176,7 @@ public:
};
/*
- * DataBuffer is a simple extention to Buffer. It knows about the byte order
+ * DataBuffer is a simple extension to Buffer. It knows about the byte order
* of its contents and can therefore provide save access to larger than
* byte sized data, like int, float, etc.
*/
diff --git a/src/external/rawspeed/src/librawspeed/io/ByteStream.h b/src/external/rawspeed/src/librawspeed/io/ByteStream.h
index ec53de032..a9613e59a 100644
--- a/src/external/rawspeed/src/librawspeed/io/ByteStream.h
+++ b/src/external/rawspeed/src/librawspeed/io/ByteStream.h
@@ -21,15 +21,15 @@
#pragma once
-#include "rawspeedconfig.h" // for ASAN_REGION_IS_POISONED
-#include "common/Common.h" // for uchar8, int32, uint32, ushort16, roundUp
-#include "common/Memory.h" // for alignedMalloc
-#include "io/Buffer.h" // for Buffer::size_type, Buffer, DataBuffer
-#include "io/Endianness.h" // for Endianness, Endianness::little
-#include "io/IOException.h" // for IOException (ptr only), ThrowIOE
-#include <cassert> // for assert
-#include <cstring> // for memcmp, memcpy
-#include <limits> // for numeric_limits
+#include "AddressSanitizer.h" // for ASan::RegionIsPoisoned
+#include "common/Common.h" // for uchar8, int32, uint32, ushort16, roundUp
+#include "common/Memory.h" // for alignedMalloc
+#include "io/Buffer.h" // for Buffer::size_type, Buffer, DataBuffer
+#include "io/Endianness.h" // for Endianness, Endianness::little
+#include "io/IOException.h" // for IOException (ptr only), ThrowIOE
+#include <cassert> // for assert
+#include <cstring> // for memcmp, memcpy
+#include <limits> // for numeric_limits
namespace rawspeed {
@@ -73,13 +73,13 @@ public:
inline size_type check(size_type bytes) const {
if (static_cast<uint64>(pos) + bytes > size)
ThrowIOE("Out of bounds access in ByteStream");
- assert(!ASAN_REGION_IS_POISONED(data + pos, bytes));
+ assert(!ASan::RegionIsPoisoned(data + pos, bytes));
return bytes;
}
inline size_type check(size_type nmemb, size_type size_) const {
if (size_ && nmemb > std::numeric_limits<size_type>::max() / size_)
- ThrowIOE("Integer overflow when calculating stream lenght");
+ ThrowIOE("Integer overflow when calculating stream length");
return check(nmemb * size_);
}
@@ -115,7 +115,7 @@ public:
}
inline ByteStream peekStream(size_type nmemb, size_type size_) const {
if (size_ && nmemb > std::numeric_limits<size_type>::max() / size_)
- ThrowIOE("Integer overflow when calculating stream lenght");
+ ThrowIOE("Integer overflow when calculating stream length");
return peekStream(nmemb * size_);
}
inline ByteStream getStream(size_type size_) {
@@ -125,7 +125,7 @@ public:
}
inline ByteStream getStream(size_type nmemb, size_type size_) {
if (size_ && nmemb > std::numeric_limits<size_type>::max() / size_)
- ThrowIOE("Integer overflow when calculating stream lenght");
+ ThrowIOE("Integer overflow when calculating stream length");
return getStream(nmemb * size_);
}
diff --git a/src/external/rawspeed/src/librawspeed/io/Endianness.h b/src/external/rawspeed/src/librawspeed/io/Endianness.h
index 728a1b830..777810767 100644
--- a/src/external/rawspeed/src/librawspeed/io/Endianness.h
+++ b/src/external/rawspeed/src/librawspeed/io/Endianness.h
@@ -102,7 +102,7 @@ template <typename T> inline T getByteSwapped(const void* data, bool bswap) {
// memory location converted to the native byte order of the host.
// 'BE' suffix: source byte order is known to be big endian
// 'LE' suffix: source byte order is known to be little endian
-// Note: these functions should be avoided if higher level acess from
+// Note: these functions should be avoided if higher level access from
// Buffer/DataBuffer classes is available.
template <typename T> inline T getBE(const void* data) {
diff --git a/src/external/rawspeed/src/utilities/rstest/MD5Benchmark.cpp b/src/external/rawspeed/src/utilities/rstest/MD5Benchmark.cpp
index d1009b2f9..eef07b0aa 100644
--- a/src/external/rawspeed/src/utilities/rstest/MD5Benchmark.cpp
+++ b/src/external/rawspeed/src/utilities/rstest/MD5Benchmark.cpp
@@ -50,4 +50,4 @@ static inline void CustomArguments(benchmark::internal::Benchmark* b) {
BENCHMARK(BM_MD5)->Apply(CustomArguments);
-BENCHMARK_MAIN();
+BENCHMARK_MAIN()
diff --git a/src/external/rawspeed/src/utilities/rstest/rstest.cpp b/src/external/rawspeed/src/utilities/rstest/rstest.cpp
index 6ddc0e801..c29658297 100644
--- a/src/external/rawspeed/src/utilities/rstest/rstest.cpp
+++ b/src/external/rawspeed/src/utilities/rstest/rstest.cpp
@@ -80,7 +80,6 @@ using rawspeed::TYPE_USHORT16;
using rawspeed::TYPE_FLOAT32;
using rawspeed::getU16BE;
using rawspeed::getU32LE;
-using rawspeed::isAligned;
using rawspeed::roundUp;
using rawspeed::RawspeedException;
@@ -292,21 +291,21 @@ void writePFM(const RawImage& raw, const string& fn) {
// the first byte after that \n will be aligned
const int paddedLen = roundUp(realLen, dataAlignment);
assert(paddedLen > len);
- assert(isAligned(paddedLen, dataAlignment));
+ assert(rawspeed::isAligned(paddedLen, dataAlignment));
// how much padding?
const int padding = paddedLen - realLen;
assert(padding >= 0);
- assert(isAligned(realLen + padding, dataAlignment));
+ assert(rawspeed::isAligned(realLen + padding, dataAlignment));
// and actually write padding + new line
len += fprintf(f.get(), "%0*i\n", padding, 0);
assert(paddedLen == len);
// did we write a multiple of an alignment value?
- assert(isAligned(len, dataAlignment));
+ assert(rawspeed::isAligned(len, dataAlignment));
assert(ftell(f.get()) == len);
- assert(isAligned(ftell(f.get()), dataAlignment));
+ assert(rawspeed::isAligned(ftell(f.get()), dataAlignment));
width *= raw->getCpp();
diff --git a/src/external/rawspeed/test/librawspeed/metadata/ColorFilterArrayTest.cpp b/src/external/rawspeed/test/librawspeed/metadata/ColorFilterArrayTest.cpp
index 5fecf66c6..abf28a273 100644
--- a/src/external/rawspeed/test/librawspeed/metadata/ColorFilterArrayTest.cpp
+++ b/src/external/rawspeed/test/librawspeed/metadata/ColorFilterArrayTest.cpp
@@ -80,7 +80,7 @@ TEST(ColorFilterArrayTestBasic, DISABLED_SetTooBigSize) {
ColorFilterArray cfa(iPoint2D(1, 1));
cfa.setSize({6, 8});
});
-};
+}
TEST(ColorFilterArrayTestBasic, ToDcraw) {
ASSERT_NO_THROW({
diff --git a/src/version_gen.c b/src/version_gen.c
index 4c3fd2dab..895267690 100644
--- a/src/version_gen.c
+++ b/src/version_gen.c
@@ -2,13 +2,13 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
- const char darktable_package_version[] = "2.4.2";
- const char darktable_package_string[] = PACKAGE_NAME " 2.4.2";
+ const char darktable_package_version[] = "2.4.3";
+ const char darktable_package_string[] = PACKAGE_NAME " 2.4.3";
const char darktable_last_commit_year[] = "2018";
#else
#define DT_MAJOR 2
#define DT_MINOR 4
- #define DT_PATCH 2
+ #define DT_PATCH 3
#define DT_N_COMMITS 0
#define LAST_COMMIT_YEAR "2018"
#endif