Blender V2.27

logImageCore.h

00001 /*
00002  *       Cineon image file format library definitions.
00003  *       Cineon and DPX common structures.
00004  *
00005  *       This header file contains private details.
00006  *       User code should generally use cineonlib.h and dpxlib.h only.
00007  *       Hmm. I thought the two formats would have more in common!
00008  *
00009  *       Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
00010  *
00011  *       This program is free software; you can redistribute it and/or modify it
00012  *       under the terms of the GNU General Public License as published by the Free
00013  *       Software Foundation; either version 2 of the License, or (at your option)
00014  *       any later version.
00015  *
00016  *       This program is distributed in the hope that it will be useful, but
00017  *       WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00018  *       or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
00019  *       for more details.
00020  *
00021  *       You should have received a copy of the GNU General Public License
00022  *       along with this program; if not, write to the Free Software
00023  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00024  *
00025  */
00026 
00027 #ifndef _LOG_IMAGE_CORE_H_
00028 #define _LOG_IMAGE_CORE_H_
00029 
00030 #include <stdio.h>
00031 #include "logImageLib.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #include "BLO_sys_types.h" // for intptr_t support
00038 #undef ntohl
00039 #undef htonl
00040 typedef int (GetRowFn)(LogImageFile* logImage, unsigned short* row, int lineNum);
00041 typedef int (SetRowFn)(LogImageFile* logImage, const unsigned short* row, int lineNum);
00042 typedef void (CloseFn)(LogImageFile* logImage);
00043 
00044 struct _Log_Image_File_t_
00045 {
00046         /* specified in header */
00047         int width;
00048         int height;
00049         int depth;
00050         int bitsPerPixel;
00051         int imageOffset;
00052 
00053         /* file buffer, measured in longwords (4 byte) */
00054         int lineBufferLength;
00055         unsigned int* lineBuffer;
00056 
00057         /* pixel buffer, holds 10 bit pixel values */
00058         unsigned short* pixelBuffer;
00059         int pixelBufferUsed;
00060 
00061         /* io stuff */
00062         FILE* file;
00063         int reading;
00064         int fileYPos;
00065 
00066         /* byte conversion stuff */
00067         LogImageByteConversionParameters params;
00068 #if 0
00069         float gamma;
00070         int blackPoint;
00071         int whitePoint;
00072 #endif
00073         unsigned char lut10[1024];
00074         unsigned short lut8[256];
00075 
00076         unsigned short lut10_16[1024];
00077         unsigned short lut16_16[65536];
00078 
00079         /* pixel access functions */
00080         GetRowFn* getRow;
00081         SetRowFn* setRow;
00082         CloseFn* close;
00083         
00084         unsigned char *membuffer;
00085         uintptr_t membuffersize;
00086         unsigned char *memcursor;
00087 };
00088 
00089 void setupLut(LogImageFile*);
00090 void setupLut16(LogImageFile*);
00091 
00092 int pixelsToLongs(int numPixels);
00093 
00094 /* typedefs used in original docs */
00095 /* note size assumptions! */
00096 
00097 typedef unsigned int U32;
00098 typedef unsigned short U16;
00099 typedef unsigned char U8;
00100 typedef signed int S32;
00101 typedef float R32;
00102 typedef char ASCII;
00103 
00104 R32 htonf(R32 f);
00105 R32 ntohf(R32 f);
00106 R32 undefined(void);
00107 U16 reverseU16(U16 value);
00108 U32 reverseU32(U32 value);
00109 R32 reverseR32(R32 value);
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif
00114 
00115 #endif /* _LOG_IMAGE_CORE_H_ */