Squashed 'rtengine/libraw/' changes from 12b0e5d60..8afe44cd0

8afe44cd0 Snapshot 202502
29d9785c2 Do not apply canon metadata crop to DNG files
015b27fff Changelog updated
d1a27c26e Merge branch 'master' of git.lexa.ru:LibRaw
ca1368d8e check split_col/split_row values in phase_one_correct
fb23332a9 UINT32=>unsigned as defined in structure declaration
354bc2907 Revert "build: add handling of openmp library"
797ac1934 Merge pull request #680 from ssssota/remove-duplicated-camera
52421b19e fix: remove duplicated supported camera
ca57a1103 Merge pull request #679 from dlemstra/fix-profile-length
25bb86fe7 Merge pull request #678 from clan/openmp
591239482 Changelog updated
42fce9f8e Make sure the profile_length is the same size as the allocated memory.
f767a2fbe prevent OOB reads in phase_one_correct
638154a5b build: add handling of openmp library
bdd9e3436 Prevent out-of-bounds read in fuji 0xf00c tag parser
59cfa8b8a Prevent out-of-bounds read in fuji 0xf00c tag parser
3240fb21f Merge pull request #677 from ssssota/windows-makefile-invalid-indent
416912f43 build: fix indentation (8 spaces -> tab)
bf7a0346d Merge pull request #676 from lance5/master
6a0ef2483 [fix] use LIBRAW_OWN_SWAB control swab
816ab359b [feature] support android NDK 21
cc118c1c1 H265 and JPEG-XL thumbnails support for dcraw_make_mem_thumb
9bcb8a1d9 LIBRAW_CALLOC_RAWSTORE; replace for w/ memmove in dng_sdk glue
bf1a9140e panasonic decoder: limit load_flags to 0x4000
77a46b319 panasonic loader: zero buf to avoid uninitalized data leak
4f5a4cfb3 null-terminate xmp block
f9bb7d126 small allocations: replace malloc with calloc
70f511871 define NOMINMAX before including winsock2 in public header file => do not provide min/max maco
3772d1be2 Merge pull request #661 from nekopsykose/end
f2d1070f7 fix endian detection for ppc64le
47c7a2394 Ignore vendor crops for Fuji S6000/6500
17f16837e Prevent Sony-LJPEG decoder buffer overrun
9c9c04b44 Ensure SR2 block is fully read from file
d3cbbd0e9 4-component DNG-JPEG support
891630152 additional check for imgdata.color.WB_Coeffs index range
54c6af90b prevent possible imgdata.color.WBCT_Coeffs overrun
158e635e5 X100V color updated w/ actual data; X-T4 and X-Pro3 typo fixed
393dc925d Fuji X-T3x colormatrix: fixed typo
66a81c333 removed extra Pentax KP colordata
6475fd04b pass all images with wrong bayer filter data to vng_interpolate
fe2a7e2b7 Refuse images with colors==2
c2e8a908d additional offset checks in Sony metadata parser
c9facb4b7 Clean wrong aber values; allocate extra data to image to avoid overrun on specially crafted test images
83bf3ad5e Merge pull request #640 from Calandracas606/fix-clback-docs
c294e7075 fix the docs to properly reflect the size of cblack[LIBRAW_CBLACK_SIZE]
072eeaeb4 fixed integer overflow in largest frame selection code
e58e8e43a additional checked_buffer_t offset checks
73d6daa05 Check for negatife offset checked_buffer_t
0d011198b Oops. Forgot to increase version
a625a7d53 Merge pull request #633 from thesamesam/openmp
b396d92d8 README.md: removed unprintable symbols
9893eb825 README.md: update policy actualized to match libraw.org site
54fbe8f47 libraw_adjust_to_raw_inset_crop
2f75ef793 m4: update ax_openmp.m4 from autoconf-archive (8->14)

git-subtree-dir: rtengine/libraw
git-subtree-split: 8afe44cd0e96611ba3cb73779b83ad05e945634c
This commit is contained in:
Lawrence Lee
2025-03-23 15:05:07 -07:00
parent 4c61b7d3c3
commit 16e502f1c5
98 changed files with 2840 additions and 1457 deletions

View File

@@ -120,16 +120,19 @@ extern "C"
DllDef int libraw_raw2image(libraw_data_t *);
DllDef void libraw_free_image(libraw_data_t *);
/* version helpers */
DllDef const char *libraw_version();
DllDef int libraw_versionNumber();
DllDef const char *libraw_version(void);
DllDef int libraw_versionNumber(void);
/* Camera list */
DllDef const char **libraw_cameraList();
DllDef int libraw_cameraCount();
DllDef const char **libraw_cameraList(void);
DllDef int libraw_cameraCount(void);
/* helpers */
DllDef void libraw_set_exifparser_handler(libraw_data_t *,
exif_parser_callback cb,
void *datap);
DllDef void libraw_set_makernotes_handler(libraw_data_t *,
exif_parser_callback cb,
void *datap);
DllDef void libraw_set_dataerror_handler(libraw_data_t *, data_callback func,
void *datap);
DllDef void libraw_set_progress_handler(libraw_data_t *, progress_callback cb,
@@ -138,7 +141,8 @@ extern "C"
DllDef int libraw_get_decoder_info(libraw_data_t *lr,
libraw_decoder_info_t *d);
DllDef int libraw_COLOR(libraw_data_t *, int row, int col);
DllDef unsigned libraw_capabilities();
DllDef unsigned libraw_capabilities(void);
DllDef int libraw_adjust_to_raw_inset_crop(libraw_data_t *lr, unsigned mask, float maxcrop);
/* DCRAW compatibility */
DllDef int libraw_adjust_sizes_info_only(libraw_data_t *);
@@ -231,6 +235,11 @@ public:
callbacks.exifparser_data = data;
callbacks.exif_cb = cb;
}
void set_makernotes_handler(exif_parser_callback cb, void *data)
{
callbacks.makernotesparser_data = data;
callbacks.makernotes_cb = cb;
}
void set_dataerror_handler(data_callback func, void *data)
{
callbacks.datacb_data = data;
@@ -247,6 +256,10 @@ public:
void convertFloatToInt(float dmin = 4096.f, float dmax = 32767.f,
float dtarget = 16383.f);
/* Make/Model simplification */
static int simplify_make_model(unsigned *_maker_index, char *_make, unsigned _make_buf_size, char *_model, unsigned _model_buf_size);
/* helpers */
static unsigned capabilities();
static const char *version();

View File

@@ -29,14 +29,18 @@ it under the terms of the one of two licenses as you choose:
#endif
#ifndef LIBRAW_MAX_NONDNG_RAW_FILE_SIZE
#define LIBRAW_MAX_NONDNG_RAW_FILE_SIZE 2147483647ULL
#define LIBRAW_MAX_NONDNG_RAW_FILE_SIZE 2147483647LL
#endif
#ifndef LIBRAW_MAX_CR3_RAW_FILE_SIZE
#define LIBRAW_MAX_CR3_RAW_FILE_SIZE LIBRAW_MAX_NONDNG_RAW_FILE_SIZE
#endif
#ifndef LIBRAW_MAX_DNG_RAW_FILE_SIZE
#ifdef USE_DNGSDK
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 4294967295ULL
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 4294967295LL
#else
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 2147483647ULL
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 2147483647LL
#endif
#endif
@@ -474,6 +478,37 @@ enum LibRawImageAspects
LIBRAW_IMAGE_ASPECT_7to5 = (1000 * 7) / 5
};
/*
inch-based ID (diameter) -> diagonal, mm
ID diagonal aspect
1/4" 4.00 4:3
1/3.6" 5.00 4:3
1/3.4" 5.29 4:3
1/3.2" 5.62 4:3
1/3" 6.00 4:3
1/2.9" 6.20 4:3
1/2.7" 6.66 4:3
1/2.5" 7.19 4:3
1/2.4" 7.38 4:3
1/2.35" 7.54 4:3
1/2.33" 7.60 4:3
1/2.3" 7.70 4:3
1/2" 8.00 4:3
1/1.9" 8.42 4:3
1/1.8" 8.89 4:3
1/1.76" 9.09 4:3
1/1.75" 9.14 4:3
1/1.72" 9.30 4:3
1/1.7" 9.41 4:3
1/1.65" 9.69 4:3
1/1.63" 9.81 4:3
1/1.6" 10.00 4:3
2/3" 11.00 4:3
1" 15.86 3:2
4/3" 21.64 4:3
1.5" 23.36 4:3
*/
enum LibRaw_lens_focal_types
{
LIBRAW_FT_UNDEFINED = 0,
@@ -699,7 +734,9 @@ enum LibRaw_warnings
LIBRAW_WARN_RAWSPEED3_UNSUPPORTED = 1 << 22,
LIBRAW_WARN_RAWSPEED3_PROCESSED = 1 << 23,
LIBRAW_WARN_RAWSPEED3_NOTLISTED = 1 << 24,
LIBRAW_WARN_VENDOR_CROP_SUGGESTED = 1 << 25
LIBRAW_WARN_VENDOR_CROP_SUGGESTED = 1 << 25,
LIBRAW_WARN_DNG_NOT_PROCESSED = 1 << 26,
LIBRAW_WARN_DNG_NOT_PARSED = 1 << 27
};
enum LibRaw_exceptions
@@ -813,7 +850,9 @@ enum LibRaw_thumbnail_formats
enum LibRaw_image_formats
{
LIBRAW_IMAGE_JPEG = 1,
LIBRAW_IMAGE_BITMAP = 2
LIBRAW_IMAGE_BITMAP = 2,
LIBRAW_IMAGE_JPEGXL = 3,
LIBRAW_IMAGE_H265 = 4
};
#endif

View File

@@ -29,7 +29,18 @@ it under the terms of the one of two licenses as you choose:
#else /* __cplusplus */
#if defined _WIN32
#ifndef LIBRAW_NO_WINSOCK2
#ifdef NOMINMAX
#define LIBRAW_NO_UNDEF_NOMINMAX
#else
#define NOMINMAX
#endif
#include <winsock2.h>
#ifndef LIBRAW_NO_UNDEF_NOMINMAX
#undef NOMINMAX /* restore previous mode*/
#endif
#undef LIBRAW_NO_UNDEF_NOMINMAX
#endif
#endif
/* No unique_ptr on Apple ?? */
@@ -97,6 +108,8 @@ public:
virtual int eof() = 0;
virtual int jpeg_src(void *);
virtual void buffering_off() {}
virtual void buffering_on() {}
virtual bool is_buffered() { return false; }
/* reimplement in subclass to use parallel access in xtrans_load_raw() if
* OpenMP is not used */
virtual int lock() { return 1; } /* success */
@@ -209,6 +222,8 @@ public:
virtual ~LibRaw_bigfile_buffered_datastream();
virtual int valid();
virtual void buffering_off() { buffered = 0; }
virtual void buffering_on() { buffered = 1; }
virtual bool is_buffered() { return buffered; }
virtual int read(void *ptr, size_t size, size_t nmemb);
virtual int eof();
virtual int seek(INT64 o, int whence);
@@ -354,15 +369,20 @@ public:
{
if (parent_stream)
{
parent_buffered = parent_stream->is_buffered();
parent_stream->buffering_off();
off = parent_stream->tell();
parent_stream->seek(0UL, SEEK_SET); /* seek to start */
off = parent_stream->tell();
parent_stream->seek(0UL, SEEK_SET); /* seek to start */
}
}
~libraw_dng_stream()
{
if (parent_stream)
parent_stream->seek(off, SEEK_SET);
if (parent_stream)
{
if (parent_buffered)
parent_stream->buffering_on();
parent_stream->seek(off, SEEK_SET);
}
}
virtual uint64 DoGetLength()
{
@@ -384,6 +404,7 @@ private:
libraw_dng_stream &operator=(const libraw_dng_stream &stream);
LibRaw_abstract_datastream *parent_stream;
INT64 off;
bool parent_buffered;
};
#endif

View File

@@ -174,7 +174,7 @@ typedef struct
INT64 strip_offset, data_offset;
INT64 meta_offset;
INT64 exif_offset, exif_subdir_offset, ifd0_offset;
unsigned data_size;
INT64 data_size;
unsigned meta_length;
unsigned cr3_exif_length, cr3_ifd0_length;
unsigned thumb_misc;
@@ -228,11 +228,14 @@ struct decode
struct tiff_ifd_t
{
int t_width, t_height, bps, comp, phint, offset, t_flip, samples, bytes, extrasamples;
int t_width, t_height, bps, comp, phint, t_flip, samples, extrasamples;
INT64 offset, bytes;
int t_tile_width, t_tile_length, sample_format, predictor;
int rows_per_strip;
int *strip_offsets, strip_offsets_count;
int *strip_byte_counts, strip_byte_counts_count;
INT64 *strip_offsets;
int strip_offsets_count;
INT64 *strip_byte_counts;
int strip_byte_counts_count;
unsigned t_filters;
int t_vwidth, t_vheight, t_lm,t_tm;
int t_fuji_width;

View File

@@ -138,10 +138,10 @@ typedef unsigned long long UINT64;
int len, unsigned int ord, void *ifp,
INT64 base);
typedef void (*data_callback)(void *data, const char *file, const int offset);
typedef void (*data_callback)(void *data, const char *file, const INT64 offset);
DllDef void default_data_callback(void *data, const char *file,
const int offset);
const INT64 offset);
typedef int (*progress_callback)(void *data, enum LibRaw_progress stage,
int iteration, int expected);
@@ -157,8 +157,8 @@ typedef unsigned long long UINT64;
progress_callback progress_cb;
void *progresscb_data;
exif_parser_callback exif_cb;
void *exifparser_data;
exif_parser_callback exif_cb,makernotes_cb;
void *exifparser_data, *makernotesparser_data;
pre_identify_callback pre_identify_cb;
post_identify_callback post_identify_cb;
process_step_callback pre_subtractblack_cb, pre_scalecolors_cb,
@@ -515,6 +515,14 @@ typedef unsigned long long UINT64;
char PictureControlName [20];
char PictureControlBase [20];
unsigned ShotInfoVersion;
char ShotInfoFirmware [9];
unsigned BurstTable_0x0056_len;
uchar *BurstTable_0x0056;
ushort BurstTable_0x0056_ver;
ushort BurstTable_0x0056_gid;
uchar BurstTable_0x0056_fnum;
short MakernotesFlip;
double RollAngle; // positive is clockwise, CW
double PitchAngle; // positive is upwords
@@ -525,6 +533,10 @@ typedef unsigned long long UINT64;
{
char CameraType2[6];
ushort ValidBits;
// decoder data
unsigned tagX640, tagX641, tagX642, tagX643, tagX644, tagX645, tagX646, tagX647,
tagX648, tagX649, tagX650, tagX651, tagX652, tagX653;
//
int SensorCalibration[2];
ushort DriveMode[5];
ushort ColorSpace;
@@ -580,6 +592,7 @@ typedef unsigned long long UINT64;
int AFPointsInFocus_version;
unsigned AFPointsInFocus;
ushort FocusPosition;
uchar DynamicRangeExpansion[4]; /* if (DynamicRangeExpansion[1] > 0) BLE+=DynamicRangeExpansion[0] */
short AFAdjustment;
uchar AFPointMode;
uchar MultiExposure; /* last bit is not "1" if ME is not used */
@@ -740,6 +753,7 @@ typedef unsigned long long UINT64;
3350 ARW 2.3.5
4000 ARW 4.0
4010 ARW 4.0.1
5000 ARW 5.0
*/
char MetaVersion [16];
float AspectRatio;
@@ -767,7 +781,7 @@ typedef unsigned long long UINT64;
// Sony
// and aliases of the above
// DNG
long linear_max[4];
unsigned linear_max[4];
float fmaximum;
float fnorm;
@@ -1152,7 +1166,19 @@ private:
/* Byte order */
#if defined(__POWERPC__)
#if defined(__LITTLE_ENDIAN__)
#define LibRawBigEndian 0
#elif defined(__BIG_ENDIAN__)
#define LibRawBigEndian 1
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define LibRawBigEndian 0
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define LibRawBigEndian 1
#elif defined(__POWERPC__)
#define LibRawBigEndian 1
#elif defined(__INTEL__)
@@ -1164,19 +1190,9 @@ private:
#elif defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
#define LibRawBigEndian 0
#elif defined(__LITTLE_ENDIAN__)
#define LibRawBigEndian 0
#elif defined(__BIG_ENDIAN__)
#define LibRawBigEndian 1
#elif defined(_ARM_)
#define LibRawBigEndian 0
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define LibRawBigEndian 0
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define LibRawBigEndian 1
#else
#ifndef qXCodeRez
#error Unable to figure out byte order.

View File

@@ -21,11 +21,11 @@ it under the terms of the one of two licenses as you choose:
#define __VERSION_H
#define LIBRAW_MAJOR_VERSION 0
#define LIBRAW_MINOR_VERSION 21
#define LIBRAW_MINOR_VERSION 22
#define LIBRAW_PATCH_VERSION 0
#define LIBRAW_VERSION_TAIL Beta1
#define LIBRAW_VERSION_TAIL Devel202502
#define LIBRAW_SHLIB_CURRENT 23
#define LIBRAW_SHLIB_CURRENT 24
#define LIBRAW_SHLIB_REVISION 0
#define LIBRAW_SHLIB_AGE 0