📄 mod_ijl_jpg.bas
字号:
pad0 As Byte
pad1 As Byte
pad2 As Byte
proc_type As PROCESSOR_TYPE
cur_scan_comp As Long
file As Long
JPGBuffer(0 To JBUFSIZE - 1) As Byte
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: FAST_MCU_PROCESSING_TYPE
Rem
Rem Purpose: Advanced Control Option. Do NOT modify.
Rem WARNING: Used for internal reference only.
Rem
Rem Fields:
Rem
Rem IJL_(sampling)_(JPEG color space)_(sampling)_(DIB color space)
Rem Decode is read left to right w/ upsampling.
Rem Encode is read right to left w/ subsampling.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public 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
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: JPEG_PROPERTIES
Rem
Rem Purpose: Stores low-level and control information. It is used by
Rem both the encoder and decoder. An advanced external user
Rem may access this structure to expand the interface
Rem capability.
Rem
Rem See the Developer's Guide for an expanded description
Rem of this structure and its use.
Rem
Rem Context: Used by all interface methods and most IJL routines.
Rem
Rem Fields:
Rem
Rem iotype IN: Specifies type of data operation
Rem (read/write/other) to be
Rem performed by IJL_Read or IJL_Write.
Rem roi IN: Rectangle-Of-Interest to read from, or
Rem write to, in pixels.
Rem dcttype IN: DCT alogrithm to be used.
Rem fast_processing OUT: Supported fast pre/post-processing path.
Rem This is set by the IJL.
Rem interrupt IN: Signals an interrupt has been requested.
Rem
Rem DIBBytes IN: Pointer to buffer of uncompressed data.
Rem DIBWidth IN: Width of uncompressed data.
Rem DIBHeight IN: Height of uncompressed data.
Rem DIBPadBytes IN: Padding (in bytes) at end of each
Rem row in the uncompressed data.
Rem DIBChannels IN: Number of components in the
Rem uncompressed data.
Rem DIBColor IN: Color space of uncompressed data.
Rem DIBSubsampling IN: Required to be IJL_NONE or IJL_422.
Rem DIBLineBytes OUT: Number of bytes in an output DIB line
Rem including padding.
Rem
Rem JPGFile IN: Pointer to file based JPEG.
Rem JPGBytes IN: Pointer to buffer based JPEG.
Rem JPGSizeBytes IN: Max buffer size. Used with JPGBytes.
Rem OUT: Number of compressed bytes written.
Rem JPGWidth IN: Width of JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGHeight IN: Height of JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGChannels IN: Number of components in JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGColor IN: Color space of JPEG image.
Rem JPGSubsampling IN: Subsampling of JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGThumbWidth OUT: JFIF embedded thumbnail width [0-255].
Rem JPGThumbHeight OUT: JFIF embedded thumbnail height [0-255].
Rem
Rem cconversion_reqd OUT: If color conversion done on decode, TRUE.
Rem upsampling_reqd OUT: If upsampling done on decode, TRUE.
Rem jquality IN: [0-100] where highest quality is 100.
Rem jinterleaveType IN/OUT: 0 => MCU interleaved file, and
Rem 1 => 1 scan per component.
Rem numxMCUs OUT: Number of MCUs in the x direction.
Rem numyMCUs OUT: Number of MCUs in the y direction.
Rem
Rem nqtables IN/OUT: Number of quantization tables.
Rem maxquantindex IN/OUT: Maximum index of quantization tables.
Rem nhuffActables IN/OUT: Number of AC Huffman tables.
Rem nhuffDctables IN/OUT: Number of DC Huffman tables.
Rem maxhuffindex IN/OUT: Maximum index of Huffman tables.
Rem jFmtQuant IN/OUT: Formatted quantization table info.
Rem jFmtAcHuffman IN/OUT: Formatted AC Huffman table info.
Rem jFmtDcHuffman IN/OUT: Formatted DC Huffman table info.
Rem
Rem jEncFmtQuant IN/OUT: Pointer to one of the above, or
Rem to externally persisted table.
Rem jEncFmtAcHuffman IN/OUT: Pointer to one of the above, or
Rem to externally persisted table.
Rem jEncFmtDcHuffman IN/OUT: Pointer to one of the above, or
Rem to externally persisted table.
Rem
Rem use_default_qtables IN: Set to default quantization tables.
Rem Clear to supply your own.
Rem use_default_htables IN: Set to default Huffman tables.
Rem Clear to supply your own.
Rem rawquanttables IN: Up to 4 sets of quantization tables.
Rem rawhufftables IN: Alternating pairs (DC/AC) of up to 4
Rem sets of raw Huffman tables.
Rem HuffIdentifierAC IN: Indicates what channel the user-
Rem supplied Huffman AC tables apply to.
Rem HuffIdentifierDC IN: Indicates what channel the user-
Rem supplied Huffman DC tables apply to.
Rem
Rem jframe OUT: Structure with frame-specific info.
Rem needframe OUT: TRUE when a frame has been detected.
Rem
Rem jscan Persistence for current scan pointer when
Rem interrupted.
Rem
Rem state OUT: Contains info on the state of the IJL.
Rem SawAdobeMarker OUT: Decoder saw an APP14 marker somewhere.
Rem AdobeXform OUT: If SawAdobeMarker TRUE, this indicates
Rem the JPEG color space given by that marker.
Rem
Rem rowoffsets Persistence for the decoder MCU row origins
Rem when decoding by ROI. Offsets (in bytes
Rem from the beginning of the entropy data)
Rem to the start of each of the decoded rows.
Rem Fill the offsets with -1 if they have not
Rem been initalized and NULL could be the
Rem offset to the first row.
Rem
Rem MCUBuf OUT: Quadword aligned internal buffer.
Rem Big enough for the largest MCU
Rem (10 blocks) with extra room for
Rem additional operations.
Rem tMCUBuf OUT: Version of above, without alignment.
Rem
Rem processor_type OUT: Determines type of processor found
Rem during initialization.
Rem
Rem ignoreDCTs IN: Assert to bypass DCTs when processing
Rem data. Required for conformance
Rem testing.
Rem
Rem progressive_found OUT: 1 when progressive image detected.
Rem coef_buffer IN: Pointer to a larger buffer containing
Rem frequency coefficients when they
Rem cannot be decoded dynamically
Rem (i.e., as in progressive decoding).
Rem
Rem upsampling_type IN: Type of sampling:
Rem IJL_BOX_FILTER or IJL_TRIANGLE_FILTER.
Rem SAMPLING_STATE* OUT: pointer to structure, describing current
Rem condition of upsampling
Rem
Rem AdobeVersion OUT version field, if Adobe APP14 marker detected
Rem AdobeFlags0 OUT flags0 field, if Adobe APP14 marker detected
Rem AdobeFlags1 OUT flags1 field, if Adobe APP14 marker detected
Rem
Rem jfif_app0_detected OUT: 1 - if JFIF APP0 marker detected,
Rem 0 - if not
Rem jfif_app0_version IN/OUT The JFIF file version
Rem jfif_app0_units IN/OUT units for the X and Y densities
Rem 0 - no units, X and Y specify
Rem the pixel aspect ratio
Rem 1 - X and Y are dots per inch
Rem 2 - X and Y are dots per cm
Rem jfif_app0_Xdensity IN/OUT horizontal pixel density
Rem jfif_app0_Ydensity IN/OUT vertical pixel density
Rem
Rem jpeg_comment IN pointer to JPEG comments
Rem jpeg_comment_size IN/OUT size of JPEG comments, in bytes
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type JPEG_PROPERTIES
' Compression/Decompression control.
iotype As IJLIOTYPE ' default = IJL_SETUP
roi As IJL_RECT ' default = 0
dct_type As DCTTYPE ' default = IJL_AAN
fast_processing As FAST_MCU_PROCESSING_TYPE ' default = IJL_NO_CC_OR_US
interrupt As Long ' default = FALSE
' DIB specific I/O data specifiers.
DIBBytes As Long ' default = NULL
DIBWidth As Long ' default = 0
DIBHeight As Long ' default = 0
DIBPadBytes As Long ' default = 0
DIBChannels As Long ' default = 3
DIBColor As IJL_COLOR ' default = IJL_BGR
DIBSubsampling As IJL_DIBSUBSAMPLING ' default = IJL_NONE
DIBLineBytes As Long ' default = 0
' JPEG specific I/O data specifiers.
JPGFile As Long ' default = NULL
JPGBytes As Long ' default = NULL
JPGSizeBytes As Long ' default = 0
JPGWidth As Long ' default = 0
JPGHeight As Long ' default = 0
JPGChannels As Long ' default = 3
JPGColor As IJL_COLOR ' default = IJL_YCBCR
JPGSubsampling As IJL_JPGSUBSAMPLING ' default = IJL_411
JPGThumbWidth As Long ' default = 0
JPGThumbHeight As Long ' default = 0
' JPEG conversion properties.
cconversion_reqd As Long ' default = TRUE
upsampling_reqd As Long ' default = TRUE
jquality As Long ' default = 75
jinterleaveType As Long ' default = 0
numxMCUs As Long ' default = 0
numyMCUs As Long ' default = 0
' Tables.
nqtables As Long
maxquantindex As Long
nhuffActables As Long
nhuffDctables As Long
maxhuffindex As Long
jFmtQuant(0 To 3) As QUANT_TABLE
jFmtAcHuffman(0 To 3) As HUFFMAN_TABLE
jFmtDcHuffman(0 To 3) As HUFFMAN_TABLE
jEndFmtQuant(0 To 3) As Long
jEncFmtAcHuffman(0 To 3) As Long
jEndFmtDcHuffman(0 To 3) As Long
' Allow user-defined tables.
use_default_qtables As Long
use_default_htables As Long
rawquanttables(0 To 3) As JPEGQuantTable
rawhufftables(0 To 7) As JPEGHuffTable
HuffIdentifierAC(0 To 3) As Byte
HuffIdentifierDC(0 To 3) As Byte
' Frame specific members.
jframe As FRAME
needframe As Long
' SCAN persistent members.
jscan As Long
' IJL use 8 byte pack structures
pad0 As Byte
pad1 As Byte
pad2 As Byte
pad3 As Byte
' State members.
state_field As STATE
SawAdobeMarker As Long
AdobeXform As Long
' ROI decoder members.
rowoffsets As Long
' Intermediate buffers.
MCUBuf As Long
tMCUBuf(0 To 1439) As Byte
' Processor detected.
processortype As PROCESSOR_TYPE
' Test specific members.
ignoreDCTs As Long
' Progressive mode members.
progressive_found As Long
coef_buffer As Long
' Upsampling mode members.
upsampling_type As upsampling_type
sampling_state_ptr As Long
' Adobe APP14 segment variables
AdobeVersion As Integer
AdobeFlags0 As Integer
AdobeFlags1 As Integer
' JFIF APP0 segment variables
jfif_app0_detected As Long
jfif_app0_version As Integer
jfif_app0_units As Byte
jfif_app0_Xdensity As Integer
jfif_app0_Ydensity As Integer
' comments related fields
jpeg_comment As Long
jpeg_comment_size As Integer
End Type
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: JPEG_CORE_PROPERTIES
Rem
Rem Purpose: This is the primary data structure between the IJL and
Rem the external user. It stores JPEG state information
Rem and controls the IJL. It is user-modifiable.
Rem
Rem See the Developer's Guide for details on appropriate usage.
Rem
Rem Context: Used by all low-level IJL routines to store
Rem pseudo-global information.
Rem
Rem Fields:
Rem
Rem UseJPEGPROPERTIES Set this flag != 0 if you wish to override
Rem the JPEG_CORE_PROPERTIES "IN" parameters with
Rem the JPEG_PROPERTIES parameters.
Rem
Rem DIBBytes IN: Pointer to buffer of uncompressed data.
Rem DIBWidth IN: Width of uncompressed data.
Rem DIBHeight IN: Height of uncompressed data.
Rem DIBPadBytes IN: Padding (in bytes) at end of each
Rem row in the uncompressed data.
Rem DIBChannels IN: Number of components in the
Rem uncompressed data.
Rem DIBColor IN: Color space of uncompressed data.
Rem DIBSubsampling IN: Required to be IJL_NONE or IJL_422.
Rem
Rem JPGFile IN: Pointer to file based JPEG.
Rem JPGBytes IN: Pointer to buffer based JPEG.
Rem JPGSizeBytes IN: Max buffer size. Used with JPGBytes.
Rem OUT: Number of compressed bytes written.
Rem JPGWidth IN: Width of JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGHeight IN: Height of JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGChannels IN: Number of components in JPEG image.
Rem OUT: After reading (except READHEADER).
Rem JPGColor IN: Color space of JPEG image.
Rem JPGSubsampling IN: Subsampling of JPEG image.
Rem OUT: After reading (except READHEADER).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -