Blender V2.61 - r43446

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 
00042 #ifdef _MSC_VER
00043 #undef ntohl
00044 #undef htonl
00045 #endif
00046 
00047 typedef int (GetRowFn)(LogImageFile* logImage, unsigned short* row, int lineNum);
00048 typedef int (SetRowFn)(LogImageFile* logImage, const unsigned short* row, int lineNum);
00049 typedef void (CloseFn)(LogImageFile* logImage);
00050 
00051 struct _Log_Image_File_t_
00052 {
00053     /* specified in header */
00054     int width;
00055     int height;
00056     int depth;
00057     int bitsPerPixel;
00058     int imageOffset;
00059 
00060     /* file buffer, measured in longwords (4 byte) */
00061     int lineBufferLength;
00062     unsigned int* lineBuffer;
00063 
00064     /* pixel buffer, holds 10 bit pixel values */
00065     unsigned short* pixelBuffer;
00066     int pixelBufferUsed;
00067 
00068     /* io stuff */
00069     FILE* file;
00070     int reading;
00071     int fileYPos;
00072 
00073     /* byte conversion stuff */
00074     LogImageByteConversionParameters params;
00075 #if 0
00076     float gamma;
00077     int blackPoint;
00078     int whitePoint;
00079 #endif
00080     unsigned char lut10[1024];
00081     unsigned short lut8[256];
00082 
00083     unsigned short lut10_16[1024];
00084     unsigned short lut16_16[65536];
00085 
00086     /* pixel access functions */
00087     GetRowFn* getRow;
00088     SetRowFn* setRow;
00089     CloseFn* close;
00090     
00091     unsigned char *membuffer;
00092     uintptr_t membuffersize;
00093     unsigned char *memcursor;
00094 };
00095 
00096 void setupLut(LogImageFile*);
00097 void setupLut16(LogImageFile*);
00098 
00099 int pixelsToLongs(int numPixels);
00100 
00101 /* typedefs used in original docs */
00102 /* note size assumptions! */
00103 
00104 typedef unsigned int U32;
00105 typedef unsigned short U16;
00106 typedef unsigned char U8;
00107 typedef signed int S32;
00108 typedef float R32;
00109 typedef char ASCII;
00110 
00111 R32 htonf(R32 f);
00112 R32 ntohf(R32 f);
00113 R32 undefined(void);
00114 U16 reverseU16(U16 value);
00115 U32 reverseU32(U32 value);
00116 R32 reverseR32(R32 value);
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 
00122 #endif /* _LOG_IMAGE_CORE_H_ */