📄 ijl.pas
字号:
// 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).
//
//
////////////////////////////////////////////////////////////////////////////
PSTATE = ^TSTATE;
TSTATE = record
// Bit buffer.
bit_buffer_64 : IJL_UINT64;
bit_buffer_32 : DWORD;
bitbuf_bits_valid : Integer;
// Entropy.
cur_entropy_ptr : PByte;
start_entropy_ptr : PByte;
end_entropy_ptr : PByte;
entropy_bytes_processed : Longint;
entropy_buf_maxsize : Longint;
entropy_bytes_left : Integer;
Prog_EndOfBlock_Run : Integer;
// Input or output DIB.
DIB_ptr : PByte;
unread_marker : Byte;
processor_type : TPROCESSOR_TYPE;
cur_scan_comp : Integer;
hFile : TIJL_HANDLE; //THandle;
JPGBuffer : array [0..JBUFSIZE-1] of Byte;
end;
////////////////////////////////////////////////////////////////////////////
// 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.
//
////////////////////////////////////////////////////////////////////////////
TFAST_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, encoding from YCbCr 422 format
IJL_YCBCR_YCBYCR // = 19 decoding to YCbCr 422 format
);
////////////////////////////////////////////////////////////////////////////
// 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.
// 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_external_qtables IN: Set to default quantization tables.
// Clear to supply your own.
// use_external_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
//
////////////////////////////////////////////////////////////////////////////
PJPEG_PROPERTIES = ^TJPEG_PROPERTIES;
TJPEG_PROPERTIES = record
// Compression/Decompression control.
iotype : TIJLIOTYPE; // default = IJL_SETUP
roi : TIJL_RECT; // default = 0
dcttype : TDCTTYPE; // default = IJL_AAN
fast_processing : TFAST_MCU_PROCESSING_TYPE; // default = IJL_NO_CC_OR_US
intr : DWORD; // default = FALSE
// DIB specific I/O data specifiers.
DIBBytes : PByte; // default = NULL
DIBWidth : DWORD; // default = 0
DIBHeight : Integer; // default = 0
DIBPadBytes : DWORD; // default = 0
DIBChannels : DWORD; // default = 3
DIBColor : TIJL_COLOR; // default = IJL_BGR
DIBSubsampling : TIJL_DIBSUBSAMPLING; // default = IJL_NONE
DIBLineBytes : Integer; // default = 0
// JPEG specific I/O data specifiers.
JPGFile : PChar; // default = NULL
JPGBytes : PByte; // default = NULL
JPGSizeBytes : DWORD; // default = 0
JPGWidth : DWORD; // default = 0
JPGHeight : DWORD; // default = 0
JPGChannels : DWORD; // default = 3
JPGColor : TIJL_COLOR; // default = IJL_YCBCR
JPGSubsampling : TIJL_JPGSUBSAMPLING; // default = IJL_411
JPGThumbWidth : DWORD; // default = 0
JPGThumbHeight : DWORD; // default = 0
// JPEG conversion properties.
cconversion_reqd : DWORD; // default = TRUE
upsampling_reqd : DWORD; // default = TRUE
jquality : DWORD; // default = 75
jinterleaveType : DWORD; // default = 0
numxMCUs : DWORD; // default = 0
numyMCUs : DWORD; // default = 0
// Tables.
nqtables : DWORD;
maxquantindex : DWORD;
nhuffActables : DWORD;
nhuffDctables : DWORD;
maxhuffindex : DWORD;
jFmtQuant : array [0..3] of TQUANT_TABLE;
jFmtAcHuffman : array [0..3] of THUFFMAN_TABLE;
jFmtDcHuffman : array [0..3] of THUFFMAN_TABLE;
jEncFmtQuant : array [0..3] of PSHORT;
jEncFmtAcHuffman : array [0..3] of PHUFFMAN_TABLE;
jEncFmtDcHuffman : array [0..3] of PHUFFMAN_TABLE;
// Allow user-defined tables.
use_external_qtables : DWORD;
use_external_htables : DWORD;
rawquanttables : array [0..3] of TJPEGQuantTable;
rawhufftables : array [0..7] of TJPEGHuffTable;
HuffIdentifierAC : array [0..3] of Byte;
HuffIdentifierDC : array [0..3] of Byte;
// Frame specific members.
jframe : TFRAME;
needframe : Integer;
// SCAN persistent members.
jscan : PSCAN;
Pad : DWORD; // 8-byte alignment!!!
// State members.
state : TSTATE;
SawAdobeMarker : DWORD;
AdobeXform : DWORD;
// ROI decoder members.
rowoffsets : PENTROPYSTRUCT;
// Intermediate buffers.
MCUBuf : PByte;
tMCUBuf : array [0..720*2-1] of Byte; // ???
// Processor detected.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -