Squashed 'rtengine/libraw/' changes from 1ef70158d..12b0e5d60

12b0e5d60 Snapshot 202403
a4c9b1981 loop parameters in remove_trailing_spaces
e231b01a4 CR3-Qstep table: avoid wrong 64-bit code generation
21368133a 0.21.2 release
a6f212a4a tag type => tag size mapping fixed
41506ef73 cubic_spline: better handling of non-integer data
17294b5fd extra metadata check in arq_load_raw
47d9dd8e2 Better incorrect data handling in cubic_spline
3baa51068 skip invalid pattern in xtrans_interpolate
eaf63bf5f Check HL recovery coeffs before processing
a14574080 limit wavelet denoise minimum size
4e597e4e9 Merge pull request #594 from pinotree/path_max
086dcb9a6 raw-identify: use fallback if PATH_MAX not available
0e105f9f8 additional check against corrupted ljpeg layout
0c8b68e9f Disable color conversion for Canon 16-bit thumbnails
cd1abd695 docs/changelog: explained the case when no thumbnail is found in specific file
6fffd414b rename swapXX to libraw_swapXX to avoid name conflict
af78ae48a Check against corrupted LJPEG header in Canon sRAW decoder
ba780e600 Limit embedded color profile allocation/read size
122bf7c5b Wrong alloc result check for 16-bit bitmap thumbnail
e6dd2709e check pana_data/buffer offset before use
ae2dc5884 Check P1 quadrant linearization coeff[15] against zero
f2998bacc avoid integer overflow in buffer space check
443b7fb51 prevent buffer overrun in buffer_datastream::scanf_one
35a6d3615 ensure correct T.tlength for 16b bitmap thumbnails(2)
b69ea8be5 ensure correct T.tlength for 16b bitmap thumbnails
2b6eca897 Do not run sraw decoder on (crafted) bayer files
68808b57f better striped thumbnails handling
9ab70f6dc do not set shrink flag for 3/4 component images
32425dd96 allow more decoders for fuji-rotated RAWs
REVERT: 1ef70158d 0.21.2 release
REVERT: 62f042366 tag type => tag size mapping fixed
REVERT: ee087e3fe cubic_spline: better handling of non-integer data
REVERT: af755b991 extra metadata check in arq_load_raw
REVERT: 0fadd8819 Better incorrect data handling in cubic_spline
REVERT: d7fb66053 skip invalid pattern in xtrans_interpolate
REVERT: d059ed280 Check HL recovery coeffs before processing
REVERT: 104730519 limit wavelet denoise minimum size
REVERT: cae09838e raw-identify: use fallback if PATH_MAX not available
REVERT: d6c677608 additional check against corrupted ljpeg layout
REVERT: 1001a6ac1 Disable color conversion for Canon 16-bit thumbnails
REVERT: a5130b01b docs/changelog: explained the case when no thumbnail is found in specific file
REVERT: 600c0c63d rename swapXX to libraw_swapXX to avoid name conflict
REVERT: 299c8a11b Check against corrupted LJPEG header in Canon sRAW decoder
REVERT: ec8671ad9 Limit embedded color profile allocation/read size
REVERT: 5229d5942 Wrong alloc result check for 16-bit bitmap thumbnail
REVERT: b278b775f check pana_data/buffer offset before use
REVERT: 7f4b8d3af Check P1 quadrant linearization coeff[15] against zero
REVERT: e942a7db6 avoid integer overflow in buffer space check
REVERT: f6a57cfb8 prevent buffer overrun in buffer_datastream::scanf_one
REVERT: 3e62ed304 ensure correct T.tlength for 16b bitmap thumbnails(2)
REVERT: 8e52d81cd ensure correct T.tlength for 16b bitmap thumbnails
REVERT: 8e1af15e2 Do not run sraw decoder on (crafted) bayer files
REVERT: 0ace959c2 better striped thumbnails handling
REVERT: 477e0719f do not set shrink flag for 3/4 component images
REVERT: c8efae6c5 allow more decoders for fuji-rotated RAWs

git-subtree-dir: rtengine/libraw
git-subtree-split: 12b0e5d60c57bb795382fda8494fc45f683550b8
This commit is contained in:
Lawrence Lee
2024-04-13 22:44:59 -07:00
parent de5f929378
commit 4c61b7d3c3
133 changed files with 4307 additions and 1939 deletions

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sat Mar 8, 2008
*
* LibRaw C++ interface
@@ -24,11 +24,6 @@ it under the terms of the one of two licenses as you choose:
#define _FILE_OFFSET_BITS 64
#endif
// Enable use old cinema cameras if USE_OLD_VIDEOCAMS defined
#ifdef USE_OLD_VIDEOCAMS
#define LIBRAW_OLD_VIDEO_SUPPORT
#endif
#ifndef LIBRAW_USE_DEPRECATED_IOSTREAMS_DATASTREAM
#define LIBRAW_NO_IOSTREAMS_DATASTREAM
#endif
@@ -378,7 +373,9 @@ protected:
int crxDecodePlane(void *, uint32_t planeNumber);
virtual void crxLoadFinalizeLoopE3(void *, int);
void crxConvertPlaneLineDf(void *, int);
/* Panasonic Compression 8 parallel decoder stubs*/
virtual void pana8_decode_loop(void*);
int pana8_decode_strip(void*, int); // return: 0 if OK, non-zero on error
int FCF(int row, int col)
{
int rr, cc;
@@ -417,12 +414,7 @@ protected:
//void (LibRaw::*thumb_load_raw)();
void (LibRaw::*pentax_component_load_raw)();
void kodak_thumb_loader();
void write_thumb_ppm_tiff(FILE *);
#ifdef USE_X3FTOOLS
void x3f_thumb_loader();
INT64 x3f_thumb_size();
#endif
int own_filtering_supported() { return 0; }
void identify();

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw_alloc.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sat Mar 22, 2008
*
* LibRaw C++ interface

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw_const.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sat Mar 8 , 2008
* LibRaw error codes
LibRaw is free software; you can redistribute it and/or modify
@@ -119,7 +119,8 @@ enum LibRaw_As_Shot_WB_Applied_codes
LIBRAW_ASWB_CANON = 2,
LIBRAW_ASWB_NIKON = 4,
LIBRAW_ASWB_NIKON_SRAW = 8,
LIBRAW_ASWB_PENTAX = 16
LIBRAW_ASWB_PENTAX = 16,
LIBRAW_ASWB_SONY = 32
};
#define tagtypeIs(typex) (type == typex)
@@ -288,6 +289,7 @@ enum LibRaw_colorspace {
LIBRAW_COLORSPACE_CameraGamma,
LIBRAW_COLORSPACE_MonochromeLinear,
LIBRAW_COLORSPACE_MonochromeGamma,
LIBRAW_COLORSPACE_Rec2020,
LIBRAW_COLORSPACE_Unknown = 255
};
@@ -540,7 +542,8 @@ enum LibRaw_Sony_0x9050_Type {
LIBRAW_SONY_Tag9050None = 0,
LIBRAW_SONY_Tag9050a,
LIBRAW_SONY_Tag9050b,
LIBRAW_SONY_Tag9050c
LIBRAW_SONY_Tag9050c,
LIBRAW_SONY_Tag9050d
};
enum LIBRAW_SONY_FOCUSMODEmodes
@@ -639,7 +642,8 @@ enum LibRaw_processing_options
LIBRAW_RAWOPTIONS_DNG_STAGE2_IFPRESENT = 1 << 20,
LIBRAW_RAWOPTIONS_DNG_STAGE3_IFPRESENT = 1 << 21,
LIBRAW_RAWOPTIONS_DNG_ADD_MASKS = 1 << 22,
LIBRAW_RAWOPTIONS_CANON_IGNORE_MAKERNOTES_ROTATION = 1 << 23
LIBRAW_RAWOPTIONS_CANON_IGNORE_MAKERNOTES_ROTATION = 1 << 23,
LIBRAW_RAWOPTIONS_ALLOW_JPEGXL_PREVIEWS = 1 << 24
};
enum LibRaw_decoder_flags
@@ -682,9 +686,6 @@ enum LibRaw_warnings
LIBRAW_WARN_NO_BADPIXELMAP = 1 << 8,
LIBRAW_WARN_BAD_DARKFRAME_FILE = 1 << 9,
LIBRAW_WARN_BAD_DARKFRAME_DIM = 1 << 10,
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
LIBRAW_WARN_NO_JASPER = 1 << 11,
#endif
LIBRAW_WARN_RAWSPEED_PROBLEM = 1 << 12,
LIBRAW_WARN_RAWSPEED_UNSUPPORTED = 1 << 13,
LIBRAW_WARN_RAWSPEED_PROCESSED = 1 << 14,
@@ -697,7 +698,8 @@ enum LibRaw_warnings
LIBRAW_WARN_RAWSPEED3_PROBLEM = 1 << 21,
LIBRAW_WARN_RAWSPEED3_UNSUPPORTED = 1 << 22,
LIBRAW_WARN_RAWSPEED3_PROCESSED = 1 << 23,
LIBRAW_WARN_RAWSPEED3_NOTLISTED = 1 << 24
LIBRAW_WARN_RAWSPEED3_NOTLISTED = 1 << 24,
LIBRAW_WARN_VENDOR_CROP_SUGGESTED = 1 << 25
};
enum LibRaw_exceptions
@@ -791,6 +793,8 @@ enum LibRaw_internal_thumbnail_formats
LIBRAW_INTERNAL_THUMBNAIL_PPM,
LIBRAW_INTERNAL_THUMBNAIL_PPM16,
LIBRAW_INTERNAL_THUMBNAIL_X3F,
LIBRAW_INTERNAL_THUMBNAIL_DNG_YCBCR,
LIBRAW_INTERNAL_THUMBNAIL_JPEGXL
};
@@ -802,7 +806,8 @@ enum LibRaw_thumbnail_formats
LIBRAW_THUMBNAIL_BITMAP16 = 3,
LIBRAW_THUMBNAIL_LAYER = 4,
LIBRAW_THUMBNAIL_ROLLEI = 5,
LIBRAW_THUMBNAIL_H265 = 6
LIBRAW_THUMBNAIL_H265 = 6,
LIBRAW_THUMBNAIL_JPEGXL = 7
};
enum LibRaw_image_formats

View File

@@ -1,6 +1,6 @@
/* -*- C -*-
* File: libraw_datastream.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sun Jan 18 13:07:35 2009
*
* LibRaw Data stream interface
@@ -95,9 +95,6 @@ public:
virtual char *gets(char *, int) = 0;
virtual int scanf_one(const char *, void *) = 0;
virtual int eof() = 0;
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
virtual void *make_jas_stream() = 0;
#endif
virtual int jpeg_src(void *);
virtual void buffering_off() {}
/* reimplement in subclass to use parallel access in xtrans_load_raw() if
@@ -133,16 +130,12 @@ protected:
#ifdef LIBRAW_WIN32_UNICODEPATHS
std::wstring wfilename;
#endif
FILE *jas_file;
public:
virtual ~LibRaw_file_datastream();
LibRaw_file_datastream(const char *fname);
#ifdef LIBRAW_WIN32_UNICODEPATHS
LibRaw_file_datastream(const wchar_t *fname);
#endif
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
virtual void *make_jas_stream();
#endif
virtual int valid();
virtual int read(void *ptr, size_t size, size_t nmemb);
@@ -215,9 +208,6 @@ public:
#endif
virtual ~LibRaw_bigfile_buffered_datastream();
virtual int valid();
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
virtual void *make_jas_stream();
#endif
virtual void buffering_off() { buffered = 0; }
virtual int read(void *ptr, size_t size, size_t nmemb);
virtual int eof();
@@ -266,9 +256,6 @@ public:
LibRaw_buffer_datastream(const void *buffer, size_t bsize);
virtual ~LibRaw_buffer_datastream();
virtual int valid();
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
virtual void *make_jas_stream();
#endif
virtual int jpeg_src(void *jpegdata);
virtual int read(void *ptr, size_t sz, size_t nmemb);
virtual int eof();
@@ -297,10 +284,6 @@ public:
#endif
virtual ~LibRaw_bigfile_datastream();
virtual int valid();
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
virtual void *make_jas_stream();
#endif
virtual int read(void *ptr, size_t size, size_t nmemb);
virtual int eof();
virtual int seek(INT64 o, int whence);

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw_internal.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sat Mar 8 , 2008
*
* LibRaw internal data structures (not visible outside)
@@ -150,6 +150,22 @@ typedef struct
INT64 *chunk_offsets;
} crx_data_header_t;
typedef struct
{
uint32_t tag39[6];
uint16_t tag3A[6];
uint16_t tag3B;
uint16_t initial[4];
uint16_t tag40a[17], tag40b[17], tag41[17];
uint16_t stripe_count; // 0x42
uint16_t tag43;
INT64 stripe_offsets[5]; //0x44
uint16_t stripe_left[5]; // 0x45
uint32_t stripe_compressed_size[5]; //0x46
uint16_t stripe_width[5]; //0x47
uint16_t stripe_height[5];
} pana8_tags_t;
typedef struct
{
short order;
@@ -177,6 +193,7 @@ typedef struct
int fuji_total_lines, fuji_total_blocks, fuji_block_width, fuji_bits,
fuji_raw_type, fuji_lossless;
int pana_encoding, pana_bpp;
pana8_tags_t pana8;
crx_data_header_t crx_header[LIBRAW_CRXTRACKS_MAXCOUNT];
int crx_track_selected;
int crx_track_count;

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw_types.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Sat Mar 8 , 2008
*
* LibRaw C data structures
@@ -370,6 +370,8 @@ typedef unsigned long long UINT64;
ushort DRangePriority;
ushort DRangePriorityAuto;
ushort DRangePriorityFixed;
char FujiModel[32 + 1];
char FujiModel2[32 + 1];
/*
tag 0x9200, converted to BrightnessCompensation
@@ -509,6 +511,9 @@ typedef unsigned long long UINT64;
ushort SensorWidth;
ushort SensorHeight;
ushort Active_D_Lighting;
unsigned PictureControlVersion;
char PictureControlName [20];
char PictureControlBase [20];
unsigned ShotInfoVersion;
short MakernotesFlip;
double RollAngle; // positive is clockwise, CW
@@ -675,6 +680,9 @@ typedef unsigned long long UINT64;
ushort HDR[2];
ushort group2010;
ushort group9050;
ushort len_group9050; // currently, for debugging only
ushort real_iso_offset; // init in 0xffff
ushort MeteringMode_offset;
ushort ExposureProgram_offset;
@@ -731,8 +739,10 @@ typedef unsigned long long UINT64;
3330 ARW 2.3.3
3350 ARW 2.3.5
4000 ARW 4.0
4010 ARW 4.0.1
*/
char MetaVersion [16];
float AspectRatio;
} libraw_sony_info_t;
typedef struct
@@ -915,6 +925,7 @@ typedef unsigned long long UINT64;
float adjust_maximum_thr;
int no_auto_bright; /* -W */
int use_fuji_rotate; /* -j */
int use_p1_correction;
int green_matching;
/* DCB parameters */
int dcb_iterations;

View File

@@ -1,6 +1,6 @@
/* -*- C++ -*-
* File: libraw_version.h
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
* Copyright 2008-2024 LibRaw LLC (info@libraw.org)
* Created: Mon Sept 8, 2008
*
* LibRaw C++ interface
@@ -22,8 +22,8 @@ it under the terms of the one of two licenses as you choose:
#define LIBRAW_MAJOR_VERSION 0
#define LIBRAW_MINOR_VERSION 21
#define LIBRAW_PATCH_VERSION 2
#define LIBRAW_VERSION_TAIL Release
#define LIBRAW_PATCH_VERSION 0
#define LIBRAW_VERSION_TAIL Beta1
#define LIBRAW_SHLIB_CURRENT 23
#define LIBRAW_SHLIB_REVISION 0