📄 ijl.h
字号:
// data isn't request (DIBBytes!=NULL).//// Fields:// short* raw_ptrs[4] - pointers to buffers with raw data; one pointer // corresponds one JPG component;// data_type - 0 - raw dct coefficients, 1 - raw sampled data.////////////////////////////////////////////////////////////////////////////*D*/typedef struct _RAW_DATA_TYPES_STATE{ int data_type; unsigned short* raw_ptrs[4];} RAW_DATA_TYPES_STATE;/*D*////////////////////////////////////////////////////////////////////////////// Name: ENTROPYSTRUCT//// Purpose: Stores the decoder state information necessary to "jump"// to a particular MCU row in a compressed entropy stream.//// Context: Used to persist the decoder state within Decode_Scan when// decoding using ROIs.//// Fields:// offset Offset (in bytes) into the entropy stream// from the beginning.// dcval1 DC val at the beginning of the MCU row// for component 1.// dcval2 DC val at the beginning of the MCU row// for component 2.// dcval3 DC val at the beginning of the MCU row// for component 3.// dcval4 DC val at the beginning of the MCU row// for component 4.// bit_buffer_64 64-bit Huffman bit buffer. Stores current// bit buffer at the start of a MCU row.// Also used as a 32-bit buffer on 32-bit// architectures.// bitbuf_bits_valid Number of valid bits in the above bit buffer.// unread_marker Have any markers been decoded but not// processed at the beginning of a MCU row?// This entry holds the unprocessed marker, or// 0 if none.//////////////////////////////////////////////////////////////////////////////*D*/typedef struct _ENTROPYSTRUCT{ unsigned int offset; int dcval1; int dcval2; int dcval3; int dcval4; IJL_UINT64 bit_buffer_64; int bitbuf_bits_valid; unsigned char unread_marker;} ENTROPYSTRUCT;/*D*////////////////////////////////////////////////////////////////////////////// Name: STATE//// Purpose: Stores the active state of the IJL.//// Context: Used by all low-level routines to store pseudo-global or// state variables.//// Fields:// bit_buffer_64 64-bit bitbuffer utilized by Huffman// encoder/decoder algorithms utilizing routines// designed for MMX(TM) technology.// bit_buffer_32 32-bit bitbuffer for all other Huffman// encoder/decoder algorithms.// bitbuf_bits_valid Number of bits in the above two fields that// are valid.//// cur_entropy_ptr Current position (absolute address) in// the entropy buffer.// start_entropy_ptr Starting position (absolute address) of// the entropy buffer.// end_entropy_ptr Ending position (absolute address) of// the entropy buffer.// entropy_bytes_processed Number of bytes actually processed// (passed over) in the entropy buffer.// entropy_buf_maxsize Max size of the entropy buffer.// entropy_bytes_left Number of bytes left in the entropy buffer.// Prog_EndOfBlock_Run Progressive block run counter.//// DIB_ptr Temporary offset into the input/output DIB.//// unread_marker If a marker has been read but not processed,// stick it in this field.// processor_type (0, 1, or 2) == current processor does not// support MMX(TM) instructions.// (3 or 4) == current processor does// support MMX(TM) instructions.// cur_scan_comp On which component of the scan are we working?// file Process file handle, or// 0x00000000 if no file is defined.// JPGBuffer Entropy buffer (~4K).////////////////////////////////////////////////////////////////////////////////*D*/typedef struct _STATE{ /* Bit buffer. */ IJL_UINT64 bit_buffer_64; void* ctx; int bitbuf_bits_valid; /* Entropy. */ unsigned char* cur_entropy_ptr; unsigned char* start_entropy_ptr; unsigned char* end_entropy_ptr; int entropy_bytes_processed; int entropy_buf_maxsize; int entropy_bytes_left; int Prog_EndOfBlock_Run; /* Input or output DIB. */ unsigned char* DIB_ptr; /* Control. */ unsigned char unread_marker; PROCESSOR_TYPE processor_type; int cur_scan_comp; IJL_HANDLE file; unsigned char JPGBuffer [JBUFSIZE];} STATE;/*D*////////////////////////////////////////////////////////////////////////////// Name: FAST_MCU_PROCESSING_TYPE//// Purpose: Advanced Control Option. Do NOT modify.// WARNING: Used for internal reference only.//// Fields://// IJL_(sampling)_(JPEG color space)_(sampling)_(DIB color space)// Decode is read left to right w/ upsampling.// Encode is read right to left w/ subsampling.//////////////////////////////////////////////////////////////////////////////*D*/typedef enum _FAST_MCU_PROCESSING_TYPE{ IJL_NO_CC_OR_US = 0, IJL_111_YCBCR_111_RGB = 1, IJL_111_YCBCR_111_BGR = 2, IJL_411_YCBCR_111_RGB = 3, IJL_411_YCBCR_111_BGR = 4, IJL_422_YCBCR_111_RGB = 5, IJL_422_YCBCR_111_BGR = 6, IJL_111_YCBCR_1111_RGBA_FPX = 7, IJL_411_YCBCR_1111_RGBA_FPX = 8, IJL_422_YCBCR_1111_RGBA_FPX = 9, IJL_1111_YCBCRA_FPX_1111_RGBA_FPX = 10, IJL_4114_YCBCRA_FPX_1111_RGBA_FPX = 11, IJL_4224_YCBCRA_FPX_1111_RGBA_FPX = 12, IJL_111_RGB_1111_RGBA_FPX = 13, IJL_1111_RGBA_FPX_1111_RGBA_FPX = 14, IJL_111_OTHER_111_OTHER = 15, IJL_411_OTHER_111_OTHER = 16, IJL_422_OTHER_111_OTHER = 17, IJL_YCBYCR_YCBCR = 18, IJL_YCBCR_YCBYCR = 19, IJL_1_G_1_G = 20} FAST_MCU_PROCESSING_TYPE;/*D*////////////////////////////////////////////////////////////////////////////// Name: JPEG_PROPERTIES//// Purpose: Stores low-level and control information. It is used by// both the encoder and decoder. An advanced external user// may access this structure to expand the interface// capability.//// See the Developer's Guide for an expanded description// of this structure and its use.//// Context: Used by all interface methods and most IJL routines.//// Fields://// iotype IN: Specifies type of data operation// (read/write/other) to be// performed by IJL_Read or IJL_Write.// roi IN: Rectangle-Of-Interest to read from, or// write to, in pixels.// dcttype IN: DCT alogrithm to be used.// fast_processing OUT: Supported fast pre/post-processing path.// This is set by the IJL.// interrupt IN: Signals an interrupt has been requested.//// DIBBytes IN: Pointer to buffer of uncompressed data.// DIBWidth IN: Width of uncompressed data.// DIBHeight IN: Height of uncompressed data.// DIBPadBytes IN: Padding (in bytes) at end of each// row in the uncompressed data.// DIBChannels IN: Number of components in the// uncompressed data.// DIBColor IN: Color space of uncompressed data.// DIBSubsampling IN: Required to be IJL_NONE or IJL_422.// DIBLineBytes OUT: Number of bytes in an output DIB line// including padding.//// JPGFile IN: Pointer to file based JPEG.// JPGBytes IN: Pointer to buffer based JPEG.// JPGSizeBytes IN: Max buffer size. Used with JPGBytes.// OUT: Number of compressed bytes written.// JPGWidth IN: Width of JPEG image.// OUT: After reading (except READHEADER).// JPGHeight IN: Height of JPEG image.// OUT: After reading (except READHEADER).// JPGChannels IN: Number of components in JPEG image.// OUT: After reading (except READHEADER).// JPGColor IN: Color space of JPEG image.// JPGSubsampling IN: Subsampling of JPEG image.// OUT: After reading (except READHEADER).// JPGThumbWidth OUT: JFIF embedded thumbnail width [0-255].// JPGThumbHeight OUT: JFIF embedded thumbnail height [0-255].//// cconversion_reqd OUT: If color conversion done on decode, TRUE.// upsampling_reqd OUT: If upsampling done on decode, TRUE.// jquality IN: [0-100] where highest quality is 100.// jinterleaveType IN/OUT: 0 => MCU interleaved file, and// 1 => 1 scan per component.// numxMCUs OUT: Number of MCUs in the x direction.// numyMCUs OUT: Number of MCUs in the y direction.//// nqtables IN/OUT: Number of quantization tables.// maxquantindex IN/OUT: Maximum index of quantization tables.// nhuffActables IN/OUT: Number of AC Huffman tables.// nhuffDctables IN/OUT: Number of DC Huffman tables.// maxhuffindex IN/OUT: Maximum index of Huffman tables.// jFmtQuant IN/OUT: Formatted quantization table info.// jFmtAcHuffman IN/OUT: Formatted AC Huffman table info.// jFmtDcHuffman IN/OUT: Formatted DC Huffman table info.//// jEncFmtQuant IN/OUT: Pointer to one of the above, or// to externally persisted table.// jEncFmtAcHuffman IN/OUT: Pointer to one of the above, or// to externally persisted table.// jEncFmtDcHuffman IN/OUT: Pointer to one of the above, or// to externally persisted table.//// use_default_qtables IN: Set to default quantization tables.// Clear to supply your own.// use_default_htables IN: Set to default Huffman tables.// Clear to supply your own.// rawquanttables IN: Up to 4 sets of quantization tables.// rawhufftables IN: Alternating pairs (DC/AC) of up to 4// sets of raw Huffman tables.// HuffIdentifierAC IN: Indicates what channel the user-// supplied Huffman AC tables apply to.// HuffIdentifierDC IN: Indicates what channel the user-// supplied Huffman DC tables apply to.//// jframe OUT: Structure with frame-specific info.// needframe OUT: TRUE when a frame has been detected.//// jscan Persistence for current scan pointer when// interrupted.//// state OUT: Contains info on the state of the IJL.// SawAdobeMarker OUT: Decoder saw an APP14 marker somewhere.// AdobeXform OUT: If SawAdobeMarker TRUE, this indicates// the JPEG color space given by that marker.//// rowoffsets Persistence for the decoder MCU row origins// when decoding by ROI. Offsets (in bytes// from the beginning of the entropy data)// to the start of each of the decoded rows.// Fill the offsets with -1 if they have not// been initalized and NULL could be the// offset to the first row.//// MCUBuf OUT: Quadword aligned internal buffer.// Big enough for the largest MCU// (10 blocks) with extra room for// additional operations.// tMCUBuf OUT: Version of above, without alignment.//// processor_type OUT: Determines type of processor found// during initialization.//// raw_coefs IN: Place to hold pointers to raw data buffers or// raw DCT coefficients buffers//// progressive_found OUT: 1 when progressive image detected.// coef_buffer IN: Pointer to a larger buffer containing// frequency coefficients when they// cannot be decoded dynamically// (i.e., as in progressive decoding).//// upsampling_type IN: Type of sampling:// IJL_BOX_FILTER or IJL_TRIANGLE_FILTER.// SAMPLING_STATE* OUT: pointer to structure, describing current// condition of upsampling//// AdobeVersion OUT version field, if Adobe APP14 marker detected// AdobeFlags0 OUT flags0 field, if Adobe APP14 marker detected// AdobeFlags1 OUT flags1 field, if Adobe APP14 marker detected//// jfif_app0_detected OUT: 1 - if JFIF APP0 marker detected, // 0 - if not// jfif_app0_version IN/OUT The JFIF file version// jfif_app0_units IN/OUT units for the X and Y densities// 0 - no units, X and Y specify// the pixel aspect ratio// 1 - X and Y are dots per inch// 2 - X and Y are dots per cm// jfif_app0_Xdensity IN/OUT horizontal pixel density// jfif_app0_Ydensity IN/OUT vertical pixel density//// jpeg_comment IN pointer to JPEG comments// jpeg_comment_size IN/OUT size of JPEG comments, in bytes//// raw_coefs IN/OUT if !NULL, then pointer to vector of pointers// (size = JPGChannels) to buffers for raw (short)// dct coefficients. 1 pointer corresponds to one// component;//////////////////////////////////////////////////////////////////////////////*D*/typedef struct _JPEG_PROPERTIES{ /* Compression/Decompression control. */ IJLIOTYPE iotype; /* default = IJL_SETUP */ IJL_RECT roi; /* default = 0 */ DCTTYPE dcttype; /* default = IJL_AAN */ FAST_MCU_PROCESSING_TYPE fast_processing; /* default = IJL_NO_CC_OR_US */ int interrupt; /* default = FALSE */ /* DIB specific I/O data specifiers. */ unsigned char* DIBBytes; /* default = NULL */ int DIBWidth; /* default = 0 */ int DIBHeight; /* default = 0 */ int DIBPadBytes; /* default = 0 */ int DIBChannels; /* default = 3 */ IJL_COLOR DIBColor; /* default = IJL_BGR */ IJL_DIBSUBSAMPLING DIBSubsampling; /* default = IJL_NONE */ int DIBLineBytes; /* default = 0 */ /* JPEG specific I/O data specifiers. */ const char* JPGFile; /* default = NULL */ unsigned char* JPGBytes; /* default = NULL */ int JPGSizeBytes; /* default = 0 */ int JPGWidth; /* default = 0 */ int JPGHeight; /* default = 0 */ int JPGChannels; /* default = 3 */ IJL_COLOR JPGColor; /* default = IJL_YCBCR */ IJL_JPGSUBSAMPLING JPGSubsampling; /* default = IJL_411 */ int JPGThumbWidth; /* default = 0 */ int JPGThumbHeight; /* default = 0 */ /* JPEG conversion properties. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -