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