aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-16 02:11:07 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-06-10 02:18:14 +0200
commit81145064de936e9ec401a50deca315891c6068f0 (patch)
treed0060c36073a6ee79e8f8c6dcdb21c0fa8c1f444
parent60a8ee7a80063eaf620eaa727af0f484fdb91bff (diff)
downloadfiv-81145064de936e9ec401a50deca315891c6068f0.tar.gz
fiv-81145064de936e9ec401a50deca315891c6068f0.tar.xz
fiv-81145064de936e9ec401a50deca315891c6068f0.zip
Generate TIFF structs/enums from a text file
This is to make the tables much easier to maintain.
-rw-r--r--meson.build9
-rwxr-xr-xtiff-tables.awk94
-rw-r--r--tiff-tables.db427
-rw-r--r--tools/info.h505
4 files changed, 531 insertions, 504 deletions
diff --git a/meson.build b/meson.build
index a33cbd7..c511d6a 100644
--- a/meson.build
+++ b/meson.build
@@ -96,6 +96,13 @@ resources = gnome.compile_resources('resources',
c_name : 'resources',
)
+tiff_tables = custom_target('tiff-tables.h',
+ output : 'tiff-tables.h',
+ input : 'tiff-tables.db',
+ command : ['tiff-tables.awk', '@INPUT@'],
+ capture : true,
+)
+
exe = executable('fiv', 'fiv.c', 'fiv-view.c', 'fiv-io.c',
'fiv-browser.c', 'fiv-sidebar.c', 'fiv-thumbnail.c', 'xdg.c', resources,
install : true,
@@ -122,7 +129,7 @@ if get_option('tools').enabled()
tools_c_args = cc.get_supported_arguments(
'-Wno-unused-function', '-Wno-unused-parameter')
foreach tool : ['pnginfo', 'jpeginfo', 'tiffinfo', 'webpinfo', 'bmffinfo']
- executable(tool, 'tools/' + tool + '.c',
+ executable(tool, 'tools/' + tool + '.c', tiff_tables,
dependencies : tools_dependencies,
c_args: tools_c_args)
endforeach
diff --git a/tiff-tables.awk b/tiff-tables.awk
new file mode 100755
index 0000000..2d93c36
--- /dev/null
+++ b/tiff-tables.awk
@@ -0,0 +1,94 @@
+#!/usr/bin/awk -f
+BEGIN {
+ FS = ", *"
+ print "// Generated by tiff-tables.awk. DO NOT MODIFY."
+}
+
+{
+ # Remember and strip consecutive comments.
+ if (match($0, /#/))
+ comment[++comments] = substr($0, RSTART + 1)
+ else if (!/[[:space:]]/)
+ comments = 0
+
+ sub(/#.*$/, "")
+ sub(/[[:space:]]*$/, "")
+}
+
+# Converts arbitrary strings to C identifiers (when running in the C locale).
+function identifize(s) {
+ # Regard parenthesised text as comments.
+ while (match(s, /[[:space:]]\([^)]+\)/)) {
+ comment[++comments] = substr(s, RSTART, RLENGTH)
+ s = substr(s, 1, RSTART - 1) substr(s, RSTART + RLENGTH)
+ }
+
+ # Capitalize words (toupper is POSIX), removing spaces and dashes between.
+ while (match(s, /[-[:space:]]./)) {
+ s = substr(s, 1, RSTART - 1) \
+ toupper(substr(s, RSTART + 1, 1)) \
+ substr(s, RSTART + RLENGTH)
+ }
+
+ # Replace any remaining non-identifier characters with underscores.
+ gsub(/[^[:alnum:]]/, "_", s)
+ return s
+}
+
+function flushcomments(prefix, i, acc) {
+ for (i = 1; i <= comments; i++)
+ acc = acc prefix comment[i] "\n"
+ comments = 0
+ return acc
+}
+
+function flushvalues() {
+ if (values) {
+ allvalues = allvalues "enum " fieldname " {\n" values "};\n\n"
+ values = ""
+ fields = fields "\n\t\t{}\n\t}},"
+ } else if (fields) {
+ fields = fields " NULL},"
+ }
+}
+
+function flushsection() {
+ if (section) {
+ flushvalues()
+ print "};\n\n" allvalues "static struct tiff_entry " \
+ sectionsnakecase "_entries[] = {" fields "\n\t{}\n};"
+ }
+}
+
+# Section marker
+/^= / {
+ flushsection()
+ section = identifize(substr($0, 3))
+ sectionsnakecase = tolower(substr($0, 3))
+ gsub(/[^[:alnum:]]/, "_", sectionsnakecase)
+ fields = ""
+ allvalues = ""
+ print "\n" flushcomments("//") "enum {"
+}
+
+# Field
+section && /^[^\t=]/ {
+ flushvalues()
+ fieldname = section "_" identifize($2)
+ fields = fields "\n\t{\"" $2 "\", " fieldname ","
+ print flushcomments("\t//") "\t" fieldname " = " $1 ","
+}
+
+# Value
+section && /^\t/ {
+ sub(/^\t*/, "")
+ valuename = fieldname "_" identifize($2)
+ if (!values)
+ fields = fields " (struct tiff_value[]) {"
+ values = values flushcomments("\t//") "\t" valuename " = " $1 ",\n"
+ fields = fields "\n\t\t{\"" $2 "\", " valuename "},"
+}
+
+END {
+ flushsection()
+}
diff --git a/tiff-tables.db b/tiff-tables.db
new file mode 100644
index 0000000..8b0e206
--- /dev/null
+++ b/tiff-tables.db
@@ -0,0 +1,427 @@
+# Use tiff-tables.awk to produce a C source file from this database.
+
+# Use the Internet Archive should any of these links go down.
+#
+# TIFF Revision 6.0 (1992)
+# https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFF6.pdf
+#
+# TIFF Technical Note 1: TIFF Trees (1993)
+# https://download.osgeo.org/libtiff/old/TTN1.ps
+#
+# DRAFT TIFF Technical Note 2 (1995)
+# https://www.awaresystems.be/imaging/tiff/specification/TIFFTechNote2.txt
+#
+# Adobe PageMaker 6.0 TIFF Technical Notes (1995) [includes TTN1]
+# https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFFPM6.pdf
+#
+# Adobe Photoshop TIFF Technical Notes (2002)
+# https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFFphotoshop.pdf
+# https://www.alternatiff.com/resources/TIFFphotoshop.pdf
+# - Note that ImageSourceData 8BIM frames are specified differently
+# from how Adobe XMP Specification Part 3 defines them.
+# - The document places a condition on SubIFDs, without further explanation.
+#
+# Adobe Photoshop TIFF Technical Note 3 (2005)
+# http://chriscox.org/TIFFTN3d1.pdf
+#
+# Exif Version 2.3 (2012)
+# https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
+#
+# Exif Version 2.32 (2019)
+# https://www.cipa.jp/e/std/std-sec.html
+#
+# Digital Negative (DNG) Specification 1.5.0.0 (2019)
+# https://www.adobe.com/content/dam/acom/en/products/photoshop/pdfs/dng_spec_1.5.0.0.pdf
+
+# TIFF 6.0
+= TIFF
+254, NewSubfileType
+255, SubfileType
+ 1, Full-resolution image data
+ 2, Reduced-resolution image data
+ 3, Page of a multi-page image
+256, ImageWidth
+257, ImageLength
+258, BitsPerSample
+259, Compression
+ 1, Uncompressed
+ 2, CCITT 1D
+ 3, Group 3 Fax
+ 4, Group 4 Fax
+ 5, LZW
+ 6, JPEG
+ 7, JPEG datastream # DRAFT TIFF Technical Note 2 + TIFFphotoshop.pdf
+ 8, Deflate/zlib # Adobe Photoshop TIFF Technical Notes
+ 32773, PackBits
+ 32946, Deflate # Adobe Photoshop TIFF Technical Notes
+262, PhotometricInterpretation
+ 0, WhiteIsZero
+ 1, BlackIsZero
+ 2, RGB
+ 3, RGB Palette
+ 4, Transparency mask
+ 5, CMYK
+ 6, YCbCr
+ 8, CIELab
+ 9, ICCLab # Adobe PageMaker 6.0 TIFF Technical Notes
+263, Threshholding
+ 1, No dithering or halftoning
+ 2, Ordered dither or halftoning
+ 3, Randomized process
+264, CellWidth
+265, CellLength
+266, FillOrder
+ 1, MSB-first
+ 2, LSB-first
+269, DocumentName
+270, ImageDescription
+271, Make
+272, Model
+273, StripOffsets
+274, Orientation
+ 1, TopLeft
+ 2, TopRight
+ 3, BottomRight
+ 4, BottomLeft
+ 5, LeftTop
+ 6, RightTop
+ 7, RightBottom
+ 8, LeftBottom
+277, SamplesPerPixel
+278, RowsPerStrip
+279, StripByteCounts
+280, MinSampleValue
+281, MaxSampleValue
+282, XResolution
+283, YResolution
+284, PlanarConfiguration
+ 1, Chunky
+ 2, Planar
+285, PageName
+286, XPosition
+287, YPosition
+288, FreeOffsets
+289, FreeByteCounts
+290, GrayResponseUnit
+ 1, 1/10
+ 2, 1/100
+ 3, 1/1000
+ 4, 1/10000
+ 5, 1/100000
+291, GrayResponseCurve
+292, T4Options
+293, T6Options
+296, ResolutionUnit
+ 1, None
+ 2, Inch
+ 3, Centimeter
+297, PageNumber
+301, TransferFunction
+305, Software
+306, DateTime
+315, Artist
+316, HostComputer
+317, Predictor
+ 1, None
+ 2, Horizontal
+ 3, Floating point # Adobe Photoshop TIFF Technical Note 3
+318, WhitePoint
+319, PrimaryChromaticities
+320, ColorMap
+321, HalftoneHints
+322, TileWidth
+323, TileLength
+324, TileOffsets
+325, TileByteCounts
+330, SubIFDs # TIFF Technical Note 1: TIFF Trees
+332, InkSet
+ 1, CMYK
+ 2, Non-CMYK
+333, InkNames
+334, NumberOfInks
+336, DotRange
+337, TargetPrinter
+338, ExtraSamples
+ 0, Unspecified
+ 1, Associated alpha
+ 2, Unassociated alpha
+339, SampleFormat
+ 1, Unsigned integer
+ 2, Two's complement signed integer
+ 3, IEEE floating-point
+ 4, Undefined
+340, SMinSampleValue
+341, SMaxSampleValue
+342, TransferRange
+343, ClipPath # TIFF Technical Note 2: Clipping Path
+344, XClipPathUnits # TIFF Technical Note 2: Clipping Path
+345, YClipPathUnits # TIFF Technical Note 2: Clipping Path
+346, Indexed # TIFF Technical Note 3: Indexed Images
+347, JPEGTables # DRAFT TIFF Technical Note 2 + TIFFphotoshop.pdf
+351, OPIProxy # Adobe PageMaker 6.0 TIFF Technical Notes
+512, JPEGProc
+ 1, Baseline sequential
+ 14, Lossless Huffman
+513, JPEGInterchangeFormat
+514, JPEGInterchangeFormatLength
+515, JPEGRestartInterval
+517, JPEGLosslessPredictors
+ 1, A
+ 2, B
+ 3, C
+ 4, A+B+C
+ 5, A+((B-C)/2)
+ 6, B+((A-C)/2)
+ 7, (A+B)/2
+518, JPEGPointTransforms
+519, JPEGQTables
+520, JPEGDCTables
+521, JPEGACTables
+529, YCbCrCoefficients
+530, YCbCrSubSampling
+531, YCbCrPositioning
+ 1, Centered
+ 2, Co-sited
+532, ReferenceBlackWhite
+700, XMP # Adobe XMP Specification Part 3 Table 12/13/39
+32781, ImageID # Adobe PageMaker 6.0 TIFF Technical Notes
+33432, Copyright
+# TODO(p): Extract IPTC DataSets, like we do directly with PSIRs.
+33723, IPTC # Adobe XMP Specification Part 3 Table 12/39
+# TODO(p): Extract PSIRs, like we do directly with the JPEG segment.
+34377, Photoshop # Adobe XMP Specification Part 3 Table 12/39
+34665, Exif IFD Pointer # Exif 2.3
+34853, GPS Info IFD Pointer # Exif 2.3
+37398, TIFF/EP StandardID # ISO 12234 TIFF/EP image data format
+37724, ImageSourceData # Adobe Photoshop TIFF Technical Notes
+50706, DNGVersion # DNG 1.5.0.0
+50707, DNGBackwardVersion # DNG 1.5.0.0
+50708, UniqueCameraModel # DNG 1.5.0.0
+50709, LocalizedCameraModel # DNG 1.5.0.0
+# TODO(p): Add more DNG tags that can be only in IFD0.
+
+# Exif 2.3 4.6.5
+= Exif
+33434, ExposureTime
+33437, FNumber
+34850, ExposureProgram
+ 0, Not defined
+ 1, Manual
+ 2, Normal program
+ 3, Aperture priority
+ 4, Shutter priority
+ 5, Creative program
+ 6, Action program
+ 7, Portrait mode
+ 8, Landscape mode
+34852, SpectralSensitivity
+34855, PhotographicSensitivity
+34856, OECF
+34864, SensitivityType
+ 0, Unknown
+ 1, Standard output sensitivity
+ 2, Recommended exposure index
+ 3, ISO speed
+ 4, SOS and REI
+ 5, SOS and ISO speed
+ 6, REI and ISO speed
+ 7, SOS and REI and ISO speed
+34865, StandardOutputSensitivity
+34866, RecommendedExposureIndex
+34867, ISOSpeed
+34868, ISOSpeedLatitudeyyy
+34869, ISOSpeedLatitudezzz
+36864, ExifVersion
+36867, DateTimeOriginal
+36868, DateTimeDigitized
+36880, OffsetTime # 2.31
+36881, OffsetTimeOriginal # 2.31
+36882, OffsetTimeDigitized # 2.31
+37121, ComponentsConfiguration
+ 0, Does not exist
+ 1, Y
+ 2, Cb
+ 3, Cr
+ 4, R
+ 5, G
+ 6, B
+37122, CompressedBitsPerPixel
+37377, ShutterSpeedValue
+37378, ApertureValue
+37379, BrightnessValue
+37380, ExposureBiasValue
+37381, MaxApertureValue
+37382, SubjectDistance
+37383, MeteringMode
+ 0, Unknown
+ 1, Average
+ 2, CenterWeightedAverage
+ 3, Spot
+ 4, MultiSpot
+ 5, Pattern
+ 6, Partial
+ 255, Other
+37384, LightSource
+ 0, Unknown
+ 1, Daylight
+ 2, Fluorescent
+ 3, Tungsten (incandescent light)
+ 4, Flash
+ 9, Fine weather
+ 10, Cloudy weather
+ 11, Shade
+ 12, Daylight fluorescent (D 5700 - 7100K)
+ 13, Day white fluorescent (N 4600 - 5500K)
+ 14, Cool white fluorescent (W 3800 - 4500K)
+ 15, White fluorescent (WW 3250 - 3800K)
+ 16, Warm white fluorescent (L 2600 - 3250K)
+ 17, Standard light A
+ 18, Standard light B
+ 19, Standard light C
+ 20, D55
+ 21, D65
+ 22, D75
+ 23, D50
+ 24, ISO studio tungsten
+ 255, Other light source
+37385, Flash
+37386, FocalLength
+37396, SubjectArea
+37500, MakerNote
+# TODO(p): Decode.
+37510, UserComment
+37520, SubSecTime
+37521, SubSecTimeOriginal
+37522, SubSecTimeDigitized
+37888, Temperature # 2.31
+37889, Humidity # 2.31
+37890, Pressure # 2.31
+37891, WaterDepth # 2.31
+37892, Acceleration # 2.31
+37893, CameraElevationAngle # 2.31
+40960, FlashpixVersion
+40961, ColorSpace
+ 1, sRGB
+ 65535, Uncalibrated
+40962, PixelXDimension
+40963, PixelYDimension
+40964, RelatedSoundFile
+40965, Interoperability IFD Pointer
+41483, FlashEnergy
+41484, SpatialFrequencyResponse
+41486, FocalPlaneXResolution
+41487, FocalPlaneYResolution
+41488, FocalPlaneResolutionUnit
+41492, SubjectLocation
+41493, ExposureIndex
+41495, SensingMethod
+ 1, Not defined
+ 2, One-chip color area sensor
+ 3, Two-chip color area sensor
+ 4, Three-chip color area sensor
+ 5, Color sequential area sensor
+ 7, Trilinear sensor
+ 8, Color sequential linear sensor
+41728, FileSource
+ 0, Others
+ 1, Scanner of transparent type
+ 2, Scanner of reflex type
+ 3, DSC
+41729, SceneType
+ 1, Directly-photographed image
+41730, CFAPattern
+41985, CustomRendered
+ 0, Normal process
+ 1, Custom process
+41986, ExposureMode
+ 0, Auto exposure
+ 1, Manual exposure
+ 2, Auto bracket
+41987, WhiteBalance
+ 0, Auto white balance
+ 1, Manual white balance
+41988, DigitalZoomRatio
+41989, FocalLengthIn35mmFilm
+41990, SceneCaptureType
+ 0, Standard
+ 1, Landscape
+ 2, Portrait
+ 3, Night scene
+41991, GainControl
+ 0, None
+ 1, Low gain up
+ 2, High gain up
+ 3, Low gain down
+ 4, High gain down
+41992, Contrast
+ 0, Normal
+ 1, Soft
+ 2, Hard
+41993, Saturation
+ 0, Normal
+ 1, Low
+ 2, High
+41994, Sharpness
+ 0, Normal
+ 1, Soft
+ 2, Hard
+41995, DeviceSettingDescription
+41996, SubjectDistanceRange
+ 0, Unknown
+ 1, Macro
+ 2, Close view
+ 3, Distant view
+42016, ImageUniqueID
+42032, CameraOwnerName
+42033, BodySerialNumber
+42034, LensSpecification
+42035, LensMake
+42036, LensModel
+42037, LensSerialNumber
+42080, CompositeImage # 2.32
+42081, SourceImageNumberOfCompositeImage # 2.32
+42082, SourceExposureTimesOfCompositeImage # 2.32
+42240, Gamma
+
+# Exif 2.3 4.6.6 (Notice it starts at 0.)
+= Exif GPS
+0, GPSVersionID
+1, GPSLatitudeRef
+2, GPSLatitude
+3, GPSLongitudeRef
+4, GPSLongitude
+5, GPSAltitudeRef
+ 0, Sea level
+ 1, Sea level reference (negative value)
+6, GPSAltitude
+7, GPSTimeStamp
+8, GPSSatellites
+9, GPSStatus
+10, GPSMeasureMode
+11, GPSDOP
+12, GPSSpeedRef
+13, GPSSpeed
+14, GPSTrackRef
+15, GPSTrack
+16, GPSImgDirectionRef
+17, GPSImgDirection
+18, GPSMapDatum
+19, GPSDestLatitudeRef
+20, GPSDestLatitude
+21, GPSDestLongitudeRef
+22, GPSDestLongitude
+23, GPSDestBearingRef
+24, GPSDestBearing
+25, GPSDestDistanceRef
+26, GPSDestDistance
+27, GPSProcessingMethod
+28, GPSAreaInformation
+29, GPSDateStamp
+30, GPSDifferential
+ 0, Measurement without differential correction
+ 1, Differential correction applied
+31, GPSHPositioningError
+
+# Exif 2.3 4.6.7 (Notice it starts at 1, and collides with GPS.)
+= Exif Interoperability
+1, InteroperabilityIndex
diff --git a/tools/info.h b/tools/info.h
index ef58d7b..816c9cf 100644
--- a/tools/info.h
+++ b/tools/info.h
@@ -76,37 +76,6 @@ u16le(const uint8_t *p)
}
// --- TIFF --------------------------------------------------------------------
-// TIFF Revision 6.0 (1992)
-// https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFF6.pdf
-//
-// TIFF Technical Note 1: TIFF Trees (1993)
-// https://download.osgeo.org/libtiff/old/TTN1.ps
-//
-// DRAFT TIFF Technical Note 2 (1995)
-// https://www.awaresystems.be/imaging/tiff/specification/TIFFTechNote2.txt
-//
-// Adobe PageMaker 6.0 TIFF Technical Notes (1995) [includes TTN1]
-// https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFFPM6.pdf
-//
-// Adobe Photoshop TIFF Technical Notes (2002)
-// https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFFphotoshop.pdf
-// - Note that ImageSourceData 8BIM frames are specified differently
-// from how Adobe XMP Specification Part 3 defines them.
-// - The document places a condition on SubIFDs, without further explanation.
-//
-// Adobe Photoshop TIFF Technical Note 3 (2005)
-// http://chriscox.org/TIFFTN3d1.pdf
-//
-// Exif Version 2.3 (2012)
-// https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
-//
-// Exif Version 2.32 (2019)
-// https://www.cipa.jp/e/std/std-sec.html
-//
-// Digital Negative (DNG) Specification 1.5.0.0 (2019)
-// https://www.adobe.com/content/dam/acom/en/products/photoshop/pdfs
-// /dng_spec_1.5.0.0.pdf
-//
// libtiff is a mess, and the format is not particularly complicated.
// Exiv2 is senselessly copylefted, and cannot do much.
// libexif is only marginally better.
@@ -391,477 +360,7 @@ struct tiff_entry {
struct tiff_value *values;
};
-static struct tiff_entry tiff_entries[] = {
- {"NewSubfileType", 254, NULL},
- {"SubfileType", 255, (struct tiff_value[]) {
- {"Full-resolution image data", 1},
- {"Reduced-resolution image data", 2},
- {"Page of a multi-page image", 3},
- {}
- }},
- {"ImageWidth", 256, NULL},
- {"ImageLength", 257, NULL},
- {"BitsPerSample", 258, NULL},
- {"Compression", 259, (struct tiff_value[]) {
- {"Uncompressed", 1},
- {"CCITT 1D", 2},
- {"Group 3 Fax", 3},
- {"Group 4 Fax", 4},
- {"LZW", 5},
- {"JPEG", 6},
- {"JPEG datastream", 7}, // DRAFT TIFF Technical Note 2 + TIFFphotoshop
- {"Deflate/zlib", 8}, // Adobe Photoshop TIFF Technical Notes
- {"PackBits", 32773},
- {"Deflate/zlib", 32946}, // Adobe Photoshop TIFF Technical Notes
- {}
- }},
- {"PhotometricInterpretation", 262, (struct tiff_value[]) {
- {"WhiteIsZero", 0},
- {"BlackIsZero", 1},
- {"RGB", 2},
- {"RGB Palette", 3},
- {"Transparency mask", 4},
- {"CMYK", 5},
- {"YCbCr", 6},
- {"CIELab", 8},
- {"ICCLab", 9}, // Adobe PageMaker 6.0 TIFF Technical Notes
- {}
- }},
- {"Threshholding", 263, (struct tiff_value[]) {
- {"No dithering or halftoning", 1},
- {"Ordered dither or halftoning", 2},
- {"Randomized process", 3},
- {}
- }},
- {"CellWidth", 264, NULL},
- {"CellLength", 265, NULL},
- {"FillOrder", 266, (struct tiff_value[]) {
- {"MSB-first", 1},
- {"LSB-first", 2},
- {}
- }},
- {"DocumentName", 269, NULL},
- {"ImageDescription", 270, NULL},
- {"Make", 271, NULL},
- {"Model", 272, NULL},
- {"StripOffsets", 273, NULL},
- {"Orientation", 274, (struct tiff_value[]) {
- {"TopLeft", 1},
- {"TopRight", 2},
- {"BottomRight", 3},
- {"BottomLeft", 4},
- {"LeftTop", 5},
- {"RightTop", 6},
- {"RightBottom", 7},
- {"LeftBottom", 8},
- {}
- }},
- {"SamplesPerPixel", 277, NULL},
- {"RowsPerStrip", 278, NULL},
- {"StripByteCounts", 279, NULL},
- {"MinSampleValue", 280, NULL},
- {"MaxSampleValue", 281, NULL},
- {"XResolution", 282, NULL},
- {"YResolution", 283, NULL},
- {"PlanarConfiguration", 284, (struct tiff_value[]) {
- {"Chunky", 1},
- {"Planar", 2},
- {}
- }},
- {"PageName", 285, NULL},
- {"XPosition", 286, NULL},
- {"YPosition", 287, NULL},
- {"FreeOffsets", 288, NULL},
- {"FreeByteCounts", 289, NULL},
- {"GrayResponseUnit", 290, (struct tiff_value[]) {
- {"1/10", 1},
- {"1/100", 2},
- {"1/1000", 3},
- {"1/10000", 4},
- {"1/100000", 5},
- {}
- }},
- {"GrayResponseCurve", 291, NULL},
- {"T4Options", 292, NULL},
- {"T6Options", 293, NULL},
- {"ResolutionUnit", 296, (struct tiff_value[]) {
- {"None", 1},
- {"Inch", 2},
- {"Centimeter", 3},
- {}
- }},
- {"PageNumber", 297, NULL},
- {"TransferFunction", 301, NULL},
- {"Software", 305, NULL},
- {"DateTime", 306, NULL},
- {"Artist", 315, NULL},
- {"HostComputer", 316, NULL},
- {"Predictor", 317, (struct tiff_value[]) {
- {"None", 1},
- {"Horizontal", 2},
- {"Floating point", 3}, // Adobe Photoshop TIFF Technical Note 3
- {}
- }},
- {"WhitePoint", 318, NULL},
- {"PrimaryChromaticities", 319, NULL},
- {"ColorMap", 320, NULL},
- {"HalftoneHints", 321, NULL},
- {"TileWidth", 322, NULL},
- {"TileLength", 323, NULL},
- {"TileOffsets", 324, NULL},
- {"TileByteCounts", 325, NULL},
- {"SubIFDs", 330, NULL}, // TIFF Technical Note 1: TIFF Trees
- {"InkSet", 332, (struct tiff_value[]) {
- {"CMYK", 1},
- {"Non-CMYK", 2},
- {}
- }},
- {"InkNames", 333, NULL},
- {"NumberOfInks", 334, NULL},
- {"DotRange", 336, NULL},
- {"TargetPrinter", 337, NULL},
- {"ExtraSamples", 338, (struct tiff_value[]) {
- {"Unspecified", 0},
- {"Associated alpha", 1},
- {"Unassociated alpha", 2},
- {}
- }},
- {"SampleFormat", 339, (struct tiff_value[]) {
- {"Unsigned integer", 1},
- {"Two's complement signed integer", 2},
- {"IEEE floating-point", 3},
- {"Undefined", 4},
- {}
- }},
- {"SMinSampleValue", 340, NULL},
- {"SMaxSampleValue", 341, NULL},
- {"TransferRange", 342, NULL},
- {"ClipPath", 343, NULL}, // TIFF Technical Note 2: Clipping Path
- {"XClipPathUnits", 344, NULL}, // TIFF Technical Note 2: Clipping Path
- {"YClipPathUnits", 345, NULL}, // TIFF Technical Note 2: Clipping Path
- {"Indexed", 346, NULL}, // TIFF Technical Note 3: Indexed Images
- {"JPEGTables", 347, NULL}, // DRAFT TIFF Technical Note 2 + TIFFphotoshop
- {"OPIProxy", 351, NULL}, // Adobe PageMaker 6.0 TIFF Technical Notes
- {"JPEGProc", 512, (struct tiff_value[]) {
- {"Baseline sequential", 1},
- {"Lossless Huffman", 14},
- {}
- }},
- {"JPEGInterchangeFormat", 513, NULL},
- {"JPEGInterchangeFormatLength", 514, NULL},
- {"JPEGRestartInterval", 515, NULL},
- {"JPEGLosslessPredictors", 517, (struct tiff_value[]) {
- {"A", 1},
- {"B", 2},
- {"C", 3},
- {"A+B+C", 4},
- {"A+((B-C)/2)", 5},
- {"B+((A-C)/2)", 6},
- {"(A+B)/2", 7},
- {}
- }},
- {"JPEGPointTransforms", 518, NULL},
- {"JPEGQTables", 519, NULL},
- {"JPEGDCTables", 520, NULL},
- {"JPEGACTables", 521, NULL},
- {"YCbCrCoefficients", 529, NULL},
- {"YCbCrSubSampling", 530, NULL},
- {"YCbCrPositioning", 531, (struct tiff_value[]) {
- {"Centered", 1},
- {"Co-sited", 2},
- {}
- }},
- {"ReferenceBlackWhite", 532, NULL},
- {"XMP", 700, NULL}, // Adobe XMP Specification Part 3 Table 12/13/39
- {"ImageID", 32781, NULL}, // Adobe PageMaker 6.0 TIFF Technical Notes
- {"Copyright", 33432, NULL},
- // TODO(p): Extract IPTC DataSets, like we do directly with PSIRs.
- {"IPTC", 33723, NULL}, // Adobe XMP Specification Part 3 Table 12/39
- // TODO(p): Extract PSIRs, like we do directly with the JPEG segment.
- {"Photoshop", 34377, NULL}, // Adobe XMP Specification Part 3 Table 12/39
- {"Exif IFD Pointer", 34665, NULL}, // Exif 2.3
- {"GPS Info IFD Pointer", 34853, NULL}, // Exif 2.3
- {"TIFF/EP StandardID", 37398, NULL}, // ISO 12234 TIFF/EP image data format
- {"ImageSourceData", 37724, NULL}, // Adobe Photoshop TIFF Technical Notes
- {"DNGVersion", 50706, NULL}, // DNG 1.5.0.0
- {"DNGBackwardVersion", 50707, NULL}, // DNG 1.5.0.0
- {"UniqueCameraModel", 50708, NULL}, // DNG 1.5.0.0
- {"LocalizedCameraModel", 50709, NULL}, // DNG 1.5.0.0
- // TODO(p): Add more DNG tags that can be only in IFD0.
- {}
-};
-
-// Exif 2.3 4.6.5
-static struct tiff_entry exif_entries[] = {
- {"ExposureTime", 33434, NULL},
- {"FNumber", 33437, NULL},
- {"ExposureProgram", 34850, (struct tiff_value[]) {
- {"Not defined", 0},
- {"Manual", 1},
- {"Normal program", 2},
- {"Aperture priority", 3},
- {"Shutter priority", 4},
- {"Creative program", 5},
- {"Action program", 6},
- {"Portrait mode", 7},
- {"Landscape mode", 8},
- {}
- }},
- {"SpectralSensitivity", 34852, NULL},
- {"PhotographicSensitivity", 34855, NULL},
- {"OECF", 34856, NULL},
- {"SensitivityType", 34864, (struct tiff_value[]) {
- {"Unknown", 0},
- {"Standard output sensitivity", 1},
- {"Recommended exposure index", 2},
- {"ISO speed", 3},
- {"SOS and REI", 4},
- {"SOS and ISO speed", 5},
- {"REI and ISO speed", 6},
- {"SOS and REI and ISO speed", 7},
- {}
- }},
- {"StandardOutputSensitivity", 34865, NULL},
- {"RecommendedExposureIndex", 34866, NULL},
- {"ISOSpeed", 34867, NULL},
- {"ISOSpeedLatitudeyyy", 34868, NULL},
- {"ISOSpeedLatitudezzz", 34869, NULL},
- {"ExifVersion", 36864, NULL},
- {"DateTimeOriginal", 36867, NULL},
- {"DateTimeDigitized", 36868, NULL},
- {"OffsetTime", 36880, NULL}, // 2.31
- {"OffsetTimeOriginal", 36881, NULL}, // 2.31
- {"OffsetTimeDigitized", 36882, NULL}, // 2.31
- {"ComponentsConfiguration", 37121, (struct tiff_value[]) {
- {"Does not exist", 0},
- {"Y", 1},
- {"Cb", 2},
- {"Cr", 3},
- {"R", 4},
- {"G", 5},
- {"B", 6},
- {}
- }},
- {"CompressedBitsPerPixel", 37122, NULL},
- {"ShutterSpeedValue", 37377, NULL},
- {"ApertureValue", 37378, NULL},
- {"BrightnessValue", 37379, NULL},
- {"ExposureBiasValue", 37380, NULL},
- {"MaxApertureValue", 37381, NULL},
- {"SubjectDistance", 37382, NULL},
- {"MeteringMode", 37383, (struct tiff_value[]) {
- {"Unknown", 0},
- {"Average", 1},
- {"CenterWeightedAverage", 2},
- {"Spot", 3},
- {"MultiSpot", 4},
- {"Pattern", 5},
- {"Partial", 6},
- {"Other", 255},
- {}
- }},
- {"LightSource", 37384, (struct tiff_value[]) {
- {"Unknown", 0},
- {"Daylight", 1},
- {"Fluorescent", 2},
- {"Tungsten (incandescent light)", 3},
- {"Flash", 4},
- {"Fine weather", 9},
- {"Cloudy weather", 10},
- {"Shade", 11},
- {"Daylight fluorescent (D 5700 - 7100K)", 12},
- {"Day white fluorescent (N 4600 - 5500K)", 13},
- {"Cool white fluorescent (W 3800 - 4500K)", 14},
- {"White fluorescent (WW 3250 - 3800K)", 15},
- {"Warm white fluorescent (L 2600 - 3250K)", 16},
- {"Standard light A", 17},
- {"Standard light B", 18},
- {"Standard light C", 19},
- {"D55", 20},
- {"D65", 21},
- {"D75", 22},
- {"D50", 23},
- {"ISO studio tungsten", 24},
- {"Other light source", 255},
- {}
- }},
- {"Flash", 37385, NULL},
- {"FocalLength", 37386, NULL},
- {"SubjectArea", 37396, NULL},
- {"MakerNote", 37500, NULL},
- // TODO(p): Decode.
- {"UserComment", 37510, NULL},
- {"SubSecTime", 37520, NULL},
- {"SubSecTimeOriginal", 37521, NULL},
- {"SubSecTimeDigitized", 37522, NULL},
- {"Temperature", 37888, NULL}, // 2.31
- {"Humidity", 37889, NULL}, // 2.31
- {"Pressure", 37890, NULL}, // 2.31
- {"WaterDepth", 37891, NULL}, // 2.31
- {"Acceleration", 37892, NULL}, // 2.31
- {"CameraElevationAngle", 37893, NULL}, // 2.31
- {"FlashpixVersion", 40960, NULL},
- {"ColorSpace", 40961, (struct tiff_value[]) {
- {"sRGB", 1},
- {"Uncalibrated", 0xFFFF},
- {}
- }},
- {"PixelXDimension", 40962, NULL},
- {"PixelYDimension", 40963, NULL},
- {"RelatedSoundFile", 40964, NULL},
- {"Interoperability IFD Pointer", 40965, NULL},
- {"FlashEnergy", 41483, NULL},
- {"SpatialFrequencyResponse", 41484, NULL},
- {"FocalPlaneXResolution", 41486, NULL},
- {"FocalPlaneYResolution", 41487, NULL},
- {"FocalPlaneResolutionUnit", 41488, NULL},
- {"SubjectLocation", 41492, NULL},
- {"ExposureIndex", 41493, NULL},
- {"SensingMethod", 41495, (struct tiff_value[]) {
- {"Not defined", 1},
- {"One-chip color area sensor", 2},
- {"Two-chip color area sensor", 3},
- {"Three-chip color area sensor", 4},
- {"Color sequential area sensor", 5},
- {"Trilinear sensor", 7},
- {"Color sequential linear sensor", 8},
- {}
- }},
- {"FileSource", 41728, (struct tiff_value[]) {
- {"Others", 0},
- {"Scanner of transparent type", 1},
- {"Scanner of reflex type", 2},
- {"DSC", 3},
- {}
- }},
- {"SceneType", 41729, (struct tiff_value[]) {
- {"Directly-photographed image", 1},
- {}
- }},
- {"CFAPattern", 41730, NULL},
- {"CustomRendered", 41985, (struct tiff_value[]) {
- {"Normal process", 0},
- {"Custom process", 1},
- {}
- }},
- {"ExposureMode", 41986, (struct tiff_value[]) {
- {"Auto exposure", 0},
- {"Manual exposure", 1},
- {"Auto bracket", 2},
- {}
- }},
- {"WhiteBalance", 41987, (struct tiff_value[]) {
- {"Auto white balance", 0},
- {"Manual white balance", 1},
- {}
- }},
- {"DigitalZoomRatio", 41988, NULL},
- {"FocalLengthIn35mmFilm", 41989, NULL},
- {"SceneCaptureType", 41990, (struct tiff_value[]) {
- {"Standard", 0},
- {"Landscape", 1},
- {"Portrait", 2},
- {"Night scene", 3},
- {}
- }},
- {"GainControl", 41991, (struct tiff_value[]) {
- {"None", 0},
- {"Low gain up", 1},
- {"High gain up", 2},
- {"Low gain down", 3},
- {"High gain down", 4},
- {}
- }},
- {"Contrast", 41992, (struct tiff_value[]) {
- {"Normal", 0},
- {"Soft", 1},
- {"Hard", 2},
- {}
- }},
- {"Saturation", 41993, (struct tiff_value[]) {
- {"Normal", 0},
- {"Low", 1},
- {"High", 2},
- {}
- }},
- {"Sharpness", 41994, (struct tiff_value[]) {
- {"Normal", 0},
- {"Soft", 1},
- {"Hard", 2},
- {}
- }},
- {"DeviceSettingDescription", 41995, NULL},
- {"SubjectDistanceRange", 41996, (struct tiff_value[]) {
- {"Unknown", 0},
- {"Macro", 1},
- {"Close view", 2},
- {"Distant view", 3},
- {}
- }},
- {"ImageUniqueID", 42016, NULL},
- {"CameraOwnerName", 42032, NULL},
- {"BodySerialNumber", 42033, NULL},
- {"LensSpecification", 42034, NULL},
- {"LensMake", 42035, NULL},
- {"LensModel", 42036, NULL},
- {"LensSerialNumber", 42037, NULL},
- {"CompositeImage", 42080, NULL}, // 2.32
- {"SourceImageNumberOfCompositeImage", 42081, NULL}, // 2.32
- {"SourceExposureTimesOfCompositeImage", 42082, NULL}, // 2.32
- {"Gamma", 42240, NULL},
- {}
-};
-
-// Exif 2.3 4.6.6 (Notice it starts at 0.)
-static struct tiff_entry exif_gps_entries[] = {
- {"GPSVersionID", 0, NULL},
- {"GPSLatitudeRef", 1, NULL},
- {"GPSLatitude", 2, NULL},
- {"GPSLongitudeRef", 3, NULL},
- {"GPSLongitude", 4, NULL},
- {"GPSAltitudeRef", 5, (struct tiff_value[]) {
- {"Sea level", 0},
- {"Sea level reference (negative value)", 1},
- {}
- }},
- {"GPSAltitude", 6, NULL},
- {"GPSTimeStamp", 7, NULL},
- {"GPSSatellites", 8, NULL},
- {"GPSStatus", 9, NULL},
- {"GPSMeasureMode", 10, NULL},
- {"GPSDOP", 11, NULL},
- {"GPSSpeedRef", 12, NULL},
- {"GPSSpeed", 13, NULL},
- {"GPSTrackRef", 14, NULL},
- {"GPSTrack", 15, NULL},
- {"GPSImgDirectionRef", 16, NULL},
- {"GPSImgDirection", 17, NULL},
- {"GPSMapDatum", 18, NULL},
- {"GPSDestLatitudeRef", 19, NULL},
- {"GPSDestLatitude", 20, NULL},
- {"GPSDestLongitudeRef", 21, NULL},
- {"GPSDestLongitude", 22, NULL},
- {"GPSDestBearingRef", 23, NULL},
- {"GPSDestBearing", 24, NULL},
- {"GPSDestDistanceRef", 25, NULL},
- {"GPSDestDistance", 26, NULL},
- {"GPSProcessingMethod", 27, NULL},
- {"GPSAreaInformation", 28, NULL},
- {"GPSDateStamp", 29, NULL},
- {"GPSDifferential", 30, (struct tiff_value[]) {
- {"Measurement without differential correction", 0},
- {"Differential correction applied", 1},
- {}
- }},
- {"GPSHPositioningError", 31, NULL},
- {}
-};
-
-// Exif 2.3 4.6.7 (Notice it starts at 1, and collides with GPS.)
-static struct tiff_entry exif_interop_entries[] = {
- {"InteroperabilityIndex", 1, NULL},
- {}
-};
+#include "tiff-tables.h"
// TODO(p): Consider if these can't be inlined into `tiff_entries`.
static struct {
@@ -871,7 +370,7 @@ static struct {
{330, tiff_entries}, // SubIFDs
{34665, exif_entries}, // Exif IFD Pointer
{34853, exif_gps_entries}, // GPS Info IFD Pointer
- {40965, exif_interop_entries}, // Interoperability IFD Pointer
+ {40965, exif_interoperability_entries}, // Interoperability IFD Pointer
{}
};