13d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/*Copyright (c) 2015, The Linux Foundation. All rights reserved. 23d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 33d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelRedistribution and use in source and binary forms, with or without 43d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelmodification, are permitted provided that the following conditions are 53d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelmet: 63d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * Redistributions of source code must retain the above copyright 73d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel notice, this list of conditions and the following disclaimer. 83d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * Redistributions in binary form must reproduce the above 93d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel copyright notice, this list of conditions and the following 103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel disclaimer in the documentation and/or other materials provided 113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel with the distribution. 123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * Neither the name of The Linux Foundation nor the names of its 133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel contributors may be used to endorse or promote products derived 143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel from this software without specific prior written permission. 153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 163d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelTHIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 173d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 183d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 193d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 203d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 213d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 223d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 233d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 243d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 253d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 263d63919a23d7e7954e160c48c36713267106c3c2Thierry StrudelIF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ 273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifndef __QMPO_H__ 293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define __QMPO_H__ 303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include <stdio.h> 323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include <qexif.h> 333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel//Length of MPO header fields 353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_APP2_FIELD_LENGTH_BYTES 2 363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_FORMAT_IDENTIFIER_BYTES 4 373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_ENDIAN_BYTES 4 383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_HEADER_OFFSET_TO_FIRST_IFD_BYTES 4 393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_COUNT_BYTES 2 403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_VERSION_BYTES 12 413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_NUMBER_OF_IMAGES_BYTES 12 423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_ENTRY_BYTES 12 433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_IMAGE_UNIQUE_ID_LIST_BYTES 12 443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_TOTAL_CAPURED_FRAMES 12 453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_OFFSET_OF_NEXT_IFD_BYTES 4 463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_ENTRY_VALUE_BYTES 16 473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_ATTRIBUTE_BYTES 4 483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_SIZE_BYTES 4 493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_ENTRY_INDIVIDUAL_IMAGE_DATA_OFFSET_BYTES 4 503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_ATTRIBUTE_COUNT_BYTES 2 513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_ATTRIBUTE_OFFSET_OF_NEXT_IFD_BYTES 4 523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_TAG_BYTES 12 533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDIVIDUAL_IMAGE_ID_BYTES 33 543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MP_INDEX_IFD_START 2 553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPO_BIG_ENDIAN 0x4D4D002A 573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPO_LITTLE_ENDIAN 0x49492A00 583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* MPO Dependent Type */ 603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum 613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{ 623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel NON_DEPENDENT_IMAGE = 0x00000000, // Non dependent image 633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel DEPENDENT_CHILD_IMAGE = 0x40000000, // Dependent child image flag 643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel DEPENDENT_PARENT_IMAGE = 0x80000000, // Dependent parent image flag 653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel DEPENDENT_MASK = 0xc0000000, // Dependent mask 663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel DEPENDENT_MAX, 673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qmpo_dependent_t; 683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* MPO Representative Type */ 703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum 713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{ 723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel NOT_REPRESENTATIVE_IMAGE = 0x00000000, // Not a representative image 733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel REPRESENTATIVE_IMAGE = 0x20000000, // Representative image flag 743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel REPRESENTATIVE_MASK = 0x20000000, // Representative mask 753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel REPRESENTATIVE_MAX, 763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qmpo_representative_t; 773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* MPO Image Data Format Type */ 793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum 803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{ 813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel JPEG = 0x00000000, // Image is in JPEG format 823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel NON_JPEG = 0x07000000, // Image is not JPEG 833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel IMAGE_DATA_FORMAT_MASK = 0x07000000, // Image mask 843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel IMAGE_DATA_FORMAT_MAX, 853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qmpo_image_data_format_t; 863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* MPO Type */ 883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum 893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{ 903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel UNDEFINED = 0x00000000, // MP types undefined 913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel LARGE_TN_CLASS_1 = 0x00010001, // Large thumbnail class 1 image 923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel LARGE_TN_CLASS_2 = 0x00010002, // Large thumbnail class 2 image 933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel MULTI_VIEW_PANORAMA = 0x00020001, // Multi-view Panorama image 943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel MULTI_VIEW_DISPARITY = 0x00020002, // Multi-view Disparity image 953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel MULTI_VIEW_MULTI_ANGLE = 0x00020003, // Multi-view Multi-angle image 963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel BASELINE_PRIMARY = 0x00030000, // Baseline MP Primary image 973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel TYPE_MASK = 0x00ffffff, // Type mask 983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel TYPE_MAX, 993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qmpo_type_t; 1003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// MP Format Version 1023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_MP_F_VERSION as the exif_tag_type (EXIF_UNDEFINED) 1033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 4 1043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_MP_F_VERSION_FIRST 0xb000 1053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_MP_F_VERSION_FIRST CONSTRUCT_TAGID(MP_F_VERSION_FIRST, _ID_MP_F_VERSION_FIRST) 1063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_MP_F_VERSION_FIRST EXIF_UNDEFINED 1073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Number of Images 1093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_NUMBER_OF_IMAGES as the exif_tag_type (EXIF_LONG) 1103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 1 1113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_NUMBER_OF_IMAGES 0xb001 1123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_NUMBER_OF_IMAGES CONSTRUCT_TAGID(NUMBER_OF_IMAGES, _ID_NUMBER_OF_IMAGES) 1133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_NUMBER_OF_IMAGES EXIF_LONG 1143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// MP Entry 1163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_MP_ENTRY as the exif_tag_type (EXIF_UNDEFINED) 1173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 16 x NumberOfImages 1183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_MP_ENTRY 0xb002 1193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_MP_ENTRY CONSTRUCT_TAGID(MP_ENTRY, _ID_MP_ENTRY) 1203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_MP_ENTRY EXIF_UNDEFINED 1213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Individual Image Unique ID List 1233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_IMAGE_UID_LIST as the exif_tag_type (EXIF_UNDEFINED) 1243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 33 x NumberOfImages 1253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_IMAGE_UID_LIST 0xb003 1263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_IMAGE_UID_LIST CONSTRUCT_TAGID(IMAGE_UID_LIST, _ID_IMAGE_UID_LIST) 1273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_IMAGE_UID_LIST EXIF_UNDEFINED 1283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Total Number of Camptured Frames 1303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_TOTAL_FRAMES as the exif_tag_type (EXIF_LONG) 1313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 1 1323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_TOTAL_FRAMES 0xb004 1333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_TOTAL_FRAMES CONSTRUCT_TAGID(TOTAL_FRAMES, _ID_TOTAL_FRAMES) 1343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_TOTAL_FRAMES EXIF_LONG 1353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// MP Format Version 1373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_MP_F_VERSION as the exif_tag_type (EXIF_UNDEFINED) 1383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 4 1393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_MP_F_VERSION 0xb000 1403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_MP_F_VERSION CONSTRUCT_TAGID(MP_F_VERSION, _ID_MP_F_VERSION) 1413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_MP_F_VERSION EXIF_UNDEFINED 1423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// MP Individual Image Number 1443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Use MPOTAGTYPE_MP_INDIVIDUAL_NUM as the exif_tag_type (EXIF_LONG) 1453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Count should be 1 1463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define _ID_MP_INDIVIDUAL_NUM 0xb101 1473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGID_MP_INDIVIDUAL_NUM CONSTRUCT_TAGID(MP_INDIVIDUAL_NUM, _ID_MP_INDIVIDUAL_NUM) 1483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MPOTAGTYPE_MP_INDIVIDUAL_NUM EXIF_LONG 1493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel 1503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif 151