⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ijl.h

📁 Intel JPEG Library
💻 H
📖 第 1 页 / 共 4 页
字号:
//                          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
{
  DWORD   offset;
  int     dcval1;
  int     dcval2;
  int     dcval3;
  int     dcval4;
  UINT64  bit_buffer_64;
  int     bitbuf_bits_valid;
  BYTE    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.
  UINT64          bit_buffer_64;
  DWORD           bit_buffer_32;
  int             bitbuf_bits_valid;

  // Entropy.
  BYTE*           cur_entropy_ptr;
  BYTE*           start_entropy_ptr;
  BYTE*           end_entropy_ptr;
  long            entropy_bytes_processed;
  long            entropy_buf_maxsize;
  int             entropy_bytes_left;
  int             Prog_EndOfBlock_Run;

  // Input or output DIB.
  BYTE*           DIB_ptr;

  // Control.
  BYTE            unread_marker;
  PROCESSOR_TYPE  processor_type;
  int             cur_scan_comp;
  HANDLE          file;
  BYTE            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
{
  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

} 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.
//  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.
//
//  ignoreDCTs          IN:     Assert to bypass DCTs when processing
//                              data.  Required for conformance
//                              testing.
//
//  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).
//
////////////////////////////////////////////////////////////////////////////
*D*/

typedef struct
{
  // Compression/Decompression control.
  IJLIOTYPE                iotype;               // default = IJL_SETUP
  RECT                     roi;                  // default = 0
  DCTTYPE                  dcttype;              // default = IJL_AAN
  FAST_MCU_PROCESSING_TYPE fast_processing;      // default = IJL_NO_CC_OR_US
  DWORD                    interrupt;            // default = FALSE

  // DIB specific I/O data specifiers.
  BYTE*                    DIBBytes;             // default = NULL
  DWORD                    DIBWidth;             // default = 0
  int                      DIBHeight;            // default = 0
  DWORD                    DIBPadBytes;          // default = 0
  DWORD                    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.
  LPTSTR                   JPGFile;              // default = NULL
  BYTE*                    JPGBytes;             // default = NULL
  DWORD                    JPGSizeBytes;         // default = 0
  DWORD                    JPGWidth;             // default = 0
  DWORD                    JPGHeight;            // default = 0
  DWORD                    JPGChannels;          // default = 3
  IJL_COLOR                JPGColor;             // default = IJL_YCBCR
  IJL_JPGSUBSAMPLING       JPGSubsampling;       // default = IJL_411
  DWORD                    JPGThumbWidth;        // default = 0
  DWORD                    JPGThumbHeight;       // default = 0

  // JPEG conversion properties.
  DWORD                    cconversion_reqd;     // default = TRUE
  DWORD                    upsampling_reqd;      // default = TRUE
  DWORD                    jquality;             // default = 75
  DWORD                    jinterleaveType;      // default = 0
  DWORD                    numxMCUs;             // default = 0
  DWORD                    numyMCUs;             // default = 0

  // Tables.
  DWORD                    nqtables;
  DWORD                    maxquantindex;
  DWORD                    nhuffActables;
  DWORD                    nhuffDctables;
  DWORD                    maxhuffindex;

  QUANT_TABLE              jFmtQuant[4];
  HUFFMAN_TABLE            jFmtAcHuffman[4];
  HUFFMAN_TABLE            jFmtDcHuffman[4];

  short*                   jEncFmtQuant[4];
  HUFFMAN_TABLE*           jEncFmtAcHuffman[4];
  HUFFMAN_TABLE*           jEncFmtDcHuffman[4];

  // Allow user-defined tables.
  DWORD                    use_default_qtables;
  DWORD                    use_default_htables;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -