commondecls.h

来自「常好且全面的jpeg图像压缩算法」· C头文件 代码 · 共 79 行

H
79
字号
#include <stdio.h>#include <stddef.h>#include  <stdlib.h>#define SIZEOF(object)  ((size_t) sizeof(object))typedef unsigned char JSAMPLE;typedef JSAMPLE  *JSAMPROW;  /* ptr to one image row of pixel samples. */typedef JSAMPROW *JSAMPARRAY;   /* ptr to some rows (a 2-D sample array) */typedef long INT32;/* Datatype used for image dimensions.  The JPEG standard only supports * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore * "unsigned int" is sufficient on all machines.  However, if you need to * handle larger images and you don't mind deviating from the spec, you * can change this datatype. */typedef unsigned int JDIMENSION; /*usigned int is 32 bits*/typedef unsigned char UINT8;/* UINT16 must hold at least the values 0..65535. */typedef unsigned short UINT16;typedef unsigned char U_CHAR;#define UCH(x)	((int) (x))#define JFREAD(file,buf,sizeofbuf)  \  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))#define JFWRITE(file,buf,sizeofbuf)  \  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))#define WriteOK(file,buffer,len) (JFWRITE(file,buffer,len)==((size_t) (len)))#define LOCAL(type) static type/* Private version of data source object */typedef struct _bmp_source_struct * bmp_source_ptr;typedef struct _bmp_destination_struct * bmp_destination_ptr;typedef struct _bmp_source_struct {    FILE *inputfile;              /*source file pointer*/  JSAMPROW buffer;              /*input buffer pointer*/  JSAMPROW rgb_buffer;              /*rgb sequence data buffer pointer*/  INT32 *rgb_gray_tab;  JSAMPARRAY colormap;		/* BMP colormap (converted to my format) */  UINT8 colormap_used;          /*the tag of the colormap,in the real_color image,the colormap isn't used*/  JDIMENSION image_width;  JDIMENSION image_height;      /* BMP image height*/  void (* adjust_pixel_rows)(bmp_source_ptr sinfo);     JDIMENSION row_width;		/* Physical width of scanlines in file */  int bits_per_pixel;		/* remembers 8- or 24-bit format */  UINT16 X_density ;             /* 100 cm per meter */  UINT16 Y_density ;  UINT8  density_unit ;  	/* dots/cm */  } bmp_source_struct;typedef struct _bmp_destination_struct {    FILE *outputfile;                /*destination file pointer*/  JSAMPROW buffer;              /*buffer pointer*/  JDIMENSION image_width;  JDIMENSION image_height;      /* BMP image height*/   JDIMENSION row_width;		/* Physical width of scanlines in file */    } bmp_destination_struct;

⌨️ 快捷键说明

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