Image-MetaData-JPEG
view release on metacpan or search on metacpan
2005-02-06 Stefano Bettelli <bettelli@cpan.org>
* lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): there is
now a prediction and correction mechanism for the offsets in the
interoperability arrays. The simple assumption is that the absolute
value of offsets can be wrong, but their difference is always right,
so, if you get the first one right ... a good bet is the address of
the byte immediately following the next_IFD link. This mechanism is
currently enabled only for MakerNotes (it might be able to read even
MakerNotes corrupted by an arbitrary relocation).
* lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd_children):
the code for parsing sub-IFD's was single out into this routine.
* lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_makernote): this
routine was polished and uncommented; it now deals with every possible
MakerNote format (because of the catch-all rule), even if sometimes
it has a minimalist approach ... Information is made available in a
subdirectory of APP1@IFD@SubIFD, named 'MakerNote_' + the selected
format (so, there isn't any more any 'MakerNote' entry in IFD0@SubIFD);
lib/Image/MetaData/JPEG/dumpers/app1_exif.pl view on Meta::CPAN
# in general, the MakerNote's next-IFD link is zero, but some
# MakerNotes do not even have these four bytes: prepare the flag
my $next_flag = exists $$hash{nonext} ? 2 : 1;
# in general, MakerNote's offsets are computed from the APP1 segment
# TIFF base; however, some formats compute offsets from the beginning
# of the MakerNote itself: setup the offset base as required.
$offset = length($signature) + (exists $$hash{mkntstart} ? 0 : $offset);
# initialise the data area with the detected signature
$data = $signature;
# some MakerNotes have a TIFF header on their own, freeing them
# from the relocation problem; values from this header overwrite
# the previously assigned values; records are saved in $mknt_dir.
if (exists $$hash{mkntTIFF}) {
my ($TIFF_header, $TIFF_offset, $TIFF_endianness)
= $this->dump_TIFF_header($spcref);
$this->die('Endianness mismatch') if $endianness ne $TIFF_endianness;
$data .= $TIFF_header; $offset = $TIFF_offset; }
# Unstructured case: the content of the MakerNote is simply
# a sequence of bytes, which must be encoded using $$hash{tags}
if (exists $$hash{nonIFD}) {
$data .= $this->search_record($$_[0], $dirref)->get($endianness)
lib/Image/MetaData/JPEG/parsers/app1_exif.pl view on Meta::CPAN
my $mknt_endianness = exists $$hash{endianness} ? $$hash{endianness} :
$it_looks_big_endian ? $BIG_ENDIAN : $LITTLE_ENDIAN;
# in general, the MakerNote's next-IFD link is zero, but some
# MakerNotes do not even have these four bytes: prepare the flag
my $next_flag = exists $$hash{nonext} ? 2 : 1;
# in general, MakerNote's offsets are computed from the APP1 segment
# TIFF base; however, some formats compute offsets from the beginning
# of the MakerNote itself: prepare an alternative base if necessary
my $mknt_base = exists $$hash{mkntstart} ? $mknt_offset : $base;
# some MakerNotes have a TIFF header on their own, freeing them
# from the relocation problem; values from this header overwrite
# the previously assigned values; records are saved in $mknt_dir.
if (exists $$hash{mkntTIFF}) {
($mknt_base, my $ifd_link, $mknt_endianness)
= $this->parse_TIFF_header($mknt_offset + $skip, $mknt_spc);
# update $skip to point to the beginning of the IFD
$skip += $ifd_link; }
# calculate the address of the beginning of the IFD (both with
# and without a TIFF header) or of an unstructured data area.
my $data_offset = $mknt_offset + $skip;
# Store the special MakerNote information in a special subdirectory
( run in 1.096 second using v1.01-cache-2.11-cpan-5511b514fd6 )