# This defines a sample config for baseline TIFFs with TIFF/EP extensions,
# based on ISO 12234-2:2001

# HINT: because checkit_tiff is designed as a *baseline TIFF* validation tool,
# some rules could not be defined to allow a fine granular validation of
# TIFF/EP files!

# tag; required; values
#
# works as whitelist
# * tag: any tag number in TIFF
# * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) 
# * values: range($start, $end) | logical_or( $a, …) | only($a) |any
# Remember, because it works as whitelist for each required tag we need an
# entry here

# 5.2.1 TIFF/EPStandard ID, should have 4 bytes: 1 0 0 0
37398; mandatory; only(1)

# 5.2.2 ImageWidth (depends if Thumbnail or Main, on Thumbnail only 0..256 allowed
256; mandatory; any

# 5.2.3 ImageLength (depends if Thumbnail or Main, on Thumbnail only 0..256 allowed
257; mandatory; any

# 5.2.4 NewSubFileType, Bit 0 = 1 if thumbnail else 0
254; mandatory; any

# 5.2.5 SubIFDs
330; mandatory; any

# 5.2.6 XResolution
282; mandatory; any

# 5.2.7 YResolution
283; mandatory; any

# 5.2.8 ResolutionUnit
284; mandatory; range(1,3)

# 5.2.9 FocalPlaneXResolution
37390; optional; any

# 5.2.10 FocalPlaneYResolution
37391; optional; any

# 5.2.11 FocalPlaneResolutionUnit
37392; optional; range(1,5)

# 5.2.12 Orientation
274; optional; logical_or(1, 3, 6, 8, 9)

# 5.2.13 Photometric Interpretation
262; mandatory; logical_or(1, 2, 6, 32803, range(32768, 65535))

# 5.2.14 Planar Configuration
284; mandatory; range(1,2)

# 5.2.15 Interlace, optional tag indicates the field number of multifield images
34857; optional; range(0, 16383)

# 5.2.16 Sensing Method, type of image sensor
37399; mandatory; range(0,8)

# 5.2.17 CFARepeatPatternDim, mandatory if PhotometricInterpretation=32803,
# optional if PhotometricInterpretation=2|6 && SensingMethod=2
33421; depends(262.32803); range(0,1)
33421; optdepends(37399.2); range(0,1)

# 5.2.18 CFAPattern, mandatory if PhotometricInterpretation=32803,
# optional if PhotometricInterpretation=2|6 && SensingMethod=2
33422; depends(262.32803); any
33422; optdepends(37399.2); any

# 5.2.19 SamplesPerPixel
277; depends(262.range(32768,65535)); any
277; depends(262.1); only(1)
277; depends(262.32803); only(1)
277; depends(262.2); only(3)
277; depends(262.6); only(3)

# 5.2.20 BitsPerSample
258; mandatory; range(0, 65535)

# 5.2.21 StripOffsets, it is only mandatory if no Tiles used.
273; mandatory; any

# 5.2.22 RowsPerStrip
278; depends(273.any); any

# 5.2.23 StripByteCounts
279; depends(273.any); any

# 5.2.24 TileWidth, it is only mandatory if no Strips used.
#322; mandatory; any

# 5.2.25 TileLength
323; depends(322.any); any

# 5.2.26 TileOffsets
324; depends(322.any); any

# 5.2.27 TileByteCounts
325; depends(322.any); any

# 5.2.28 Compression
259; mandatory; logical_or(1, 7, range(32768,65535))

# 5.2.29 CompressedBitsPerPixel
37122; optional; any

# 5.2.30 JPEGTables
347; optional; any

# 5.2.31 YCbCrSubSampling (two values, both are 1,2 or 4)
347; depends(262.6); any

# 5.2.32 YCbCrPositioning
531; depends(262.6); only(2)

# 5.2.33 YCbCrCoefficents
529; depends(262.6); any

# 5.2.34 ReferenceBlackWhite
532; depends(262.6); any

# 5.2.35 Make
271; mandatory; any

# 5.2.36 Model
272; mandatory; any

# 5.2.37 Software
305; mandatory; any

# 5.2.38 ImageNumber
37393; optional; any

# 5.2.39 Image Description
270; mandatory; any

# 5.2.40 Artist
315; optional; any

# 5.2.41 Copyright
33432; mandatory; any

# 5.2.42 ImageHistory
37395; optional; any

# 5.2.43 IPTC/NAA
33723; optional; any

# 5.2.44 SecurityClassification
37394; optional; any

# 5.2.45 GPSInfo
34853; optional; any

# 5.2.46 DateTimeOriginal, mandatory here as part of IFD0 (in opposite to EXIF
# DateTimeOriginal which is referenced by EXIF IFD)
36867; mandatory; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$")

# 5.2.47 DateTime, mandatory
306; mandatory; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$")

# 5.2.48 TimeZoneOffset
34858; optional; any

# 5.2.49 ExposureTime
33434; optional; any

# 5.2.50 ShutterSpeedValue
37377; optional; any

# 5.2.51 FNumber encodes lens f-number
33437; optional; any

# 5.2.52 ApertureValue
37378; optional; any

# 5.2.53 MaxApertureValue
37381; optional; any

# 5.2.54 BrightnessValue
37379; optional; any

# 5.2.55 ExposureBiasValue
37380; optional; any

# 5.2.56 Exposure Program
34850; optional; logical_or(range(0, 8), range(32768,65535))

# 5.2.57 Metering Mode
37383; optional; logical_or(range(0,4), range(32768, 65535))

# 5.2.58 Flash, Bitflags encoded 
# 0b---- ---- ---- ---0
# 0b---- ---- ---- ---1 fire status

# 0b---- ---- ---- -00-
# 0b---- ---- ---- -10-
# 0b---- ---- ---- -11- return sense (01 reserved)

# 0b---- ---- ---0 0---
# 0b---- ---- ---0 1---
# 0b---- ---- ---1 0---
# 0b---- ---- ---1 1--- mode bits

# 0b---- ---- --0- ----
# 0b---- ---- --1- ---- unit present

# 0b0000 0000 00-- ---- reserved

37385; optional; logical_or(0,1,5,7,9,13,15,16,24,25,29,31,32)

# 5.2.59 FlashEnergy
37387; optional; any

# 5.2.60 FocalLength
37386; optional; any

# 5.2.61 SubjectDistance
37382; optional; any

# 5.2.62 SubjectLocation
37396; optional; any

# 5.2.63 SelfTimerMode
34859; optional; range(0, 65535)

# 5.2.64 BatteryLevel
33423; optional; any

# 5.2.65 LightSource
37384; optional; any

# 5.2.66 InterColourProfile (it is not defined as optional here, mandatory?)
34675; mandatory; any

# 5.2.67 ExposureIndex
37397; optional; any

# 5.2.68 ISOSpeedRatings
34855; optional; any

# 5.2.69 OECF (optp-electorinc conversion function)
34856; optional; any

# 5.2.70 SpectralSensitivity
34852; optional; any

# 5.2.71 SpatialFrequencyResponse
37388; optional; any

# 5.2.72 Noise (optional, because "The camera's 'noise' level may  be recorded in the Noise tag-field"
37389; optional; any

