Home | History | Annotate | Download | only in qexif
      1 /*Copyright (c) 2015, The Linux Foundation. All rights reserved.
      2 
      3 Redistribution and use in source and binary forms, with or without
      4 modification, are permitted provided that the following conditions are
      5 met:
      6     * Redistributions of source code must retain the above copyright
      7       notice, this list of conditions and the following disclaimer.
      8     * Redistributions in binary form must reproduce the above
      9       copyright notice, this list of conditions and the following
     10       disclaimer in the documentation and/or other materials provided
     11       with the distribution.
     12     * Neither the name of The Linux Foundation nor the names of its
     13       contributors may be used to endorse or promote products derived
     14       from this software without specific prior written permission.
     15 
     16 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     17 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     19 ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     25 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     26 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
     27 
     28 #ifndef __QMPO_H__
     29 #define __QMPO_H__
     30 
     31 #include <stdio.h>
     32 #include <qexif.h>
     33 
     34 //Length of MPO header fields
     35 #define MP_APP2_FIELD_LENGTH_BYTES 2
     36 #define MP_FORMAT_IDENTIFIER_BYTES 4
     37 #define MP_ENDIAN_BYTES 4
     38 #define MP_HEADER_OFFSET_TO_FIRST_IFD_BYTES 4
     39 #define MP_INDEX_COUNT_BYTES 2
     40 #define MP_INDEX_VERSION_BYTES 12
     41 #define MP_INDEX_NUMBER_OF_IMAGES_BYTES 12
     42 #define MP_INDEX_ENTRY_BYTES 12
     43 #define MP_INDEX_IMAGE_UNIQUE_ID_LIST_BYTES 12
     44 #define MP_INDEX_TOTAL_CAPURED_FRAMES 12
     45 #define MP_INDEX_OFFSET_OF_NEXT_IFD_BYTES 4
     46 #define MP_INDEX_ENTRY_VALUE_BYTES 16
     47 #define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_ATTRIBUTE_BYTES 4
     48 #define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_SIZE_BYTES 4
     49 #define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_DATA_OFFSET_BYTES 4
     50 #define MP_ATTRIBUTE_COUNT_BYTES 2
     51 #define MP_ATTRIBUTE_OFFSET_OF_NEXT_IFD_BYTES 4
     52 #define MP_TAG_BYTES 12
     53 #define MP_INDIVIDUAL_IMAGE_ID_BYTES 33
     54 #define MP_INDEX_IFD_START 2
     55 
     56 #define MPO_BIG_ENDIAN 0x4D4D002A
     57 #define MPO_LITTLE_ENDIAN 0x49492A00
     58 
     59 /* MPO Dependent Type */
     60 typedef enum
     61 {
     62    NON_DEPENDENT_IMAGE    = 0x00000000,   // Non dependent image
     63    DEPENDENT_CHILD_IMAGE  = 0x40000000,   // Dependent child image flag
     64    DEPENDENT_PARENT_IMAGE = 0x80000000,   // Dependent parent image flag
     65    DEPENDENT_MASK         = 0xc0000000,   // Dependent mask
     66    DEPENDENT_MAX,
     67 } qmpo_dependent_t;
     68 
     69 /* MPO Representative Type */
     70 typedef enum
     71 {
     72   NOT_REPRESENTATIVE_IMAGE = 0x00000000,   // Not a representative image
     73   REPRESENTATIVE_IMAGE     = 0x20000000,   // Representative image flag
     74   REPRESENTATIVE_MASK      = 0x20000000,   // Representative mask
     75   REPRESENTATIVE_MAX,
     76 } qmpo_representative_t;
     77 
     78 /* MPO Image Data Format Type */
     79 typedef enum
     80 {
     81   JPEG                   = 0x00000000,   // Image is in JPEG format
     82   NON_JPEG               = 0x07000000,   // Image is not JPEG
     83   IMAGE_DATA_FORMAT_MASK = 0x07000000,   // Image mask
     84   IMAGE_DATA_FORMAT_MAX,
     85 } qmpo_image_data_format_t;
     86 
     87 /* MPO Type */
     88 typedef enum
     89 {
     90   UNDEFINED              = 0x00000000,   // MP types undefined
     91   LARGE_TN_CLASS_1       = 0x00010001,   // Large thumbnail class 1 image
     92   LARGE_TN_CLASS_2       = 0x00010002,   // Large thumbnail class 2 image
     93   MULTI_VIEW_PANORAMA    = 0x00020001,   // Multi-view Panorama image
     94   MULTI_VIEW_DISPARITY   = 0x00020002,   // Multi-view Disparity image
     95   MULTI_VIEW_MULTI_ANGLE = 0x00020003,   // Multi-view Multi-angle image
     96   BASELINE_PRIMARY       = 0x00030000,   // Baseline MP Primary image
     97   TYPE_MASK              = 0x00ffffff,   // Type mask
     98   TYPE_MAX,
     99 } qmpo_type_t;
    100 
    101 // MP Format Version
    102 // Use MPOTAGTYPE_MP_F_VERSION as the exif_tag_type (EXIF_UNDEFINED)
    103 // Count should be 4
    104 #define _ID_MP_F_VERSION_FIRST           0xb000
    105 #define MPOTAGID_MP_F_VERSION_FIRST      CONSTRUCT_TAGID(MP_F_VERSION_FIRST, _ID_MP_F_VERSION_FIRST)
    106 #define MPOTAGTYPE_MP_F_VERSION_FIRST    EXIF_UNDEFINED
    107 
    108 // Number of Images
    109 // Use MPOTAGTYPE_NUMBER_OF_IMAGES as the exif_tag_type (EXIF_LONG)
    110 // Count should be 1
    111 #define _ID_NUMBER_OF_IMAGES             0xb001
    112 #define MPOTAGID_NUMBER_OF_IMAGES        CONSTRUCT_TAGID(NUMBER_OF_IMAGES, _ID_NUMBER_OF_IMAGES)
    113 #define MPOTAGTYPE_NUMBER_OF_IMAGES      EXIF_LONG
    114 
    115 // MP Entry
    116 // Use MPOTAGTYPE_MP_ENTRY as the exif_tag_type (EXIF_UNDEFINED)
    117 // Count should be 16 x NumberOfImages
    118 #define _ID_MP_ENTRY                     0xb002
    119 #define MPOTAGID_MP_ENTRY                CONSTRUCT_TAGID(MP_ENTRY, _ID_MP_ENTRY)
    120 #define MPOTAGTYPE_MP_ENTRY              EXIF_UNDEFINED
    121 
    122 // Individual Image Unique ID List
    123 // Use MPOTAGTYPE_IMAGE_UID_LIST as the exif_tag_type (EXIF_UNDEFINED)
    124 // Count should be 33 x NumberOfImages
    125 #define _ID_IMAGE_UID_LIST               0xb003
    126 #define MPOTAGID_IMAGE_UID_LIST          CONSTRUCT_TAGID(IMAGE_UID_LIST, _ID_IMAGE_UID_LIST)
    127 #define MPOTAGTYPE_IMAGE_UID_LIST        EXIF_UNDEFINED
    128 
    129 // Total Number of Camptured Frames
    130 // Use MPOTAGTYPE_TOTAL_FRAMES as the exif_tag_type (EXIF_LONG)
    131 // Count should be 1
    132 #define _ID_TOTAL_FRAMES                 0xb004
    133 #define MPOTAGID_TOTAL_FRAMES            CONSTRUCT_TAGID(TOTAL_FRAMES, _ID_TOTAL_FRAMES)
    134 #define MPOTAGTYPE_TOTAL_FRAMES          EXIF_LONG
    135 
    136 // MP Format Version
    137 // Use MPOTAGTYPE_MP_F_VERSION as the exif_tag_type (EXIF_UNDEFINED)
    138 // Count should be 4
    139 #define _ID_MP_F_VERSION                 0xb000
    140 #define MPOTAGID_MP_F_VERSION            CONSTRUCT_TAGID(MP_F_VERSION, _ID_MP_F_VERSION)
    141 #define MPOTAGTYPE_MP_F_VERSION          EXIF_UNDEFINED
    142 
    143 // MP Individual Image Number
    144 // Use MPOTAGTYPE_MP_INDIVIDUAL_NUM as the exif_tag_type (EXIF_LONG)
    145 // Count should be 1
    146 #define _ID_MP_INDIVIDUAL_NUM            0xb101
    147 #define MPOTAGID_MP_INDIVIDUAL_NUM       CONSTRUCT_TAGID(MP_INDIVIDUAL_NUM, _ID_MP_INDIVIDUAL_NUM)
    148 #define MPOTAGTYPE_MP_INDIVIDUAL_NUM     EXIF_LONG
    149 
    150 #endif
    151