Main Page | Modules | Class List | File List | Class Members | File Members

dpx_io.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_IMAGE_DPX_IO_H
00030 #define _GAN_IMAGE_DPX_IO_H
00031 
00032 #include <stdio.h>
00033 #include <gandalf/common/misc_defs.h>
00034 #include <gandalf/image/image_defs.h>
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00053 typedef enum Gan_DPXTransferCharacteristic
00054 {
00055     GAN_DPXTRANSFER_USER_DEFINED      =  0,
00056     GAN_DPXTRANSFER_PRINTING_DENSITY  =  1,
00057     GAN_DPXTRANSFER_LINEAR            =  2,
00058     GAN_DPXTRANSFER_LOGARITHMIC       =  3,
00059     GAN_DPXTRANSFER_UNSPECIFIED_VIDEO =  4,
00060     GAN_DPXTRANSFER_SMPTE240M         =  5,
00061     GAN_DPXTRANSFER_CCIR709_1         =  6,
00062     GAN_DPXTRANSFER_CCIR601_2BG       =  7,
00063     GAN_DPXTRANSFER_CCIR601_2M        =  8,
00064     GAN_DPXTRANSFER_NTSC              =  9,
00065     GAN_DPXTRANSFER_PAL               = 10,
00066     GAN_DPXTRANSFER_ZLINEAR           = 11,
00067     GAN_DPXTRANSFER_ZHOMOGENEOUS      = 12,
00068     GAN_DPXTRANSFER_DEFAULT
00069 } Gan_DPXTransferCharacteristic;
00070 
00074 typedef enum Gan_DPXColorimetricCharacteristics
00075 {
00076     GAN_DPXCOLORIMETRIC_USER_DEFINED      =  0,
00077     GAN_DPXCOLORIMETRIC_PRINTING_DENSITY  =  1,
00078     GAN_DPXCOLORIMETRIC_UNSPECIFIED_VIDEO =  4,
00079     GAN_DPXCOLORIMETRIC_SMPTE240M         =  5,
00080     GAN_DPXCOLORIMETRIC_CCIR709_1         =  6,
00081     GAN_DPXCOLORIMETRIC_CCIR601_2BG       =  7,
00082     GAN_DPXCOLORIMETRIC_CCIR601_2M        =  8,
00083     GAN_DPXCOLORIMETRIC_NTSC              =  9,
00084     GAN_DPXCOLORIMETRIC_PAL               = 10,
00085     GAN_DPXCOLORIMETRIC_DEFAULT
00086 } Gan_DPXColorimetricCharacteristics;
00087 
00089 typedef struct Gan_DPXGenericImageDataHeader
00090 {
00092    char version[8];
00093 
00095    gan_uint32 ditto_key;
00096 
00098    char file_name[100];
00099 
00101    char create_time[24];
00102 
00104    char creator[100];
00105 
00107    char project[200];
00108 
00110    char copyright[200];
00111 
00113    gan_uint32 encryption_key;
00114 } Gan_DPXGenericImageDataHeader;
00115 
00117 typedef struct Gan_DPXImageInfoHeader
00118 {
00120    Gan_Bool data_sign;
00121 
00123    gan_uint32 ref_low_data;
00124    
00126    gan_float32 ref_low_quantity;
00127    
00129    gan_uint32 ref_high_data;
00130    
00132    gan_float32 ref_high_quantity;
00133 
00135    gan_uint8 descriptor;
00136 
00138    Gan_DPXTransferCharacteristic transfer;
00139 
00141    Gan_DPXColorimetricCharacteristics colorimetric;
00142 
00144    unsigned int bit_size;
00145 
00147    Gan_Bool packed;
00148 
00150    gan_uint16 encoding;
00151 
00153    char description[32];
00154 } Gan_DPXImageInfoHeader;
00155 
00159 typedef struct Gan_DPXOrientationHeader
00160 {
00161    gan_uint32 x_offset, y_offset;
00162    gan_uint32 x_centre, y_centre;
00163    gan_uint32 x_orig_size, y_orig_size;
00164 
00166    char file_name[100];
00167 
00168    // source image creation date and time
00169    char creation_time[24];
00170 
00172    char input_dev[32];
00173 
00175    char input_serial[32];
00176 
00178    gan_uint16 border[4];
00179 
00181    gan_uint32 pixel_aspect[2];
00182 } Gan_DPXOrientationHeader;
00183 
00187 typedef struct Gan_DPXFilmHeader
00188 {
00190    char film_mfg_id[2];
00191 
00193    char film_type[2];
00194 
00196    char offset[2];
00197 
00199    char prefix[6];
00200 
00202    char count[4];
00203 
00205    char format[32];
00206 
00208    gan_uint32 frame_position;
00209 
00211    gan_uint32 sequence_len;
00212 
00214    gan_uint32 held_count;
00215 
00217    gan_float32 frame_rate;
00218 
00220    gan_float32 shutter_angle;
00221 
00223    char frame_id[32];
00224 
00226    char slate_info[100];
00227 } Gan_DPXFilmHeader;
00228 
00232 typedef struct Gan_DPXTVHeader
00233 {
00235    gan_uint8 field_num;
00236 
00238    gan_uint8 video_signal;
00239 
00241    gan_float32 hor_sample_rate;
00242 
00244    gan_float32 ver_sample_rate;
00245 
00247    gan_float32 frame_rate;
00248 
00250    gan_float32 time_offset;
00251 
00253    gan_float32 gamma;
00254 
00256    gan_float32 black_level;
00257 
00259    gan_float32 black_gain;
00260 
00262    gan_float32 break_point;
00263 
00265    gan_float32 white_level;
00266 
00268    gan_float32 integration_times;
00269 } Gan_DPXTVHeader;
00270 
00274 typedef struct Gan_DPXHeaderStruct
00275 {
00276    Gan_DPXGenericImageDataHeader generic;
00277    Gan_DPXImageInfoHeader        image_info;
00278    Gan_DPXOrientationHeader      orientation;
00279    Gan_DPXFilmHeader             film;
00280    Gan_DPXTVHeader               tv;
00281 } Gan_DPXHeaderStruct;
00282 
00283 /* functions exported so that Cineon I/O can use them */
00284  void vReverseEndianness32(gan_uint32* pui32Val);
00285  void vReverseEndianness16(gan_uint16* pui16Val);
00286  gan_uint32 ui32ReverseEndianness(gan_uint32 ui32Val);
00287  gan_uint16 ui16ReverseEndianness(gan_uint16 ui16Val);
00288  void vReverseEndiannessArray16(gan_uint16* aui16Val, unsigned int uiNumberOfVals);
00289  void vReverseEndiannessArray32(gan_uint32* aui32Val, unsigned int uiNumberOfVals);
00290  Gan_Image *pgiRead8BitDPXImageData(FILE* pfInFile,
00291                                                gan_uint32 ui32eolPadding, gan_uint32 ui32eoImagePadding,
00292                                                Gan_ImageFormat eFormat, Gan_Type eType,
00293                                                gan_uint32 ui32PixelsPerLine, gan_uint32 ui32LinesPerImageEle,
00294                                                Gan_Image* pgiImage, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00295  Gan_Image *pgiRead10BitDPXImageData(FILE* pfInFile, Gan_Bool bReversedEndianness, Gan_Bool bPacked,
00296                                                 gan_uint32 ui32eolPadding, gan_uint32 ui32eoImagePadding,
00297                                                 Gan_ImageFormat eFormat, Gan_Type eType,
00298                                                 gan_uint32 ui32PixelsPerLine, gan_uint32 ui32LinesPerImageEle,
00299                                                 Gan_Image* pgiImage, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00300  Gan_Image *pgiRead12BitDPXImageData(FILE* pfInFile, Gan_Bool bReversedEndianness, Gan_Bool bPacked,
00301                                                 gan_uint32 ui32eolPadding, gan_uint32 ui32eoImagePadding,
00302                                                 Gan_ImageFormat eFormat, Gan_Type eType,
00303                                                 gan_uint32 ui32PixelsPerLine, gan_uint32 ui32LinesPerImageEle,
00304                                                 Gan_Image* pgiImage, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00305  Gan_Image *pgiRead16BitDPXImageData(FILE* pfInFile, Gan_Bool bReversedEndianness,
00306                                                 gan_uint32 ui32eolPadding, gan_uint32 ui32eoImagePadding,
00307                                                 Gan_ImageFormat eFormat, Gan_Type eType,
00308                                                 gan_uint32 ui32PixelsPerLine, gan_uint32 ui32LinesPerImageEle,
00309                                                 Gan_Image* pgiImage, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00310  Gan_Image *pgiRead32BitFloatDPXImageData(FILE* pfInFile, Gan_Bool bReversedEndianness,
00311                                                      gan_uint32 ui32eolPadding, gan_uint32 ui32eoImagePadding,
00312                                                      Gan_ImageFormat eFormat, Gan_Type eType,
00313                                                      gan_uint32 ui32PixelsPerLine, gan_uint32 ui32LinesPerImageEle,
00314                                                      Gan_Image* pgiImage, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00315  gan_uint32 ui32DPXFileSize(unsigned int uiImageDataOffset,
00316                            Gan_ImageFormat eFormat, gan_uint8 ui8BitSize, Gan_Bool bPacked, unsigned int uiHeight, unsigned int uiWidth,
00317                            gan_uint32* pui32eolPadding);
00318  Gan_Bool bWrite8BitDPXImageData(FILE* pfOutFile, const Gan_Image* pgiImage, Gan_Bool bNewFile, unsigned int uieolPadding,
00319                                             Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00320  Gan_Bool bWrite10BitDPXImageData(FILE* pfOutFile, const Gan_Image* pgiImage, Gan_Bool bNewFile, Gan_Bool bReverseBytes, unsigned int uieolPadding,
00321                                              Gan_Bool bPacked, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00322  Gan_Bool bWrite12BitDPXImageData(FILE* pfOutFile, const Gan_Image* pgiImage, Gan_Bool bNewFile, Gan_Bool bReverseBytes, unsigned int uieolPadding,
00323                                              Gan_Bool bPacked, Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00324  Gan_Bool bWrite16BitDPXImageData(FILE* pfOutFile, const Gan_Image* pgiImage, Gan_Bool bNewFile, Gan_Bool bReverseBytes, unsigned int uieolPadding,
00325                                              Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00326  Gan_Bool bWrite32BitFloatDPXImageData(FILE* pfOutFile, const Gan_Image* pgiImage, Gan_Bool bNewFile, Gan_Bool bReverseBytes, unsigned int uieolPadding,
00327                                                   Gan_Bool bFlip, Gan_Bool bSingleField, Gan_Bool bUpper, Gan_Bool bWholeImage);
00328 
00329 /* forward declaration */
00330 struct Gan_ImageReadControlStruct;
00331 struct Gan_ImageHeaderStruct;
00332 struct Gan_ImageWriteControlStruct;
00333 
00334 /* Prototypes for public functions in dpx_io.c */
00335  Gan_Bool gan_image_is_dpx(const unsigned char *magic_string, size_t length);
00336  Gan_Image *gan_read_dpx_image_stream ( FILE *infile, Gan_Image *image,
00337                                                    const struct Gan_ImageReadControlStruct *ictrlstr, struct Gan_ImageHeaderStruct *header );
00338  Gan_Image *gan_read_dpx_image ( const char *filename, Gan_Image *image,
00339                                             const struct Gan_ImageReadControlStruct *ictrlstr, struct Gan_ImageHeaderStruct *header );
00340  void       gan_initialise_dpx_header_struct(Gan_DPXHeaderStruct *octrlstr, Gan_ImageFormat image_format, Gan_Type type);
00341  Gan_Bool   gan_write_dpx_image_stream ( FILE *outfile, const Gan_Image *image, Gan_Bool new_file, const struct Gan_ImageWriteControlStruct *octrlstr );
00342  Gan_Bool   gan_write_dpx_image ( const char *filename, const Gan_Image *image, const struct Gan_ImageWriteControlStruct *octrlstr );
00343 
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355 
00356 #endif /* #ifndef _GAN_IMAGE_DPX_IO_H */

Generated on Fri Mar 17 12:44:47 2006 by  doxygen 1.3.9.1