1 /* 2 * This program is free software; you can redistribute it and/or modify it 3 * under the terms of the GNU General Public License as published by the Free 4 * Software Foundation; either version 2 of the License, or (at your option) 5 * any later version. 6 * 7 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10 * for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * Copyright 1999 - 2002 David Hodson <hodsond@acm.org> 17 */ 18 19 /** \file 20 * \ingroup imbcineon 21 * 22 * DPX image file format library definitions. 23 */ 24 25 #pragma once 26 27 #include "logImageCore.h" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #define DPX_FILE_MAGIC 0x53445058 34 #define DPX_UNDEFINED_U8 0xFF 35 #define DPX_UNDEFINED_U16 0xFFFF 36 #define DPX_UNDEFINED_U32 0xFFFFFFFF 37 #define DPX_UNDEFINED_R32 0xFFFFFFFF 38 #define DPX_UNDEFINED_CHAR 0 39 40 typedef struct { 41 unsigned int magic_num; 42 unsigned int offset; 43 char version[8]; 44 unsigned int file_size; 45 unsigned int ditto_key; 46 unsigned int gen_hdr_size; 47 unsigned int ind_hdr_size; 48 unsigned int user_data_size; 49 char file_name[100]; 50 char creation_date[24]; 51 char creator[100]; 52 char project[200]; 53 char copyright[200]; 54 unsigned int key; 55 char reserved[104]; 56 } DpxFileHeader; 57 58 typedef struct { 59 unsigned int data_sign; 60 unsigned int ref_low_data; 61 float ref_low_quantity; 62 unsigned int ref_high_data; 63 float ref_high_quantity; 64 unsigned char descriptor; 65 unsigned char transfer; 66 unsigned char colorimetric; 67 unsigned char bits_per_sample; 68 unsigned short packing; 69 unsigned short encoding; 70 unsigned int data_offset; 71 unsigned int line_padding; 72 unsigned int element_padding; 73 char description[32]; 74 } DpxElementHeader; 75 76 typedef struct { 77 unsigned short orientation; 78 unsigned short elements_per_image; 79 unsigned int pixels_per_line; 80 unsigned int lines_per_element; 81 DpxElementHeader element[8]; 82 char reserved[52]; 83 } DpxImageHeader; 84 85 typedef struct { 86 unsigned int x_offset; 87 unsigned int y_offset; 88 float x_center; 89 float y_center; 90 unsigned int x_original_size; 91 unsigned int y_original_size; 92 char file_name[100]; 93 char creation_time[24]; 94 char input_device[32]; 95 char input_serial_number[32]; 96 unsigned short border_validity[4]; 97 unsigned int pixel_aspect_ratio[2]; 98 char reserved[28]; 99 } DpxOrientationHeader; 100 101 typedef struct { 102 char film_manufacturer_id[2]; 103 char film_type[2]; 104 char edge_code_perforation_offset[2]; 105 char edge_code_prefix[6]; 106 char edge_code_count[4]; 107 char film_format[32]; 108 unsigned int frame_position; 109 unsigned int sequence_length; 110 unsigned int held_count; 111 float frame_rate; 112 float shutter_angle; 113 char frame_identification[32]; 114 char slate_info[100]; 115 char reserved[56]; 116 } DpxFilmHeader; 117 118 typedef struct { 119 unsigned int time_code; 120 unsigned int user_bits; 121 unsigned char interlace; 122 unsigned char field_number; 123 unsigned char video_signal; 124 unsigned char padding; 125 float horizontal_sample_rate; 126 float vertical_sample_rate; 127 float frame_rate; 128 float time_offset; 129 float gamma; 130 float black_level; 131 float black_gain; 132 float breakpoint; 133 float white_level; 134 float integration_times; 135 unsigned char reserved[76]; 136 } DpxTelevisionHeader; 137 138 typedef struct { 139 DpxFileHeader fileHeader; 140 DpxImageHeader imageHeader; 141 DpxOrientationHeader orientationHeader; 142 DpxFilmHeader filmHeader; 143 DpxTelevisionHeader televisionHeader; 144 } DpxMainHeader; 145 146 void dpxSetVerbose(int verbosity); 147 LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize); 148 LogImageFile *dpxCreate(const char *filename, 149 int width, 150 int height, 151 int bitsPerSample, 152 int hasAlpha, 153 int isLogarithmic, 154 int referenceWhite, 155 int referenceBlack, 156 float gamma, 157 const char *creator); 158 159 #ifdef __cplusplus 160 } 161 #endif 162