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