Commit 0be266f9 authored by David Bremner's avatar David Bremner

Importing darktable_2.4.3.orig.tar.xz

parent ad674e77
......@@ -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")
......
......@@ -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 && \
......
---
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
......
......@@ -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";
......
......@@ -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)
......
......@@ -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
--------------------------------------------------------------------------------
......
......@@ -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()
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
......
......@@ -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)
......
......@@ -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)
......@@ -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!")
......@@ -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 )
......
......@@ -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)
......
......@@ -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()
......@@ -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
......
......@@ -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">
......
......@@ -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&) {
......
......@@ -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;
};
}
/*
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
/*
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
/*
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
......@@ -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.
......
......@@ -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) {
......
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -312,7 +312,7 @@ void ArwDecoder::ParseA100WB() {
len = bs.getU32();
bs.check(len);