fix(metadata): read exposure mode, interval shooting and RAW size from MakerNotes
BRIEF §9 lists exposure mode, intervalometer hints and sRaw flags among the MakerNote fields; no vendor parser read them. The vendor exposure mode (Canon, Olympus, Fujifilm, Panasonic, Sony) now fills ExposureProgram when Exif has none, Panasonic's TimerRecording becomes FrameMetadata.IntervalShooting, and Canon's SRAWQuality and Nikon's ImageSizeRAW / small NEF compression become FrameMetadata.RawSize. Nikon keeps its interval-shooting state in the encrypted ShotInfo, which stays undecoded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
10 files changed
+271
-7
No files matched your search
@@ -1,9 +1,13 @@
|
||||
using System.Globalization;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Metadata.Tiff;
|
||||
|
||||
namespace Titano.Core.Metadata.MakerNotes;
|
||||
|
||||
/// <summary>Canon MakerNote: a bare IFD whose offsets are relative to the enclosing TIFF header (also CR3 CMT3).</summary>
|
||||
/// <summary>
|
||||
/// Canon MakerNote: a bare IFD whose offsets are relative to the enclosing TIFF header (also CR3 CMT3). CameraSettings
|
||||
/// gives the stabiliser, the exposure mode and the sRAW size; Canon records no interval-shooting hint there.
|
||||
/// </summary>
|
||||
internal static class CanonMakerNote
|
||||
{
|
||||
private const ushort CameraSettings = 0x0001;
|
||||
@@ -11,7 +15,9 @@ internal static class CanonMakerNote
|
||||
private const ushort LensModel = 0x0095;
|
||||
private const ushort InternalSerialNumber = 0x0096;
|
||||
private const ushort ColorTemperature = 0x00AE;
|
||||
private const int ExposureModeIndex = 20;
|
||||
private const int ImageStabilizationIndex = 34;
|
||||
private const int SRawQualityIndex = 46;
|
||||
|
||||
public static void Parse(TiffReader r, Ifd ifd, MetadataBuilder m)
|
||||
{
|
||||
@@ -25,7 +31,21 @@ internal static class CanonMakerNote
|
||||
v.BodySerial ??= IfdValue.String(r, ifd, InternalSerialNumber);
|
||||
v.LensModel ??= IfdValue.String(r, ifd, LensModel);
|
||||
v.ColorTemperature ??= IfdValue.Int(r, ifd, ColorTemperature) is { } kelvin and > 0 and < 65535 ? kelvin : null;
|
||||
if (IfdValue.UInts(r, ifd, CameraSettings) is { Length: > ImageStabilizationIndex } settings)
|
||||
if (IfdValue.UInts(r, ifd, CameraSettings) is not { } settings) return;
|
||||
if (settings.Length > ExposureModeIndex)
|
||||
{
|
||||
// CanonExposureMode: 1 Program, 2 Tv, 3 Av, 4 Manual, 5 Depth-of-field AE, 6 M-Dep, 7 Bulb, 8 Fv; 0 Easy (scene).
|
||||
v.ExposureProgram ??= settings[ExposureModeIndex] switch
|
||||
{
|
||||
1 or 8 => 2,
|
||||
2 => 4,
|
||||
3 => 3,
|
||||
4 or 7 => 1,
|
||||
5 or 6 => 5,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
if (settings.Length > ImageStabilizationIndex)
|
||||
{
|
||||
// 0 Off, 1 On, 2 Shoot only, 3 Panning, 4 Dynamic; +256 for the "(2)" variants.
|
||||
v.ImageStabilization ??= (settings[ImageStabilizationIndex] & 0xFF) switch
|
||||
@@ -35,5 +55,16 @@ internal static class CanonMakerNote
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
if (settings.Length > SRawQualityIndex && m.Format is ImageFileFormat.Cr2 or ImageFileFormat.Cr3)
|
||||
{
|
||||
// SRAWQuality: 0 full-size RAW, 1 sRAW1 (mRAW), 2 sRAW2 (sRAW).
|
||||
v.RawSize ??= settings[SRawQualityIndex] switch
|
||||
{
|
||||
0 => RawSize.Full,
|
||||
1 => RawSize.Medium,
|
||||
2 => RawSize.Small,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user