📄 mod_ijl_jpg.bas
字号:
Attribute VB_Name = "IJL"
Rem
Rem
Rem
Rem INTEL CORPORATION PROPRIETARY INFORMATION
Rem This software is supplied under the terms of a license agreement or
Rem nondisclosure agreement with Intel Corporation and may not be copied
Rem or disclosed except in accordance with the terms of that agreement.
Rem Copyright (c) 1998 Intel Corporation. All Rights Reserved.
Rem
Rem
Rem File:
Rem ijl.bas
Rem
Rem Purpose:
Rem Intel(R) JPEG Library Visual Basic interface module
Rem
Rem Version:
Rem 1.2
Rem
Rem
Option Explicit
Global Const JBUFSIZE As Long = 4096
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: IJLibVersion
Rem
Rem Purpose: Stores library version info.
Rem
Rem Context:
Rem
Rem Example:
Rem major - 1
Rem minor - 0
Rem build - 1
Rem Name - "ijl10.dll"
Rem Version - "1.0.1 Beta 1"
Rem InternalVersion - "1.0.1.1"
Rem BuildDate - "Sep 22 1998"
Rem CallConv - "DLL"
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type IJLibVersion
major As Long
minor As Long
build As Long
Name As Long 'pointer to C-style string
Version As Long 'pointer to C-style string
InternalVersion As Long 'pointer to C-style string
BuildDate As Long 'pointer to C-style string
CallConv As Long 'pointer to C-style string
End Type
Rem/*D*
Rem////////////////////////////////////////////////////////////////////////////
Rem// Name: IJL_RECT
Rem//
Rem// Purpose: Keep coordinates for rectangle region of image
Rem//
Rem// Context: Used to specify roi
Rem//
Rem// Fields:
Rem//
Rem////////////////////////////////////////////////////////////////////////////
Rem*D*/
Public Type IJL_RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: IJLIOTYPE
Rem
Rem Purpose: Possible types of data read/write/other operations to be
Rem performed by the functions IJL_Read and IJL_Write.
Rem
Rem See the Developer's Guide for details on appropriate usage.
Rem
Rem Fields:
Rem
Rem IJL_JFILE_XXXXXXX Indicates JPEG data in a stdio file.
Rem
Rem IJL_JBUFF_XXXXXXX Indicates JPEG data in an addressable buffer.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum IJLIOTYPE
IJL_SETUP = -1
' Read JPEG parameters (i.e., height, width, channels, sampling, etc.)
' from a JPEG bit stream.
IJL_JFILE_READPARAMS = 0
IJL_JBUFF_READPARAMS = 1
' Read a JPEG Interchange Format image.
IJL_JFILE_READWHOLEIMAGE = 2
IJL_JBUFF_READWHOLEIMAGE = 3
' Read JPEG tables from a JPEG Abbreviated Format bit stream.
IJL_JFILE_READHEADER = 4
IJL_JBUFF_READHEADER = 5
' Read image info from a JPEG Abbreviated Format bit stream.
IJL_JFILE_READENTROPY = 6
IJL_JBUFF_READENTROPY = 7
' Write an entire JFIF bit stream.
IJL_JFILE_WRITEWHOLEIMAGE = 8
IJL_JBUFF_WRITEWHOLEIMAGE = 9
' Write a JPEG Abbreviated Format bit stream.
IJL_JFILE_WRITEHEADER = 10
IJL_JBUFF_WRITEHEADER = 11
' Write image info to a JPEG Abbreviated Format bit stream.
IJL_JFILE_WRITEENTROPY = 12
IJL_JBUFF_WRITEENTROPY = 13
' Scaled Decoding Options:
' Reads a JPEG image scaled to 1/2 size.
IJL_JFILE_READONEHALF = 14
IJL_JBUFF_READONEHALF = 15
' Reads a JPEG image scaled to 1/4 size.
IJL_JFILE_READONEQUARTER = 16
IJL_JBUFF_READONEQUARTER = 17
' Reads a JPEG image scaled to 1/8 size.
IJL_JFILE_READONEEIGHTH = 18
IJL_JBUFF_READONEEIGHTH = 19
' Reads an embedded thumbnail from a JFIF bit stream.
IJL_JFILE_READTHUMBNAIL = 20
IJL_JBUFF_READTHUMBNAIL = 21
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: IJL_COLOR
Rem
Rem Purpose: Possible color space formats.
Rem
Rem Note these formats do *not* necessarily denote
Rem the number of channels in the color space.
Rem There exists separate "channel" fields in the
Rem JPEG_CORE_PROPERTIES data structure specifically
Rem for indicating the number of channels in the
Rem JPEG and/or DIB color spaces.
Rem
Rem See the Developer's Guide for details on appropriate usage.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum IJL_COLOR
IJL_RGB = 1 ' Red-Green-Blue color space.
IJL_BGR = 2 ' Reversed channel ordering from IJL_RGB.
IJL_YCBCR = 3 ' Luminance-Chrominance color space as defined
' by CCIR Recommendation 601.
IJL_G = 4 ' Grayscale color space.
IJL_RGBA_FPX = 5 ' FlashPix RGB 4 channel color space that
' has pre-multiplied opacity.
IJL_YCBCRA_FPX = 6 ' FlashPix YCbCr 4 channel color space that
' has pre-multiplied opacity.
IJL_OTHER = 255 ' Some other color space not defined by the IJL.
' (This means no color space conversion will be
' done by the IJL.)
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: IJL_JPGSUBSAMPLING
Rem
Rem Purpose: Possible subsampling formats used in the JPEG.
Rem
Rem See the Developer's Guide for details on appropriate usage.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum IJL_JPGSUBSAMPLING
IJL_NONE = 0 ' Corresponds to "No Subsampling".
' Valid on a JPEG w/ any number of channels.
IJL_411 = 1 ' Valid on a JPEG w/ 3 channels.
IJL_422 = 2 ' Valid on a JPEG w/ 3 channels.
IJL_4114 = 3 ' Valid on a JPEG w/ 4 channels.
IJL_4224 = 4 ' Valid on a JPEG w/ 4 channels.
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: IJL_DIBSUBSAMPLING
Rem
Rem Purpose: Possible subsampling formats used in the DIB.
Rem
Rem See the Developer's Guide for details on appropriate usage.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Enum IJL_DIBSUBSAMPLING
IJL_NONE = 0 ' Corresponds to "No Subsampling".
' Valid on a DIB w/ any number of channels.
IJL_422 = 2 ' Valid on a DIB with YCbYCr color.
End Enum
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: HUFFMAN_TABLE
Rem
Rem Purpose: Stores Huffman table information in a fast-to-use format.
Rem
Rem Context: Used by Huffman encoder/decoder to access Huffman table
Rem data. Raw Huffman tables are formatted to fit this
Rem structure prior to use.
Rem
Rem Fields:
Rem huff_class 0 == DC Huffman or lossless table, 1 == AC table.
Rem ident Huffman table identifier, 0-3 valid (Extended Baseline).
Rem huffelem Huffman elements for codes <= 8 bits long;
Rem contains both zero run-length and symbol length in bits.
Rem huffval Huffman values for codes 9-16 bits in length.
Rem mincode Smallest Huffman code of length n.
Rem maxcode Largest Huffman code of length n.
Rem valptr Starting index into huffval[] for symbols of length k.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type HUFFMAN_TABLE
huff_class As Long
ident As Long
huffelem(0 To 255) As Long
huffval(0 To 255) As Integer
mincode(0 To 16) As Integer
maxcode(0 To 17) As Integer
valptr(0 To 16) As Integer
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: JPEGHuffTable
Rem
Rem Purpose: Stores pointers to JPEG-binary spec compliant
Rem Huffman table information.
Rem
Rem Context: Used by interface and table methods to specify encoder
Rem tables to generate and store JPEG images.
Rem
Rem Fields:
Rem bits Points to number of codes of length i (<=16 supported).
Rem vals Value associated with each Huffman code.
Rem hclass 0 == DC table, 1 == AC table.
Rem ident Specifies the identifier for this table.
Rem 0-3 for extended JPEG compliance.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type JPEGHuffTable
bits As Long
vals As Long
hclass As Byte
ident As Byte
' IJL use 8 byte pack structures
pad0 As Byte
pad1 As Byte
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: QUANT_TABLE
Rem
Rem Purpose: Stores quantization table information in a
Rem fast-to-use format.
Rem
Rem Context: Used by quantizer/dequantizer to store formatted
Rem quantization tables.
Rem
Rem Fields:
Rem precision 0 => elements contains 8-bit elements,
Rem 1 => elements contains 16-bit elements.
Rem ident Table identifier (0-3).
Rem elements Pointer to 64 table elements + 16 extra elements to catch
Rem input data errors that may cause malfunction of the
Rem Huffman decoder.
Rem elarray Space for elements (see above) plus 8 bytes to align
Rem to a quadword boundary.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type QUANT_TABLE
precision As Long
ident As Long
elements As Long
elarray(0 To 83) As Integer
End Type
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem Name: JPEGQuantTable
Rem
Rem Purpose: Stores pointers to JPEG binary spec compliant
Rem quantization table information.
Rem
Rem Context: Used by interface and table methods to specify encoder
Rem tables to generate and store JPEG images.
Rem
Rem Fields:
Rem quantizer Zig-zag order elements specifying quantization factors.
Rem ident Specifies identifier for this table.
Rem 0-3 valid for Extended Baseline JPEG compliance.
Rem
Rem//////////////////////////////////////////////////////////////////////////
Rem
Public Type JPEGQuantTable
quantizer As Long
ident As Byte
' IJL use 8 byte pack structures
pad0 As Byte
pad1 As Byte
pad2 As Byte
End Type
Rem
Rem///////////////////////////////////////////////////////////////////////////
Rem Name: FRAME_COMPONENT
Rem
Rem Purpose: One frame-component structure is allocated per component
Rem in a frame.
Rem
Rem Context: Used by Huffman decoder to manage components.
Rem
Rem Fields:
Rem ident Component identifier. The tables use this ident to
Rem determine the correct table for each component.
Rem hsampling Horizontal subsampling factor for this component,
Rem 1-4 are legal.
Rem vsampling Vertical subsampling factor for this component,
Rem 1-4 are legal.
Rem quant_sel Quantization table selector. The quantization table
Rem used by this component is determined via this selector.
Rem
Rem//////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -