gif_read.h

来自「ucOS 模拟环境」· C头文件 代码 · 共 94 行

H
94
字号
#ifndef _GIFREAD_H_
#define _GIFREAD_H_
#include "gif_interface.h"
#include "typedef.h"
#include "gif_include.h"
#define BYTEOFRGB 4
#define	MAXCOLORMAPSIZE	256	/* max # of colors in a GIF colormap */
#define NUMCOLORS	3	/* # of colors */
#define CM_RED		0	/* color component numbers */
#define CM_GREEN	1
#define CM_BLUE		2

#define RGB_RED		0	/* Offset of Red in an RGB scanline element */
#define RGB_GREEN	1	/* Offset of Green */
#define RGB_BLUE	2	/* Offset of Blue */
#define RGB_PIXELSIZE	3	/* JSAMPLEs per RGB scanline element */
#define MAXPELWIDTH     4096
#define MAXPELHEIGHT	4096
#define MAXWIDTH		1024
#define MAXHEIGHT		1024	



//now define  GrayScale
#define   ONE_BIT_COLOR 1
#define   TWO_BIT_COLOR 2
#define   THREE_BIT_COLOR 3
#define   FOUR_BIT_COLOR 4
#define   EIGHT_BIT_COLOR 8
#define   SIXTEEN_BIT_COLOR 16
#define   TWENTY_FOUR_BIT_COLOR 24




/* colormap[i][j] = value of i'th color component for pixel value j */

#define	MAX_LZW_BITS	12	/* maximum LZW code size */
#define LZW_TABLE_SIZE	(1<<MAX_LZW_BITS) /* # of possible LZW symbols */

/* Macros for extracting header data --- note we assume chars may be signed */

#define LM_to_uint(a,b)		((((b)&0xFF) << 8) | ((a)&0xFF))


#define INTERLACE	0x40	/* mask for bit signifying interlaced image */
#define COLORMAPFLAG	0x80	/* mask for bit signifying colormap presence */
#define BitSet(byte, bit)	((byte) & (bit))
#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))

#define		IMAGE_GEOMETRY_NEAREST_NEIGHBOR_INTERPOLATE	0X00050100
#define		IMAGE_GEOMETRY_BILINEAR_INTERPOLATE			0X00050101
#define		IMAGE_GEOMETRY_THREE_ORDER_INTERPOLATE		0X00050102
#define		IMAGE_GEOMETRY_NO_INTERPOLATE		0X00050103
#define		IMAGE_GEOMETRY_INTERPOLATE			IMAGE_GEOMETRY_NO_INTERPOLATE	


void StrechPixels(int S_size, int D_size, int* select  );
Bool  colortoGrayScale(uchar* SrcBuffer, uchar* DestBuffer,  uchar ucScale);
Bool readFromBuffer(int len, uchar* DestBuffer);
int ReadByte (void );
int GetDataBlock (char *buf);
Bool skipFrame();
void SkipDataBlocks (void);
Bool half_find(int* arr, int len, int value);
Bool input_init (GIFParameter *ucGifParameter);
void load_interlaced_image (decompress_info_ptr cinfo, char* pixel_row );
void get_input_row (decompress_info_ptr cinfo, char* pixel_row,int cur_col);
void get_interlaced_row (decompress_info_ptr cinfo, char* pixel_row,uchar* buf);
Bool InitWorkingBuf(GIFParameter* ucGifParameter); 
int  LZWReadByte (decompress_info_ptr cinfo);

Bool Gif_Scale(uchar* lpbyBitsSrc32, int nScanWidth,  int nScanHeight, uchar* lpbyBitsDst32, int nWidthImgDst, int nHeightImgDst,ulong ScaleType);
uchar**  gif_alloc_memr(ulong width, ulong height);//
uchar* gif_alloc_buf(ulong MemorySize);//malloc memory return pointer
Bool	init_gif_color_space(GIFParameter* ucGifParameter);//initialize color space */


int	get_real_height_index(int height,int code,int* record);

//for smooth
void smooth (decompress_info_ptr cinfo, uchar* input_data, uchar* output_data_ptr);
 void smooth_guess (decompress_info_ptr cinfo, uchar* input_data, uchar* output_data_ptr);
#ifdef PCVER 
		void WriteToErrorFile(const char* ErrorFunc,ulong ErrorCode,  void * f);
		void  openErrorFile();
		void  closeFile();

#endif
		Bool SetBufferCur(ulong ulPointer);
		ulong GetDataBufferCur(void);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?