📄 mod_ijl_jpg.bas
字号:
Rem
Public Type FRAME_COMPONENT
ident As Long
hsampling As Long
vsampling As Long
quant_sel As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: FRAME
Rem
Rem Purpose: Stores frame-specific data.
Rem
Rem Context: One Frame structure per image.
Rem
Rem Fields:
Rem precision Sample precision in bits.
Rem width Width of the source image in pixels.
Rem height Height of the source image in pixels.
Rem MCUheight Height of a frame MCU.
Rem MCUwidth Width of a frame MCU.
Rem max_hsampling Max horiz sampling ratio of any component in the frame.
Rem max_vsampling Max vert sampling ratio of any component in the frame.
Rem ncomps Number of components/channels in the frame.
Rem horMCU Number of horizontal MCUs in the frame.
Rem totalMCU Total number of MCUs in the frame.
Rem comps Array of 'ncomps' component descriptors.
Rem restart_interv Indicates number of MCUs after which to restart the
Rem entropy parameters.
Rem SeenAllDCScans Used when decoding Multiscan images to determine if
Rem all channels of an image have been decoded.
Rem SeenAllACScans (See SeenAllDCScans)
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type FRAME
precision As Long
width As Long
Height As Long
MCUheight As Long
MCUwidth As Long
max_hsampling As Long
max_vsampling As Long
ncomps As Long
horMCU As Long
totalMCU As Long
comps As Long
restart_interv As Long
SeenAllDCScans As Long
SeenAllACScans As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: SCAN_COMPONENT
Rem
Rem Purpose: One scan-component structure is allocated per component
Rem of each scan in a frame.
Rem
Rem Context: Used by Huffman decoder to manage components within scans.
Rem
Rem Fields:
Rem comp Component number, index to the comps member of FRAME.
Rem hsampling Horizontal sampling factor.
Rem vsampling Vertical sampling factor.
Rem dc_table DC Huffman table pointer for this scan.
Rem ac_table AC Huffman table pointer for this scan.
Rem quant_table Quantization table pointer for this scan.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type SCAN_COMPONENT
comp As Long
hsampling As Long
vsampling As Long
dc_table As Long
ac_table As Long
quantTable As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: SCAN
Rem
Rem Purpose: One SCAN structure is allocated per scan in a frame.
Rem
Rem Context: Used by Huffman decoder to manage scans.
Rem
Rem Fields:
Rem ncomps Number of image components in a scan, 1-4 legal.
Rem gray_scale If TRUE, decode only the Y channel.
Rem start_spec Start coefficient of spectral or predictor selector.
Rem end_spec End coefficient of spectral selector.
Rem approx_high High bit position in successive approximation
Rem Progressive coding.
Rem approx_low Low bit position in successive approximation
Rem Progressive coding.
Rem restart_interv Restart interval, 0 if disabled.
Rem curxMCU Next horizontal MCU index to be processed after
Rem an interrupted SCAN.
Rem curyMCU Next vertical MCU index to be processed after
Rem an interrupted SCAN.
Rem dc_diff Array of DC predictor values for DPCM modes.
Rem comps Array of ncomps SCAN_COMPONENT component identifiers.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type SCAN
ncomps As Long
gray_scale As Long
start_spec As Long
end_spec As Long
approx_high As Long
approx_low As Long
restart_interv As Long
curxMCU As Long
curyMCU As Long
dc_diff(0 To 3) As Long
comps As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: DCTTYPE
Rem
Rem Purpose: Possible algorithms to be used to perform the discrete
Rem cosine transform (DCT).
Rem
Rem Fields:
Rem IJL_AAN The AAN (Arai, Agui, and Nakajima) algorithm from
Rem Trans. IEICE, vol. E 71(11), 1095-1097, Nov. 1988.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum DCTTYPE
IJL_AAN = 0
IJL_IPP = 1
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: UPSAMPLING_TYPE
Rem
Rem Purpose: - Possible algorithms to be used to perform upsampling
Rem
Rem Fields:
Rem IJL_BOX_FILTER - the algorithm is simple replication of the input pixel
Rem onto the corresponding output pixels (box filter);
Rem IJL_TRIANGLE_FILTER - 3/4 * nearer pixel + 1/4 * further pixel in each
Rem dimension
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum upsampling_type
IJL_BOX_FILTER = 0
IJL_TRIANGLE_FILTER = 1
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: SAMPLING_STATE
Rem
Rem Purpose: Stores current conditions of sampling. Only for upsampling
Rem with triangle filter is used now.
Rem
Rem Fields:
Rem top_row - pointer to buffer with MCUs, that are located above than
Rem current row of MCUs;
Rem cur_row - pointer to buffer with current row of MCUs;
Rem bottom_row - pointer to buffer with MCUs, that are located below than
Rem current row of MCUs;
Rem last_row - pointer to bottom boundary of last row of MCUs
Rem cur_row_number - number of row of MCUs, that is decoding;
Rem user_interrupt - field to store jprops->interrupt, because of we prohibit
Rem interrupts while top row of MCUs is upsampling.
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type SAMPLING_STATE
top_row As Long
cur_row As Long
bottom_row As Long
last_row As Long
cur_row_number As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: PROCESSOR_TYPE
Rem
Rem Purpose: Possible types of processors.
Rem Note that the enums are defined in ascending order
Rem depending upon their various IA32 instruction support.
Rem
Rem Fields:
Rem
Rem IJL_OTHER_PROC
Rem Does not support the CPUID instruction and
Rem assumes no Pentium(R) processor instructions.
Rem
Rem IJL_PENTIUM_PROC
Rem Corresponds to an Intel(R) Pentium(R) processor
Rem (or a 100% compatible) that supports the
Rem Pentium(R) processor instructions.
Rem
Rem IJL_PENTIUM_PRO_PROC
Rem Corresponds to an Intel(R) Pentium(R) Pro processor
Rem (or a 100% compatible) that supports the
Rem Pentium(R) Pro processor instructions.
Rem
Rem IJL_PENTIUM_PROC_MMX_TECH
Rem Corresponds to an Intel(R) Pentium(R) processor
Rem with MMX(TM) technology (or a 100% compatible)
Rem that supports the MMX(TM) instructions.
Rem
Rem IJL_PENTIUM_II_PROC
Rem Corresponds to an Intel(R) Pentium(R) II processor
Rem (or a 100% compatible) that supports both the
Rem Pentium(R) Pro processor instructions and the
Rem MMX(TM) instructions.
Rem
Rem IJL_PENTIUM_III_PROC
Rem Corresponds to an Intel(R) Pentium(R) III processor
Rem
Rem Any additional processor types that support a superset
Rem of both the Pentium(R) Pro processor instructions and the
Rem MMX(TM) instructions should be given an enum value greater
Rem than IJL_PENTIUM_III_PROC.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum PROCESSOR_TYPE
IJL_OTHER_PROC = 0
IJL_PENTIUM_PROC = 1
IJL_PENTIUM_PRO_PROC = 2
IJL_PENTIUM_PROC_MMX_TECH = 3
IJL_PENTIUM_II_PROC = 4
IJL_PENTIUM_III_PROC = 5
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: ENTROPYSTRUCT
Rem
Rem Purpose: Stores the decoder state information necessary to "jump"
Rem to a particular MCU row in a compressed entropy stream.
Rem
Rem Context: Used to persist the decoder state within Decode_Scan when
Rem decoding using ROIs.
Rem
Rem Fields:
Rem offset Offset (in bytes) into the entropy stream
Rem from the beginning.
Rem dcval1 DC val at the beginning of the MCU row
Rem for component 1.
Rem dcval2 DC val at the beginning of the MCU row
Rem for component 2.
Rem dcval3 DC val at the beginning of the MCU row
Rem for component 3.
Rem dcval4 DC val at the beginning of the MCU row
Rem for component 4.
Rem bit_buffer_64 64-bit Huffman bit buffer. Stores current
Rem bit buffer at the start of a MCU row.
Rem Also used as a 32-bit buffer on 32-bit
Rem architectures.
Rem bitbuf_bits_valid Number of valid bits in the above bit buffer.
Rem unread_marker Have any markers been decoded but not
Rem processed at the beginning of a MCU row?
Rem This entry holds the unprocessed marker, or
Rem 0 if none.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type ENTROPYSTRUCT
offset As Long
dcval1 As Long
dcval2 As Long
dcval3 As Long
dcval4 As Long
' IJL use 8 byte pack structures
pad0 As Byte
pad1 As Byte
pad2 As Byte
pad3 As Byte
bit_buffer_64 As Long
bit_buffer_64_part_2 As Long
bitbuf_bits_valid As Long
unread_marker As Byte
' IJL use 8 byte pack structures
pad4 As Byte
pad5 As Byte
pad6 As Byte
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: STATE
Rem
Rem Purpose: Stores the active state of the IJL.
Rem
Rem Context: Used by all low-level routines to store pseudo-global or
Rem state variables.
Rem
Rem Fields:
Rem bit_buffer_64 64-bit bitbuffer utilized by Huffman
Rem encoder/decoder algorithms utilizing routines
Rem designed for MMX(TM) technology.
Rem bit_buffer_32 32-bit bitbuffer for all other Huffman
Rem encoder/decoder algorithms.
Rem bitbuf_bits_valid Number of bits in the above two fields that
Rem are valid.
Rem
Rem cur_entropy_ptr Current position (absolute address) in
Rem the entropy buffer.
Rem start_entropy_ptr Starting position (absolute address) of
Rem the entropy buffer.
Rem end_entropy_ptr Ending position (absolute address) of
Rem the entropy buffer.
Rem entropy_bytes_processed Number of bytes actually processed
Rem (passed over) in the entropy buffer.
Rem entropy_buf_maxsize Max size of the entropy buffer.
Rem entropy_bytes_left Number of bytes left in the entropy buffer.
Rem Prog_EndOfBlock_Run Progressive block run counter.
Rem
Rem DIB_ptr Temporary offset into the input/output DIB.
Rem
Rem unread_marker If a marker has been read but not processed,
Rem stick it in this field.
Rem processor_type (0, 1, or 2) == current processor does not
Rem support MMX(TM) instructions.
Rem (3 or 4) == current processor does
Rem support MMX(TM) instructions.
Rem cur_scan_comp On which component of the scan are we working?
Rem file Process file handle, or
Rem 0x00000000 if no file is defined.
Rem JPGBuffer Entropy buffer (~4K).
Rem
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type STATE
bit_buffer_64 As Long
bit_buffer_64_part_2 As Long
bit_buffer_32 As Long
bitbuf_bits_valid As Long
cur_entropy_ptr As Long
start_entropy_ptr As Long
end_entropy_ptr As Long
entropy_bytes_processed As Long
entropy_buf_maxsize As Long
entropy_bytes_left As Long
Prog_EndOfBlock_Run As Long
DIB_ptr As Long
unread_marker As Byte
' IJL use 8 byte pack structures
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -