Image-EXIF

 view release on metacpan or  search on metacpan

leica.c  view on Meta::CPAN


/* Flash exposure compensation. */

static struct descrip leica_flashev[] = {
	{ 0,		"0 EV" },
	{ 1,		"0.33 EV" },
	{ 2,		"0.67 EV" },
	{ 3,		"1 EV" },
	{ 4,		"1.33 EV" },
	{ 5,		"1.67 EV" },
	{ 6,		"2 EV" },
	{ 0xfffa,	"-2 EV" },
	{ 0xfffb,	"-1.67 EV" },
	{ 0xfffc,	"-1.33 EV" },
	{ 0xfffd,	"-1 EV" },
	{ 0xfffe,	"-0.67 EV" },
	{ 0xffff,	"-0.33 EV" },
	{ -1,		"Unknown" },
};


/* Contrast. */

static struct descrip leica_contrast[] = {
	{ 0x100,	"Low" },
	{ 0x110,	"Standard" },
	{ 0x120,	"High" },
	{ -1,		"Unknown" },
};


/* Aperture mode. */

static struct descrip leica_aperture[] = {
	{ 6,	"Auto" },
	{ 7,	"Manual" },
	{ -1,	"Unknown" },
};


/* Spot autofocus. */

static struct descrip leica_spotaf[] = {
	{ 256,	"On" },
	{ 4096,	"Off" },
	{ -1,	"Unknown" },
};


/* Maker note IFD tags. */

static struct exiftag leica_tags[] = {
	{ 0x0001, TIFF_ASCII, 8, ED_IMG, "LeicaCompress",
	  "Compression Rate", leica_compress },
	{ 0x0003, TIFF_SHORT, 1, ED_IMG, "LeicaWhiteBal",
	  "White Balance", leica_white },
	{ 0x0007, TIFF_SHORT, 1, ED_IMG, "LeicaFocusMode",
	  "Focus Mode", leica_focus },
	{ 0x000f, TIFF_SHORT, 1, ED_IMG, "LeicaSpotAF",
	  "Spot Autofocus", leica_spotaf },
	{ 0x001c, TIFF_SHORT, 1, ED_IMG, "LeicaMacro",
	  "Macro Mode", leica_bool },
	{ 0x001f, TIFF_SHORT, 1, ED_IMG, "LeicaAperture",
	  "Aperture Mode", leica_aperture },
	{ 0x0024, TIFF_SHORT, 1, ED_IMG, "LeicaFlashEV",
	  "Flash Compensation", leica_flashev },
	{ 0x002c, TIFF_SHORT, 1, ED_IMG, "LeicaContrast",
	  "Contrast", leica_contrast },
	{ 0xffff, TIFF_UNKN, 0, ED_UNK, "LeicaUnknown",
	  "Leica Unknown", NULL },
};


/*
 * Process Leica maker note tags.
 */
void
leica_prop(struct exifprop *prop, struct exiftags *t)
{

	/*
	 * Assume that if the property's tag set is not our Leica one,
	 * it must be Fuji's.
	 */

	if (prop->tagset != leica_tags) {
		fuji_prop(prop, t);
		return;
	}

	/* Override a couple of standard tags. */

	switch (prop->tag) {

	/* White balance. */

	case 0x0003:
		prop->override = EXIF_T_WHITEBAL;
		break;

	/* Contrast. */

	case 0x002c:
		prop->override = EXIF_T_CONTRAST;
		break;
	}
}


/*
 * Try to read a Leica maker note IFD.
 */
struct ifd *
leica_ifd(u_int32_t offset, struct tiffmeta *md)
{

	/*
	 * Leica maker notes start with an ID string, followed by an IFD
	 * offset relative to the MakerNote tag.
	 *
	 * The Digilux 4.3 seems to just spit out Fuji maker notes.  So,
	 * go ahead and use the Fuji functions...



( run in 1.409 second using v1.01-cache-2.11-cpan-99c4e6809bf )