Squashed 'rtengine/libraw/' content from commit cccb97647
git-subtree-dir: rtengine/libraw git-subtree-split: cccb97647fcee56801fa68231fa8a38aa8b52ef7
This commit is contained in:
534
libraw/libraw.h
Normal file
534
libraw/libraw.h
Normal file
@@ -0,0 +1,534 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 8, 2008
|
||||
*
|
||||
* LibRaw C++ interface
|
||||
*
|
||||
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _LIBRAW_CLASS_H
|
||||
#define _LIBRAW_CLASS_H
|
||||
|
||||
#ifdef __linux__
|
||||
#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
|
||||
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
/* maximum file size to use LibRaw_file_datastream (fully buffered) I/O */
|
||||
#define LIBRAW_USE_STREAMS_DATASTREAM_MAXSIZE (250 * 1024L * 1024L)
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
/* better WIN32 defines */
|
||||
|
||||
/* better WIN32 defines */
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
|
||||
/* Win32 API */
|
||||
# ifndef LIBRAW_WIN32_CALLS
|
||||
# define LIBRAW_WIN32_CALLS
|
||||
# endif
|
||||
|
||||
/* DLLs: Microsoft or Intel compiler */
|
||||
# if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
# ifndef LIBRAW_WIN32_DLLDEFS
|
||||
# define LIBRAW_WIN32_DLLDEFS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* wchar_t* API for std::filebuf */
|
||||
# if (defined(_MSC_VER) && (_MSC_VER > 1310)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 910))
|
||||
# ifndef LIBRAW_WIN32_UNICODEPATHS
|
||||
# define LIBRAW_WIN32_UNICODEPATHS
|
||||
# endif
|
||||
# elif _GLIBCXX_HAVE__WFOPEN && _GLIBCXX_USE_WCHAR_T
|
||||
# ifndef LIBRAW_WIN32_UNICODEPATHS
|
||||
# define LIBRAW_WIN32_UNICODEPATHS
|
||||
# endif
|
||||
# elif defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
|
||||
# ifndef LIBRAW_WIN32_UNICODEPATHS
|
||||
# define LIBRAW_WIN32_UNICODEPATHS
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "libraw_datastream.h"
|
||||
#include "libraw_types.h"
|
||||
#include "libraw_const.h"
|
||||
#include "libraw_internal.h"
|
||||
#include "libraw_alloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
DllDef const char *libraw_strerror(int errorcode);
|
||||
DllDef const char *libraw_strprogress(enum LibRaw_progress);
|
||||
/* LibRaw C API */
|
||||
DllDef libraw_data_t *libraw_init(unsigned int flags);
|
||||
DllDef int libraw_open_file(libraw_data_t *, const char *);
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
DllDef int libraw_open_file_ex(libraw_data_t *, const char *,
|
||||
INT64 max_buff_sz);
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
DllDef int libraw_open_wfile(libraw_data_t *, const wchar_t *);
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
DllDef int libraw_open_wfile_ex(libraw_data_t *, const wchar_t *,
|
||||
INT64 max_buff_sz);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DllDef int libraw_open_buffer(libraw_data_t *, const void *buffer, size_t size);
|
||||
DllDef int libraw_open_bayer(libraw_data_t *lr, unsigned char *data,
|
||||
unsigned datalen, ushort _raw_width,
|
||||
ushort _raw_height, ushort _left_margin,
|
||||
ushort _top_margin, ushort _right_margin,
|
||||
ushort _bottom_margin, unsigned char procflags,
|
||||
unsigned char bayer_battern,
|
||||
unsigned unused_bits, unsigned otherflags,
|
||||
unsigned black_level);
|
||||
DllDef int libraw_unpack(libraw_data_t *);
|
||||
DllDef int libraw_unpack_thumb(libraw_data_t *);
|
||||
DllDef int libraw_unpack_thumb_ex(libraw_data_t *,int);
|
||||
DllDef void libraw_recycle_datastream(libraw_data_t *);
|
||||
DllDef void libraw_recycle(libraw_data_t *);
|
||||
DllDef void libraw_close(libraw_data_t *);
|
||||
DllDef void libraw_subtract_black(libraw_data_t *);
|
||||
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();
|
||||
/* Camera list */
|
||||
DllDef const char **libraw_cameraList();
|
||||
DllDef int libraw_cameraCount();
|
||||
|
||||
/* helpers */
|
||||
DllDef void libraw_set_exifparser_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,
|
||||
void *datap);
|
||||
DllDef const char *libraw_unpack_function_name(libraw_data_t *lr);
|
||||
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();
|
||||
|
||||
/* DCRAW compatibility */
|
||||
DllDef int libraw_adjust_sizes_info_only(libraw_data_t *);
|
||||
DllDef int libraw_dcraw_ppm_tiff_writer(libraw_data_t *lr,
|
||||
const char *filename);
|
||||
DllDef int libraw_dcraw_thumb_writer(libraw_data_t *lr, const char *fname);
|
||||
DllDef int libraw_dcraw_process(libraw_data_t *lr);
|
||||
DllDef libraw_processed_image_t *
|
||||
libraw_dcraw_make_mem_image(libraw_data_t *lr, int *errc);
|
||||
DllDef libraw_processed_image_t *
|
||||
libraw_dcraw_make_mem_thumb(libraw_data_t *lr, int *errc);
|
||||
DllDef void libraw_dcraw_clear_mem(libraw_processed_image_t *);
|
||||
/* getters/setters used by 3DLut Creator */
|
||||
DllDef void libraw_set_demosaic(libraw_data_t *lr, int value);
|
||||
DllDef void libraw_set_output_color(libraw_data_t *lr, int value);
|
||||
DllDef void libraw_set_adjust_maximum_thr(libraw_data_t *lr, float value);
|
||||
DllDef void libraw_set_user_mul(libraw_data_t *lr, int index, float val);
|
||||
DllDef void libraw_set_output_bps(libraw_data_t *lr, int value);
|
||||
DllDef void libraw_set_gamma(libraw_data_t *lr, int index, float value);
|
||||
DllDef void libraw_set_no_auto_bright(libraw_data_t *lr, int value);
|
||||
DllDef void libraw_set_bright(libraw_data_t *lr, float value);
|
||||
DllDef void libraw_set_highlight(libraw_data_t *lr, int value);
|
||||
DllDef void libraw_set_fbdd_noiserd(libraw_data_t *lr, int value);
|
||||
DllDef int libraw_get_raw_height(libraw_data_t *lr);
|
||||
DllDef int libraw_get_raw_width(libraw_data_t *lr);
|
||||
DllDef int libraw_get_iheight(libraw_data_t *lr);
|
||||
DllDef int libraw_get_iwidth(libraw_data_t *lr);
|
||||
DllDef float libraw_get_cam_mul(libraw_data_t *lr, int index);
|
||||
DllDef float libraw_get_pre_mul(libraw_data_t *lr, int index);
|
||||
DllDef float libraw_get_rgb_cam(libraw_data_t *lr, int index1, int index2);
|
||||
DllDef int libraw_get_color_maximum(libraw_data_t *lr);
|
||||
DllDef void libraw_set_output_tif(libraw_data_t *lr, int value);
|
||||
DllDef libraw_iparams_t *libraw_get_iparams(libraw_data_t *lr);
|
||||
DllDef libraw_lensinfo_t *libraw_get_lensinfo(libraw_data_t *lr);
|
||||
DllDef libraw_imgother_t *libraw_get_imgother(libraw_data_t *lr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class DllDef LibRaw
|
||||
{
|
||||
public:
|
||||
libraw_data_t imgdata;
|
||||
|
||||
LibRaw(unsigned int flags = LIBRAW_OPTIONS_NONE);
|
||||
libraw_output_params_t *output_params_ptr() { return &imgdata.params; }
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
int open_file(const char *fname,
|
||||
INT64 max_buffered_sz = LIBRAW_USE_STREAMS_DATASTREAM_MAXSIZE);
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
int open_file(const wchar_t *fname,
|
||||
INT64 max_buffered_sz = LIBRAW_USE_STREAMS_DATASTREAM_MAXSIZE);
|
||||
#endif
|
||||
#else
|
||||
int open_file(const char *fname);
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
int open_file(const wchar_t *fname);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
int open_buffer(const void *buffer, size_t size);
|
||||
virtual int open_datastream(LibRaw_abstract_datastream *);
|
||||
virtual int open_bayer(const unsigned char *data, unsigned datalen,
|
||||
ushort _raw_width, ushort _raw_height,
|
||||
ushort _left_margin, ushort _top_margin,
|
||||
ushort _right_margin, ushort _bottom_margin,
|
||||
unsigned char procflags, unsigned char bayer_pattern,
|
||||
unsigned unused_bits, unsigned otherflags,
|
||||
unsigned black_level);
|
||||
int error_count() { return libraw_internal_data.unpacker_data.data_error; }
|
||||
void recycle_datastream();
|
||||
int unpack(void);
|
||||
int unpack_thumb(void);
|
||||
int unpack_thumb_ex(int);
|
||||
int thumbOK(INT64 maxsz = -1);
|
||||
int adjust_sizes_info_only(void);
|
||||
int subtract_black();
|
||||
int subtract_black_internal();
|
||||
int raw2image();
|
||||
int raw2image_ex(int do_subtract_black);
|
||||
void raw2image_start();
|
||||
void free_image();
|
||||
int adjust_maximum();
|
||||
int adjust_to_raw_inset_crop(unsigned mask, float maxcrop = 0.55f);
|
||||
void set_exifparser_handler(exif_parser_callback cb, void *data)
|
||||
{
|
||||
callbacks.exifparser_data = data;
|
||||
callbacks.exif_cb = cb;
|
||||
}
|
||||
void set_dataerror_handler(data_callback func, void *data)
|
||||
{
|
||||
callbacks.datacb_data = data;
|
||||
callbacks.data_cb = func;
|
||||
}
|
||||
void set_progress_handler(progress_callback pcb, void *data)
|
||||
{
|
||||
callbacks.progresscb_data = data;
|
||||
callbacks.progress_cb = pcb;
|
||||
}
|
||||
|
||||
static const char* cameramakeridx2maker(unsigned maker);
|
||||
int setMakeFromIndex(unsigned index);
|
||||
|
||||
void convertFloatToInt(float dmin = 4096.f, float dmax = 32767.f,
|
||||
float dtarget = 16383.f);
|
||||
/* helpers */
|
||||
static unsigned capabilities();
|
||||
static const char *version();
|
||||
static int versionNumber();
|
||||
static const char **cameraList();
|
||||
static int cameraCount();
|
||||
static const char *strprogress(enum LibRaw_progress);
|
||||
static const char *strerror(int p);
|
||||
/* dcraw emulation */
|
||||
int dcraw_ppm_tiff_writer(const char *filename);
|
||||
int dcraw_thumb_writer(const char *fname);
|
||||
int dcraw_process(void);
|
||||
/* information calls */
|
||||
int is_fuji_rotated()
|
||||
{
|
||||
return libraw_internal_data.internal_output_params.fuji_width;
|
||||
}
|
||||
int is_sraw();
|
||||
int sraw_midpoint();
|
||||
int is_nikon_sraw();
|
||||
int is_coolscan_nef();
|
||||
int is_jpeg_thumb();
|
||||
int is_floating_point();
|
||||
int have_fpdata();
|
||||
/* memory writers */
|
||||
virtual libraw_processed_image_t *dcraw_make_mem_image(int *errcode = NULL);
|
||||
virtual libraw_processed_image_t *dcraw_make_mem_thumb(int *errcode = NULL);
|
||||
static void dcraw_clear_mem(libraw_processed_image_t *);
|
||||
|
||||
/* Additional calls for make_mem_image */
|
||||
void get_mem_image_format(int *width, int *height, int *colors,
|
||||
int *bps) const;
|
||||
int copy_mem_image(void *scan0, int stride, int bgr);
|
||||
|
||||
/* free all internal data structures */
|
||||
void recycle();
|
||||
virtual ~LibRaw(void);
|
||||
|
||||
int COLOR(int row, int col)
|
||||
{
|
||||
if (!imgdata.idata.filters)
|
||||
return 6; /* Special value 0+1+2+3 */
|
||||
if (imgdata.idata.filters < 1000)
|
||||
return fcol(row, col);
|
||||
return libraw_internal_data.internal_output_params.fuji_width
|
||||
? FCF(row, col)
|
||||
: FC(row, col);
|
||||
}
|
||||
|
||||
int FC(int row, int col)
|
||||
{
|
||||
return (imgdata.idata.filters >> (((row << 1 & 14) | (col & 1)) << 1) & 3);
|
||||
}
|
||||
int fcol(int row, int col);
|
||||
|
||||
const char *unpack_function_name();
|
||||
virtual int get_decoder_info(libraw_decoder_info_t *d_info);
|
||||
libraw_internal_data_t *get_internal_data_pointer()
|
||||
{
|
||||
return &libraw_internal_data;
|
||||
}
|
||||
|
||||
static float powf_lim(float a, float b, float limup)
|
||||
{
|
||||
return (b > limup || b < -limup) ? 0.f : powf(a, b);
|
||||
}
|
||||
static float libraw_powf64l(float a, float b) { return powf_lim(a, b, 64.f); }
|
||||
|
||||
static unsigned sgetn(int n, uchar *s)
|
||||
{
|
||||
unsigned result = 0;
|
||||
while (n-- > 0)
|
||||
result = (result << 8) | (*s++);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Phase one correction/subtractBL calls */
|
||||
/* Returns libraw error code */
|
||||
|
||||
int phase_one_subtract_black(ushort *src, ushort *dest);
|
||||
int phase_one_correct();
|
||||
|
||||
int set_rawspeed_camerafile(char *filename);
|
||||
virtual void setCancelFlag();
|
||||
virtual void clearCancelFlag();
|
||||
virtual int adobe_coeff(unsigned, const char *, int internal_only = 0);
|
||||
|
||||
void set_dng_host(void *);
|
||||
|
||||
protected:
|
||||
static void *memmem(char *haystack, size_t haystacklen, char *needle,
|
||||
size_t needlelen);
|
||||
static char *strcasestr(char *h, const char *n);
|
||||
static size_t strnlen(const char *s, size_t n);
|
||||
|
||||
#ifdef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
int libraw_openfile_tail(LibRaw_abstract_datastream *stream);
|
||||
#endif
|
||||
|
||||
int is_curve_linear();
|
||||
void checkCancel();
|
||||
void cam_xyz_coeff(float _rgb_cam[3][4], double cam_xyz[4][3]);
|
||||
void phase_one_allocate_tempbuffer();
|
||||
void phase_one_free_tempbuffer();
|
||||
virtual int is_phaseone_compressed();
|
||||
virtual int is_canon_600();
|
||||
/* Hotspots */
|
||||
virtual void copy_fuji_uncropped(unsigned short cblack[4],
|
||||
unsigned short *dmaxp);
|
||||
virtual void copy_bayer(unsigned short cblack[4], unsigned short *dmaxp);
|
||||
virtual void fuji_rotate();
|
||||
virtual void convert_to_rgb_loop(float out_cam[3][4]);
|
||||
virtual void lin_interpolate_loop(int *code, int size);
|
||||
virtual void scale_colors_loop(float scale_mul[4]);
|
||||
|
||||
/* Fujifilm compressed decoder public interface (to make parallel decoder) */
|
||||
virtual void
|
||||
fuji_decode_loop(struct fuji_compressed_params *common_info, int count,
|
||||
INT64 *offsets, unsigned *sizes, uchar *q_bases);
|
||||
void fuji_decode_strip(struct fuji_compressed_params *info_common,
|
||||
int cur_block, INT64 raw_offset, unsigned size, uchar *q_bases);
|
||||
/* CR3 decoder public interface to make parallel decoder */
|
||||
virtual void crxLoadDecodeLoop(void *, int);
|
||||
int crxDecodePlane(void *, uint32_t planeNumber);
|
||||
virtual void crxLoadFinalizeLoopE3(void *, int);
|
||||
void crxConvertPlaneLineDf(void *, int);
|
||||
|
||||
int FCF(int row, int col)
|
||||
{
|
||||
int rr, cc;
|
||||
if (libraw_internal_data.unpacker_data.fuji_layout)
|
||||
{
|
||||
rr = libraw_internal_data.internal_output_params.fuji_width - 1 - col +
|
||||
(row >> 1);
|
||||
cc = col + ((row + 1) >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rr = libraw_internal_data.internal_output_params.fuji_width - 1 + row -
|
||||
(col >> 1);
|
||||
cc = row + ((col + 1) >> 1);
|
||||
}
|
||||
return FC(rr, cc);
|
||||
}
|
||||
|
||||
void adjust_bl();
|
||||
void *malloc(size_t t);
|
||||
void *calloc(size_t n, size_t t);
|
||||
void *realloc(void *p, size_t s);
|
||||
void free(void *p);
|
||||
void derror();
|
||||
|
||||
LibRaw_TLS *tls;
|
||||
libraw_internal_data_t libraw_internal_data;
|
||||
decode first_decode[2048], *second_decode, *free_decode;
|
||||
tiff_ifd_t tiff_ifd[LIBRAW_IFD_MAXCOUNT];
|
||||
libraw_memmgr memmgr;
|
||||
libraw_callbacks_t callbacks;
|
||||
|
||||
//void (LibRaw::*write_thumb)();
|
||||
void (LibRaw::*write_fun)();
|
||||
void (LibRaw::*load_raw)();
|
||||
//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();
|
||||
void initdata();
|
||||
unsigned parse_custom_cameras(unsigned limit, libraw_custom_camera_t table[],
|
||||
char **list);
|
||||
void write_ppm_tiff();
|
||||
void convert_to_rgb();
|
||||
void remove_zeroes();
|
||||
void crop_masked_pixels();
|
||||
#ifndef NO_LCMS
|
||||
void apply_profile(const char *, const char *);
|
||||
#endif
|
||||
void pre_interpolate();
|
||||
void border_interpolate(int border);
|
||||
void lin_interpolate();
|
||||
void vng_interpolate();
|
||||
void ppg_interpolate();
|
||||
void cielab(ushort rgb[3], short lab[3]);
|
||||
void xtrans_interpolate(int);
|
||||
void ahd_interpolate();
|
||||
void dht_interpolate();
|
||||
void aahd_interpolate();
|
||||
|
||||
void dcb(int iterations, int dcb_enhance);
|
||||
void fbdd(int noiserd);
|
||||
void exp_bef(float expos, float preser);
|
||||
|
||||
void bad_pixels(const char *);
|
||||
void subtract(const char *);
|
||||
void hat_transform(float *temp, float *base, int st, int size, int sc);
|
||||
void wavelet_denoise();
|
||||
void scale_colors();
|
||||
void median_filter();
|
||||
void blend_highlights();
|
||||
void recover_highlights();
|
||||
void green_matching();
|
||||
|
||||
void stretch();
|
||||
|
||||
void jpeg_thumb_writer(FILE *tfp, char *thumb, int thumb_length);
|
||||
#if 0
|
||||
void jpeg_thumb();
|
||||
void ppm_thumb();
|
||||
void ppm16_thumb();
|
||||
void layer_thumb();
|
||||
void rollei_thumb();
|
||||
#endif
|
||||
void kodak_thumb_load_raw();
|
||||
|
||||
unsigned get4();
|
||||
|
||||
int flip_index(int row, int col);
|
||||
void gamma_curve(double pwr, double ts, int mode, int imax);
|
||||
void cubic_spline(const int *x_, const int *y_, const int len);
|
||||
|
||||
/* RawSpeed data */
|
||||
void *_rawspeed_camerameta;
|
||||
void *_rawspeed_decoder;
|
||||
void *_rawspeed3_handle;
|
||||
void fix_after_rawspeed(int bl);
|
||||
int try_rawspeed(); /* returns LIBRAW_SUCCESS on success */
|
||||
/* Fast cancel flag */
|
||||
long _exitflag;
|
||||
|
||||
/* DNG SDK data */
|
||||
void *dnghost;
|
||||
void *dngnegative;
|
||||
void *dngimage;
|
||||
int valid_for_dngsdk();
|
||||
int try_dngsdk();
|
||||
/* X3F data */
|
||||
void *_x3f_data; /* keep it even if USE_X3FTOOLS is not defined to do not change sizeof(LibRaw)*/
|
||||
|
||||
int raw_was_read()
|
||||
{
|
||||
return imgdata.rawdata.raw_image || imgdata.rawdata.color4_image ||
|
||||
imgdata.rawdata.color3_image || imgdata.rawdata.float_image ||
|
||||
imgdata.rawdata.float3_image || imgdata.rawdata.float4_image;
|
||||
}
|
||||
|
||||
#ifdef LIBRAW_LIBRARY_BUILD
|
||||
#include "internal/libraw_internal_funcs.h"
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef LIBRAW_LIBRARY_BUILD
|
||||
ushort libraw_sget2_static(short _order, uchar *s);
|
||||
unsigned libraw_sget4_static(short _order, uchar *s);
|
||||
int libraw_tagtype_dataunit_bytes(int tagtype);
|
||||
double libraw_sgetreal_static(short _order, int type, uchar *s);
|
||||
float libraw_int_to_float (int i);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LIBRAW_LIBRARY_BUILD
|
||||
#define RUN_CALLBACK(stage, iter, expect) \
|
||||
if (callbacks.progress_cb) \
|
||||
{ \
|
||||
int rr = (*callbacks.progress_cb)(callbacks.progresscb_data, stage, iter, \
|
||||
expect); \
|
||||
if (rr != 0) \
|
||||
throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LIBRAW_CLASS_H */
|
148
libraw/libraw_alloc.h
Normal file
148
libraw/libraw_alloc.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_alloc.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 22, 2008
|
||||
*
|
||||
* LibRaw C++ interface
|
||||
*
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LIBRAW_ALLOC_H
|
||||
#define __LIBRAW_ALLOC_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "libraw_const.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define LIBRAW_MSIZE 512
|
||||
|
||||
class DllDef libraw_memmgr
|
||||
{
|
||||
public:
|
||||
libraw_memmgr(unsigned ee) : extra_bytes(ee)
|
||||
{
|
||||
size_t alloc_sz = LIBRAW_MSIZE * sizeof(void *);
|
||||
mems = (void **)::malloc(alloc_sz);
|
||||
memset(mems, 0, alloc_sz);
|
||||
}
|
||||
~libraw_memmgr()
|
||||
{
|
||||
cleanup();
|
||||
::free(mems);
|
||||
}
|
||||
void *malloc(size_t sz)
|
||||
{
|
||||
#ifdef LIBRAW_USE_CALLOC_INSTEAD_OF_MALLOC
|
||||
void *ptr = ::calloc(sz + extra_bytes, 1);
|
||||
#else
|
||||
void *ptr = ::malloc(sz + extra_bytes);
|
||||
#endif
|
||||
mem_ptr(ptr);
|
||||
return ptr;
|
||||
}
|
||||
void *calloc(size_t n, size_t sz)
|
||||
{
|
||||
void *ptr = ::calloc(n + (extra_bytes + sz - 1) / (sz ? sz : 1), sz);
|
||||
mem_ptr(ptr);
|
||||
return ptr;
|
||||
}
|
||||
void *realloc(void *ptr, size_t newsz)
|
||||
{
|
||||
void *ret = ::realloc(ptr, newsz + extra_bytes);
|
||||
forget_ptr(ptr);
|
||||
mem_ptr(ret);
|
||||
return ret;
|
||||
}
|
||||
void free(void *ptr)
|
||||
{
|
||||
forget_ptr(ptr);
|
||||
::free(ptr);
|
||||
}
|
||||
void cleanup(void)
|
||||
{
|
||||
for (int i = 0; i < LIBRAW_MSIZE; i++)
|
||||
if (mems[i])
|
||||
{
|
||||
::free(mems[i]);
|
||||
mems[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void **mems;
|
||||
unsigned extra_bytes;
|
||||
void mem_ptr(void *ptr)
|
||||
{
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
bool ok = false; /* do not return from critical section */
|
||||
#endif
|
||||
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
#pragma omp critical
|
||||
{
|
||||
#endif
|
||||
if (ptr)
|
||||
{
|
||||
for (int i = 0; i < LIBRAW_MSIZE - 1; i++)
|
||||
if (!mems[i])
|
||||
{
|
||||
mems[i] = ptr;
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
ok = true;
|
||||
break;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#ifdef LIBRAW_MEMPOOL_CHECK
|
||||
#if !defined(LIBRAW_USE_OPENMP)
|
||||
/* remember ptr in last mems item to be free'ed at cleanup */
|
||||
if (!mems[LIBRAW_MSIZE - 1])
|
||||
mems[LIBRAW_MSIZE - 1] = ptr;
|
||||
throw LIBRAW_EXCEPTION_MEMPOOL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
}
|
||||
if(!ok)
|
||||
{
|
||||
if (!mems[LIBRAW_MSIZE - 1])
|
||||
mems[LIBRAW_MSIZE - 1] = ptr;
|
||||
throw LIBRAW_EXCEPTION_MEMPOOL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void forget_ptr(void *ptr)
|
||||
{
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
#pragma omp critical
|
||||
{
|
||||
#endif
|
||||
if (ptr)
|
||||
for (int i = 0; i < LIBRAW_MSIZE; i++)
|
||||
if (mems[i] == ptr)
|
||||
{
|
||||
mems[i] = NULL;
|
||||
break;
|
||||
}
|
||||
#if defined(LIBRAW_USE_OPENMP)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* C++ */
|
||||
|
||||
#endif
|
810
libraw/libraw_const.h
Normal file
810
libraw/libraw_const.h
Normal file
@@ -0,0 +1,810 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_const.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 8 , 2008
|
||||
* LibRaw error codes
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _LIBRAW_ERRORS_H
|
||||
#define _LIBRAW_ERRORS_H
|
||||
|
||||
#define LIBRAW_DEFAULT_ADJUST_MAXIMUM_THRESHOLD 0.75f
|
||||
#define LIBRAW_DEFAULT_AUTO_BRIGHTNESS_THRESHOLD 0.01f
|
||||
/* limit allocation size, default is 2Gb */
|
||||
#ifndef LIBRAW_MAX_ALLOC_MB_DEFAULT
|
||||
#define LIBRAW_MAX_ALLOC_MB_DEFAULT 2048L
|
||||
#endif
|
||||
|
||||
#ifndef LIBRAW_MAX_NONDNG_RAW_FILE_SIZE
|
||||
#define LIBRAW_MAX_NONDNG_RAW_FILE_SIZE 2147483647ULL
|
||||
#endif
|
||||
|
||||
#ifndef LIBRAW_MAX_DNG_RAW_FILE_SIZE
|
||||
#ifdef USE_DNGSDK
|
||||
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 4294967295ULL
|
||||
#else
|
||||
#define LIBRAW_MAX_DNG_RAW_FILE_SIZE 2147483647ULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* limit thumbnail size, default is 512Mb*/
|
||||
#ifndef LIBRAW_MAX_THUMBNAIL_MB
|
||||
#define LIBRAW_MAX_THUMBNAIL_MB 512L
|
||||
#endif
|
||||
|
||||
/* Check if enough file space exists before tag read */
|
||||
#ifndef LIBRAW_NO_IOSPACE_CHECK
|
||||
#define LIBRAW_IOSPACE_CHECK
|
||||
#endif
|
||||
#ifndef LIBRAW_NO_CR3_MEMPOOL
|
||||
#define LIBRAW_CR3_MEMPOOL
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* LibRaw uses own memory pool management, with LIBRAW_MSIZE (512)
|
||||
entries. It is enough for parsing/decoding non-damaged files, but
|
||||
may overflow on specially crafted files (eg. with many string values
|
||||
like XMP blocks.
|
||||
LIBRAW_MEMPOOL_CHECK define will result in error on pool overflow */
|
||||
#ifndef LIBRAW_NO_MEMPOOL_CHECK
|
||||
#define LIBRAW_MEMPOOL_CHECK
|
||||
#endif
|
||||
|
||||
#define LIBRAW_MAX_METADATA_BLOCKS 1024
|
||||
#define LIBRAW_CBLACK_SIZE 4104
|
||||
#define LIBRAW_IFD_MAXCOUNT 10
|
||||
#define LIBRAW_THUMBNAIL_MAXCOUNT 8
|
||||
#define LIBRAW_CRXTRACKS_MAXCOUNT 16
|
||||
#define LIBRAW_AFDATA_MAXCOUNT 4
|
||||
|
||||
#define LIBRAW_AHD_TILE 512
|
||||
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
|
||||
enum LibRaw_open_flags
|
||||
{
|
||||
LIBRAW_OPEN_BIGFILE=1,
|
||||
LIBRAW_OPEN_FILE= 1<<1
|
||||
};
|
||||
#endif
|
||||
|
||||
enum LibRaw_openbayer_patterns
|
||||
{
|
||||
LIBRAW_OPENBAYER_RGGB = 0x94,
|
||||
LIBRAW_OPENBAYER_BGGR = 0x16,
|
||||
LIBRAW_OPENBAYER_GRBG = 0x61,
|
||||
LIBRAW_OPENBAYER_GBRG = 0x49
|
||||
};
|
||||
|
||||
enum LibRaw_dngfields_marks
|
||||
{
|
||||
LIBRAW_DNGFM_FORWARDMATRIX = 1,
|
||||
LIBRAW_DNGFM_ILLUMINANT = 1 << 1,
|
||||
LIBRAW_DNGFM_COLORMATRIX = 1 << 2,
|
||||
LIBRAW_DNGFM_CALIBRATION = 1 << 3,
|
||||
LIBRAW_DNGFM_ANALOGBALANCE = 1 << 4,
|
||||
LIBRAW_DNGFM_BLACK = 1 << 5,
|
||||
LIBRAW_DNGFM_WHITE = 1 << 6,
|
||||
LIBRAW_DNGFM_OPCODE2 = 1 << 7,
|
||||
LIBRAW_DNGFM_LINTABLE = 1 << 8,
|
||||
LIBRAW_DNGFM_CROPORIGIN = 1 << 9,
|
||||
LIBRAW_DNGFM_CROPSIZE = 1 << 10,
|
||||
LIBRAW_DNGFM_PREVIEWCS = 1 << 11,
|
||||
LIBRAW_DNGFM_ASSHOTNEUTRAL = 1 << 12,
|
||||
LIBRAW_DNGFM_BASELINEEXPOSURE = 1 << 13,
|
||||
LIBRAW_DNGFM_LINEARRESPONSELIMIT = 1 << 14,
|
||||
LIBRAW_DNGFM_USERCROP = 1 << 15,
|
||||
LIBRAW_DNGFM_OPCODE1 = 1 << 16,
|
||||
LIBRAW_DNGFM_OPCODE3 = 1 << 17,
|
||||
};
|
||||
|
||||
enum LibRaw_As_Shot_WB_Applied_codes
|
||||
{
|
||||
LIBRAW_ASWB_APPLIED = 1,
|
||||
LIBRAW_ASWB_CANON = 2,
|
||||
LIBRAW_ASWB_NIKON = 4,
|
||||
LIBRAW_ASWB_NIKON_SRAW = 8,
|
||||
LIBRAW_ASWB_PENTAX = 16
|
||||
};
|
||||
|
||||
#define tagtypeIs(typex) (type == typex)
|
||||
enum LibRaw_ExifTagTypes {
|
||||
LIBRAW_EXIFTAG_TYPE_UNKNOWN = 0,
|
||||
LIBRAW_EXIFTAG_TYPE_BYTE = 1,
|
||||
LIBRAW_EXIFTAG_TYPE_ASCII = 2,
|
||||
LIBRAW_EXIFTAG_TYPE_SHORT = 3,
|
||||
LIBRAW_EXIFTAG_TYPE_LONG = 4,
|
||||
LIBRAW_EXIFTAG_TYPE_RATIONAL = 5,
|
||||
LIBRAW_EXIFTAG_TYPE_SBYTE = 6,
|
||||
LIBRAW_EXIFTAG_TYPE_UNDEFINED = 7,
|
||||
LIBRAW_EXIFTAG_TYPE_SSHORT = 8,
|
||||
LIBRAW_EXIFTAG_TYPE_SLONG = 9,
|
||||
LIBRAW_EXIFTAG_TYPE_SRATIONAL = 10,
|
||||
LIBRAW_EXIFTAG_TYPE_FLOAT = 11,
|
||||
LIBRAW_EXIFTAG_TYPE_DOUBLE = 12,
|
||||
LIBRAW_EXIFTAG_TYPE_IFD = 13,
|
||||
LIBRAW_EXIFTAG_TYPE_UNICODE = 14,
|
||||
LIBRAW_EXIFTAG_TYPE_COMPLEX = 15,
|
||||
LIBRAW_EXIFTAG_TYPE_LONG8 = 16,
|
||||
LIBRAW_EXIFTAG_TYPE_SLONG8 = 17,
|
||||
LIBRAW_EXIFTAG_TYPE_IFD8 = 18
|
||||
};
|
||||
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int8u LIBRAW_EXIFTAG_TYPE_BYTE
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_string LIBRAW_EXIFTAG_TYPE_ASCII
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int16u LIBRAW_EXIFTAG_TYPE_SHORT
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int32u LIBRAW_EXIFTAG_TYPE_LONG
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_rational64u LIBRAW_EXIFTAG_TYPE_RATIONAL
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int8s LIBRAW_EXIFTAG_TYPE_SBYTE
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_undef LIBRAW_EXIFTAG_TYPE_UNDEFINED
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_binary LIBRAW_EXIFTAG_TYPE_UNDEFINED
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int16s LIBRAW_EXIFTAG_TYPE_SSHORT
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int32s LIBRAW_EXIFTAG_TYPE_SLONG
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_rational64s LIBRAW_EXIFTAG_TYPE_SRATIONAL
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_float LIBRAW_EXIFTAG_TYPE_FLOAT
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_double LIBRAW_EXIFTAG_TYPE_DOUBLE
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_ifd LIBRAW_EXIFTAG_TYPE_IFD
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_unicode LIBRAW_EXIFTAG_TYPE_UNICODE
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_complex LIBRAW_EXIFTAG_TYPE_COMPLEX
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int64u LIBRAW_EXIFTAG_TYPE_LONG8
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_int64s LIBRAW_EXIFTAG_TYPE_SLONG8
|
||||
#define LIBRAW_EXIFTOOLTAGTYPE_ifd64 LIBRAW_EXIFTAG_TYPE_IFD8
|
||||
|
||||
#define LIBRAW_LENS_NOT_SET 0xffffffffffffffffULL
|
||||
|
||||
enum LibRaw_whitebalance_code
|
||||
{
|
||||
// clang-format off
|
||||
/*
|
||||
EXIF light sources
|
||||
12 = FL-D; Daylight fluorescent (D 5700K – 7100K) (F1,F5)
|
||||
13 = FL-N; Day white fluorescent (N 4600K – 5400K) (F7,F8)
|
||||
14 = FL-W; Cool white fluorescent (W 3900K – 4500K) (F2,F6, office, store, warehouse)
|
||||
15 = FL-WW; White fluorescent (WW 3200K – 3700K) (F3, residential)
|
||||
16 = FL-L; Soft/Warm white fluorescent (L 2600K - 3250K) (F4, kitchen, bath)
|
||||
*/
|
||||
//clang-format on
|
||||
LIBRAW_WBI_Unknown = 0,
|
||||
LIBRAW_WBI_Daylight = 1,
|
||||
LIBRAW_WBI_Fluorescent = 2,
|
||||
LIBRAW_WBI_Tungsten = 3,
|
||||
LIBRAW_WBI_Flash = 4,
|
||||
LIBRAW_WBI_FineWeather = 9,
|
||||
LIBRAW_WBI_Cloudy = 10,
|
||||
LIBRAW_WBI_Shade = 11,
|
||||
LIBRAW_WBI_FL_D = 12,
|
||||
LIBRAW_WBI_FL_N = 13,
|
||||
LIBRAW_WBI_FL_W = 14,
|
||||
LIBRAW_WBI_FL_WW = 15,
|
||||
LIBRAW_WBI_FL_L = 16,
|
||||
LIBRAW_WBI_Ill_A = 17,
|
||||
LIBRAW_WBI_Ill_B = 18,
|
||||
LIBRAW_WBI_Ill_C = 19,
|
||||
LIBRAW_WBI_D55 = 20,
|
||||
LIBRAW_WBI_D65 = 21,
|
||||
LIBRAW_WBI_D75 = 22,
|
||||
LIBRAW_WBI_D50 = 23,
|
||||
LIBRAW_WBI_StudioTungsten = 24,
|
||||
LIBRAW_WBI_Sunset = 64,
|
||||
LIBRAW_WBI_Underwater = 65,
|
||||
LIBRAW_WBI_FluorescentHigh = 66,
|
||||
LIBRAW_WBI_HT_Mercury = 67,
|
||||
LIBRAW_WBI_AsShot = 81,
|
||||
LIBRAW_WBI_Auto = 82,
|
||||
LIBRAW_WBI_Custom = 83,
|
||||
LIBRAW_WBI_Auto1 = 85,
|
||||
LIBRAW_WBI_Auto2 = 86,
|
||||
LIBRAW_WBI_Auto3 = 87,
|
||||
LIBRAW_WBI_Auto4 = 88,
|
||||
LIBRAW_WBI_Custom1 = 90,
|
||||
LIBRAW_WBI_Custom2 = 91,
|
||||
LIBRAW_WBI_Custom3 = 92,
|
||||
LIBRAW_WBI_Custom4 = 93,
|
||||
LIBRAW_WBI_Custom5 = 94,
|
||||
LIBRAW_WBI_Custom6 = 95,
|
||||
LIBRAW_WBI_PC_Set1 = 96,
|
||||
LIBRAW_WBI_PC_Set2 = 97,
|
||||
LIBRAW_WBI_PC_Set3 = 98,
|
||||
LIBRAW_WBI_PC_Set4 = 99,
|
||||
LIBRAW_WBI_PC_Set5 = 100,
|
||||
LIBRAW_WBI_Measured = 110,
|
||||
LIBRAW_WBI_BW = 120,
|
||||
LIBRAW_WBI_Kelvin = 254,
|
||||
LIBRAW_WBI_Other = 255,
|
||||
LIBRAW_WBI_None = 0xffff
|
||||
};
|
||||
|
||||
enum LibRaw_MultiExposure_related
|
||||
{
|
||||
LIBRAW_ME_NONE = 0,
|
||||
LIBRAW_ME_SIMPLE = 1,
|
||||
LIBRAW_ME_OVERLAY = 2,
|
||||
LIBRAW_ME_HDR = 3
|
||||
};
|
||||
|
||||
enum LibRaw_dng_processing
|
||||
{
|
||||
LIBRAW_DNG_NONE = 0,
|
||||
LIBRAW_DNG_FLOAT = 1,
|
||||
LIBRAW_DNG_LINEAR = 2,
|
||||
LIBRAW_DNG_DEFLATE = 4,
|
||||
LIBRAW_DNG_XTRANS = 8,
|
||||
LIBRAW_DNG_OTHER = 16,
|
||||
LIBRAW_DNG_8BIT = 32,
|
||||
/*LIBRAW_DNG_LARGERANGE=64,*/ /* more than 16 bit integer */
|
||||
LIBRAW_DNG_ALL =
|
||||
LIBRAW_DNG_FLOAT | LIBRAW_DNG_LINEAR | LIBRAW_DNG_DEFLATE | LIBRAW_DNG_XTRANS |
|
||||
LIBRAW_DNG_8BIT | LIBRAW_DNG_OTHER /* |LIBRAW_DNG_LARGERANGE */,
|
||||
LIBRAW_DNG_DEFAULT = LIBRAW_DNG_FLOAT | LIBRAW_DNG_LINEAR |
|
||||
LIBRAW_DNG_DEFLATE | LIBRAW_DNG_8BIT
|
||||
};
|
||||
|
||||
enum LibRaw_output_flags
|
||||
{
|
||||
LIBRAW_OUTPUT_FLAGS_NONE = 0,
|
||||
LIBRAW_OUTPUT_FLAGS_PPMMETA = 1
|
||||
};
|
||||
|
||||
enum LibRaw_runtime_capabilities
|
||||
{
|
||||
LIBRAW_CAPS_RAWSPEED = 1,
|
||||
LIBRAW_CAPS_DNGSDK = 1<<1,
|
||||
LIBRAW_CAPS_GPRSDK = 1<<2,
|
||||
LIBRAW_CAPS_UNICODEPATHS = 1<<3,
|
||||
LIBRAW_CAPS_X3FTOOLS = 1<<4,
|
||||
LIBRAW_CAPS_RPI6BY9 = 1<<5,
|
||||
LIBRAW_CAPS_ZLIB = 1<<6,
|
||||
LIBRAW_CAPS_JPEG = 1<<7,
|
||||
LIBRAW_CAPS_RAWSPEED3 = 1<<8,
|
||||
LIBRAW_CAPS_RAWSPEED_BITS = 1<<9,
|
||||
};
|
||||
|
||||
enum LibRaw_colorspace {
|
||||
LIBRAW_COLORSPACE_NotFound = 0,
|
||||
LIBRAW_COLORSPACE_sRGB,
|
||||
LIBRAW_COLORSPACE_AdobeRGB,
|
||||
LIBRAW_COLORSPACE_WideGamutRGB,
|
||||
LIBRAW_COLORSPACE_ProPhotoRGB,
|
||||
LIBRAW_COLORSPACE_ICC,
|
||||
LIBRAW_COLORSPACE_Uncalibrated, // Tag 0x0001 InteropIndex containing "R03" + LIBRAW_COLORSPACE_Uncalibrated = Adobe RGB
|
||||
LIBRAW_COLORSPACE_CameraLinearUniWB,
|
||||
LIBRAW_COLORSPACE_CameraLinear,
|
||||
LIBRAW_COLORSPACE_CameraGammaUniWB,
|
||||
LIBRAW_COLORSPACE_CameraGamma,
|
||||
LIBRAW_COLORSPACE_MonochromeLinear,
|
||||
LIBRAW_COLORSPACE_MonochromeGamma,
|
||||
LIBRAW_COLORSPACE_Unknown = 255
|
||||
};
|
||||
|
||||
enum LibRaw_cameramaker_index
|
||||
{
|
||||
LIBRAW_CAMERAMAKER_Unknown = 0,
|
||||
LIBRAW_CAMERAMAKER_Agfa,
|
||||
LIBRAW_CAMERAMAKER_Alcatel,
|
||||
LIBRAW_CAMERAMAKER_Apple,
|
||||
LIBRAW_CAMERAMAKER_Aptina,
|
||||
LIBRAW_CAMERAMAKER_AVT,
|
||||
LIBRAW_CAMERAMAKER_Baumer,
|
||||
LIBRAW_CAMERAMAKER_Broadcom,
|
||||
LIBRAW_CAMERAMAKER_Canon,
|
||||
LIBRAW_CAMERAMAKER_Casio,
|
||||
LIBRAW_CAMERAMAKER_CINE,
|
||||
LIBRAW_CAMERAMAKER_Clauss,
|
||||
LIBRAW_CAMERAMAKER_Contax,
|
||||
LIBRAW_CAMERAMAKER_Creative,
|
||||
LIBRAW_CAMERAMAKER_DJI,
|
||||
LIBRAW_CAMERAMAKER_DXO,
|
||||
LIBRAW_CAMERAMAKER_Epson,
|
||||
LIBRAW_CAMERAMAKER_Foculus,
|
||||
LIBRAW_CAMERAMAKER_Fujifilm,
|
||||
LIBRAW_CAMERAMAKER_Generic,
|
||||
LIBRAW_CAMERAMAKER_Gione,
|
||||
LIBRAW_CAMERAMAKER_GITUP,
|
||||
LIBRAW_CAMERAMAKER_Google,
|
||||
LIBRAW_CAMERAMAKER_GoPro,
|
||||
LIBRAW_CAMERAMAKER_Hasselblad,
|
||||
LIBRAW_CAMERAMAKER_HTC,
|
||||
LIBRAW_CAMERAMAKER_I_Mobile,
|
||||
LIBRAW_CAMERAMAKER_Imacon,
|
||||
LIBRAW_CAMERAMAKER_JK_Imaging,
|
||||
LIBRAW_CAMERAMAKER_Kodak,
|
||||
LIBRAW_CAMERAMAKER_Konica,
|
||||
LIBRAW_CAMERAMAKER_Leaf,
|
||||
LIBRAW_CAMERAMAKER_Leica,
|
||||
LIBRAW_CAMERAMAKER_Lenovo,
|
||||
LIBRAW_CAMERAMAKER_LG,
|
||||
LIBRAW_CAMERAMAKER_Logitech,
|
||||
LIBRAW_CAMERAMAKER_Mamiya,
|
||||
LIBRAW_CAMERAMAKER_Matrix,
|
||||
LIBRAW_CAMERAMAKER_Meizu,
|
||||
LIBRAW_CAMERAMAKER_Micron,
|
||||
LIBRAW_CAMERAMAKER_Minolta,
|
||||
LIBRAW_CAMERAMAKER_Motorola,
|
||||
LIBRAW_CAMERAMAKER_NGM,
|
||||
LIBRAW_CAMERAMAKER_Nikon,
|
||||
LIBRAW_CAMERAMAKER_Nokia,
|
||||
LIBRAW_CAMERAMAKER_Olympus,
|
||||
LIBRAW_CAMERAMAKER_OmniVison,
|
||||
LIBRAW_CAMERAMAKER_Panasonic,
|
||||
LIBRAW_CAMERAMAKER_Parrot,
|
||||
LIBRAW_CAMERAMAKER_Pentax,
|
||||
LIBRAW_CAMERAMAKER_PhaseOne,
|
||||
LIBRAW_CAMERAMAKER_PhotoControl,
|
||||
LIBRAW_CAMERAMAKER_Photron,
|
||||
LIBRAW_CAMERAMAKER_Pixelink,
|
||||
LIBRAW_CAMERAMAKER_Polaroid,
|
||||
LIBRAW_CAMERAMAKER_RED,
|
||||
LIBRAW_CAMERAMAKER_Ricoh,
|
||||
LIBRAW_CAMERAMAKER_Rollei,
|
||||
LIBRAW_CAMERAMAKER_RoverShot,
|
||||
LIBRAW_CAMERAMAKER_Samsung,
|
||||
LIBRAW_CAMERAMAKER_Sigma,
|
||||
LIBRAW_CAMERAMAKER_Sinar,
|
||||
LIBRAW_CAMERAMAKER_SMaL,
|
||||
LIBRAW_CAMERAMAKER_Sony,
|
||||
LIBRAW_CAMERAMAKER_ST_Micro,
|
||||
LIBRAW_CAMERAMAKER_THL,
|
||||
LIBRAW_CAMERAMAKER_VLUU,
|
||||
LIBRAW_CAMERAMAKER_Xiaomi,
|
||||
LIBRAW_CAMERAMAKER_XIAOYI,
|
||||
LIBRAW_CAMERAMAKER_YI,
|
||||
LIBRAW_CAMERAMAKER_Yuneec,
|
||||
LIBRAW_CAMERAMAKER_Zeiss,
|
||||
LIBRAW_CAMERAMAKER_OnePlus,
|
||||
LIBRAW_CAMERAMAKER_ISG,
|
||||
LIBRAW_CAMERAMAKER_VIVO,
|
||||
LIBRAW_CAMERAMAKER_HMD_Global,
|
||||
LIBRAW_CAMERAMAKER_HUAWEI,
|
||||
LIBRAW_CAMERAMAKER_RaspberryPi,
|
||||
LIBRAW_CAMERAMAKER_OmDigital,
|
||||
|
||||
// Insert additional indexes here
|
||||
LIBRAW_CAMERAMAKER_TheLastOne
|
||||
};
|
||||
|
||||
enum LibRaw_camera_mounts
|
||||
{
|
||||
LIBRAW_MOUNT_Unknown = 0,
|
||||
LIBRAW_MOUNT_Alpa,
|
||||
LIBRAW_MOUNT_C, /* C-mount */
|
||||
LIBRAW_MOUNT_Canon_EF_M,
|
||||
LIBRAW_MOUNT_Canon_EF_S,
|
||||
LIBRAW_MOUNT_Canon_EF,
|
||||
LIBRAW_MOUNT_Canon_RF,
|
||||
LIBRAW_MOUNT_Contax_N,
|
||||
LIBRAW_MOUNT_Contax645,
|
||||
LIBRAW_MOUNT_FT, /* original 4/3 */
|
||||
LIBRAW_MOUNT_mFT, /* micro 4/3 */
|
||||
LIBRAW_MOUNT_Fuji_GF, /* Fujifilm GFX cameras, G mount */
|
||||
LIBRAW_MOUNT_Fuji_GX, /* Fujifilm GX680 */
|
||||
LIBRAW_MOUNT_Fuji_X,
|
||||
LIBRAW_MOUNT_Hasselblad_H, /* Hasselblad Hn cameras, HC & HCD lenses */
|
||||
LIBRAW_MOUNT_Hasselblad_V,
|
||||
LIBRAW_MOUNT_Hasselblad_XCD, /* Hasselblad Xn cameras, XCD lenses */
|
||||
LIBRAW_MOUNT_Leica_M, /* Leica rangefinder bayonet */
|
||||
LIBRAW_MOUNT_Leica_R, /* Leica SLRs, 'R' for reflex */
|
||||
LIBRAW_MOUNT_Leica_S, /* LIBRAW_FORMAT_LeicaS 'MF' */
|
||||
LIBRAW_MOUNT_Leica_SL, /* lens, mounts on 'L' throat, FF */
|
||||
LIBRAW_MOUNT_Leica_TL, /* lens, mounts on 'L' throat, APS-C */
|
||||
LIBRAW_MOUNT_LPS_L, /* Leica/Panasonic/Sigma camera mount, takes L, SL and TL lenses */
|
||||
LIBRAW_MOUNT_Mamiya67, /* Mamiya RB67, RZ67 */
|
||||
LIBRAW_MOUNT_Mamiya645,
|
||||
LIBRAW_MOUNT_Minolta_A,
|
||||
LIBRAW_MOUNT_Nikon_CX, /* used in 'Nikon 1' series */
|
||||
LIBRAW_MOUNT_Nikon_F,
|
||||
LIBRAW_MOUNT_Nikon_Z,
|
||||
LIBRAW_MOUNT_PhaseOne_iXM_MV,
|
||||
LIBRAW_MOUNT_PhaseOne_iXM_RS,
|
||||
LIBRAW_MOUNT_PhaseOne_iXM,
|
||||
LIBRAW_MOUNT_Pentax_645,
|
||||
LIBRAW_MOUNT_Pentax_K,
|
||||
LIBRAW_MOUNT_Pentax_Q,
|
||||
LIBRAW_MOUNT_RicohModule,
|
||||
LIBRAW_MOUNT_Rollei_bayonet, /* Rollei Hy-6: Leaf AFi, Sinar Hy6- models */
|
||||
LIBRAW_MOUNT_Samsung_NX_M,
|
||||
LIBRAW_MOUNT_Samsung_NX,
|
||||
LIBRAW_MOUNT_Sigma_X3F,
|
||||
LIBRAW_MOUNT_Sony_E,
|
||||
LIBRAW_MOUNT_LF,
|
||||
LIBRAW_MOUNT_DigitalBack,
|
||||
LIBRAW_MOUNT_FixedLens,
|
||||
LIBRAW_MOUNT_IL_UM, /* Interchangeable lens, mount unknown */
|
||||
LIBRAW_MOUNT_TheLastOne
|
||||
};
|
||||
|
||||
enum LibRaw_camera_formats
|
||||
{
|
||||
LIBRAW_FORMAT_Unknown = 0,
|
||||
LIBRAW_FORMAT_APSC,
|
||||
LIBRAW_FORMAT_FF,
|
||||
LIBRAW_FORMAT_MF,
|
||||
LIBRAW_FORMAT_APSH,
|
||||
LIBRAW_FORMAT_1INCH,
|
||||
LIBRAW_FORMAT_1div2p3INCH, /* 1/2.3" */
|
||||
LIBRAW_FORMAT_1div1p7INCH, /* 1/1.7" */
|
||||
LIBRAW_FORMAT_FT, /* sensor size in FT & mFT cameras */
|
||||
LIBRAW_FORMAT_CROP645, /* 44x33mm */
|
||||
LIBRAW_FORMAT_LeicaS, /* 'MF' Leicas */
|
||||
LIBRAW_FORMAT_645,
|
||||
LIBRAW_FORMAT_66,
|
||||
LIBRAW_FORMAT_69,
|
||||
LIBRAW_FORMAT_LF,
|
||||
LIBRAW_FORMAT_Leica_DMR,
|
||||
LIBRAW_FORMAT_67,
|
||||
LIBRAW_FORMAT_SigmaAPSC, /* DP1, DP2, SD15, SD14, SD10, SD9 */
|
||||
LIBRAW_FORMAT_SigmaMerrill, /* SD1, 'SD1 Merrill', 'DP1 Merrill', 'DP2 Merrill' */
|
||||
LIBRAW_FORMAT_SigmaAPSH, /* 'sd Quattro H' */
|
||||
LIBRAW_FORMAT_3648, /* DALSA FTF4052C (Mamiya ZD) */
|
||||
LIBRAW_FORMAT_68, /* Fujifilm GX680 */
|
||||
LIBRAW_FORMAT_TheLastOne
|
||||
};
|
||||
|
||||
enum LibRawImageAspects
|
||||
{
|
||||
LIBRAW_IMAGE_ASPECT_UNKNOWN = 0,
|
||||
LIBRAW_IMAGE_ASPECT_OTHER = 1,
|
||||
LIBRAW_IMAGE_ASPECT_MINIMAL_REAL_ASPECT_VALUE = 99, /* 1:10*/
|
||||
LIBRAW_IMAGE_ASPECT_MAXIMAL_REAL_ASPECT_VALUE = 10000, /* 10: 1*/
|
||||
// Value: width / height * 1000
|
||||
LIBRAW_IMAGE_ASPECT_3to2 = (1000 * 3)/2,
|
||||
LIBRAW_IMAGE_ASPECT_1to1 = 1000,
|
||||
LIBRAW_IMAGE_ASPECT_4to3 = (1000 * 4)/ 3,
|
||||
LIBRAW_IMAGE_ASPECT_16to9 = (1000 * 16) / 9,
|
||||
//LIBRAW_IMAGE_ASPECT_6to6, // what is the difference with 1:1 ?
|
||||
LIBRAW_IMAGE_ASPECT_5to4 = (1000 * 5) / 4,
|
||||
LIBRAW_IMAGE_ASPECT_7to6 = (1000 * 7) / 6,
|
||||
LIBRAW_IMAGE_ASPECT_6to5 = (1000 * 6) / 5,
|
||||
LIBRAW_IMAGE_ASPECT_7to5 = (1000 * 7) / 5
|
||||
};
|
||||
|
||||
enum LibRaw_lens_focal_types
|
||||
{
|
||||
LIBRAW_FT_UNDEFINED = 0,
|
||||
LIBRAW_FT_PRIME_LENS = 1,
|
||||
LIBRAW_FT_ZOOM_LENS = 2,
|
||||
LIBRAW_FT_ZOOM_LENS_CONSTANT_APERTURE = 3,
|
||||
LIBRAW_FT_ZOOM_LENS_VARIABLE_APERTURE = 4
|
||||
};
|
||||
|
||||
enum LibRaw_Canon_RecordModes {
|
||||
LIBRAW_Canon_RecordMode_UNDEFINED = 0,
|
||||
LIBRAW_Canon_RecordMode_JPEG,
|
||||
LIBRAW_Canon_RecordMode_CRW_THM,
|
||||
LIBRAW_Canon_RecordMode_AVI_THM,
|
||||
LIBRAW_Canon_RecordMode_TIF,
|
||||
LIBRAW_Canon_RecordMode_TIF_JPEG,
|
||||
LIBRAW_Canon_RecordMode_CR2,
|
||||
LIBRAW_Canon_RecordMode_CR2_JPEG,
|
||||
LIBRAW_Canon_RecordMode_UNKNOWN,
|
||||
LIBRAW_Canon_RecordMode_MOV,
|
||||
LIBRAW_Canon_RecordMode_MP4,
|
||||
LIBRAW_Canon_RecordMode_CRM,
|
||||
LIBRAW_Canon_RecordMode_CR3,
|
||||
LIBRAW_Canon_RecordMode_CR3_JPEG,
|
||||
LIBRAW_Canon_RecordMode_HEIF,
|
||||
LIBRAW_Canon_RecordMode_CR3_HEIF,
|
||||
LIBRAW_Canon_RecordMode_TheLastOne
|
||||
};
|
||||
|
||||
enum LibRaw_minolta_storagemethods
|
||||
{
|
||||
LIBRAW_MINOLTA_UNPACKED = 0x52,
|
||||
LIBRAW_MINOLTA_PACKED = 0x59
|
||||
};
|
||||
|
||||
enum LibRaw_minolta_bayerpatterns
|
||||
{
|
||||
LIBRAW_MINOLTA_RGGB = 0x01,
|
||||
LIBRAW_MINOLTA_G2BRG1 = 0x04
|
||||
};
|
||||
|
||||
enum LibRaw_sony_cameratypes
|
||||
{
|
||||
LIBRAW_SONY_DSC = 1,
|
||||
LIBRAW_SONY_DSLR = 2,
|
||||
LIBRAW_SONY_NEX = 3,
|
||||
LIBRAW_SONY_SLT = 4,
|
||||
LIBRAW_SONY_ILCE = 5,
|
||||
LIBRAW_SONY_ILCA = 6,
|
||||
LIBRAW_SONY_CameraType_UNKNOWN = 0xffff
|
||||
};
|
||||
|
||||
enum LibRaw_Sony_0x2010_Type {
|
||||
LIBRAW_SONY_Tag2010None = 0,
|
||||
LIBRAW_SONY_Tag2010a,
|
||||
LIBRAW_SONY_Tag2010b,
|
||||
LIBRAW_SONY_Tag2010c,
|
||||
LIBRAW_SONY_Tag2010d,
|
||||
LIBRAW_SONY_Tag2010e,
|
||||
LIBRAW_SONY_Tag2010f,
|
||||
LIBRAW_SONY_Tag2010g,
|
||||
LIBRAW_SONY_Tag2010h,
|
||||
LIBRAW_SONY_Tag2010i
|
||||
};
|
||||
enum LibRaw_Sony_0x9050_Type {
|
||||
LIBRAW_SONY_Tag9050None = 0,
|
||||
LIBRAW_SONY_Tag9050a,
|
||||
LIBRAW_SONY_Tag9050b,
|
||||
LIBRAW_SONY_Tag9050c
|
||||
};
|
||||
|
||||
enum LIBRAW_SONY_FOCUSMODEmodes
|
||||
{
|
||||
LIBRAW_SONY_FOCUSMODE_MF = 0,
|
||||
LIBRAW_SONY_FOCUSMODE_AF_S = 2,
|
||||
LIBRAW_SONY_FOCUSMODE_AF_C = 3,
|
||||
LIBRAW_SONY_FOCUSMODE_AF_A = 4,
|
||||
LIBRAW_SONY_FOCUSMODE_DMF = 6,
|
||||
LIBRAW_SONY_FOCUSMODE_AF_D = 7,
|
||||
LIBRAW_SONY_FOCUSMODE_AF = 101,
|
||||
LIBRAW_SONY_FOCUSMODE_PERMANENT_AF = 104,
|
||||
LIBRAW_SONY_FOCUSMODE_SEMI_MF = 105,
|
||||
LIBRAW_SONY_FOCUSMODE_UNKNOWN = -1
|
||||
};
|
||||
|
||||
enum LibRaw_KodakSensors
|
||||
{
|
||||
LIBRAW_Kodak_UnknownSensor = 0,
|
||||
LIBRAW_Kodak_M1 = 1,
|
||||
LIBRAW_Kodak_M15 = 2,
|
||||
LIBRAW_Kodak_M16 = 3,
|
||||
LIBRAW_Kodak_M17 = 4,
|
||||
LIBRAW_Kodak_M2 = 5,
|
||||
LIBRAW_Kodak_M23 = 6,
|
||||
LIBRAW_Kodak_M24 = 7,
|
||||
LIBRAW_Kodak_M3 = 8,
|
||||
LIBRAW_Kodak_M5 = 9,
|
||||
LIBRAW_Kodak_M6 = 10,
|
||||
LIBRAW_Kodak_C14 = 11,
|
||||
LIBRAW_Kodak_X14 = 12,
|
||||
LIBRAW_Kodak_M11 = 13
|
||||
};
|
||||
|
||||
enum LibRaw_HasselbladFormatCodes {
|
||||
LIBRAW_HF_Unknown = 0,
|
||||
LIBRAW_HF_3FR,
|
||||
LIBRAW_HF_FFF,
|
||||
LIBRAW_HF_Imacon,
|
||||
LIBRAW_HF_HasselbladDNG,
|
||||
LIBRAW_HF_AdobeDNG,
|
||||
LIBRAW_HF_AdobeDNG_fromPhocusDNG
|
||||
};
|
||||
|
||||
enum LibRaw_rawspecial_t
|
||||
{
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_NONE = 0,
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_BASEONLY = 1,
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTAONLY = 1 << 1,
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTAZEROBASE = 1 << 2,
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTATOVALUE = 1 << 3,
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_ALLFLAGS =
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_BASEONLY +
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTAONLY +
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTAZEROBASE +
|
||||
LIBRAW_RAWSPECIAL_SONYARW2_DELTATOVALUE,
|
||||
LIBRAW_RAWSPECIAL_NODP2Q_INTERPOLATERG = 1<<4,
|
||||
LIBRAW_RAWSPECIAL_NODP2Q_INTERPOLATEAF = 1 << 5,
|
||||
LIBRAW_RAWSPECIAL_SRAW_NO_RGB = 1 << 6,
|
||||
LIBRAW_RAWSPECIAL_SRAW_NO_INTERPOLATE = 1 << 7
|
||||
};
|
||||
|
||||
enum LibRaw_rawspeed_bits_t
|
||||
{
|
||||
LIBRAW_RAWSPEEDV1_USE = 1,
|
||||
LIBRAW_RAWSPEEDV1_FAILONUNKNOWN = 1 << 1,
|
||||
LIBRAW_RAWSPEEDV1_IGNOREERRORS = 1 << 2,
|
||||
/* bits 3-7 are reserved*/
|
||||
LIBRAW_RAWSPEEDV3_USE = 1 << 8,
|
||||
LIBRAW_RAWSPEEDV3_FAILONUNKNOWN = 1 << 9,
|
||||
LIBRAW_RAWSPEEDV3_IGNOREERRORS = 1 << 10,
|
||||
};
|
||||
|
||||
enum LibRaw_processing_options
|
||||
{
|
||||
LIBRAW_RAWOPTIONS_PENTAX_PS_ALLFRAMES = 1,
|
||||
LIBRAW_RAWOPTIONS_CONVERTFLOAT_TO_INT = 1 << 1,
|
||||
LIBRAW_RAWOPTIONS_ARQ_SKIP_CHANNEL_SWAP = 1 << 2,
|
||||
LIBRAW_RAWOPTIONS_NO_ROTATE_FOR_KODAK_THUMBNAILS = 1 << 3,
|
||||
// LIBRAW_RAWOPTIONS_USE_DNG_DEFAULT_CROP = 1 << 4,
|
||||
LIBRAW_RAWOPTIONS_USE_PPM16_THUMBS = 1 << 5,
|
||||
LIBRAW_RAWOPTIONS_DONT_CHECK_DNG_ILLUMINANT = 1 << 6,
|
||||
LIBRAW_RAWOPTIONS_DNGSDK_ZEROCOPY = 1 << 7,
|
||||
LIBRAW_RAWOPTIONS_ZEROFILTERS_FOR_MONOCHROMETIFFS = 1 << 8,
|
||||
LIBRAW_RAWOPTIONS_DNG_ADD_ENHANCED = 1 << 9,
|
||||
LIBRAW_RAWOPTIONS_DNG_ADD_PREVIEWS = 1 << 10,
|
||||
LIBRAW_RAWOPTIONS_DNG_PREFER_LARGEST_IMAGE = 1 << 11,
|
||||
LIBRAW_RAWOPTIONS_DNG_STAGE2 = 1 << 12,
|
||||
LIBRAW_RAWOPTIONS_DNG_STAGE3 = 1 << 13,
|
||||
LIBRAW_RAWOPTIONS_DNG_ALLOWSIZECHANGE = 1 << 14,
|
||||
LIBRAW_RAWOPTIONS_DNG_DISABLEWBADJUST = 1 << 15,
|
||||
LIBRAW_RAWOPTIONS_PROVIDE_NONSTANDARD_WB = 1 << 16,
|
||||
LIBRAW_RAWOPTIONS_CAMERAWB_FALLBACK_TO_DAYLIGHT = 1 << 17,
|
||||
LIBRAW_RAWOPTIONS_CHECK_THUMBNAILS_KNOWN_VENDORS = 1 << 18,
|
||||
LIBRAW_RAWOPTIONS_CHECK_THUMBNAILS_ALL_VENDORS = 1 << 19,
|
||||
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
|
||||
};
|
||||
|
||||
enum LibRaw_decoder_flags
|
||||
{
|
||||
LIBRAW_DECODER_HASCURVE = 1 << 4,
|
||||
LIBRAW_DECODER_SONYARW2 = 1 << 5,
|
||||
LIBRAW_DECODER_TRYRAWSPEED = 1 << 6,
|
||||
LIBRAW_DECODER_OWNALLOC = 1 << 7,
|
||||
LIBRAW_DECODER_FIXEDMAXC = 1 << 8,
|
||||
LIBRAW_DECODER_ADOBECOPYPIXEL = 1 << 9,
|
||||
LIBRAW_DECODER_LEGACY_WITH_MARGINS = 1 << 10,
|
||||
LIBRAW_DECODER_3CHANNEL = 1 << 11,
|
||||
LIBRAW_DECODER_SINAR4SHOT = 1 << 11,
|
||||
LIBRAW_DECODER_FLATDATA = 1 << 12,
|
||||
LIBRAW_DECODER_FLAT_BG2_SWAPPED = 1<<13,
|
||||
LIBRAW_DECODER_UNSUPPORTED_FORMAT = 1 << 14,
|
||||
LIBRAW_DECODER_NOTSET = 1 << 15,
|
||||
LIBRAW_DECODER_TRYRAWSPEED3 = 1 << 16
|
||||
};
|
||||
|
||||
#define LIBRAW_XTRANS 9
|
||||
|
||||
enum LibRaw_constructor_flags
|
||||
{
|
||||
LIBRAW_OPTIONS_NONE = 0,
|
||||
LIBRAW_OPTIONS_NO_DATAERR_CALLBACK = 1 << 1,
|
||||
/* Compatibility w/ years old typo */
|
||||
LIBRAW_OPIONS_NO_DATAERR_CALLBACK = LIBRAW_OPTIONS_NO_DATAERR_CALLBACK
|
||||
};
|
||||
|
||||
enum LibRaw_warnings
|
||||
{
|
||||
LIBRAW_WARN_NONE = 0,
|
||||
LIBRAW_WARN_BAD_CAMERA_WB = 1 << 2,
|
||||
LIBRAW_WARN_NO_METADATA = 1 << 3,
|
||||
LIBRAW_WARN_NO_JPEGLIB = 1 << 4,
|
||||
LIBRAW_WARN_NO_EMBEDDED_PROFILE = 1 << 5,
|
||||
LIBRAW_WARN_NO_INPUT_PROFILE = 1 << 6,
|
||||
LIBRAW_WARN_BAD_OUTPUT_PROFILE = 1 << 7,
|
||||
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,
|
||||
LIBRAW_WARN_FALLBACK_TO_AHD = 1 << 15,
|
||||
LIBRAW_WARN_PARSEFUJI_PROCESSED = 1 << 16,
|
||||
LIBRAW_WARN_DNGSDK_PROCESSED = 1 << 17,
|
||||
LIBRAW_WARN_DNG_IMAGES_REORDERED = 1 << 18,
|
||||
LIBRAW_WARN_DNG_STAGE2_APPLIED = 1 << 19,
|
||||
LIBRAW_WARN_DNG_STAGE3_APPLIED = 1 << 20,
|
||||
LIBRAW_WARN_RAWSPEED3_PROBLEM = 1 << 21,
|
||||
LIBRAW_WARN_RAWSPEED3_UNSUPPORTED = 1 << 22,
|
||||
LIBRAW_WARN_RAWSPEED3_PROCESSED = 1 << 23,
|
||||
LIBRAW_WARN_RAWSPEED3_NOTLISTED = 1 << 24
|
||||
};
|
||||
|
||||
enum LibRaw_exceptions
|
||||
{
|
||||
LIBRAW_EXCEPTION_NONE = 0,
|
||||
LIBRAW_EXCEPTION_ALLOC = 1,
|
||||
LIBRAW_EXCEPTION_DECODE_RAW = 2,
|
||||
LIBRAW_EXCEPTION_DECODE_JPEG = 3,
|
||||
LIBRAW_EXCEPTION_IO_EOF = 4,
|
||||
LIBRAW_EXCEPTION_IO_CORRUPT = 5,
|
||||
LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK = 6,
|
||||
LIBRAW_EXCEPTION_BAD_CROP = 7,
|
||||
LIBRAW_EXCEPTION_IO_BADFILE = 8,
|
||||
LIBRAW_EXCEPTION_DECODE_JPEG2000 = 9,
|
||||
LIBRAW_EXCEPTION_TOOBIG = 10,
|
||||
LIBRAW_EXCEPTION_MEMPOOL = 11,
|
||||
LIBRAW_EXCEPTION_UNSUPPORTED_FORMAT = 12
|
||||
};
|
||||
|
||||
enum LibRaw_progress
|
||||
{
|
||||
LIBRAW_PROGRESS_START = 0,
|
||||
LIBRAW_PROGRESS_OPEN = 1,
|
||||
LIBRAW_PROGRESS_IDENTIFY = 1 << 1,
|
||||
LIBRAW_PROGRESS_SIZE_ADJUST = 1 << 2,
|
||||
LIBRAW_PROGRESS_LOAD_RAW = 1 << 3,
|
||||
LIBRAW_PROGRESS_RAW2_IMAGE = 1 << 4,
|
||||
LIBRAW_PROGRESS_REMOVE_ZEROES = 1 << 5,
|
||||
LIBRAW_PROGRESS_BAD_PIXELS = 1 << 6,
|
||||
LIBRAW_PROGRESS_DARK_FRAME = 1 << 7,
|
||||
LIBRAW_PROGRESS_FOVEON_INTERPOLATE = 1 << 8,
|
||||
LIBRAW_PROGRESS_SCALE_COLORS = 1 << 9,
|
||||
LIBRAW_PROGRESS_PRE_INTERPOLATE = 1 << 10,
|
||||
LIBRAW_PROGRESS_INTERPOLATE = 1 << 11,
|
||||
LIBRAW_PROGRESS_MIX_GREEN = 1 << 12,
|
||||
LIBRAW_PROGRESS_MEDIAN_FILTER = 1 << 13,
|
||||
LIBRAW_PROGRESS_HIGHLIGHTS = 1 << 14,
|
||||
LIBRAW_PROGRESS_FUJI_ROTATE = 1 << 15,
|
||||
LIBRAW_PROGRESS_FLIP = 1 << 16,
|
||||
LIBRAW_PROGRESS_APPLY_PROFILE = 1 << 17,
|
||||
LIBRAW_PROGRESS_CONVERT_RGB = 1 << 18,
|
||||
LIBRAW_PROGRESS_STRETCH = 1 << 19,
|
||||
/* reserved */
|
||||
LIBRAW_PROGRESS_STAGE20 = 1 << 20,
|
||||
LIBRAW_PROGRESS_STAGE21 = 1 << 21,
|
||||
LIBRAW_PROGRESS_STAGE22 = 1 << 22,
|
||||
LIBRAW_PROGRESS_STAGE23 = 1 << 23,
|
||||
LIBRAW_PROGRESS_STAGE24 = 1 << 24,
|
||||
LIBRAW_PROGRESS_STAGE25 = 1 << 25,
|
||||
LIBRAW_PROGRESS_STAGE26 = 1 << 26,
|
||||
LIBRAW_PROGRESS_STAGE27 = 1 << 27,
|
||||
|
||||
LIBRAW_PROGRESS_THUMB_LOAD = 1 << 28,
|
||||
LIBRAW_PROGRESS_TRESERVED1 = 1 << 29,
|
||||
LIBRAW_PROGRESS_TRESERVED2 = 1 << 30
|
||||
};
|
||||
#define LIBRAW_PROGRESS_THUMB_MASK 0x0fffffff
|
||||
|
||||
enum LibRaw_errors
|
||||
{
|
||||
LIBRAW_SUCCESS = 0,
|
||||
LIBRAW_UNSPECIFIED_ERROR = -1,
|
||||
LIBRAW_FILE_UNSUPPORTED = -2,
|
||||
LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE = -3,
|
||||
LIBRAW_OUT_OF_ORDER_CALL = -4,
|
||||
LIBRAW_NO_THUMBNAIL = -5,
|
||||
LIBRAW_UNSUPPORTED_THUMBNAIL = -6,
|
||||
LIBRAW_INPUT_CLOSED = -7,
|
||||
LIBRAW_NOT_IMPLEMENTED = -8,
|
||||
LIBRAW_REQUEST_FOR_NONEXISTENT_THUMBNAIL = -9,
|
||||
LIBRAW_UNSUFFICIENT_MEMORY = -100007,
|
||||
LIBRAW_DATA_ERROR = -100008,
|
||||
LIBRAW_IO_ERROR = -100009,
|
||||
LIBRAW_CANCELLED_BY_CALLBACK = -100010,
|
||||
LIBRAW_BAD_CROP = -100011,
|
||||
LIBRAW_TOO_BIG = -100012,
|
||||
LIBRAW_MEMPOOL_OVERFLOW = -100013
|
||||
};
|
||||
|
||||
#define LIBRAW_FATAL_ERROR(ec) ((ec) < -100000)
|
||||
|
||||
enum LibRaw_internal_thumbnail_formats
|
||||
{
|
||||
LIBRAW_INTERNAL_THUMBNAIL_UNKNOWN = 0,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_KODAK_THUMB = 1,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_KODAK_YCBCR = 2,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_KODAK_RGB = 3,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_JPEG = 4,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_LAYER,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_ROLLEI,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_PPM,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_PPM16,
|
||||
LIBRAW_INTERNAL_THUMBNAIL_X3F,
|
||||
};
|
||||
|
||||
|
||||
enum LibRaw_thumbnail_formats
|
||||
{
|
||||
LIBRAW_THUMBNAIL_UNKNOWN = 0,
|
||||
LIBRAW_THUMBNAIL_JPEG = 1,
|
||||
LIBRAW_THUMBNAIL_BITMAP = 2,
|
||||
LIBRAW_THUMBNAIL_BITMAP16 = 3,
|
||||
LIBRAW_THUMBNAIL_LAYER = 4,
|
||||
LIBRAW_THUMBNAIL_ROLLEI = 5,
|
||||
LIBRAW_THUMBNAIL_H265 = 6
|
||||
};
|
||||
|
||||
enum LibRaw_image_formats
|
||||
{
|
||||
LIBRAW_IMAGE_JPEG = 1,
|
||||
LIBRAW_IMAGE_BITMAP = 2
|
||||
};
|
||||
|
||||
#endif
|
410
libraw/libraw_datastream.h
Normal file
410
libraw/libraw_datastream.h
Normal file
@@ -0,0 +1,410 @@
|
||||
/* -*- C -*-
|
||||
* File: libraw_datastream.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sun Jan 18 13:07:35 2009
|
||||
*
|
||||
* LibRaw Data stream interface
|
||||
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LIBRAW_DATASTREAM_H
|
||||
#define __LIBRAW_DATASTREAM_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#else /* __cplusplus */
|
||||
#if defined _WIN32
|
||||
#ifndef LIBRAW_NO_WINSOCK2
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#endif
|
||||
/* No unique_ptr on Apple ?? */
|
||||
#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) || \
|
||||
(defined(_MSC_VER) && _MSVC_LANG >= 201103L)
|
||||
/* OK - use unique_ptr unless LIBRAW_USE_AUTOPTR defined externally*/
|
||||
#else
|
||||
/* Force to use auto_ptr */
|
||||
#ifndef LIBRAW_USE_AUTOPTR
|
||||
#define LIBRAW_USE_AUTOPTR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libraw_const.h"
|
||||
#include "libraw_types.h"
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) && (_MSC_VER) >= 1500
|
||||
#define WIN32SECURECALLS
|
||||
#endif
|
||||
|
||||
#ifdef USE_DNGSDK
|
||||
|
||||
#if defined LIBRAW_WIN32_CALLS
|
||||
#define qWinOS 1
|
||||
#define qMacOS 0
|
||||
#elif defined(__APPLE__)
|
||||
#define qWinOS 0
|
||||
#define qMacOS 1
|
||||
#else
|
||||
/* define OS types for DNG here */
|
||||
#endif
|
||||
#define qDNGXMPDocOps 0
|
||||
#define qDNGUseLibJPEG 1
|
||||
#define qDNGXMPFiles 0
|
||||
#define qDNGExperimental 1
|
||||
#define qDNGThreadSafe 1
|
||||
#include "dng_stream.h"
|
||||
#endif /* DNGSDK */
|
||||
|
||||
#define IOERROR() \
|
||||
do \
|
||||
{ \
|
||||
throw LIBRAW_EXCEPTION_IO_EOF; \
|
||||
} while (0)
|
||||
|
||||
class LibRaw_buffer_datastream;
|
||||
class LibRaw_bit_buffer;
|
||||
|
||||
class DllDef LibRaw_abstract_datastream
|
||||
{
|
||||
public:
|
||||
LibRaw_abstract_datastream() { };
|
||||
virtual ~LibRaw_abstract_datastream(void) { }
|
||||
virtual int valid() = 0;
|
||||
virtual int read(void *, size_t, size_t) = 0;
|
||||
virtual int seek(INT64, int) = 0;
|
||||
virtual INT64 tell() = 0;
|
||||
virtual INT64 size() = 0;
|
||||
virtual int get_char() = 0;
|
||||
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
|
||||
* OpenMP is not used */
|
||||
virtual int lock() { return 1; } /* success */
|
||||
virtual void unlock() {}
|
||||
virtual const char *fname() { return NULL; };
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
virtual const wchar_t *wfname() { return NULL; };
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef LIBRAW_NO_IOSTREAMS_DATASTREAM
|
||||
|
||||
#ifdef LIBRAW_WIN32_DLLDEFS
|
||||
#ifdef LIBRAW_USE_AUTOPTR
|
||||
template class DllDef std::auto_ptr<std::streambuf>;
|
||||
#else
|
||||
template class DllDef std::unique_ptr<std::streambuf>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class DllDef LibRaw_file_datastream : public LibRaw_abstract_datastream
|
||||
{
|
||||
protected:
|
||||
#ifdef LIBRAW_USE_AUTOPTR
|
||||
std::auto_ptr<std::streambuf> f; /* will close() automatically through dtor */
|
||||
#else
|
||||
std::unique_ptr<std::streambuf> f;
|
||||
#endif
|
||||
std::string filename;
|
||||
INT64 _fsize;
|
||||
#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);
|
||||
virtual int eof();
|
||||
virtual int seek(INT64 o, int whence);
|
||||
virtual INT64 tell();
|
||||
virtual INT64 size() { return _fsize; }
|
||||
virtual int get_char() {return f->sbumpc();}
|
||||
virtual char *gets(char *str, int sz);
|
||||
virtual int scanf_one(const char *fmt, void *val);
|
||||
virtual const char *fname();
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
virtual const wchar_t *wfname();
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined (LIBRAW_NO_IOSTREAMS_DATASTREAM) && defined (LIBRAW_WIN32_CALLS)
|
||||
|
||||
struct DllDef LibRaw_bufio_params
|
||||
{
|
||||
static int bufsize;
|
||||
static void set_bufsize(int bs);
|
||||
};
|
||||
|
||||
class buffer_t : public std::vector<unsigned char>
|
||||
{
|
||||
public:
|
||||
INT64 _bstart, _bend;
|
||||
buffer_t() : std::vector<unsigned char>(LibRaw_bufio_params::bufsize), _bstart(0), _bend(0) {}
|
||||
int charOReof(INT64 _fpos)
|
||||
{
|
||||
if (_bstart < 0LL || _bend < 0LL || _bend < _bstart || _fpos < 0LL)
|
||||
return -1;
|
||||
if ((_bend - _bstart) > (INT64)size())
|
||||
return -1;
|
||||
if (_fpos >= _bstart && _fpos < _bend)
|
||||
return data()[_fpos - _bstart];
|
||||
return -1;
|
||||
}
|
||||
bool contains(INT64 _fpos, INT64& contains)
|
||||
{
|
||||
if (_bstart < 0LL || _bend < 0LL || _bend < _bstart || _fpos < 0LL)
|
||||
{
|
||||
contains = 0;
|
||||
return false;
|
||||
}
|
||||
if ((_bend - _bstart) > (INT64)size())
|
||||
{
|
||||
contains = 0;
|
||||
return false;
|
||||
}
|
||||
if (_fpos >= _bstart && _fpos < _bend)
|
||||
{
|
||||
contains = _bend - _fpos;
|
||||
return true;
|
||||
}
|
||||
contains = 0;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DllDef LibRaw_bigfile_buffered_datastream : public LibRaw_abstract_datastream
|
||||
{
|
||||
public:
|
||||
LibRaw_bigfile_buffered_datastream(const char *fname);
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
LibRaw_bigfile_buffered_datastream(const wchar_t *fname);
|
||||
#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();
|
||||
virtual int seek(INT64 o, int whence);
|
||||
virtual INT64 tell();
|
||||
virtual INT64 size() { return _fsize; }
|
||||
virtual char *gets(char *str, int sz);
|
||||
virtual int scanf_one(const char *fmt, void *val);
|
||||
virtual const char *fname();
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
virtual const wchar_t *wfname();
|
||||
#endif
|
||||
virtual int get_char()
|
||||
{
|
||||
int r = iobuffers[0].charOReof(_fpos);
|
||||
if (r >= 0)
|
||||
{
|
||||
_fpos++;
|
||||
return r;
|
||||
}
|
||||
unsigned char c;
|
||||
r = read(&c, 1, 1);
|
||||
return r > 0 ? c : r;
|
||||
}
|
||||
|
||||
protected:
|
||||
INT64 readAt(void *ptr, size_t size, INT64 off);
|
||||
bool fillBufferAt(int buf, INT64 off);
|
||||
int selectStringBuffer(INT64 len, INT64& contains);
|
||||
HANDLE fhandle;
|
||||
INT64 _fsize;
|
||||
INT64 _fpos; /* current file position; current buffer start position */
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
std::wstring wfilename;
|
||||
#endif
|
||||
std::string filename;
|
||||
buffer_t iobuffers[2];
|
||||
int buffered;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class DllDef LibRaw_buffer_datastream : public LibRaw_abstract_datastream
|
||||
{
|
||||
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();
|
||||
virtual int seek(INT64 o, int whence);
|
||||
virtual INT64 tell();
|
||||
virtual INT64 size() { return streamsize; }
|
||||
virtual char *gets(char *s, int sz);
|
||||
virtual int scanf_one(const char *fmt, void *val);
|
||||
virtual int get_char()
|
||||
{
|
||||
if (streampos >= streamsize) return -1;
|
||||
return buf[streampos++];
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char *buf;
|
||||
size_t streampos, streamsize;
|
||||
};
|
||||
|
||||
class DllDef LibRaw_bigfile_datastream : public LibRaw_abstract_datastream
|
||||
{
|
||||
public:
|
||||
LibRaw_bigfile_datastream(const char *fname);
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
LibRaw_bigfile_datastream(const wchar_t *fname);
|
||||
#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);
|
||||
virtual INT64 tell();
|
||||
virtual INT64 size() { return _fsize; }
|
||||
virtual char *gets(char *str, int sz);
|
||||
virtual int scanf_one(const char *fmt, void *val);
|
||||
virtual const char *fname();
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
virtual const wchar_t *wfname();
|
||||
#endif
|
||||
virtual int get_char()
|
||||
{
|
||||
#ifndef LIBRAW_WIN32_CALLS
|
||||
return getc_unlocked(f);
|
||||
#else
|
||||
return fgetc(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
FILE *f;
|
||||
std::string filename;
|
||||
INT64 _fsize;
|
||||
#ifdef LIBRAW_WIN32_UNICODEPATHS
|
||||
std::wstring wfilename;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef LIBRAW_WIN32_CALLS
|
||||
class DllDef LibRaw_windows_datastream : public LibRaw_buffer_datastream
|
||||
{
|
||||
public:
|
||||
/* ctor: high level constructor opens a file by name */
|
||||
LibRaw_windows_datastream(const TCHAR *sFile);
|
||||
/* ctor: construct with a file handle - caller is responsible for closing the
|
||||
* file handle */
|
||||
LibRaw_windows_datastream(HANDLE hFile);
|
||||
/* dtor: unmap and close the mapping handle */
|
||||
virtual ~LibRaw_windows_datastream();
|
||||
virtual INT64 size() { return cbView_; }
|
||||
|
||||
protected:
|
||||
void Open(HANDLE hFile);
|
||||
inline void reconstruct_base()
|
||||
{
|
||||
/* this subterfuge is to overcome the private-ness of
|
||||
* LibRaw_buffer_datastream */
|
||||
(LibRaw_buffer_datastream &)*this =
|
||||
LibRaw_buffer_datastream(pView_, (size_t)cbView_);
|
||||
}
|
||||
|
||||
HANDLE hMap_; /* handle of the file mapping */
|
||||
void *pView_; /* pointer to the mapped memory */
|
||||
__int64 cbView_; /* size of the mapping in bytes */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DNGSDK
|
||||
|
||||
class libraw_dng_stream : public dng_stream
|
||||
{
|
||||
public:
|
||||
libraw_dng_stream(LibRaw_abstract_datastream *p)
|
||||
: dng_stream((dng_abort_sniffer *)NULL, kBigBufferSize, 0),
|
||||
parent_stream(p)
|
||||
{
|
||||
if (parent_stream)
|
||||
{
|
||||
parent_stream->buffering_off();
|
||||
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);
|
||||
}
|
||||
virtual uint64 DoGetLength()
|
||||
{
|
||||
if (parent_stream)
|
||||
return parent_stream->size();
|
||||
return 0;
|
||||
}
|
||||
virtual void DoRead(void *data, uint32 count, uint64 offset)
|
||||
{
|
||||
if (parent_stream)
|
||||
{
|
||||
parent_stream->seek(offset, SEEK_SET);
|
||||
parent_stream->read(data, 1, count);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
libraw_dng_stream(const libraw_dng_stream &stream);
|
||||
libraw_dng_stream &operator=(const libraw_dng_stream &stream);
|
||||
LibRaw_abstract_datastream *parent_stream;
|
||||
INT64 off;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* cplusplus */
|
||||
|
||||
#endif
|
341
libraw/libraw_internal.h
Normal file
341
libraw/libraw_internal.h
Normal file
@@ -0,0 +1,341 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_internal.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 8 , 2008
|
||||
*
|
||||
* LibRaw internal data structures (not visible outside)
|
||||
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _LIBRAW_INTERNAL_TYPES_H
|
||||
#define _LIBRAW_INTERNAL_TYPES_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "libraw_datastream.h"
|
||||
#include "libraw_types.h"
|
||||
|
||||
class LibRaw_TLS
|
||||
{
|
||||
public:
|
||||
struct
|
||||
{
|
||||
unsigned bitbuf;
|
||||
int vbits, reset;
|
||||
} getbits;
|
||||
struct
|
||||
{
|
||||
UINT64 bitbuf;
|
||||
int vbits;
|
||||
|
||||
} ph1_bits;
|
||||
struct
|
||||
{
|
||||
unsigned pad[128], p;
|
||||
} sony_decrypt;
|
||||
struct
|
||||
{
|
||||
uchar buf[0x4002];
|
||||
int vpos, padding;
|
||||
} pana_data;
|
||||
uchar jpeg_buffer[4096];
|
||||
struct
|
||||
{
|
||||
float cbrt[0x10000], xyz_cam[3][4];
|
||||
} ahd_data;
|
||||
void init()
|
||||
{
|
||||
getbits.bitbuf = 0;
|
||||
getbits.vbits = getbits.reset = 0;
|
||||
ph1_bits.bitbuf = 0;
|
||||
ph1_bits.vbits = 0;
|
||||
pana_data.vpos = 0;
|
||||
ahd_data.cbrt[0] = -2.0f;
|
||||
}
|
||||
};
|
||||
|
||||
class LibRaw_constants
|
||||
{
|
||||
public:
|
||||
static const float d65_white[3];
|
||||
static const double xyz_rgb[3][3];
|
||||
static const double xyzd50_srgb[3][3];
|
||||
static const double rgb_rgb[3][3];
|
||||
static const double adobe_rgb[3][3];
|
||||
static const double wide_rgb[3][3];
|
||||
static const double prophoto_rgb[3][3];
|
||||
static const double aces_rgb[3][3];
|
||||
static const double dcip3d65_rgb[3][3];
|
||||
static const double rec2020_rgb[3][3];
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifndef __cplusplus
|
||||
struct
|
||||
#endif
|
||||
LibRaw_abstract_datastream *input;
|
||||
FILE *output;
|
||||
int input_internal;
|
||||
char *meta_data;
|
||||
INT64 profile_offset;
|
||||
INT64 toffset;
|
||||
unsigned pana_black[4];
|
||||
|
||||
} internal_data_t;
|
||||
|
||||
#define LIBRAW_HISTOGRAM_SIZE 0x2000
|
||||
typedef struct
|
||||
{
|
||||
int (*histogram)[LIBRAW_HISTOGRAM_SIZE];
|
||||
unsigned *oprof;
|
||||
} output_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned olympus_exif_cfa;
|
||||
unsigned long long unique_id;
|
||||
unsigned long long OlyID;
|
||||
unsigned tiff_nifds;
|
||||
int tiff_flip;
|
||||
int metadata_blocks;
|
||||
} identify_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t first;
|
||||
uint32_t count;
|
||||
uint32_t id;
|
||||
} crx_sample_to_chunk_t;
|
||||
|
||||
// contents of tag CMP1 for relevant track in CR3 file
|
||||
typedef struct
|
||||
{
|
||||
int32_t version;
|
||||
int32_t f_width;
|
||||
int32_t f_height;
|
||||
int32_t tileWidth;
|
||||
int32_t tileHeight;
|
||||
int32_t nBits;
|
||||
int32_t nPlanes;
|
||||
int32_t cfaLayout;
|
||||
int32_t encType;
|
||||
int32_t imageLevels;
|
||||
int32_t hasTileCols;
|
||||
int32_t hasTileRows;
|
||||
int32_t mdatHdrSize;
|
||||
int32_t medianBits;
|
||||
// Not from header, but from datastream
|
||||
uint32_t MediaSize;
|
||||
INT64 MediaOffset;
|
||||
uint32_t MediaType; /* 1 -> /C/RAW, 2-> JPEG, 3-> CTMD metadata*/
|
||||
crx_sample_to_chunk_t * stsc_data; /* samples to chunk */
|
||||
uint32_t stsc_count;
|
||||
uint32_t sample_count;
|
||||
uint32_t sample_size; /* zero if not fixed sample size */
|
||||
int32_t *sample_sizes;
|
||||
uint32_t chunk_count;
|
||||
INT64 *chunk_offsets;
|
||||
} crx_data_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short order;
|
||||
ushort sraw_mul[4], cr2_slice[3];
|
||||
unsigned kodak_cbpp;
|
||||
INT64 strip_offset, data_offset;
|
||||
INT64 meta_offset;
|
||||
INT64 exif_offset, exif_subdir_offset, ifd0_offset;
|
||||
unsigned data_size;
|
||||
unsigned meta_length;
|
||||
unsigned cr3_exif_length, cr3_ifd0_length;
|
||||
unsigned thumb_misc;
|
||||
enum LibRaw_internal_thumbnail_formats thumb_format;
|
||||
unsigned fuji_layout;
|
||||
unsigned tiff_samples;
|
||||
unsigned tiff_bps;
|
||||
unsigned tiff_compress;
|
||||
unsigned tiff_sampleformat;
|
||||
unsigned zero_after_ff;
|
||||
unsigned tile_width, tile_length, load_flags;
|
||||
unsigned data_error;
|
||||
int hasselblad_parser_flag;
|
||||
long long posRAFData;
|
||||
unsigned lenRAFData;
|
||||
int fuji_total_lines, fuji_total_blocks, fuji_block_width, fuji_bits,
|
||||
fuji_raw_type, fuji_lossless;
|
||||
int pana_encoding, pana_bpp;
|
||||
crx_data_header_t crx_header[LIBRAW_CRXTRACKS_MAXCOUNT];
|
||||
int crx_track_selected;
|
||||
int crx_track_count;
|
||||
short CR3_CTMDtag;
|
||||
short CR3_Version;
|
||||
int CM_found;
|
||||
unsigned is_NikonTransfer;
|
||||
unsigned is_Olympus;
|
||||
int OlympusDNG_SubDirOffsetValid;
|
||||
unsigned is_Sony;
|
||||
unsigned is_pana_raw;
|
||||
unsigned is_PentaxRicohMakernotes; /* =1 for Ricoh software by Pentax, Camera DNG */
|
||||
|
||||
unsigned dng_frames[LIBRAW_IFD_MAXCOUNT*2]; /* bits: 0-7: shot_select, 8-15: IFD#, 16-31: low 16 bit of newsubfile type */
|
||||
unsigned short raw_stride;
|
||||
} unpacker_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
internal_data_t internal_data;
|
||||
libraw_internal_output_params_t internal_output_params;
|
||||
output_data_t output_data;
|
||||
identify_data_t identify_data;
|
||||
unpacker_data_t unpacker_data;
|
||||
} libraw_internal_data_t;
|
||||
|
||||
struct decode
|
||||
{
|
||||
struct decode *branch[2];
|
||||
int leaf;
|
||||
};
|
||||
|
||||
struct tiff_ifd_t
|
||||
{
|
||||
int t_width, t_height, bps, comp, phint, offset, t_flip, samples, bytes, extrasamples;
|
||||
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;
|
||||
unsigned t_filters;
|
||||
int t_vwidth, t_vheight, t_lm,t_tm;
|
||||
int t_fuji_width;
|
||||
float t_shutter;
|
||||
/* Per-IFD DNG fields */
|
||||
INT64 opcode2_offset;
|
||||
INT64 lineartable_offset;
|
||||
int lineartable_len;
|
||||
libraw_dng_color_t dng_color[2];
|
||||
libraw_dng_levels_t dng_levels;
|
||||
int newsubfiletype;
|
||||
};
|
||||
|
||||
struct jhead
|
||||
{
|
||||
int algo, bits, high, wide, clrs, sraw, psv, restart, vpred[6];
|
||||
ushort quant[64], idct[64], *huff[20], *free[20], *row;
|
||||
};
|
||||
|
||||
struct libraw_tiff_tag
|
||||
{
|
||||
ushort tag, type;
|
||||
int count;
|
||||
union {
|
||||
char c[4];
|
||||
short s[2];
|
||||
int i;
|
||||
} val;
|
||||
};
|
||||
|
||||
struct tiff_hdr
|
||||
{
|
||||
ushort t_order, magic;
|
||||
int ifd;
|
||||
ushort pad, ntag;
|
||||
struct libraw_tiff_tag tag[23];
|
||||
int nextifd;
|
||||
ushort pad2, nexif;
|
||||
struct libraw_tiff_tag exif[4];
|
||||
ushort pad3, ngps;
|
||||
struct libraw_tiff_tag gpst[10];
|
||||
short bps[4];
|
||||
int rat[10];
|
||||
unsigned gps[26];
|
||||
char t_desc[512], t_make[64], t_model[64], soft[32], date[20], t_artist[64];
|
||||
};
|
||||
|
||||
#ifdef DEBUG_STAGE_CHECKS
|
||||
#define CHECK_ORDER_HIGH(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
if ((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) >= \
|
||||
expected_stage) \
|
||||
{ \
|
||||
fprintf(stderr, "CHECK_HIGH: check %d >= %d\n", \
|
||||
imgdata.progress_flags &LIBRAW_PROGRESS_THUMB_MASK, \
|
||||
expected_stage); \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_ORDER_LOW(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
printf("Checking LOW %d/%d : %d\n", imgdata.progress_flags, \
|
||||
expected_stage, imgdata.progress_flags < expected_stage); \
|
||||
if ((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) < \
|
||||
expected_stage) \
|
||||
{ \
|
||||
printf("failed!\n"); \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} \
|
||||
} while (0)
|
||||
#define CHECK_ORDER_BIT(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
if (imgdata.progress_flags & expected_stage) \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} while (0)
|
||||
|
||||
#define SET_PROC_FLAG(stage) \
|
||||
do \
|
||||
{ \
|
||||
imgdata.progress_flags |= stage; \
|
||||
fprintf(stderr, "SET_FLAG: %d\n", stage); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define CHECK_ORDER_HIGH(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
if ((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) >= \
|
||||
expected_stage) \
|
||||
{ \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_ORDER_LOW(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
if ((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) < \
|
||||
expected_stage) \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_ORDER_BIT(expected_stage) \
|
||||
do \
|
||||
{ \
|
||||
if (imgdata.progress_flags & expected_stage) \
|
||||
return LIBRAW_OUT_OF_ORDER_CALL; \
|
||||
} while (0)
|
||||
|
||||
#define SET_PROC_FLAG(stage) \
|
||||
do \
|
||||
{ \
|
||||
imgdata.progress_flags |= stage; \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
1175
libraw/libraw_types.h
Normal file
1175
libraw/libraw_types.h
Normal file
File diff suppressed because it is too large
Load Diff
63
libraw/libraw_version.h
Normal file
63
libraw/libraw_version.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_version.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Mon Sept 8, 2008
|
||||
*
|
||||
* LibRaw C++ interface
|
||||
*
|
||||
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See the file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See the file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define LIBRAW_MAJOR_VERSION 0
|
||||
#define LIBRAW_MINOR_VERSION 21
|
||||
#define LIBRAW_PATCH_VERSION 1
|
||||
#define LIBRAW_VERSION_TAIL Release
|
||||
|
||||
#define LIBRAW_SHLIB_CURRENT 23
|
||||
#define LIBRAW_SHLIB_REVISION 0
|
||||
#define LIBRAW_SHLIB_AGE 0
|
||||
|
||||
#define _LIBRAW_VERSION_MAKE(a, b, c, d) #a "." #b "." #c "-" #d
|
||||
#define LIBRAW_VERSION_MAKE(a, b, c, d) _LIBRAW_VERSION_MAKE(a, b, c, d)
|
||||
|
||||
#define LIBRAW_VERSION_STR \
|
||||
LIBRAW_VERSION_MAKE(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, \
|
||||
LIBRAW_PATCH_VERSION, LIBRAW_VERSION_TAIL)
|
||||
|
||||
#define LIBRAW_MAKE_VERSION(major, minor, patch) \
|
||||
(((major) << 16) | ((minor) << 8) | (patch))
|
||||
|
||||
#define LIBRAW_VERSION \
|
||||
LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, \
|
||||
LIBRAW_PATCH_VERSION)
|
||||
|
||||
#define LIBRAW_CHECK_VERSION(major, minor, patch) \
|
||||
(LibRaw::versionNumber() >= LIBRAW_MAKE_VERSION(major, minor, patch))
|
||||
|
||||
#define LIBRAW_RUNTIME_CHECK_VERSION_EXACT() \
|
||||
((LibRaw::versionNumber() & 0xffff00) == \
|
||||
LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, 0))
|
||||
|
||||
#define LIBRAW_RUNTIME_CHECK_VERSION_NOTLESS() \
|
||||
((LibRaw::versionNumber() & 0xffff00) >= \
|
||||
LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, 0))
|
||||
|
||||
#define LIBRAW_COMPILE_CHECK_VERSION(major, minor) \
|
||||
(LIBRAW_MAKE_VERSION(major, minor, 0) == (LIBRAW_VERSION & 0xffff00))
|
||||
|
||||
#define LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(major, minor) \
|
||||
(LIBRAW_MAKE_VERSION(major, minor, 0) <= (LIBRAW_VERSION & 0xffff00))
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user