| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ########################################################### | 
| 2 |  |  |  |  |  |  | # A Perl package for showing/modifying JPEG (meta)data.   # | 
| 3 |  |  |  |  |  |  | # Copyright (C) 2004,2005,2006 Stefano Bettelli           # | 
| 4 |  |  |  |  |  |  | # See the COPYING and LICENSE files for license terms.    # | 
| 5 |  |  |  |  |  |  | ########################################################### | 
| 6 | 15 |  |  | 15 |  | 64 | use Image::MetaData::JPEG::data::Tables qw(:TagsAPP14); | 
|  | 15 |  |  |  |  | 20 |  | 
|  | 15 |  |  |  |  | 1411 |  | 
| 7 | 15 |  |  | 15 |  | 72 | no  integer; | 
|  | 15 |  |  |  |  | 22 |  | 
|  | 15 |  |  |  |  | 126 |  | 
| 8 | 15 |  |  | 15 |  | 283 | use strict; | 
|  | 15 |  |  |  |  | 22 |  | 
|  | 15 |  |  |  |  | 348 |  | 
| 9 | 15 |  |  | 15 |  | 54 | use warnings; | 
|  | 15 |  |  |  |  | 16 |  | 
|  | 15 |  |  |  |  | 2289 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | ########################################################### | 
| 12 |  |  |  |  |  |  | # This method parses a misterious Adobe APP14 segment.    # | 
| 13 |  |  |  |  |  |  | # Adobe uses this segment to record information at the    # | 
| 14 |  |  |  |  |  |  | # time of compression such as whether or not the sample   # | 
| 15 |  |  |  |  |  |  | # values were blended and which color transform was       # | 
| 16 |  |  |  |  |  |  | # performed upon the data. The format is the following:   # | 
| 17 |  |  |  |  |  |  | #---------------------------------------------------------# | 
| 18 |  |  |  |  |  |  | #  5 bytes  "Adobe" as identifier (non null-terminated)   # | 
| 19 |  |  |  |  |  |  | #  2 bytes  DCTEncode/DCTDecode version number (0x65)     # | 
| 20 |  |  |  |  |  |  | #  2 bytes  flags0                                        # | 
| 21 |  |  |  |  |  |  | #  2 bytes  flags1                                        # | 
| 22 |  |  |  |  |  |  | #  1 byte   transform code                                # | 
| 23 |  |  |  |  |  |  | #=========================================================# | 
| 24 |  |  |  |  |  |  | # Ref: "Supporting the DCT Filters in PostScript Level 2",# | 
| 25 |  |  |  |  |  |  | #      Adobe Developer Support, Tech. note #5116, pag.27  # | 
| 26 |  |  |  |  |  |  | ########################################################### | 
| 27 |  |  |  |  |  |  | sub parse_app14 { | 
| 28 | 2 |  |  | 2 | 0 | 4 | my ($this) = @_; | 
| 29 | 2 |  |  |  |  | 3 | my $offset = 0; | 
| 30 |  |  |  |  |  |  | # exactly 12 bytes, or die | 
| 31 | 2 |  |  |  |  | 5 | $this->test_size(12); | 
| 32 |  |  |  |  |  |  | # they say that this segment always starts with a specific | 
| 33 |  |  |  |  |  |  | # string from Adobe, namely "Adobe". For the time being, | 
| 34 |  |  |  |  |  |  | # die if you find something else | 
| 35 | 2 |  |  |  |  | 6 | my $identifier = $this->store_record | 
| 36 |  |  |  |  |  |  | ('Identifier', $ASCII, $offset, 5)->get_value(); | 
| 37 | 2 | 50 |  |  |  | 7 | $this->die("Wrong identifier ($identifier)") | 
| 38 |  |  |  |  |  |  | if $identifier ne $APP14_PHOTOSHOP_IDENTIFIER; | 
| 39 |  |  |  |  |  |  | # the rest is trivial | 
| 40 | 2 |  |  |  |  | 5 | $this->store_record('DCT_TransfVersion' , $SHORT, $offset   ); | 
| 41 | 2 |  |  |  |  | 6 | $this->store_record('Flags0'            , $UNDEF, $offset, 2); | 
| 42 | 2 |  |  |  |  | 5 | $this->store_record('Flags1'            , $UNDEF, $offset, 2); | 
| 43 | 2 |  |  |  |  | 6 | $this->store_record('TransformationCode', $BYTE,  $offset   ); | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | # successful load | 
| 47 |  |  |  |  |  |  | 1; |