jpeginfo: mostly finish Exif decoding
Diminishing returns and all.
This commit is contained in:
parent
1ae803a62e
commit
8e2958051d
|
@ -1,6 +1,7 @@
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
# libjq 1.6 lacks a pkg-config file, and there is no release in sight.
|
# libjq 1.6 lacks a pkg-config file, and there is no release in sight.
|
||||||
CFLAGS = -g -O2 -Wall -Wextra `pkg-config --cflags $(deps)`
|
CFLAGS = -g -O2 -Wall -Wextra `pkg-config --cflags $(deps)`
|
||||||
|
# libjq 1.6 is required.
|
||||||
LDLIBS = -ljq `pkg-config --libs $(deps)`
|
LDLIBS = -ljq `pkg-config --libs $(deps)`
|
||||||
|
|
||||||
deps = libpng
|
deps = libpng
|
||||||
|
|
|
@ -74,6 +74,9 @@ u16le(const uint8_t *p)
|
||||||
// Exif Version 2.3 (2012)
|
// Exif Version 2.3 (2012)
|
||||||
// https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
|
// 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
|
||||||
|
//
|
||||||
// libtiff is a mess, and the format is not particularly complicated.
|
// libtiff is a mess, and the format is not particularly complicated.
|
||||||
// Exif libraries are senselessly copylefted.
|
// Exif libraries are senselessly copylefted.
|
||||||
|
|
||||||
|
@ -533,7 +536,7 @@ static struct tiff_entry tiff_entries[] = {
|
||||||
{"YCbCrSubSampling", 530, NULL},
|
{"YCbCrSubSampling", 530, NULL},
|
||||||
{"YCbCrPositioning", 531, (struct tiff_value[]) {
|
{"YCbCrPositioning", 531, (struct tiff_value[]) {
|
||||||
{"Centered", 1},
|
{"Centered", 1},
|
||||||
{"Cosited", 2},
|
{"Co-sited", 2},
|
||||||
{}
|
{}
|
||||||
}},
|
}},
|
||||||
{"ReferenceBlackWhite", 532, NULL},
|
{"ReferenceBlackWhite", 532, NULL},
|
||||||
|
@ -542,7 +545,6 @@ static struct tiff_entry tiff_entries[] = {
|
||||||
{"Exif IFD Pointer", 34665, NULL}, // Exif 2.3
|
{"Exif IFD Pointer", 34665, NULL}, // Exif 2.3
|
||||||
{"GPS Info IFD Pointer", 34853, NULL}, // Exif 2.3
|
{"GPS Info IFD Pointer", 34853, NULL}, // Exif 2.3
|
||||||
{"ImageSourceData", 37724, NULL}, // Adobe Photoshop TIFF Technical Notes
|
{"ImageSourceData", 37724, NULL}, // Adobe Photoshop TIFF Technical Notes
|
||||||
{"Interoperability IFD Pointer", 40965, NULL}, // Exif 2.3
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -584,6 +586,9 @@ static struct tiff_entry exif_entries[] = {
|
||||||
{"ExifVersion", 36864, NULL},
|
{"ExifVersion", 36864, NULL},
|
||||||
{"DateTimeOriginal", 36867, NULL},
|
{"DateTimeOriginal", 36867, NULL},
|
||||||
{"DateTimeDigitized", 36868, NULL},
|
{"DateTimeDigitized", 36868, NULL},
|
||||||
|
{"OffsetTime", 36880, NULL}, // 2.31
|
||||||
|
{"OffsetTimeOriginal", 36881, NULL}, // 2.31
|
||||||
|
{"OffsetTimeDigitized", 36882, NULL}, // 2.31
|
||||||
{"ComponentsConfiguration", 37121, (struct tiff_value[]) {
|
{"ComponentsConfiguration", 37121, (struct tiff_value[]) {
|
||||||
{"Does not exist", 0},
|
{"Does not exist", 0},
|
||||||
{"Y", 1},
|
{"Y", 1},
|
||||||
|
@ -646,6 +651,12 @@ static struct tiff_entry exif_entries[] = {
|
||||||
{"SubSecTime", 37520, NULL},
|
{"SubSecTime", 37520, NULL},
|
||||||
{"SubSecTimeOriginal", 37521, NULL},
|
{"SubSecTimeOriginal", 37521, NULL},
|
||||||
{"SubSecTimeDigitized", 37522, 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},
|
{"FlashpixVersion", 40960, NULL},
|
||||||
{"ColorSpace", 40961, (struct tiff_value[]) {
|
{"ColorSpace", 40961, (struct tiff_value[]) {
|
||||||
{"sRGB", 1},
|
{"sRGB", 1},
|
||||||
|
@ -655,6 +666,7 @@ static struct tiff_entry exif_entries[] = {
|
||||||
{"PixelXDimension", 40962, NULL},
|
{"PixelXDimension", 40962, NULL},
|
||||||
{"PixelYDimension", 40963, NULL},
|
{"PixelYDimension", 40963, NULL},
|
||||||
{"RelatedSoundFile", 40964, NULL},
|
{"RelatedSoundFile", 40964, NULL},
|
||||||
|
{"Interoperability IFD Pointer", 40965, NULL},
|
||||||
{"FlashEnergy", 41483, NULL},
|
{"FlashEnergy", 41483, NULL},
|
||||||
{"SpatialFrequencyResponse", 41484, NULL},
|
{"SpatialFrequencyResponse", 41484, NULL},
|
||||||
{"FocalPlaneXResolution", 41486, NULL},
|
{"FocalPlaneXResolution", 41486, NULL},
|
||||||
|
@ -750,18 +762,63 @@ static struct tiff_entry exif_entries[] = {
|
||||||
{"LensMake", 42035, NULL},
|
{"LensMake", 42035, NULL},
|
||||||
{"LensModel", 42036, NULL},
|
{"LensModel", 42036, NULL},
|
||||||
{"LensSerialNumber", 42037, NULL},
|
{"LensSerialNumber", 42037, NULL},
|
||||||
|
{"CompositeImage", 42080, NULL}, // 2.32
|
||||||
|
{"SourceImageNumberOfCompositeImage", 42081, NULL}, // 2.32
|
||||||
|
{"SourceExposureTimesOfCompositeImage", 42082, NULL}, // 2.32
|
||||||
{"Gamma", 42240, NULL},
|
{"Gamma", 42240, NULL},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(p): Exif 2.3 4.6.6 and on (note it starts at 0).
|
// Exif 2.3 4.6.6 (Notice it starts at 0.)
|
||||||
// sed 'N; s/\n/ /g' | sort -nk2 | awk '{print "\t{\"" $1 "\", " $2 ", NULL},"}'
|
static struct tiff_entry exif_gps_entries[] = {
|
||||||
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},
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
// TODO(p): Exif 2.3 4.6.7 and on (note it starts at 1, and collides with GPS).
|
// Exif 2.3 4.6.7 (Notice it starts at 1, and collides with GPS.)
|
||||||
static struct tiff_entry exif_interop_entries[] = {{}};
|
static struct tiff_entry exif_interop_entries[] = {
|
||||||
|
{"InteroperabilityIndex", 1, NULL},
|
||||||
// TODO(p): Review Exif version history afterwards.
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
// TODO(p): Consider if these can't be inlined into `tiff_entries`.
|
// TODO(p): Consider if these can't be inlined into `tiff_entries`.
|
||||||
static struct {
|
static struct {
|
||||||
|
|
Loading…
Reference in New Issue