40#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
41#include <sanitizer/common_interface_defs.h>
47 bool uncorrectedRawValues_)
52 ThrowRDE(
"Unexpected component count / data type");
54 if (!
mRaw->dim.hasPositiveArea() ||
mRaw->dim.x % 4 != 0 ||
55 mRaw->dim.x > 4516 ||
mRaw->dim.y > 3012)
56 ThrowRDE(
"Unexpected image dimensions found: (%d; %d)",
mRaw->dim.x,
59 if (
bps != 10 &&
bps != 12)
74 static_assert(out.size() ==
segment_size,
"Wrong segment size");
76#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
78 __sanitizer_annotate_contiguous_container(out.begin(), out.end(), out.end(),
82 std::array<uint8_t, 2 * segment_size> blen;
86 for (
uint32_t i = 0; i < bsize; i += 2) {
88 blen[i] =
input.peekByte() & 15;
89 blen[i + 1] =
input.getByte() >> 4;
91 if ((bsize & 7) == 4) {
93 bitbuf += (
static_cast<int>(
input.getByte()));
96 for (
uint32_t i = 0; i < bsize; i++) {
101 for (
uint32_t j = 0; j < 32; j += 8) {
102 bitbuf +=
static_cast<int64_t
>(
static_cast<int>(
input.getByte()))
124 for (
int row = 0; row < out.
height(); row++) {
125 for (
int col = 0; col < out.
width();) {
130 std::array<int, 2> pred;
133 for (
int i = 0; i < len; ++i, ++col) {
134 pred[i & 1] +=
buf[i];
136 int value = pred[i & 1];
138 ThrowRDE(
"Value out of bounds %d (bps = %i)", value,
bps);
144 reinterpret_cast<std::byte*
>(&out(row, col)),
static int RAWSPEED_READNONE extend(uint32_t diff, uint32_t len)
int RAWSPEED_READONLY height() const
int RAWSPEED_READONLY width() const
KodakDecompressor(RawImage img, ByteStream bs, int bps, bool uncorrectedRawValues_)
segment decodeSegment(uint32_t bsize)
bool uncorrectedRawValues
static constexpr int segment_size
std::array< int16_t, segment_size > segment
constexpr RAWSPEED_READNONE Ttgt implicit_cast(Tsrc value)
constexpr bool RAWSPEED_READNONE isIntN(T value, unsigned int nBits)
void RAWSPEED_UNLIKELY_FUNCTION RAWSPEED_NOINLINE static char buf[bufSize]
constexpr RAWSPEED_READNONE T extractHighBits(T value, unsigned nBits, unsigned effectiveBitwidth=bitwidth< T >())