Squashed 'rtengine/libraw/' content from commit cccb97647
git-subtree-dir: rtengine/libraw git-subtree-split: cccb97647fcee56801fa68231fa8a38aa8b52ef7
This commit is contained in:
66
internal/dcraw_defs.h
Normal file
66
internal/dcraw_defs.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- C++ -*-
|
||||
* Copyright 2019-2021 LibRaw LLC (info@libraw.org)
|
||||
*
|
||||
|
||||
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 DCRAW_DEFS_H
|
||||
#define DCRAW_DEFS_H
|
||||
|
||||
#include <math.h>
|
||||
#define LIBRAW_LIBRARY_BUILD
|
||||
#define LIBRAW_IO_REDEFINED
|
||||
#include "libraw/libraw.h"
|
||||
#include "libraw/libraw_types.h"
|
||||
#include "internal/defines.h"
|
||||
#include "internal/var_defines.h"
|
||||
|
||||
#define stmread(buf, maxlen, fp) stread(buf, MIN(maxlen, sizeof(buf)), fp)
|
||||
#define strbuflen(buf) strnlen(buf, sizeof(buf) - 1)
|
||||
#define makeIs(idx) (maker_index == idx)
|
||||
#define strnXcat(buf, string) \
|
||||
strncat(buf, string, LIM(sizeof(buf) - strbuflen(buf) - 1, 0, sizeof(buf)))
|
||||
|
||||
// DNG was written by:
|
||||
#define nonDNG 0
|
||||
#define CameraDNG 1
|
||||
#define AdobeDNG 2
|
||||
|
||||
// Makernote tag type:
|
||||
#define is_0x927c 0 /* most cameras */
|
||||
#define is_0xc634 2 /* Adobe DNG, Sony SR2, Pentax */
|
||||
|
||||
// abbreviations
|
||||
#define ilm imgdata.lens.makernotes
|
||||
#define icWBC imgdata.color.WB_Coeffs
|
||||
#define icWBCCTC imgdata.color.WBCT_Coeffs
|
||||
#define imCanon imgdata.makernotes.canon
|
||||
#define imFuji imgdata.makernotes.fuji
|
||||
#define imHassy imgdata.makernotes.hasselblad
|
||||
#define imKodak imgdata.makernotes.kodak
|
||||
#define imNikon imgdata.makernotes.nikon
|
||||
#define imOly imgdata.makernotes.olympus
|
||||
#define imPana imgdata.makernotes.panasonic
|
||||
#define imPentax imgdata.makernotes.pentax
|
||||
#define imPhaseOne imgdata.makernotes.phaseone
|
||||
#define imRicoh imgdata.makernotes.ricoh
|
||||
#define imSamsung imgdata.makernotes.samsung
|
||||
#define imSony imgdata.makernotes.sony
|
||||
#define imCommon imgdata.makernotes.common
|
||||
|
||||
|
||||
#define ph1_bits(n) ph1_bithuff(n, 0)
|
||||
#define ph1_huff(h) ph1_bithuff(*h, h + 1)
|
||||
#define getbits(n) getbithuff(n, 0)
|
||||
#define gethuff(h) getbithuff(*h, h + 1)
|
||||
|
||||
#endif
|
25
internal/dcraw_fileio_defs.h
Normal file
25
internal/dcraw_fileio_defs.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* -*- C++ -*-
|
||||
* Copyright 2019-2021 LibRaw LLC (info@libraw.org)
|
||||
*
|
||||
|
||||
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 DCRAW_FILEIO_DEFS_H
|
||||
#define DCRAW_FILEIO_DEFS_H
|
||||
|
||||
#include <math.h>
|
||||
#define LIBRAW_LIBRARY_BUILD
|
||||
#include "libraw/libraw.h"
|
||||
#include "internal/defines.h"
|
||||
#include "internal/var_defines.h"
|
||||
|
||||
#endif
|
193
internal/defines.h
Normal file
193
internal/defines.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
|
||||
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).
|
||||
|
||||
This file is generated from Dave Coffin's dcraw.c
|
||||
dcraw.c -- Dave Coffin's raw photo decoder
|
||||
Copyright 1997-2010 by Dave Coffin, dcoffin a cybercom o net
|
||||
|
||||
Look into dcraw homepage (probably http://cybercom.net/~dcoffin/dcraw/)
|
||||
for more information
|
||||
*/
|
||||
|
||||
#ifndef LIBRAW_INT_DEFINES_H
|
||||
#define LIBRAW_INT_DEFINES_H
|
||||
#ifndef USE_JPEG
|
||||
#define NO_JPEG
|
||||
#endif
|
||||
#ifndef USE_JASPER
|
||||
#define NO_JASPER
|
||||
#endif
|
||||
#define DCRAW_VERSION "9.26"
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __CYGWIN__
|
||||
#include <io.h>
|
||||
#endif
|
||||
#if defined LIBRAW_WIN32_CALLS
|
||||
#include <sys/utime.h>
|
||||
#ifndef LIBRAW_NO_WINSOCK2
|
||||
#include <winsock2.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#endif
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <netinet/in.h>
|
||||
typedef long long INT64;
|
||||
typedef unsigned long long UINT64;
|
||||
#endif
|
||||
|
||||
#ifdef NODEPS
|
||||
#define NO_JASPER
|
||||
#define NO_JPEG
|
||||
#define NO_LCMS
|
||||
#endif
|
||||
#ifndef NO_JASPER
|
||||
#include <jasper/jasper.h> /* Decode Red camera movies */
|
||||
#endif
|
||||
#ifndef NO_JPEG
|
||||
#include <jpeglib.h> /* Decode compressed Kodak DC120 photos */
|
||||
#endif /* and Adobe Lossy DNGs */
|
||||
#ifndef NO_LCMS
|
||||
#ifdef USE_LCMS
|
||||
#include <lcms.h> /* Support color profiles */
|
||||
#else
|
||||
#include <lcms2.h> /* Support color profiles */
|
||||
#endif
|
||||
#endif
|
||||
#ifdef LOCALEDIR
|
||||
#include <libintl.h>
|
||||
#define _(String) gettext(String)
|
||||
#else
|
||||
#define _(String) (String)
|
||||
#endif
|
||||
|
||||
#ifdef LJPEG_DECODE
|
||||
#error Please compile dcraw.c by itself.
|
||||
#error Do not link it with ljpeg_decode.
|
||||
#endif
|
||||
|
||||
#ifndef LONG_BIT
|
||||
#define LONG_BIT (8 * sizeof(long))
|
||||
#endif
|
||||
#define FORC(cnt) for (c = 0; c < cnt; c++)
|
||||
#define FORC3 FORC(3)
|
||||
#define FORC4 FORC(4)
|
||||
#define FORCC for (c = 0; c < colors && c < 4; c++)
|
||||
|
||||
#define SQR(x) ((x) * (x))
|
||||
#define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define LIM(x, min, max) MAX(min, MIN(x, max))
|
||||
#define ULIM(x, y, z) ((y) < (z) ? LIM(x, y, z) : LIM(x, z, y))
|
||||
#define CLIP(x) LIM((int)(x), 0, 65535)
|
||||
#define CLIP15(x) LIM((int)(x), 0, 32767)
|
||||
#define SWAP(a, b) \
|
||||
{ \
|
||||
a = a + b; \
|
||||
b = a - b; \
|
||||
a = a - b; \
|
||||
}
|
||||
|
||||
#define my_swap(type, i, j) \
|
||||
{ \
|
||||
type t = i; \
|
||||
i = j; \
|
||||
j = t; \
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
inline
|
||||
#elif defined(_MSC_VER)
|
||||
__forceinline
|
||||
#else
|
||||
static
|
||||
#endif
|
||||
float fMAX(float a, float b) { return MAX(a, b); }
|
||||
|
||||
/*
|
||||
In order to inline this calculation, I make the risky
|
||||
assumption that all filter patterns can be described
|
||||
by a repeating pattern of eight rows and two columns
|
||||
|
||||
Do not use the FC or BAYER macros with the Leaf CatchLight,
|
||||
because its pattern is 16x16, not 2x8.
|
||||
|
||||
Return values are either 0/1/2/3 = G/M/C/Y or 0/1/2/3 = R/G1/B/G2
|
||||
|
||||
PowerShot 600 PowerShot A50 PowerShot Pro70 Pro90 & G1
|
||||
0xe1e4e1e4: 0x1b4e4b1e: 0x1e4b4e1b: 0xb4b4b4b4:
|
||||
|
||||
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
|
||||
0 G M G M G M 0 C Y C Y C Y 0 Y C Y C Y C 0 G M G M G M
|
||||
1 C Y C Y C Y 1 M G M G M G 1 M G M G M G 1 Y C Y C Y C
|
||||
2 M G M G M G 2 Y C Y C Y C 2 C Y C Y C Y
|
||||
3 C Y C Y C Y 3 G M G M G M 3 G M G M G M
|
||||
4 C Y C Y C Y 4 Y C Y C Y C
|
||||
PowerShot A5 5 G M G M G M 5 G M G M G M
|
||||
0x1e4e1e4e: 6 Y C Y C Y C 6 C Y C Y C Y
|
||||
7 M G M G M G 7 M G M G M G
|
||||
0 1 2 3 4 5
|
||||
0 C Y C Y C Y
|
||||
1 G M G M G M
|
||||
2 C Y C Y C Y
|
||||
3 M G M G M G
|
||||
|
||||
All RGB cameras use one of these Bayer grids:
|
||||
|
||||
0x16161616: 0x61616161: 0x49494949: 0x94949494:
|
||||
|
||||
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
|
||||
0 B G B G B G 0 G R G R G R 0 G B G B G B 0 R G R G R G
|
||||
1 G R G R G R 1 B G B G B G 1 R G R G R G 1 G B G B G B
|
||||
2 B G B G B G 2 G R G R G R 2 G B G B G B 2 R G R G R G
|
||||
3 G R G R G R 3 B G B G B G 3 R G R G R G 3 G B G B G B
|
||||
*/
|
||||
|
||||
// _RGBG means R, G1, B, G2 sequence
|
||||
#define GRBG_2_RGBG(q) (q ^ (q >> 1) ^ 1)
|
||||
#define RGGB_2_RGBG(q) (q ^ (q >> 1))
|
||||
#define BG2RG1_2_RGBG(q) (q ^ 2)
|
||||
#define G2BRG1_2_RGBG(q) (q ^ (q >> 1) ^ 3)
|
||||
#define GRGB_2_RGBG(q) (q ^ 1)
|
||||
#define RBGG_2_RGBG(q) ((q >> 1) | ((q & 1) << 1))
|
||||
|
||||
#define RAWINDEX(row, col) ((row)*raw_width + (col))
|
||||
#define RAW(row, col) raw_image[(row)*raw_width + (col)]
|
||||
#define BAYER(row, col) \
|
||||
image[((row) >> shrink) * iwidth + ((col) >> shrink)][FC(row, col)]
|
||||
|
||||
#define BAYER2(row, col) \
|
||||
image[((row) >> shrink) * iwidth + ((col) >> shrink)][fcol(row, col)]
|
||||
#define BAYERC(row, col, c) \
|
||||
imgdata.image[((row) >> IO.shrink) * S.iwidth + ((col) >> IO.shrink)][c]
|
||||
|
||||
#endif
|
27
internal/dmp_include.h
Normal file
27
internal/dmp_include.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* -*- C++ -*-
|
||||
* Copyright 2019-2021 LibRaw LLC (info@libraw.org)
|
||||
*
|
||||
|
||||
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 DMP_INCLUDE_H
|
||||
#define DMP_INCLUDE_H
|
||||
|
||||
#define LIBRAW_LIBRARY_BUILD
|
||||
#define LIBRAW_IO_REDEFINED
|
||||
#include "libraw/libraw.h"
|
||||
#include "internal/defines.h"
|
||||
#define SRC_USES_SHRINK
|
||||
#define SRC_USES_BLACK
|
||||
#define SRC_USES_CURVE
|
||||
|
||||
#endif
|
320
internal/libraw_cameraids.h
Normal file
320
internal/libraw_cameraids.h
Normal file
@@ -0,0 +1,320 @@
|
||||
/* -*- C++ -*-
|
||||
* File: internal/libraw_cameraids.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Aug 17, 2020
|
||||
|
||||
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_CONST_H
|
||||
#define LIBRAW_CONST_H
|
||||
|
||||
#define CanonID_EOS_M50 0x00000412ULL
|
||||
#define CanonID_EOS_M6_Mark_II 0x00000811ULL
|
||||
#define CanonID_EOS_M200 0x00000812ULL
|
||||
#define CanonID_EOS_D30 0x01140000ULL
|
||||
#define CanonID_EOS_D60 0x01668000ULL
|
||||
#define CanonID_EOS_M3 0x03740000ULL
|
||||
#define CanonID_EOS_M10 0x03840000ULL
|
||||
#define CanonID_EOS_M5 0x03940000ULL
|
||||
#define CanonID_EOS_M100 0x03980000ULL
|
||||
#define CanonID_EOS_M6 0x04070000ULL
|
||||
#define CanonID_EOS_1D (0x80000000ULL + 0x001ULL)
|
||||
#define CanonID_EOS_1Ds (0x80000000ULL + 0x167ULL)
|
||||
#define CanonID_EOS_10D (0x80000000ULL + 0x168ULL)
|
||||
#define CanonID_EOS_1D_Mark_III (0x80000000ULL + 0x169ULL)
|
||||
#define CanonID_EOS_300D (0x80000000ULL + 0x170ULL)
|
||||
#define CanonID_EOS_1D_Mark_II (0x80000000ULL + 0x174ULL)
|
||||
#define CanonID_EOS_20D (0x80000000ULL + 0x175ULL)
|
||||
#define CanonID_EOS_450D (0x80000000ULL + 0x176ULL)
|
||||
#define CanonID_EOS_1Ds_Mark_II (0x80000000ULL + 0x188ULL)
|
||||
#define CanonID_EOS_350D (0x80000000ULL + 0x189ULL)
|
||||
#define CanonID_EOS_40D (0x80000000ULL + 0x190ULL)
|
||||
#define CanonID_EOS_5D (0x80000000ULL + 0x213ULL)
|
||||
#define CanonID_EOS_1Ds_Mark_III (0x80000000ULL + 0x215ULL)
|
||||
#define CanonID_EOS_5D_Mark_II (0x80000000ULL + 0x218ULL)
|
||||
#define CanonID_EOS_1D_Mark_II_N (0x80000000ULL + 0x232ULL)
|
||||
#define CanonID_EOS_30D (0x80000000ULL + 0x234ULL)
|
||||
#define CanonID_EOS_400D (0x80000000ULL + 0x236ULL)
|
||||
#define CanonID_EOS_7D (0x80000000ULL + 0x250ULL)
|
||||
#define CanonID_EOS_500D (0x80000000ULL + 0x252ULL)
|
||||
#define CanonID_EOS_1000D (0x80000000ULL + 0x254ULL)
|
||||
#define CanonID_EOS_50D (0x80000000ULL + 0x261ULL)
|
||||
#define CanonID_EOS_1D_X (0x80000000ULL + 0x269ULL)
|
||||
#define CanonID_EOS_550D (0x80000000ULL + 0x270ULL)
|
||||
#define CanonID_EOS_1D_Mark_IV (0x80000000ULL + 0x281ULL)
|
||||
#define CanonID_EOS_5D_Mark_III (0x80000000ULL + 0x285ULL)
|
||||
#define CanonID_EOS_600D (0x80000000ULL + 0x286ULL)
|
||||
#define CanonID_EOS_60D (0x80000000ULL + 0x287ULL)
|
||||
#define CanonID_EOS_1100D (0x80000000ULL + 0x288ULL)
|
||||
#define CanonID_EOS_7D_Mark_II (0x80000000ULL + 0x289ULL)
|
||||
#define CanonID_EOS_650D (0x80000000ULL + 0x301ULL)
|
||||
#define CanonID_EOS_6D (0x80000000ULL + 0x302ULL)
|
||||
#define CanonID_EOS_1D_C (0x80000000ULL + 0x324ULL)
|
||||
#define CanonID_EOS_70D (0x80000000ULL + 0x325ULL)
|
||||
#define CanonID_EOS_700D (0x80000000ULL + 0x326ULL)
|
||||
#define CanonID_EOS_1200D (0x80000000ULL + 0x327ULL)
|
||||
#define CanonID_EOS_1D_X_Mark_II (0x80000000ULL + 0x328ULL)
|
||||
#define CanonID_EOS_M (0x80000000ULL + 0x331ULL)
|
||||
#define CanonID_EOS_100D (0x80000000ULL + 0x346ULL)
|
||||
#define CanonID_EOS_760D (0x80000000ULL + 0x347ULL)
|
||||
#define CanonID_EOS_5D_Mark_IV (0x80000000ULL + 0x349ULL)
|
||||
#define CanonID_EOS_80D (0x80000000ULL + 0x350ULL)
|
||||
#define CanonID_EOS_M2 (0x80000000ULL + 0x355ULL)
|
||||
#define CanonID_EOS_5DS (0x80000000ULL + 0x382ULL)
|
||||
#define CanonID_EOS_750D (0x80000000ULL + 0x393ULL)
|
||||
#define CanonID_EOS_5DS_R (0x80000000ULL + 0x401ULL)
|
||||
#define CanonID_EOS_1300D (0x80000000ULL + 0x404ULL)
|
||||
#define CanonID_EOS_800D (0x80000000ULL + 0x405ULL)
|
||||
#define CanonID_EOS_6D_Mark_II (0x80000000ULL + 0x406ULL)
|
||||
#define CanonID_EOS_77D (0x80000000ULL + 0x408ULL)
|
||||
#define CanonID_EOS_200D (0x80000000ULL + 0x417ULL)
|
||||
#define CanonID_EOS_R5 (0x80000000ULL + 0x421ULL)
|
||||
#define CanonID_EOS_3000D (0x80000000ULL + 0x422ULL)
|
||||
#define CanonID_EOS_R (0x80000000ULL + 0x424ULL)
|
||||
#define CanonID_EOS_1D_X_Mark_III (0x80000000ULL + 0x428ULL)
|
||||
#define CanonID_EOS_1500D (0x80000000ULL + 0x432ULL)
|
||||
#define CanonID_EOS_RP (0x80000000ULL + 0x433ULL)
|
||||
#define CanonID_EOS_850D (0x80000000ULL + 0x435ULL)
|
||||
#define CanonID_EOS_250D (0x80000000ULL + 0x436ULL)
|
||||
#define CanonID_EOS_90D (0x80000000ULL + 0x437ULL)
|
||||
#define CanonID_EOS_R3 (0x80000000ULL + 0x450ULL)
|
||||
#define CanonID_EOS_R6 (0x80000000ULL + 0x453ULL)
|
||||
#define CanonID_EOS_R7 (0x80000000ULL + 0x464ULL)
|
||||
#define CanonID_EOS_R10 (0x80000000ULL + 0x465ULL)
|
||||
#define CanonID_EOS_M50_Mark_II (0x80000000ULL + 0x468ULL)
|
||||
|
||||
// CanonID_EOS_D2000C after Canon's TIFF2CR2 convertor:
|
||||
#define CanonID_EOS_D2000C (0x80000000ULL + 0x520ULL)
|
||||
// CanonID_EOS_D6000C id after Canon's TIFF2CR2 convertor:
|
||||
#define CanonID_EOS_D6000C (0x80000000ULL + 0x560ULL)
|
||||
|
||||
#define OlyID_str2hex(str) ((unsigned long long)str[0]<<32 | str[1]<<24 | str[2]<<16 | str[3]<<8 | str[4])
|
||||
#define OlyID_E_20 OlyID_str2hex("D4029")
|
||||
#define OlyID_E_1 OlyID_str2hex("D4040")
|
||||
#define OlyID_E_300 OlyID_str2hex("D4041")
|
||||
#define OlyID_SP_550UZ OlyID_str2hex("D4321")
|
||||
#define OlyID_SP_510UZ OlyID_str2hex("D4322")
|
||||
#define OlyID_SP_560UZ OlyID_str2hex("D4355")
|
||||
#define OlyID_SP_570UZ OlyID_str2hex("D4364")
|
||||
#define OlyID_SP_565UZ OlyID_str2hex("D4374")
|
||||
#define OlyID_XZ_1 OlyID_str2hex("D4401")
|
||||
#define OlyID_XZ_2 OlyID_str2hex("D4531")
|
||||
#define OlyID_XZ_10 OlyID_str2hex("D4546")
|
||||
#define OlyID_STYLUS_1 OlyID_str2hex("D4572")
|
||||
#define OlyID_SH_2 OlyID_str2hex("D4585")
|
||||
#define OlyID_TG_4 OlyID_str2hex("D4586")
|
||||
#define OlyID_TG_5 OlyID_str2hex("D4593")
|
||||
#define OlyID_TG_6 OlyID_str2hex("D4603")
|
||||
#define OlyID_E_10 OlyID_str2hex("D4842")
|
||||
#define OlyID_AIR_A01 OlyID_str2hex("K0055")
|
||||
#define OlyID_NORMA OlyID_str2hex("NORMA")
|
||||
#define OlyID_E_330 OlyID_str2hex("S0003")
|
||||
#define OlyID_E_500 OlyID_str2hex("S0004")
|
||||
#define OlyID_E_400 OlyID_str2hex("S0009")
|
||||
#define OlyID_E_510 OlyID_str2hex("S0010")
|
||||
#define OlyID_E_3 OlyID_str2hex("S0011")
|
||||
#define OlyID_E_410 OlyID_str2hex("S0013")
|
||||
#define OlyID_E_420 OlyID_str2hex("S0016")
|
||||
#define OlyID_E_30 OlyID_str2hex("S0017")
|
||||
#define OlyID_E_520 OlyID_str2hex("S0018")
|
||||
#define OlyID_E_P1 OlyID_str2hex("S0019")
|
||||
#define OlyID_E_620 OlyID_str2hex("S0023")
|
||||
#define OlyID_E_P2 OlyID_str2hex("S0026")
|
||||
#define OlyID_E_PL1 OlyID_str2hex("S0027")
|
||||
#define OlyID_E_450 OlyID_str2hex("S0029")
|
||||
#define OlyID_E_600 OlyID_str2hex("S0030")
|
||||
#define OlyID_E_P3 OlyID_str2hex("S0032")
|
||||
#define OlyID_E_5 OlyID_str2hex("S0033")
|
||||
#define OlyID_E_PL2 OlyID_str2hex("S0034")
|
||||
#define OlyID_E_M5 OlyID_str2hex("S0036")
|
||||
#define OlyID_E_PL3 OlyID_str2hex("S0038")
|
||||
#define OlyID_E_PM1 OlyID_str2hex("S0039")
|
||||
#define OlyID_E_PL1s OlyID_str2hex("S0040")
|
||||
#define OlyID_E_PL5 OlyID_str2hex("S0042")
|
||||
#define OlyID_E_PM2 OlyID_str2hex("S0043")
|
||||
#define OlyID_E_P5 OlyID_str2hex("S0044")
|
||||
#define OlyID_E_PL6 OlyID_str2hex("S0045")
|
||||
#define OlyID_E_PL7 OlyID_str2hex("S0046")
|
||||
#define OlyID_E_M1 OlyID_str2hex("S0047")
|
||||
#define OlyID_E_M10 OlyID_str2hex("S0051")
|
||||
#define OlyID_E_M5_Mark_II OlyID_str2hex("S0052")
|
||||
#define OlyID_E_M10_Mark_II OlyID_str2hex("S0059")
|
||||
#define OlyID_PEN_F OlyID_str2hex("S0061")
|
||||
#define OlyID_E_PL8 OlyID_str2hex("S0065")
|
||||
#define OlyID_E_M1_Mark_II OlyID_str2hex("S0067")
|
||||
#define OlyID_E_M10_Mark_III OlyID_str2hex("S0068")
|
||||
#define OlyID_E_PL9 OlyID_str2hex("S0076")
|
||||
#define OlyID_E_M1X OlyID_str2hex("S0080")
|
||||
#define OlyID_E_PL10 OlyID_str2hex("S0085")
|
||||
#define OlyID_E_M10_Mark_IV OlyID_str2hex("S0088")
|
||||
#define OlyID_E_M5_Mark_III OlyID_str2hex("S0089")
|
||||
#define OlyID_E_M1_Mark_III OlyID_str2hex("S0092")
|
||||
#define OlyID_E_P7 OlyID_str2hex("S0093")
|
||||
#define OlyID_OM_1 OlyID_str2hex("S0095")
|
||||
#define OlyID_C_3030Z OlyID_str2hex("SX351")
|
||||
#define OlyID_C_5050Z OlyID_str2hex("SX558")
|
||||
#define OlyID_C_350Z OlyID_str2hex("SX751")
|
||||
#define OlyID_C_740UZ OlyID_str2hex("SX754")
|
||||
#define OlyID_C_5060WZ OlyID_str2hex("SX756")
|
||||
#define OlyID_C_8080WZ OlyID_str2hex("SX757")
|
||||
#define OlyID_C_770UZ OlyID_str2hex("SX772")
|
||||
#define OlyID_C_7070WZ OlyID_str2hex("SX851")
|
||||
#define OlyID_C_7000Z OlyID_str2hex("SX852")
|
||||
#define OlyID_SP_500UZ OlyID_str2hex("SX853")
|
||||
#define OlyID_SP_310 OlyID_str2hex("SX854")
|
||||
#define OlyID_SP_350 OlyID_str2hex("SX855")
|
||||
#define OlyID_SP_320 OlyID_str2hex("SX873")
|
||||
|
||||
#define PentaxID_Optio_S 0x1296cULL
|
||||
#define PentaxID_Optio_S_V101 0x12971ULL
|
||||
#define PentaxID_staristD 0x12994ULL
|
||||
#define PentaxID_Optio_33WR 0x129c6ULL
|
||||
#define PentaxID_Optio_S4 0x129d5ULL
|
||||
#define PentaxID_Optio_750Z 0x12a66ULL
|
||||
#define PentaxID_staristDS 0x12aa2ULL
|
||||
#define PentaxID_staristDL 0x12b1aULL
|
||||
#define PentaxID_staristDS2 0x12b60ULL
|
||||
#define PentaxID_GX_1S 0x12b62ULL
|
||||
#define PentaxID_staristDL2 0x12b7eULL
|
||||
#define PentaxID_GX_1L 0x12b80ULL
|
||||
#define PentaxID_K100D 0x12b9cULL
|
||||
#define PentaxID_K110D 0x12b9dULL
|
||||
#define PentaxID_K100D_Super 0x12ba2ULL
|
||||
#define PentaxID_K10D 0x12c1eULL
|
||||
#define PentaxID_GX10 0x12c20ULL
|
||||
#define PentaxID_K20D 0x12cd2ULL
|
||||
#define PentaxID_GX20 0x12cd4ULL
|
||||
#define PentaxID_K200D 0x12cfaULL
|
||||
#define PentaxID_K2000 0x12d72ULL
|
||||
#define PentaxID_K_m 0x12d73ULL
|
||||
#define PentaxID_K_7 0x12db8ULL
|
||||
#define PentaxID_K_x 0x12dfeULL
|
||||
#define PentaxID_645D 0x12e08ULL
|
||||
#define PentaxID_K_r 0x12e6cULL
|
||||
#define PentaxID_K_5 0x12e76ULL
|
||||
#define PentaxID_Q 0x12ee4ULL
|
||||
#define PentaxID_K_01 0x12ef8ULL
|
||||
#define PentaxID_K_30 0x12f52ULL
|
||||
#define PentaxID_Q10 0x12f66ULL
|
||||
#define PentaxID_K_5_II 0x12f70ULL
|
||||
#define PentaxID_K_5_II_s 0x12f71ULL
|
||||
#define PentaxID_Q7 0x12f7aULL
|
||||
#define PentaxID_MX_1 0x12f84ULL
|
||||
#define PentaxID_K_50 0x12fb6ULL
|
||||
#define PentaxID_K_3 0x12fc0ULL
|
||||
#define PentaxID_K_500 0x12fcaULL
|
||||
#define PentaxID_645Z 0x13010ULL
|
||||
#define PentaxID_K_S1 0x1301aULL
|
||||
#define PentaxID_K_S2 0x13024ULL
|
||||
#define PentaxID_Q_S1 0x1302eULL
|
||||
#define PentaxID_K_1 0x13092ULL
|
||||
#define PentaxID_K_3_II 0x1309cULL
|
||||
#define PentaxID_GR_III 0x1320eULL
|
||||
#define PentaxID_K_70 0x13222ULL
|
||||
#define PentaxID_KP 0x1322cULL
|
||||
#define PentaxID_K_1_Mark_II 0x13240ULL
|
||||
#define PentaxID_K_3_III 0x13254ULL
|
||||
#define PentaxID_GR_IIIx 0x1329aULL
|
||||
|
||||
#define SonyID_DSC_R1 0x002ULL
|
||||
#define SonyID_DSLR_A100 0x100ULL
|
||||
#define SonyID_DSLR_A900 0x101ULL
|
||||
#define SonyID_DSLR_A700 0x102ULL
|
||||
#define SonyID_DSLR_A200 0x103ULL
|
||||
#define SonyID_DSLR_A350 0x104ULL
|
||||
#define SonyID_DSLR_A300 0x105ULL
|
||||
#define SonyID_DSLR_A900_APSC 0x106ULL
|
||||
#define SonyID_DSLR_A380 0x107ULL
|
||||
#define SonyID_DSLR_A330 0x108ULL
|
||||
#define SonyID_DSLR_A230 0x109ULL
|
||||
#define SonyID_DSLR_A290 0x10aULL
|
||||
#define SonyID_DSLR_A850 0x10dULL
|
||||
#define SonyID_DSLR_A850_APSC 0x10eULL
|
||||
#define SonyID_DSLR_A550 0x111ULL
|
||||
#define SonyID_DSLR_A500 0x112ULL
|
||||
#define SonyID_DSLR_A450 0x113ULL
|
||||
#define SonyID_NEX_5 0x116ULL
|
||||
#define SonyID_NEX_3 0x117ULL
|
||||
#define SonyID_SLT_A33 0x118ULL
|
||||
#define SonyID_SLT_A55 0x119ULL
|
||||
#define SonyID_DSLR_A560 0x11aULL
|
||||
#define SonyID_DSLR_A580 0x11bULL
|
||||
#define SonyID_NEX_C3 0x11cULL
|
||||
#define SonyID_SLT_A35 0x11dULL
|
||||
#define SonyID_SLT_A65 0x11eULL
|
||||
#define SonyID_SLT_A77 0x11fULL
|
||||
#define SonyID_NEX_5N 0x120ULL
|
||||
#define SonyID_NEX_7 0x121ULL
|
||||
#define SonyID_NEX_VG20 0x122ULL
|
||||
#define SonyID_SLT_A37 0x123ULL
|
||||
#define SonyID_SLT_A57 0x124ULL
|
||||
#define SonyID_NEX_F3 0x125ULL
|
||||
#define SonyID_SLT_A99 0x126ULL
|
||||
#define SonyID_NEX_6 0x127ULL
|
||||
#define SonyID_NEX_5R 0x128ULL
|
||||
#define SonyID_DSC_RX100 0x129ULL
|
||||
#define SonyID_DSC_RX1 0x12aULL
|
||||
#define SonyID_NEX_VG900 0x12bULL
|
||||
#define SonyID_NEX_VG30 0x12cULL
|
||||
#define SonyID_ILCE_3000 0x12eULL
|
||||
#define SonyID_SLT_A58 0x12fULL
|
||||
#define SonyID_NEX_3N 0x131ULL
|
||||
#define SonyID_ILCE_7 0x132ULL
|
||||
#define SonyID_NEX_5T 0x133ULL
|
||||
#define SonyID_DSC_RX100M2 0x134ULL
|
||||
#define SonyID_DSC_RX10 0x135ULL
|
||||
#define SonyID_DSC_RX1R 0x136ULL
|
||||
#define SonyID_ILCE_7R 0x137ULL
|
||||
#define SonyID_ILCE_6000 0x138ULL
|
||||
#define SonyID_ILCE_5000 0x139ULL
|
||||
#define SonyID_DSC_RX100M3 0x13dULL
|
||||
#define SonyID_ILCE_7S 0x13eULL
|
||||
#define SonyID_ILCA_77M2 0x13fULL
|
||||
#define SonyID_ILCE_5100 0x153ULL
|
||||
#define SonyID_ILCE_7M2 0x154ULL
|
||||
#define SonyID_DSC_RX100M4 0x155ULL
|
||||
#define SonyID_DSC_RX10M2 0x156ULL
|
||||
#define SonyID_DSC_RX1RM2 0x158ULL
|
||||
#define SonyID_ILCE_QX1 0x15aULL
|
||||
#define SonyID_ILCE_7RM2 0x15bULL
|
||||
#define SonyID_ILCE_7SM2 0x15eULL
|
||||
#define SonyID_ILCA_68 0x161ULL
|
||||
#define SonyID_ILCA_99M2 0x162ULL
|
||||
#define SonyID_DSC_RX10M3 0x163ULL
|
||||
#define SonyID_DSC_RX100M5 0x164ULL
|
||||
#define SonyID_ILCE_6300 0x165ULL
|
||||
#define SonyID_ILCE_9 0x166ULL
|
||||
#define SonyID_ILCE_6500 0x168ULL
|
||||
#define SonyID_ILCE_7RM3 0x16aULL
|
||||
#define SonyID_ILCE_7M3 0x16bULL
|
||||
#define SonyID_DSC_RX0 0x16cULL
|
||||
#define SonyID_DSC_RX10M4 0x16dULL
|
||||
#define SonyID_DSC_RX100M6 0x16eULL
|
||||
#define SonyID_DSC_HX99 0x16fULL
|
||||
#define SonyID_DSC_RX100M5A 0x171ULL
|
||||
#define SonyID_ILCE_6400 0x173ULL
|
||||
#define SonyID_DSC_RX0M2 0x174ULL
|
||||
#define SonyID_DSC_RX100M7 0x176ULL
|
||||
#define SonyID_ILCE_7RM4 0x177ULL
|
||||
#define SonyID_ILCE_9M2 0x178ULL
|
||||
#define SonyID_ILCE_6600 0x17aULL
|
||||
#define SonyID_ILCE_6100 0x17bULL
|
||||
#define SonyID_ZV_1 0x17cULL
|
||||
#define SonyID_ILCE_7C 0x17dULL
|
||||
#define SonyID_ZV_E10 0x17eULL
|
||||
#define SonyID_ILCE_7SM3 0x17fULL
|
||||
#define SonyID_ILCE_1 0x180ULL
|
||||
#define SonyID_ILME_FX3 0x181ULL
|
||||
#define SonyID_ILCE_7RM3A 0x182ULL
|
||||
#define SonyID_ILCE_7RM4A 0x183ULL
|
||||
#define SonyID_ILCE_7M4 0x184ULL
|
||||
#endif
|
133
internal/libraw_cxx_defs.h
Normal file
133
internal/libraw_cxx_defs.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/* -*- C++ -*-
|
||||
* File: internal/libraw_cxx_defs.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Aug 17, 2020
|
||||
|
||||
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_CXX_DEFS_H
|
||||
#define _LIBRAW_CXX_DEFS_H
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
#include <new>
|
||||
#include <exception>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#define LIBRAW_LIBRARY_BUILD
|
||||
#include "libraw/libraw.h"
|
||||
#include "internal/defines.h"
|
||||
#ifdef USE_ZLIB
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef LIBRAW_WIN32_CALLS
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
#ifndef LIBRAW_NO_WINSOCK2
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_RAWSPEED
|
||||
#include <RawSpeed/StdAfx.h>
|
||||
#include <RawSpeed/FileMap.h>
|
||||
#include <RawSpeed/RawParser.h>
|
||||
#include <RawSpeed/RawDecoder.h>
|
||||
#include <RawSpeed/CameraMetaData.h>
|
||||
#include <RawSpeed/ColorFilterArray.h>
|
||||
extern const char *_rawspeed_data_xml[];
|
||||
extern const int RAWSPEED_DATA_COUNT;
|
||||
class CameraMetaDataLR : public RawSpeed::CameraMetaData
|
||||
{
|
||||
public:
|
||||
CameraMetaDataLR() : CameraMetaData() {}
|
||||
CameraMetaDataLR(char *filename) : RawSpeed::CameraMetaData(filename) {}
|
||||
CameraMetaDataLR(char *data, int sz);
|
||||
};
|
||||
|
||||
CameraMetaDataLR *make_camera_metadata();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DNGSDK
|
||||
#include "dng_host.h"
|
||||
#include "dng_negative.h"
|
||||
#include "dng_simple_image.h"
|
||||
#include "dng_info.h"
|
||||
#endif
|
||||
|
||||
#define P1 imgdata.idata
|
||||
#define S imgdata.sizes
|
||||
#define O imgdata.params
|
||||
#define C imgdata.color
|
||||
#define T imgdata.thumbnail
|
||||
#define MN imgdata.makernotes
|
||||
#define IO libraw_internal_data.internal_output_params
|
||||
#define ID libraw_internal_data.internal_data
|
||||
|
||||
#define makeIs(idx) (imgdata.idata.maker_index == idx)
|
||||
#define mnCamID imgdata.lens.makernotes.CamID
|
||||
|
||||
#define EXCEPTION_HANDLER(e) \
|
||||
do \
|
||||
{ \
|
||||
switch (e) \
|
||||
{ \
|
||||
case LIBRAW_EXCEPTION_MEMPOOL: \
|
||||
recycle(); \
|
||||
return LIBRAW_MEMPOOL_OVERFLOW; \
|
||||
case LIBRAW_EXCEPTION_ALLOC: \
|
||||
recycle(); \
|
||||
return LIBRAW_UNSUFFICIENT_MEMORY; \
|
||||
case LIBRAW_EXCEPTION_TOOBIG: \
|
||||
recycle(); \
|
||||
return LIBRAW_TOO_BIG; \
|
||||
case LIBRAW_EXCEPTION_DECODE_RAW: \
|
||||
case LIBRAW_EXCEPTION_DECODE_JPEG: \
|
||||
recycle(); \
|
||||
return LIBRAW_DATA_ERROR; \
|
||||
case LIBRAW_EXCEPTION_DECODE_JPEG2000: \
|
||||
recycle(); \
|
||||
return LIBRAW_DATA_ERROR; \
|
||||
case LIBRAW_EXCEPTION_IO_EOF: \
|
||||
case LIBRAW_EXCEPTION_IO_CORRUPT: \
|
||||
recycle(); \
|
||||
return LIBRAW_IO_ERROR; \
|
||||
case LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK: \
|
||||
recycle(); \
|
||||
return LIBRAW_CANCELLED_BY_CALLBACK; \
|
||||
case LIBRAW_EXCEPTION_BAD_CROP: \
|
||||
recycle(); \
|
||||
return LIBRAW_BAD_CROP; \
|
||||
case LIBRAW_EXCEPTION_UNSUPPORTED_FORMAT: \
|
||||
recycle(); \
|
||||
return LIBRAW_FILE_UNSUPPORTED; \
|
||||
default: \
|
||||
return LIBRAW_UNSPECIFIED_ERROR; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// copy-n-paste from image pipe
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define LIM(x, min, max) MAX(min, MIN(x, max))
|
||||
#ifndef CLIP
|
||||
#define CLIP(x) LIM(x, 0, 65535)
|
||||
#endif
|
||||
#define THUMB_READ_BEYOND 16384
|
||||
|
||||
#define ZERO(a) memset(&a, 0, sizeof(a))
|
||||
|
||||
#endif
|
412
internal/libraw_internal_funcs.h
Normal file
412
internal/libraw_internal_funcs.h
Normal file
@@ -0,0 +1,412 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_internal_funcs.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 14, 2008
|
||||
|
||||
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_FUNCS_H
|
||||
#define _LIBRAW_INTERNAL_FUNCS_H
|
||||
|
||||
#ifndef LIBRAW_LIBRARY_BUILD
|
||||
#error "This file should be used only for libraw library build"
|
||||
#else
|
||||
|
||||
/* inline functions */
|
||||
static int stread(char *buf, size_t len, LibRaw_abstract_datastream *fp);
|
||||
static int getwords(char *line, char *words[], int maxwords, int maxlen);
|
||||
static void remove_trailing_spaces(char *string, size_t len);
|
||||
static void remove_caseSubstr(char *string, char *remove);
|
||||
static void removeExcessiveSpaces(char *string);
|
||||
static void trimSpaces(char *s);
|
||||
/* static tables/variables */
|
||||
static libraw_static_table_t tagtype_dataunit_bytes;
|
||||
static libraw_static_table_t Canon_wbi2std;
|
||||
static libraw_static_table_t Canon_KeyIsZero_Len2048_linenums_2_StdWBi;
|
||||
static libraw_static_table_t Canon_KeyIs0x0410_Len3072_linenums_2_StdWBi;
|
||||
static libraw_static_table_t Canon_KeyIs0x0410_Len2048_linenums_2_StdWBi;
|
||||
static libraw_static_table_t Canon_D30_linenums_2_StdWBi;
|
||||
static libraw_static_table_t Canon_G9_linenums_2_StdWBi;
|
||||
|
||||
static libraw_static_table_t Fuji_wb_list1;
|
||||
static libraw_static_table_t FujiCCT_K;
|
||||
static libraw_static_table_t Fuji_wb_list2;
|
||||
|
||||
static libraw_static_table_t Pentax_wb_list1;
|
||||
static libraw_static_table_t Pentax_wb_list2;
|
||||
|
||||
static libraw_static_table_t Oly_wb_list1;
|
||||
static libraw_static_table_t Oly_wb_list2;
|
||||
|
||||
static libraw_static_table_t Sony_SRF_wb_list;
|
||||
static libraw_static_table_t Sony_SR2_wb_list;
|
||||
static libraw_static_table_t Sony_SR2_wb_list1;
|
||||
/* */
|
||||
int find_ifd_by_offset(int );
|
||||
void libraw_swab(void *arr, size_t len);
|
||||
ushort sget2 (uchar *s);
|
||||
ushort sget2Rev(uchar *s);
|
||||
libraw_area_t get_CanonArea();
|
||||
int parseCR3(INT64 oAtomList, INT64 szAtomList, short &nesting, char *AtomNameStack, short& nTrack, short &TrackType);
|
||||
void selectCRXTrack();
|
||||
void parseCR3_Free();
|
||||
int parseCR3_CTMD(short trackNum);
|
||||
int selectCRXFrame(short trackNum, unsigned frameIndex);
|
||||
void setCanonBodyFeatures (unsigned long long id);
|
||||
void processCanonCameraInfo (unsigned long long id, uchar *CameraInfo, unsigned maxlen, unsigned type, unsigned dng_writer);
|
||||
static float _CanonConvertAperture(ushort in);
|
||||
void Canon_CameraSettings(unsigned len);
|
||||
void Canon_WBpresets (int skip1, int skip2);
|
||||
void Canon_WBCTpresets (short WBCTversion);
|
||||
void parseCanonMakernotes (unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void processNikonLensData (uchar *LensData, unsigned len);
|
||||
void Nikon_NRW_WBtag (int wb, int skip);
|
||||
void parseNikonMakernote (int base, int uptag, unsigned dng_writer);
|
||||
void parseEpsonMakernote (int base, int uptag, unsigned dng_writer);
|
||||
void parseSigmaMakernote (int base, int uptag, unsigned dng_writer);
|
||||
void setOlympusBodyFeatures (unsigned long long id);
|
||||
void getOlympus_CameraType2 ();
|
||||
void getOlympus_SensorTemperature (unsigned len);
|
||||
void parseOlympus_Equipment (unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseOlympus_CameraSettings (int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseOlympus_ImageProcessing (unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseOlympus_RawInfo (unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseOlympusMakernotes (int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void setPhaseOneFeatures (unsigned long long id);
|
||||
void setPentaxBodyFeatures (unsigned long long id);
|
||||
void PentaxISO (ushort c);
|
||||
void PentaxLensInfo (unsigned long long id, unsigned len);
|
||||
void parsePentaxMakernotes(int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseRicohMakernotes(int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
void parseSamsungMakernotes(int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
|
||||
void fixupArri();
|
||||
#endif
|
||||
void setSonyBodyFeatures (unsigned long long id);
|
||||
void parseSonyLensType2 (uchar a, uchar b);
|
||||
void parseSonyLensFeatures (uchar a, uchar b);
|
||||
void process_Sony_0x0116 (uchar * buf, ushort, unsigned long long id);
|
||||
void process_Sony_0x2010 (uchar * buf, ushort);
|
||||
void process_Sony_0x9050 (uchar * buf, ushort, unsigned long long id);
|
||||
void process_Sony_0x9400 (uchar * buf, ushort, unsigned long long id);
|
||||
void process_Sony_0x9402 (uchar * buf, ushort);
|
||||
void process_Sony_0x9403 (uchar * buf, ushort);
|
||||
void process_Sony_0x9406 (uchar * buf, ushort);
|
||||
void process_Sony_0x940c (uchar * buf, ushort);
|
||||
void process_Sony_0x940e (uchar * buf, ushort, unsigned long long id);
|
||||
void parseSonyMakernotes (int base, unsigned tag, unsigned type, unsigned len, unsigned dng_writer,
|
||||
uchar *&table_buf_0x0116, ushort &table_buf_0x0116_len,
|
||||
uchar *&table_buf_0x2010, ushort &table_buf_0x2010_len,
|
||||
uchar *&table_buf_0x9050, ushort &table_buf_0x9050_len,
|
||||
uchar *&table_buf_0x9400, ushort &table_buf_0x9400_len,
|
||||
uchar *&table_buf_0x9402, ushort &table_buf_0x9402_len,
|
||||
uchar *&table_buf_0x9403, ushort &table_buf_0x9403_len,
|
||||
uchar *&table_buf_0x9406, ushort &table_buf_0x9406_len,
|
||||
uchar *&table_buf_0x940c, ushort &table_buf_0x940c_len,
|
||||
uchar *&table_buf_0x940e, ushort &table_buf_0x940e_len);
|
||||
void parseSonySR2 (uchar *cbuf_SR2, unsigned SR2SubIFDOffset, unsigned SR2SubIFDLength, unsigned dng_writer);
|
||||
void parseSonySRF (unsigned len);
|
||||
void parseFujiMakernotes (unsigned tag, unsigned type, unsigned len, unsigned dng_writer);
|
||||
const char* HassyRawFormat_idx2HR(unsigned idx);
|
||||
void process_Hassy_Lens (int LensMount);
|
||||
void parseHassyModel ();
|
||||
|
||||
void setLeicaBodyFeatures(int LeicaMakernoteSignature);
|
||||
void parseLeicaLensID();
|
||||
int parseLeicaLensName(unsigned len);
|
||||
int parseLeicaInternalBodySerial(unsigned len);
|
||||
void parseLeicaMakernote(int base, int uptag, unsigned MakernoteTagType);
|
||||
void parseAdobePanoMakernote ();
|
||||
void parseAdobeRAFMakernote ();
|
||||
void GetNormalizedModel ();
|
||||
void SetStandardIlluminants (unsigned, const char* );
|
||||
|
||||
ushort get2();
|
||||
unsigned sget4 (uchar *s);
|
||||
unsigned getint(int type);
|
||||
float int_to_float (int i);
|
||||
double getreal (int type);
|
||||
double sgetreal(int type, uchar *s);
|
||||
void read_shorts (ushort *pixel, unsigned count);
|
||||
|
||||
/* Canon P&S cameras */
|
||||
void canon_600_fixed_wb (int temp);
|
||||
int canon_600_color (int ratio[2], int mar);
|
||||
void canon_600_auto_wb();
|
||||
void canon_600_coeff();
|
||||
void canon_600_load_raw();
|
||||
void canon_600_correct();
|
||||
int canon_s2is();
|
||||
void parse_ciff (int offset, int length, int);
|
||||
void ciff_block_1030();
|
||||
|
||||
|
||||
// LJPEG decoder
|
||||
unsigned getbithuff (int nbits, ushort *huff);
|
||||
ushort* make_decoder_ref (const uchar **source);
|
||||
ushort* make_decoder (const uchar *source);
|
||||
int ljpeg_start (struct jhead *jh, int info_only);
|
||||
void ljpeg_end(struct jhead *jh);
|
||||
int ljpeg_diff (ushort *huff);
|
||||
ushort * ljpeg_row (int jrow, struct jhead *jh);
|
||||
ushort * ljpeg_row_unrolled (int jrow, struct jhead *jh);
|
||||
void ljpeg_idct (struct jhead *jh);
|
||||
unsigned ph1_bithuff (int nbits, ushort *huff);
|
||||
|
||||
// Canon DSLRs
|
||||
void crw_init_tables (unsigned table, ushort *huff[2]);
|
||||
int canon_has_lowbits();
|
||||
void canon_load_raw();
|
||||
void lossless_jpeg_load_raw();
|
||||
void canon_sraw_load_raw();
|
||||
// Adobe DNG
|
||||
void adobe_copy_pixel (unsigned int row, unsigned int col, ushort **rp);
|
||||
void lossless_dng_load_raw();
|
||||
void deflate_dng_load_raw();
|
||||
void packed_dng_load_raw();
|
||||
void packed_tiled_dng_load_raw();
|
||||
void uncompressed_fp_dng_load_raw();
|
||||
void lossy_dng_load_raw();
|
||||
//void adobe_dng_load_raw_nc();
|
||||
|
||||
// Pentax
|
||||
void pentax_load_raw();
|
||||
void pentax_4shot_load_raw();
|
||||
|
||||
void pentax_tree();
|
||||
|
||||
// Nikon (and Minolta Z2)
|
||||
void nikon_load_raw();
|
||||
void nikon_he_load_raw_placeholder();
|
||||
void nikon_read_curve();
|
||||
void nikon_load_striped_packed_raw();
|
||||
void nikon_load_padded_packed_raw();
|
||||
void nikon_load_sraw();
|
||||
void nikon_yuv_load_raw();
|
||||
void nikon_coolscan_load_raw();
|
||||
int nikon_e995();
|
||||
int nikon_e2100();
|
||||
void nikon_3700();
|
||||
int minolta_z2();
|
||||
// void nikon_e2100_load_raw();
|
||||
|
||||
// Fuji
|
||||
// void fuji_load_raw();
|
||||
int guess_RAFDataGeneration (uchar *RAFData_start);
|
||||
void parse_fuji (int offset);
|
||||
void parse_fuji_thumbnail(int offset);
|
||||
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
|
||||
// RedCine
|
||||
void parse_redcine();
|
||||
void redcine_load_raw();
|
||||
#endif
|
||||
|
||||
// Rollei
|
||||
void rollei_load_raw();
|
||||
void parse_rollei();
|
||||
|
||||
// Contax
|
||||
void parse_kyocera ();
|
||||
|
||||
// MF backs
|
||||
//int bayer (unsigned row, unsigned col);
|
||||
int p1raw(unsigned,unsigned);
|
||||
void phase_one_flat_field (int is_float, int nc);
|
||||
int p1rawc(unsigned row, unsigned col, unsigned& count);
|
||||
void phase_one_fix_col_pixel_avg(unsigned row, unsigned col);
|
||||
void phase_one_fix_pixel_grad(unsigned row, unsigned col);
|
||||
void phase_one_load_raw();
|
||||
unsigned ph1_bits (int nbits);
|
||||
void phase_one_load_raw_c();
|
||||
void phase_one_load_raw_s();
|
||||
void hasselblad_load_raw();
|
||||
void leaf_hdr_load_raw();
|
||||
void sinar_4shot_load_raw();
|
||||
void imacon_full_load_raw();
|
||||
void hasselblad_full_load_raw();
|
||||
void packed_load_raw();
|
||||
float find_green(int,int,int,int);
|
||||
void unpacked_load_raw();
|
||||
void unpacked_load_raw_FujiDBP();
|
||||
void unpacked_load_raw_reversed();
|
||||
void unpacked_load_raw_fuji_f700s20();
|
||||
void parse_sinar_ia();
|
||||
void parse_phase_one (int base);
|
||||
|
||||
// Misc P&S cameras
|
||||
void parse_broadcom();
|
||||
void broadcom_load_raw();
|
||||
void nokia_load_raw();
|
||||
void android_loose_load_raw();
|
||||
void android_tight_load_raw();
|
||||
#ifdef LIBRAW_OLD_VIDEO_SUPPORT
|
||||
void canon_rmf_load_raw();
|
||||
#endif
|
||||
unsigned pana_data (int nb, unsigned *bytes);
|
||||
void panasonic_load_raw();
|
||||
// void panasonic_16x10_load_raw();
|
||||
void olympus_load_raw();
|
||||
// void olympus_cseries_load_raw();
|
||||
void minolta_rd175_load_raw();
|
||||
void quicktake_100_load_raw();
|
||||
const int* make_decoder_int (const int *source, int level);
|
||||
int radc_token (int tree);
|
||||
void kodak_radc_load_raw();
|
||||
void kodak_jpeg_load_raw();
|
||||
void kodak_dc120_load_raw();
|
||||
void eight_bit_load_raw();
|
||||
void smal_decode_segment (unsigned seg[2][2], int holes);
|
||||
void smal_v6_load_raw();
|
||||
int median4 (int *p);
|
||||
void fill_holes (int holes);
|
||||
void smal_v9_load_raw();
|
||||
void parse_riff(int maxdepth);
|
||||
void parse_cine();
|
||||
void parse_smal (int offset, int fsize);
|
||||
int parse_jpeg (int offset);
|
||||
|
||||
// Kodak
|
||||
void kodak_262_load_raw();
|
||||
int kodak_65000_decode (short *out, int bsize);
|
||||
void kodak_65000_load_raw();
|
||||
void kodak_rgb_load_raw();
|
||||
void kodak_ycbcr_load_raw();
|
||||
// void kodak_yrgb_load_raw();
|
||||
void kodak_c330_load_raw();
|
||||
void kodak_c603_load_raw();
|
||||
void kodak_rgb_load_thumb();
|
||||
void kodak_ycbcr_load_thumb();
|
||||
void vc5_dng_load_raw_placeholder();
|
||||
// It's a Sony (and K&M)
|
||||
void sony_decrypt (unsigned *data, int len, int start, int key);
|
||||
void sony_load_raw();
|
||||
void sony_arw_load_raw();
|
||||
void sony_arw2_load_raw();
|
||||
void sony_arq_load_raw();
|
||||
void sony_ljpeg_load_raw();
|
||||
void samsung_load_raw();
|
||||
void samsung2_load_raw();
|
||||
void samsung3_load_raw();
|
||||
void parse_minolta (int base);
|
||||
|
||||
#ifdef USE_X3FTOOLS
|
||||
// Foveon/Sigma
|
||||
// We always have x3f code compiled in!
|
||||
void parse_x3f();
|
||||
void x3f_load_raw();
|
||||
void x3f_dpq_interpolate_rg();
|
||||
void x3f_dpq_interpolate_af(int xstep, int ystep, int scale); // 1x1 af pixels
|
||||
void x3f_dpq_interpolate_af_sd(int xstart,int ystart, int xend, int yend, int xstep, int ystep, int scale); // sd Quattro interpolation
|
||||
#else
|
||||
void parse_x3f() {}
|
||||
void x3f_load_raw(){}
|
||||
#endif
|
||||
#ifdef USE_6BY9RPI
|
||||
void rpi_load_raw8();
|
||||
void rpi_load_raw12();
|
||||
void rpi_load_raw14();
|
||||
void rpi_load_raw16();
|
||||
void parse_raspberrypi();
|
||||
#endif
|
||||
|
||||
// CAM/RGB
|
||||
void pseudoinverse (double (*in)[3], double (*out)[3], int size);
|
||||
void simple_coeff (int index);
|
||||
|
||||
// Openp
|
||||
char** malloc_omp_buffers(int buffer_count, size_t buffer_size);
|
||||
void free_omp_buffers(char** buffers, int buffer_count);
|
||||
|
||||
|
||||
// Tiff/Exif parsers
|
||||
void tiff_get (unsigned base,unsigned *tag, unsigned *type, unsigned *len, unsigned *save);
|
||||
short tiff_sget(unsigned save, uchar *buf, unsigned buf_len, INT64 *tag_offset,
|
||||
unsigned *tag_id, unsigned *tag_type, INT64 *tag_dataoffset,
|
||||
unsigned *tag_datalen, int *tag_dataunit_len);
|
||||
void parse_thumb_note (int base, unsigned toff, unsigned tlen);
|
||||
void parse_makernote (int base, int uptag);
|
||||
void parse_makernote_0xc634(int base, int uptag, unsigned dng_writer);
|
||||
void parse_exif (int base);
|
||||
void parse_exif_interop(int base);
|
||||
void linear_table(unsigned len);
|
||||
void Kodak_DCR_WBtags(int wb, unsigned type, int wbi);
|
||||
void Kodak_KDC_WBtags(int wb, int wbi);
|
||||
short KodakIllumMatrix (unsigned type, float *romm_camIllum);
|
||||
void parse_kodak_ifd (int base);
|
||||
int parse_tiff_ifd (int base);
|
||||
int parse_tiff (int base);
|
||||
void apply_tiff(void);
|
||||
void parse_gps (int base);
|
||||
void parse_gps_libraw(int base);
|
||||
void aRGB_coeff(double aRGB_cam[3][3]);
|
||||
void romm_coeff(float romm_cam[3][3]);
|
||||
void parse_mos (INT64 offset);
|
||||
void parse_qt (int end);
|
||||
void get_timestamp (int reversed);
|
||||
|
||||
// The identify
|
||||
short guess_byte_order (int words);
|
||||
void identify_process_dng_fields();
|
||||
void identify_finetune_pentax();
|
||||
void identify_finetune_by_filesize(int);
|
||||
void identify_finetune_dcr(char head[64],int,int);
|
||||
// Tiff writer
|
||||
void tiff_set(struct tiff_hdr *th, ushort *ntag,ushort tag, ushort type, int count, int val);
|
||||
void tiff_head (struct tiff_hdr *th, int full);
|
||||
|
||||
// split AHD code
|
||||
void ahd_interpolate_green_h_and_v(int top, int left, ushort (*out_rgb)[LIBRAW_AHD_TILE][LIBRAW_AHD_TILE][3]);
|
||||
void ahd_interpolate_r_and_b_in_rgb_and_convert_to_cielab(int top, int left, ushort (*inout_rgb)[LIBRAW_AHD_TILE][3], short (*out_lab)[LIBRAW_AHD_TILE][3]);
|
||||
void ahd_interpolate_r_and_b_and_convert_to_cielab(int top, int left, ushort (*inout_rgb)[LIBRAW_AHD_TILE][LIBRAW_AHD_TILE][3], short (*out_lab)[LIBRAW_AHD_TILE][LIBRAW_AHD_TILE][3]);
|
||||
void ahd_interpolate_build_homogeneity_map(int top, int left, short (*lab)[LIBRAW_AHD_TILE][LIBRAW_AHD_TILE][3], char (*out_homogeneity_map)[LIBRAW_AHD_TILE][2]);
|
||||
void ahd_interpolate_combine_homogeneous_pixels(int top, int left, ushort (*rgb)[LIBRAW_AHD_TILE][LIBRAW_AHD_TILE][3], char (*homogeneity_map)[LIBRAW_AHD_TILE][2]);
|
||||
|
||||
void init_fuji_compr(struct fuji_compressed_params* info);
|
||||
void init_fuji_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, INT64 raw_offset, unsigned dsize);
|
||||
void copy_line_to_xtrans(struct fuji_compressed_block* info, int cur_line, int cur_block, int cur_block_width);
|
||||
void copy_line_to_bayer(struct fuji_compressed_block* info, int cur_line, int cur_block, int cur_block_width);
|
||||
void xtrans_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, int cur_line);
|
||||
void fuji_bayer_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, int cur_line);
|
||||
void fuji_compressed_load_raw();
|
||||
void fuji_14bit_load_raw();
|
||||
void parse_fuji_compressed_header();
|
||||
void crxLoadRaw();
|
||||
int crxParseImageHeader(uchar *cmp1TagData, int nTrack, int size);
|
||||
void panasonicC6_load_raw();
|
||||
void panasonicC7_load_raw();
|
||||
|
||||
void nikon_14bit_load_raw();
|
||||
|
||||
// DCB
|
||||
void dcb_pp();
|
||||
void dcb_copy_to_buffer(float (*image2)[3]);
|
||||
void dcb_restore_from_buffer(float (*image2)[3]);
|
||||
void dcb_color();
|
||||
void dcb_color_full();
|
||||
void dcb_map();
|
||||
void dcb_correction();
|
||||
void dcb_correction2();
|
||||
void dcb_refinement();
|
||||
void rgb_to_lch(double (*image3)[3]);
|
||||
void lch_to_rgb(double (*image3)[3]);
|
||||
void fbdd_correction();
|
||||
void fbdd_correction2(double (*image3)[3]);
|
||||
void fbdd_green();
|
||||
void dcb_ver(float (*image3)[3]);
|
||||
void dcb_hor(float (*image2)[3]);
|
||||
void dcb_color2(float (*image2)[3]);
|
||||
void dcb_color3(float (*image3)[3]);
|
||||
void dcb_decide(float (*image2)[3], float (*image3)[3]);
|
||||
void dcb_nyquist();
|
||||
#endif
|
||||
|
||||
#endif
|
215
internal/var_defines.h
Normal file
215
internal/var_defines.h
Normal file
@@ -0,0 +1,215 @@
|
||||
/* -*- C++ -*-
|
||||
* File: var_defines.h
|
||||
* Copyright 2008-2021 LibRaw LLC (info@libraw.org)
|
||||
* Created: Sat Mar 8, 2008
|
||||
*
|
||||
* LibRaw redefinitions of dcraw internal variables
|
||||
|
||||
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 VAR_DEFINES_H
|
||||
#define VAR_DEFINES_H
|
||||
|
||||
|
||||
// imgdata.idata
|
||||
#define make (imgdata.idata.make)
|
||||
#define model (imgdata.idata.model)
|
||||
#define software (imgdata.idata.software)
|
||||
#define is_raw (imgdata.idata.raw_count)
|
||||
#define dng_version (imgdata.idata.dng_version)
|
||||
#define is_foveon (imgdata.idata.is_foveon)
|
||||
#define colors (imgdata.idata.colors)
|
||||
#define cdesc (imgdata.idata.cdesc)
|
||||
#define filters (imgdata.idata.filters)
|
||||
#define xtrans (imgdata.idata.xtrans)
|
||||
#define xtrans_abs (imgdata.idata.xtrans_abs)
|
||||
#define xmpdata (imgdata.idata.xmpdata)
|
||||
#define xmplen (imgdata.idata.xmplen)
|
||||
//imgdata image
|
||||
#define image (imgdata.image)
|
||||
#define raw_image (imgdata.rawdata.raw_image)
|
||||
#define color_image (imgdata.rawdata.color_image)
|
||||
#define normalized_make (imgdata.idata.normalized_make)
|
||||
#define normalized_model (imgdata.idata.normalized_model)
|
||||
#define maker_index (imgdata.idata.maker_index)
|
||||
|
||||
// imgdata.sizes
|
||||
#define raw_height (imgdata.sizes.raw_height)
|
||||
#define raw_width (imgdata.sizes.raw_width)
|
||||
#define raw_pitch (imgdata.sizes.raw_pitch)
|
||||
#define height (imgdata.sizes.height)
|
||||
#define width (imgdata.sizes.width)
|
||||
#define top_margin (imgdata.sizes.top_margin)
|
||||
#define left_margin (imgdata.sizes.left_margin)
|
||||
#define bottom_margin (imgdata.sizes.bottom_margin)
|
||||
#define right_margin (imgdata.sizes.right_margin)
|
||||
#define iheight (imgdata.sizes.iheight)
|
||||
#define iwidth (imgdata.sizes.iwidth)
|
||||
#define pixel_aspect (imgdata.sizes.pixel_aspect)
|
||||
#define flip (imgdata.sizes.flip)
|
||||
#define mask (imgdata.sizes.mask)
|
||||
#define raw_stride (libraw_internal_data.unpacker_data.raw_stride)
|
||||
|
||||
//imgdata.color
|
||||
#define white (imgdata.color.white)
|
||||
#define cam_mul (imgdata.color.cam_mul)
|
||||
#define pre_mul (imgdata.color.pre_mul)
|
||||
#define cmatrix (imgdata.color.cmatrix)
|
||||
#define rgb_cam (imgdata.color.rgb_cam)
|
||||
#ifndef SRC_USES_CURVE
|
||||
#define curve (imgdata.color.curve)
|
||||
#endif
|
||||
#ifndef SRC_USES_BLACK
|
||||
#define black (imgdata.color.black)
|
||||
#define cblack (imgdata.color.cblack)
|
||||
#endif
|
||||
#define maximum (imgdata.color.maximum)
|
||||
#define channel_maximum (imgdata.color.channel_maximum)
|
||||
#define profile_length (imgdata.color.profile_length)
|
||||
#define color_flags (imgdata.color.color_flags)
|
||||
#define ph1 (imgdata.color.phase_one_data)
|
||||
#define flash_used (imgdata.color.flash_used)
|
||||
#define canon_ev (imgdata.color.canon_ev)
|
||||
#define model2 (imgdata.color.model2)
|
||||
|
||||
//imgdata.thumbnail
|
||||
#define thumb_width (imgdata.thumbnail.twidth)
|
||||
#define thumb_height (imgdata.thumbnail.theight)
|
||||
#define thumb_length (imgdata.thumbnail.tlength)
|
||||
|
||||
|
||||
//imgdata.others
|
||||
#define iso_speed (imgdata.other.iso_speed)
|
||||
#define shutter (imgdata.other.shutter)
|
||||
#define aperture (imgdata.other.aperture)
|
||||
#define focal_len (imgdata.other.focal_len)
|
||||
#define timestamp (imgdata.other.timestamp)
|
||||
#define shot_order (imgdata.other.shot_order)
|
||||
#define gpsdata (imgdata.other.gpsdata)
|
||||
#define desc (imgdata.other.desc)
|
||||
#define artist (imgdata.other.artist)
|
||||
|
||||
#define FujiCropMode (imgdata.makernotes.fuji.CropMode)
|
||||
|
||||
//imgdata.output
|
||||
#define greybox (imgdata.params.greybox)
|
||||
#define cropbox (imgdata.params.cropbox)
|
||||
#define aber (imgdata.params.aber)
|
||||
#define gamm (imgdata.params.gamm)
|
||||
#define user_mul (imgdata.params.user_mul)
|
||||
#define shot_select (imgdata.rawparams.shot_select)
|
||||
#define bright (imgdata.params.bright)
|
||||
#define threshold (imgdata.params.threshold)
|
||||
#define half_size (imgdata.params.half_size)
|
||||
#define four_color_rgb (imgdata.params.four_color_rgb)
|
||||
#define highlight (imgdata.params.highlight)
|
||||
#define use_auto_wb (imgdata.params.use_auto_wb)
|
||||
#define use_camera_wb (imgdata.params.use_camera_wb)
|
||||
#define use_camera_matrix (imgdata.params.use_camera_matrix)
|
||||
#define output_color (imgdata.params.output_color)
|
||||
#define output_bps (imgdata.params.output_bps)
|
||||
#define gamma_16bit (imgdata.params.gamma_16bit)
|
||||
#define output_tiff (imgdata.params.output_tiff)
|
||||
#define med_passes (imgdata.params.med_passes)
|
||||
#define no_auto_bright (imgdata.params.no_auto_bright)
|
||||
#define auto_bright_thr (imgdata.params.auto_bright_thr)
|
||||
#define use_fuji_rotate (imgdata.params.use_fuji_rotate)
|
||||
#define filtering_mode (imgdata.params.filtering_mode)
|
||||
|
||||
// DCB
|
||||
#define dcb_iterations (imgdata.params.iterations)
|
||||
#define dcb_enhance_fl (imgdata.params.dcb_enhance)
|
||||
#define fbdd_noiserd (imgdata.params.fbdd_noiserd)
|
||||
|
||||
//libraw_internal_data.internal_data
|
||||
#define meta_data (libraw_internal_data.internal_data.meta_data)
|
||||
#define ifp libraw_internal_data.internal_data.input
|
||||
#define ifname ((char*)libraw_internal_data.internal_data.input->fname())
|
||||
#define ofp libraw_internal_data.internal_data.output
|
||||
#define profile_offset (libraw_internal_data.internal_data.profile_offset)
|
||||
#define thumb_offset (libraw_internal_data.internal_data.toffset)
|
||||
#define pana_black (libraw_internal_data.internal_data.pana_black)
|
||||
|
||||
//libraw_internal_data.internal_output_params
|
||||
#define mix_green (libraw_internal_data.internal_output_params.mix_green)
|
||||
#define raw_color (libraw_internal_data.internal_output_params.raw_color)
|
||||
#define use_gamma (libraw_internal_data.internal_output_params.use_gamma)
|
||||
#define zero_is_bad (libraw_internal_data.internal_output_params.zero_is_bad)
|
||||
#ifndef SRC_USES_SHRINK
|
||||
#define shrink (libraw_internal_data.internal_output_params.shrink)
|
||||
#endif
|
||||
#define fuji_width (libraw_internal_data.internal_output_params.fuji_width)
|
||||
#define thumb_format (libraw_internal_data.unpacker_data.thumb_format)
|
||||
|
||||
//libraw_internal_data.output_data
|
||||
#define histogram (libraw_internal_data.output_data.histogram)
|
||||
#define oprof (libraw_internal_data.output_data.oprof)
|
||||
|
||||
//libraw_internal_data.identify_data
|
||||
#define exif_cfa (libraw_internal_data.identify_data.olympus_exif_cfa)
|
||||
#define unique_id (libraw_internal_data.identify_data.unique_id)
|
||||
#define OlyID (libraw_internal_data.identify_data.OlyID)
|
||||
#define tiff_nifds (libraw_internal_data.identify_data.tiff_nifds)
|
||||
#define tiff_flip (libraw_internal_data.identify_data.tiff_flip)
|
||||
#define metadata_blocks (libraw_internal_data.identify_data.metadata_blocks)
|
||||
|
||||
//libraw_internal_data.unpacker_data
|
||||
#define order (libraw_internal_data.unpacker_data.order)
|
||||
#define data_error (libraw_internal_data.unpacker_data.data_error)
|
||||
#define cr2_slice (libraw_internal_data.unpacker_data.cr2_slice)
|
||||
#define sraw_mul (libraw_internal_data.unpacker_data.sraw_mul)
|
||||
#define kodak_cbpp (libraw_internal_data.unpacker_data.kodak_cbpp)
|
||||
#define strip_offset (libraw_internal_data.unpacker_data.strip_offset)
|
||||
#define data_offset (libraw_internal_data.unpacker_data.data_offset)
|
||||
#define data_size (libraw_internal_data.unpacker_data.data_size)
|
||||
#define meta_offset (libraw_internal_data.unpacker_data.meta_offset)
|
||||
#define meta_length (libraw_internal_data.unpacker_data.meta_length)
|
||||
#define thumb_misc (libraw_internal_data.unpacker_data.thumb_misc)
|
||||
#define fuji_layout (libraw_internal_data.unpacker_data.fuji_layout)
|
||||
#define tiff_samples (libraw_internal_data.unpacker_data.tiff_samples)
|
||||
#define tiff_bps (libraw_internal_data.unpacker_data.tiff_bps)
|
||||
#define tiff_compress (libraw_internal_data.unpacker_data.tiff_compress)
|
||||
#define tiff_sampleformat (libraw_internal_data.unpacker_data.tiff_sampleformat)
|
||||
#define zero_after_ff (libraw_internal_data.unpacker_data.zero_after_ff)
|
||||
#define tile_width (libraw_internal_data.unpacker_data.tile_width)
|
||||
#define tile_length (libraw_internal_data.unpacker_data.tile_length)
|
||||
#define load_flags (libraw_internal_data.unpacker_data.load_flags)
|
||||
#define pana_encoding (libraw_internal_data.unpacker_data.pana_encoding)
|
||||
#define pana_bpp (libraw_internal_data.unpacker_data.pana_bpp)
|
||||
#define CM_found (libraw_internal_data.unpacker_data.CM_found)
|
||||
|
||||
#define is_NikonTransfer (libraw_internal_data.unpacker_data.is_NikonTransfer)
|
||||
#define is_Olympus (libraw_internal_data.unpacker_data.is_Olympus)
|
||||
#define OlympusDNG_SubDirOffsetValid (libraw_internal_data.unpacker_data.OlympusDNG_SubDirOffsetValid)
|
||||
#define is_Sony (libraw_internal_data.unpacker_data.is_Sony)
|
||||
#define is_PentaxRicohMakernotes (libraw_internal_data.unpacker_data.is_PentaxRicohMakernotes)
|
||||
#define is_pana_raw (libraw_internal_data.unpacker_data.is_pana_raw)
|
||||
|
||||
|
||||
#ifdef LIBRAW_IO_REDEFINED
|
||||
#define fread(ptr,size,n,stream) stream->read(ptr,size,n)
|
||||
#define fseek(stream,o,w) stream->seek(o,w)
|
||||
#define fseeko(stream,o,w) stream->seek(o,w)
|
||||
#define ftell(stream) stream->tell()
|
||||
#define ftello(stream) stream->tell()
|
||||
#define feof(stream) stream->eof()
|
||||
#ifdef getc
|
||||
#undef getc
|
||||
#endif
|
||||
#define getc(stream) stream->get_char()
|
||||
#define fgetc(stream) stream->get_char()
|
||||
#define fgetcb(stream) stream->get_char_buf()
|
||||
#define fgets(str,n,stream) stream->gets(str,n)
|
||||
#define fscanf(stream,fmt,ptr) stream->scanf_one(fmt,ptr)
|
||||
#endif
|
||||
|
||||
#endif
|
539
internal/x3f_tools.h
Normal file
539
internal/x3f_tools.h
Normal file
@@ -0,0 +1,539 @@
|
||||
/* -*- C++ -*-
|
||||
* Copyright 2019-2021 LibRaw LLC (info@libraw.org)
|
||||
*
|
||||
|
||||
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).
|
||||
*/
|
||||
|
||||
/* Library for accessing X3F Files
|
||||
----------------------------------------------------------------
|
||||
BSD-style License
|
||||
----------------------------------------------------------------
|
||||
|
||||
* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the organization nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef X3F_TOOLS_H
|
||||
#define X3F_TOOLS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "../libraw/libraw_datastream.h"
|
||||
|
||||
/* From X3F_IO.H */
|
||||
|
||||
#define SIZE_UNIQUE_IDENTIFIER 16
|
||||
#define SIZE_WHITE_BALANCE 32
|
||||
#define SIZE_COLOR_MODE 32
|
||||
#define NUM_EXT_DATA_2_1 32
|
||||
#define NUM_EXT_DATA_3_0 64
|
||||
#define NUM_EXT_DATA NUM_EXT_DATA_3_0
|
||||
|
||||
#define X3F_VERSION(MAJ, MIN) (uint32_t)(((MAJ) << 16) + MIN)
|
||||
#define X3F_VERSION_2_0 X3F_VERSION(2, 0)
|
||||
#define X3F_VERSION_2_1 X3F_VERSION(2, 1)
|
||||
#define X3F_VERSION_2_2 X3F_VERSION(2, 2)
|
||||
#define X3F_VERSION_2_3 X3F_VERSION(2, 3)
|
||||
#define X3F_VERSION_3_0 X3F_VERSION(3, 0)
|
||||
#define X3F_VERSION_4_0 X3F_VERSION(4, 0)
|
||||
|
||||
/* Main file identifier */
|
||||
#define X3F_FOVb (uint32_t)(0x62564f46)
|
||||
/* Directory identifier */
|
||||
#define X3F_SECd (uint32_t)(0x64434553)
|
||||
/* Property section identifiers */
|
||||
#define X3F_PROP (uint32_t)(0x504f5250)
|
||||
#define X3F_SECp (uint32_t)(0x70434553)
|
||||
/* Image section identifiers */
|
||||
#define X3F_IMAG (uint32_t)(0x46414d49)
|
||||
#define X3F_IMA2 (uint32_t)(0x32414d49)
|
||||
#define X3F_SECi (uint32_t)(0x69434553)
|
||||
/* CAMF section identifiers */
|
||||
#define X3F_CAMF (uint32_t)(0x464d4143)
|
||||
#define X3F_SECc (uint32_t)(0x63434553)
|
||||
/* CAMF entry identifiers */
|
||||
#define X3F_CMbP (uint32_t)(0x50624d43)
|
||||
#define X3F_CMbT (uint32_t)(0x54624d43)
|
||||
#define X3F_CMbM (uint32_t)(0x4d624d43)
|
||||
#define X3F_CMb (uint32_t)(0x00624d43)
|
||||
/* SDQ section identifiers ? - TODO */
|
||||
#define X3F_SPPA (uint32_t)(0x41505053)
|
||||
#define X3F_SECs (uint32_t)(0x73434553)
|
||||
|
||||
#define X3F_IMAGE_THUMB_PLAIN (uint32_t)(0x00020003)
|
||||
#define X3F_IMAGE_THUMB_HUFFMAN (uint32_t)(0x0002000b)
|
||||
#define X3F_IMAGE_THUMB_JPEG (uint32_t)(0x00020012)
|
||||
#define X3F_IMAGE_THUMB_SDQ (uint32_t)(0x00020019) /* SDQ ? - TODO */
|
||||
|
||||
#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005)
|
||||
#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006)
|
||||
#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e)
|
||||
#define X3F_IMAGE_RAW_MERRILL (uint32_t)(0x0001001e)
|
||||
#define X3F_IMAGE_RAW_QUATTRO (uint32_t)(0x00010023)
|
||||
#define X3F_IMAGE_RAW_SDQ (uint32_t)(0x00010025)
|
||||
#define X3F_IMAGE_RAW_SDQH (uint32_t)(0x00010027)
|
||||
#define X3F_IMAGE_RAW_SDQH2 (uint32_t)(0x00010029)
|
||||
|
||||
#define X3F_IMAGE_HEADER_SIZE 28
|
||||
#define X3F_CAMF_HEADER_SIZE 28
|
||||
#define X3F_PROPERTY_LIST_HEADER_SIZE 24
|
||||
|
||||
typedef uint16_t utf16_t;
|
||||
|
||||
typedef int bool_t;
|
||||
|
||||
typedef enum x3f_extended_types_e
|
||||
{
|
||||
X3F_EXT_TYPE_NONE = 0,
|
||||
X3F_EXT_TYPE_EXPOSURE_ADJUST = 1,
|
||||
X3F_EXT_TYPE_CONTRAST_ADJUST = 2,
|
||||
X3F_EXT_TYPE_SHADOW_ADJUST = 3,
|
||||
X3F_EXT_TYPE_HIGHLIGHT_ADJUST = 4,
|
||||
X3F_EXT_TYPE_SATURATION_ADJUST = 5,
|
||||
X3F_EXT_TYPE_SHARPNESS_ADJUST = 6,
|
||||
X3F_EXT_TYPE_RED_ADJUST = 7,
|
||||
X3F_EXT_TYPE_GREEN_ADJUST = 8,
|
||||
X3F_EXT_TYPE_BLUE_ADJUST = 9,
|
||||
X3F_EXT_TYPE_FILL_LIGHT_ADJUST = 10
|
||||
} x3f_extended_types_t;
|
||||
|
||||
typedef struct x3f_property_s
|
||||
{
|
||||
/* Read from file */
|
||||
uint32_t name_offset;
|
||||
uint32_t value_offset;
|
||||
|
||||
/* Computed */
|
||||
utf16_t *name; /* 0x0000 terminated UTF 16 */
|
||||
utf16_t *value; /* 0x0000 terminated UTF 16 */
|
||||
} x3f_property_t;
|
||||
|
||||
typedef struct x3f_property_table_s
|
||||
{
|
||||
uint32_t size;
|
||||
x3f_property_t *element;
|
||||
} x3f_property_table_t;
|
||||
|
||||
typedef struct x3f_property_list_s
|
||||
{
|
||||
/* 2.0 Fields */
|
||||
uint32_t num_properties;
|
||||
uint32_t character_format;
|
||||
uint32_t reserved;
|
||||
uint32_t total_length;
|
||||
|
||||
x3f_property_table_t property_table;
|
||||
|
||||
void *data;
|
||||
|
||||
uint32_t data_size;
|
||||
|
||||
} x3f_property_list_t;
|
||||
|
||||
typedef struct x3f_table8_s
|
||||
{
|
||||
uint32_t size;
|
||||
uint8_t *element;
|
||||
} x3f_table8_t;
|
||||
|
||||
typedef struct x3f_table16_s
|
||||
{
|
||||
uint32_t size;
|
||||
uint16_t *element;
|
||||
} x3f_table16_t;
|
||||
|
||||
typedef struct x3f_table32_s
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t *element;
|
||||
} x3f_table32_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *data; /* Pointer to actual image data */
|
||||
void *buf; /* Pointer to allocated buffer for free() */
|
||||
uint32_t rows;
|
||||
uint32_t columns;
|
||||
uint32_t channels;
|
||||
uint32_t row_stride;
|
||||
} x3f_area8_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t *data; /* Pointer to actual image data */
|
||||
void *buf; /* Pointer to allocated buffer for free() */
|
||||
uint32_t rows;
|
||||
uint32_t columns;
|
||||
uint32_t channels;
|
||||
uint32_t row_stride;
|
||||
} x3f_area16_t;
|
||||
|
||||
#define UNDEFINED_LEAF 0xffffffff
|
||||
|
||||
typedef struct x3f_huffnode_s
|
||||
{
|
||||
struct x3f_huffnode_s *branch[2];
|
||||
uint32_t leaf;
|
||||
} x3f_huffnode_t;
|
||||
|
||||
typedef struct x3f_hufftree_s
|
||||
{
|
||||
uint32_t free_node_index; /* Free node index in huffman tree array */
|
||||
uint32_t total_node_index;
|
||||
x3f_huffnode_t *nodes; /* Coding tree */
|
||||
} x3f_hufftree_t;
|
||||
|
||||
typedef struct x3f_true_huffman_element_s
|
||||
{
|
||||
uint8_t code_size;
|
||||
uint8_t code;
|
||||
} x3f_true_huffman_element_t;
|
||||
|
||||
typedef struct x3f_true_huffman_s
|
||||
{
|
||||
uint32_t size;
|
||||
x3f_true_huffman_element_t *element;
|
||||
} x3f_true_huffman_t;
|
||||
|
||||
/* 0=bottom, 1=middle, 2=top */
|
||||
#define TRUE_PLANES 3
|
||||
|
||||
typedef struct x3f_true_s
|
||||
{
|
||||
uint16_t seed[TRUE_PLANES]; /* Always 512,512,512 */
|
||||
uint16_t unknown; /* Always 0 */
|
||||
x3f_true_huffman_t table; /* Huffman table - zero
|
||||
terminated. size is the number of
|
||||
leaves plus 1.*/
|
||||
|
||||
x3f_table32_t plane_size; /* Size of the 3 planes */
|
||||
uint8_t *plane_address[TRUE_PLANES]; /* computed offset to the planes */
|
||||
x3f_hufftree_t tree; /* Coding tree */
|
||||
x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */
|
||||
} x3f_true_t;
|
||||
|
||||
typedef struct x3f_quattro_s
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t columns;
|
||||
uint16_t rows;
|
||||
} plane[TRUE_PLANES];
|
||||
uint32_t unknown;
|
||||
|
||||
bool_t quattro_layout;
|
||||
x3f_area16_t top16; /* Container for the bigger top layer */
|
||||
} x3f_quattro_t;
|
||||
|
||||
typedef struct x3f_huffman_s
|
||||
{
|
||||
x3f_table16_t mapping; /* Value Mapping = X3F lossy compression */
|
||||
x3f_table32_t table; /* Coding Table */
|
||||
x3f_hufftree_t tree; /* Coding tree */
|
||||
x3f_table32_t row_offsets; /* Row offsets */
|
||||
x3f_area8_t rgb8; /* 3x8 bit RGB data */
|
||||
x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */
|
||||
} x3f_huffman_t;
|
||||
|
||||
typedef struct x3f_image_data_s
|
||||
{
|
||||
/* 2.0 Fields */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Known combinations of type and format are:
|
||||
1-6, 2-3, 2-11, 2-18, 3-6 */
|
||||
uint32_t type; /* 1 = RAW X3 (SD1)
|
||||
2 = thumbnail or maybe just RGB
|
||||
3 = RAW X3 */
|
||||
uint32_t format; /* 3 = 3x8 bit pixmap
|
||||
6 = 3x10 bit huffman with map table
|
||||
11 = 3x8 bit huffman
|
||||
18 = JPEG */
|
||||
uint32_t type_format; /* type<<16 + format */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
uint32_t columns; /* width / row size in pixels */
|
||||
uint32_t rows; /* height */
|
||||
uint32_t row_stride; /* row size in bytes */
|
||||
|
||||
/* NULL if not used */
|
||||
x3f_huffman_t *huffman; /* Huffman help data */
|
||||
x3f_true_t *tru; /* TRUE help data */
|
||||
x3f_quattro_t *quattro; /* Quattro help data */
|
||||
|
||||
void *data; /* Take from file if NULL. Otherwise,
|
||||
this is the actual data bytes in
|
||||
the file. */
|
||||
uint32_t data_size;
|
||||
|
||||
} x3f_image_data_t;
|
||||
|
||||
typedef struct camf_dim_entry_s
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t name_offset;
|
||||
uint32_t n; /* 0,1,2,3... */
|
||||
char *name;
|
||||
} camf_dim_entry_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
M_FLOAT,
|
||||
M_INT,
|
||||
M_UINT
|
||||
} matrix_type_t;
|
||||
|
||||
typedef struct camf_entry_s
|
||||
{
|
||||
/* pointer into decoded data */
|
||||
void *entry;
|
||||
|
||||
/* entry header */
|
||||
uint32_t id;
|
||||
uint32_t version;
|
||||
uint32_t entry_size;
|
||||
uint32_t name_offset;
|
||||
uint32_t value_offset;
|
||||
|
||||
/* computed values */
|
||||
char *name_address;
|
||||
void *value_address;
|
||||
uint32_t name_size;
|
||||
uint32_t value_size;
|
||||
|
||||
/* extracted values for explicit CAMF entry types*/
|
||||
uint32_t text_size;
|
||||
char *text;
|
||||
|
||||
uint32_t property_num;
|
||||
char **property_name;
|
||||
uint8_t **property_value;
|
||||
|
||||
uint32_t matrix_dim;
|
||||
camf_dim_entry_t *matrix_dim_entry;
|
||||
|
||||
/* Offset, pointer and size and type of raw data */
|
||||
uint32_t matrix_type;
|
||||
uint32_t matrix_data_off;
|
||||
void *matrix_data;
|
||||
uint32_t matrix_element_size;
|
||||
|
||||
/* Pointer and type of copied data */
|
||||
matrix_type_t matrix_decoded_type;
|
||||
void *matrix_decoded;
|
||||
|
||||
/* Help data to try to estimate element size */
|
||||
uint32_t matrix_elements;
|
||||
uint32_t matrix_used_space;
|
||||
double matrix_estimated_element_size;
|
||||
|
||||
} camf_entry_t;
|
||||
|
||||
typedef struct camf_entry_table_s
|
||||
{
|
||||
uint32_t size;
|
||||
camf_entry_t *element;
|
||||
} camf_entry_table_t;
|
||||
|
||||
typedef struct x3f_camf_typeN_s
|
||||
{
|
||||
uint32_t val0;
|
||||
uint32_t val1;
|
||||
uint32_t val2;
|
||||
uint32_t val3;
|
||||
} x3f_camf_typeN_t;
|
||||
|
||||
typedef struct x3f_camf_type2_s
|
||||
{
|
||||
uint32_t reserved;
|
||||
uint32_t infotype;
|
||||
uint32_t infotype_version;
|
||||
uint32_t crypt_key;
|
||||
} x3f_camf_type2_t;
|
||||
|
||||
typedef struct x3f_camf_type4_s
|
||||
{
|
||||
uint32_t decoded_data_size;
|
||||
uint32_t decode_bias;
|
||||
uint32_t block_size;
|
||||
uint32_t block_count;
|
||||
} x3f_camf_type4_t;
|
||||
|
||||
typedef struct x3f_camf_type5_s
|
||||
{
|
||||
uint32_t decoded_data_size;
|
||||
uint32_t decode_bias;
|
||||
uint32_t unknown2;
|
||||
uint32_t unknown3;
|
||||
} x3f_camf_type5_t;
|
||||
|
||||
typedef struct x3f_camf_s
|
||||
{
|
||||
|
||||
/* Header info */
|
||||
uint32_t type;
|
||||
union {
|
||||
x3f_camf_typeN_t tN;
|
||||
x3f_camf_type2_t t2;
|
||||
x3f_camf_type4_t t4;
|
||||
x3f_camf_type5_t t5;
|
||||
};
|
||||
|
||||
/* The encrypted raw data */
|
||||
void *data;
|
||||
uint32_t data_size;
|
||||
|
||||
/* Help data for type 4 Huffman compression */
|
||||
x3f_true_huffman_t table;
|
||||
x3f_hufftree_t tree;
|
||||
uint8_t *decoding_start;
|
||||
uint32_t decoding_size;
|
||||
|
||||
/* The decrypted data */
|
||||
void *decoded_data;
|
||||
uint32_t decoded_data_size;
|
||||
|
||||
/* Pointers into the decrypted data */
|
||||
camf_entry_table_t entry_table;
|
||||
} x3f_camf_t;
|
||||
|
||||
typedef struct x3f_directory_entry_header_s
|
||||
{
|
||||
uint32_t identifier; /* Should be ´SECp´, "SECi", ... */
|
||||
uint32_t version; /* 0x00020001 is version 2.1 */
|
||||
union {
|
||||
x3f_property_list_t property_list;
|
||||
x3f_image_data_t image_data;
|
||||
x3f_camf_t camf;
|
||||
} data_subsection;
|
||||
} x3f_directory_entry_header_t;
|
||||
|
||||
typedef struct x3f_directory_entry_s
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
} input, output;
|
||||
|
||||
uint32_t type;
|
||||
|
||||
x3f_directory_entry_header_t header;
|
||||
} x3f_directory_entry_t;
|
||||
|
||||
typedef struct x3f_directory_section_s
|
||||
{
|
||||
uint32_t identifier; /* Should be ´SECd´ */
|
||||
uint32_t version; /* 0x00020001 is version 2.1 */
|
||||
|
||||
/* 2.0 Fields */
|
||||
uint32_t num_directory_entries;
|
||||
x3f_directory_entry_t *directory_entry;
|
||||
} x3f_directory_section_t;
|
||||
|
||||
typedef struct x3f_header_s
|
||||
{
|
||||
/* 2.0 Fields */
|
||||
uint32_t identifier; /* Should be ´FOVb´ */
|
||||
uint32_t version; /* 0x00020001 means 2.1 */
|
||||
uint8_t unique_identifier[SIZE_UNIQUE_IDENTIFIER];
|
||||
uint32_t mark_bits;
|
||||
uint32_t columns; /* Columns and rows ... */
|
||||
uint32_t rows; /* ... before rotation */
|
||||
uint32_t rotation; /* 0, 90, 180, 270 */
|
||||
|
||||
char white_balance[SIZE_WHITE_BALANCE]; /* Introduced in 2.1 */
|
||||
char color_mode[SIZE_COLOR_MODE]; /* Introduced in 2.3 */
|
||||
|
||||
/* Introduced in 2.1 and extended from 32 to 64 in 3.0 */
|
||||
uint8_t extended_types[NUM_EXT_DATA]; /* x3f_extended_types_t */
|
||||
float extended_data[NUM_EXT_DATA]; /* 32 bits, but do type differ? */
|
||||
} x3f_header_t;
|
||||
|
||||
typedef struct x3f_info_s
|
||||
{
|
||||
char *error;
|
||||
struct
|
||||
{
|
||||
LibRaw_abstract_datastream *file; /* Use if more data is needed */
|
||||
} input, output;
|
||||
} x3f_info_t;
|
||||
|
||||
typedef struct x3f_s
|
||||
{
|
||||
x3f_info_t info;
|
||||
x3f_header_t header;
|
||||
x3f_directory_section_t directory_section;
|
||||
} x3f_t;
|
||||
|
||||
typedef enum x3f_return_e
|
||||
{
|
||||
X3F_OK = 0,
|
||||
X3F_ARGUMENT_ERROR = 1,
|
||||
X3F_INFILE_ERROR = 2,
|
||||
X3F_OUTFILE_ERROR = 3,
|
||||
X3F_INTERNAL_ERROR = 4
|
||||
} x3f_return_t;
|
||||
|
||||
x3f_return_t x3f_delete(x3f_t *x3f);
|
||||
|
||||
/* Hacky external flags */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
extern int legacy_offset;
|
||||
extern bool_t auto_legacy_offset;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Huffman Decode Macros */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define HUF_TREE_MAX_LENGTH 27
|
||||
#define HUF_TREE_MAX_NODES(_leaves) ((HUF_TREE_MAX_LENGTH + 1) * (_leaves))
|
||||
#define HUF_TREE_GET_LENGTH(_v) (((_v) >> 27) & 0x1f)
|
||||
#define HUF_TREE_GET_CODE(_v) ((_v)&0x07ffffff)
|
||||
|
||||
x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile);
|
||||
x3f_return_t x3f_delete(x3f_t *x3f);
|
||||
x3f_directory_entry_t *x3f_get_raw(x3f_t *x3f);
|
||||
x3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f);
|
||||
x3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE);
|
||||
x3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f);
|
||||
x3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f);
|
||||
x3f_directory_entry_t *x3f_get_camf(x3f_t *x3f);
|
||||
x3f_directory_entry_t *x3f_get_prop(x3f_t *x3f);
|
||||
/* extern */ int64_t x3f_load_data_size(x3f_t *x3f, x3f_directory_entry_t *DE);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user