Blender V2.27

logImageLib.h

00001 /*
00002  *       Common library definitions for Cineon and DPX image files.
00003  *
00004  *       Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
00005  *
00006  *       This program is free software; you can redistribute it and/or modify it
00007  *       under the terms of the GNU General Public License as published by the Free
00008  *       Software Foundation; either version 2 of the License, or (at your option)
00009  *       any later version.
00010  *
00011  *       This program is distributed in the hope that it will be useful, but
00012  *       WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013  *       or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
00014  *       for more details.
00015  *
00016  *       You should have received a copy of the GNU General Public License
00017  *       along with this program; if not, write to the Free Software
00018  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  */
00021 
00022 #ifndef _LOG_IMAGE_LIB_H_
00023 #define _LOG_IMAGE_LIB_H_
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /*
00030  * Image structure. You don't care what this is.
00031  */
00032 
00033 typedef struct _Log_Image_File_t_ LogImageFile;
00034 
00035 /*
00036  * Magic numbers for normal and byte-swapped Cineon and Dpx files
00037  */
00038 
00039 #define CINEON_FILE_MAGIC 0x802A5FD7
00040 #define DPX_FILE_MAGIC 0x53445058
00041 
00042 /*
00043  * Image 8 bit <-> 10 bit conversion parameters.
00044  */
00045 
00046 typedef struct {
00047         float gamma;
00048         int blackPoint;
00049         int whitePoint;
00050         int doLogarithm;
00051 } LogImageByteConversionParameters;
00052 
00053 /* int functions return 0 for OK */
00054 
00055 void logImageSetVerbose(int);
00056 
00057 LogImageFile* logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon);
00058 LogImageFile* logImageOpen(const char* filename, int cineon);
00059 int logImageGetSize(const LogImageFile* logImage, int* xsize, int* ysize, int* channels);
00060 LogImageFile* logImageCreate(const char* filename, int cineon, int xsize, int ysize, int channels);
00061 
00062 /* get / set header block NYI */
00063 int logImageGetHeader(LogImageFile*, int*, void**);
00064 int logImageSetHeader(LogImageFile*, int, void*);
00065 
00066 /* byte conversion routines for mapping logImage (usually) 10 bit values to 8 bit */
00067 /* see Kodak docs for details... */
00068 
00069 int logImageGetByteConversionDefaults(LogImageByteConversionParameters* params);
00070 int logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params);
00071 int logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params);
00072 
00073 /* get/set scanline of converted bytes */
00074 int logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y);
00075 int logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y);
00076 
00077 /* closes file and deletes data */
00078 void logImageClose(LogImageFile* logImage);
00079 
00080 /* read file and dump header info */
00081 void logImageDump(const char* filename);
00082 
00083 #ifdef __cplusplus
00084 }
00085 #endif
00086 
00087 #endif /* _LOG_IMAGE_LIB_H_ */