亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jdhuff.c

?? WinCE開發技巧與實例的配套源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * jdhuff.c
 *
 * Copyright (C) 1991-1997, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains Huffman entropy decoding routines.
 *
 * Much of the complexity here has to do with supporting input suspension.
 * If the data source module demands suspension, we want to be able to back
 * up to the start of the current MCU.  To do this, we copy state variables
 * into local working storage, and update them back to the permanent
 * storage only upon successful completion of an MCU.
 */

#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdhuff.h"		/* Declarations shared with jdphuff.c */


/*
 * Expanded entropy decoder object for Huffman decoding.
 *
 * The savable_state subrecord contains fields that change within an MCU,
 * but must not be updated permanently until we complete the MCU.
 */

typedef struct {
  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;

/* This macro is to work around compilers with missing or broken
 * structure assignment.  You'll need to fix this code if you have
 * such a compiler and you change MAX_COMPS_IN_SCAN.
 */

#ifndef NO_STRUCT_ASSIGN
#define ASSIGN_STATE(dest,src)  ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
#define ASSIGN_STATE(dest,src)  \
	((dest).last_dc_val[0] = (src).last_dc_val[0], \
	 (dest).last_dc_val[1] = (src).last_dc_val[1], \
	 (dest).last_dc_val[2] = (src).last_dc_val[2], \
	 (dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif


typedef struct {
  struct jpeg_entropy_decoder pub; /* public fields */

  /* These fields are loaded into local variables at start of each MCU.
   * In case of suspension, we exit WITHOUT updating them.
   */
  bitread_perm_state bitstate;	/* Bit buffer at start of MCU */
  savable_state saved;		/* Other state at start of MCU */

  /* These fields are NOT loaded into local working state. */
  unsigned int restarts_to_go;	/* MCUs left in this restart interval */

  /* Pointers to derived tables (these workspaces have image lifespan) */
  d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
  d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];

  /* Precalculated info set up by start_pass for use in decode_mcu: */

  /* Pointers to derived tables to be used for each block within an MCU */
  d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU];
  d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU];
  /* Whether we care about the DC and AC coefficient values for each block */
  boolean dc_needed[D_MAX_BLOCKS_IN_MCU];
  boolean ac_needed[D_MAX_BLOCKS_IN_MCU];
} huff_entropy_decoder;

typedef huff_entropy_decoder * huff_entropy_ptr;


/*
 * Initialize for a Huffman-compressed scan.
 */

METHODDEF(void)
start_pass_huff_decoder (j_decompress_ptr cinfo)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
  int ci, blkn, dctbl, actbl;
  jpeg_component_info * compptr;

  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   * This ought to be an error condition, but we make it a warning because
   * there are some baseline files out there with all zeroes in these bytes.
   */
  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
      cinfo->Ah != 0 || cinfo->Al != 0)
    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    dctbl = compptr->dc_tbl_no;
    actbl = compptr->ac_tbl_no;
    /* Compute derived values for Huffman tables */
    /* We may do this more than once for a table, but it's not expensive */
    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
			    & entropy->dc_derived_tbls[dctbl]);
    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
			    & entropy->ac_derived_tbls[actbl]);
    /* Initialize DC predictions to 0 */
    entropy->saved.last_dc_val[ci] = 0;
  }

  /* Precalculate decoding info for each block in an MCU of this scan */
  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    ci = cinfo->MCU_membership[blkn];
    compptr = cinfo->cur_comp_info[ci];
    /* Precalculate which table to use for each block */
    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
    /* Decide whether we really care about the coefficient values */
    if (compptr->component_needed) {
      entropy->dc_needed[blkn] = TRUE;
      /* we don't need the ACs if producing a 1/8th-size image */
      entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1);
    } else {
      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
    }
  }

  /* Initialize bitread state variables */
  entropy->bitstate.bits_left = 0;
  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  entropy->pub.insufficient_data = FALSE;

  /* Initialize restart counter */
  entropy->restarts_to_go = cinfo->restart_interval;
}


/*
 * Compute the derived values for a Huffman table.
 * This routine also performs some validation checks on the table.
 *
 * Note this is also used by jdphuff.c.
 */

GLOBAL(void)
jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
			 d_derived_tbl ** pdtbl)
{
  JHUFF_TBL *htbl;
  d_derived_tbl *dtbl;
  int p, i, l, si, numsymbols;
  int lookbits, ctr;
  char huffsize[257];
  unsigned int huffcode[257];
  unsigned int code;

  /* Note that huffsize[] and huffcode[] are filled in code-length order,
   * paralleling the order of the symbols themselves in htbl->huffval[].
   */

  /* Find the input Huffman table */
  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  htbl =
    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  if (htbl == NULL)
    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);

  /* Allocate a workspace if we haven't already done so. */
  if (*pdtbl == NULL)
    *pdtbl = (d_derived_tbl *)
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  SIZEOF(d_derived_tbl));
  dtbl = *pdtbl;
  dtbl->pub = htbl;		/* fill in back link */
  
  /* Figure C.1: make table of Huffman code length for each symbol */

  p = 0;
  for (l = 1; l <= 16; l++) {
    i = (int) htbl->bits[l];
    if (i < 0 || p + i > 256)	/* protect against table overrun */
      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
    while (i--)
      huffsize[p++] = (char) l;
  }
  huffsize[p] = 0;
  numsymbols = p;
  
  /* Figure C.2: generate the codes themselves */
  /* We also validate that the counts represent a legal Huffman code tree. */
  
  code = 0;
  si = huffsize[0];
  p = 0;
  while (huffsize[p]) {
    while (((int) huffsize[p]) == si) {
      huffcode[p++] = code;
      code++;
    }
    /* code is now 1 more than the last code used for codelength si; but
     * it must still fit in si bits, since no code is allowed to be all ones.
     */
    if (((INT32) code) >= (((INT32) 1) << si))
      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
    code <<= 1;
    si++;
  }

  /* Figure F.15: generate decoding tables for bit-sequential decoding */

  p = 0;
  for (l = 1; l <= 16; l++) {
    if (htbl->bits[l]) {
      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
       * minus the minimum code of length l
       */
      dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p];
      p += htbl->bits[l];
      dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
    } else {
      dtbl->maxcode[l] = -1;	/* -1 if no codes of this length */
    }
  }
  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */

  /* Compute lookahead tables to speed up decoding.
   * First we set all the table entries to 0, indicating "too long";
   * then we iterate through the Huffman codes that are short enough and
   * fill in all the entries that correspond to bit sequences starting
   * with that code.
   */

  MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));

  p = 0;
  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
    for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {
      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
      /* Generate left-justified code followed by all possible bit sequences */
      lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
      for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
	dtbl->look_nbits[lookbits] = l;
	dtbl->look_sym[lookbits] = htbl->huffval[p];
	lookbits++;
      }
    }
  }

  /* Validate symbols as being reasonable.
   * For AC tables, we make no check, but accept all byte values 0..255.
   * For DC tables, we require the symbols to be in range 0..15.
   * (Tighter bounds could be applied depending on the data depth and mode,
   * but this is sufficient to ensure safe decoding.)
   */
  if (isDC) {
    for (i = 0; i < numsymbols; i++) {
      int sym = htbl->huffval[i];
      if (sym < 0 || sym > 15)
	ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
    }
  }
}


/*
 * Out-of-line code for bit fetching (shared with jdphuff.c).
 * See jdhuff.h for info about usage.
 * Note: current values of get_buffer and bits_left are passed as parameters,
 * but are returned in the corresponding fields of the state struct.
 *
 * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width
 * of get_buffer to be used.  (On machines with wider words, an even larger
 * buffer could be used.)  However, on some machines 32-bit shifts are
 * quite slow and take time proportional to the number of places shifted.
 * (This is true with most PC compilers, for instance.)  In this case it may
 * be a win to set MIN_GET_BITS to the minimum value of 15.  This reduces the
 * average shift distance at the cost of more calls to jpeg_fill_bit_buffer.
 */

#ifdef SLOW_SHIFT_32
#define MIN_GET_BITS  15	/* minimum allowable value */
#else
#define MIN_GET_BITS  (BIT_BUF_SIZE-7)
#endif


GLOBAL(boolean)
jpeg_fill_bit_buffer (bitread_working_state * state,
		      register bit_buf_type get_buffer, register int bits_left,
		      int nbits)
/* Load up the bit buffer to a depth of at least nbits */
{
  /* Copy heavily used state fields into locals (hopefully registers) */
  register const JOCTET * next_input_byte = state->next_input_byte;
  register size_t bytes_in_buffer = state->bytes_in_buffer;
  j_decompress_ptr cinfo = state->cinfo;

  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
  /* (It is assumed that no request will be for more than that many bits.) */
  /* We fail to do so only if we hit a marker or are forced to suspend. */

  if (cinfo->unread_marker == 0) {	/* cannot advance past a marker */
    while (bits_left < MIN_GET_BITS) {
      register int c;

      /* Attempt to read a byte */
      if (bytes_in_buffer == 0) {
	if (! (*cinfo->src->fill_input_buffer) (cinfo))
	  return FALSE;
	next_input_byte = cinfo->src->next_input_byte;
	bytes_in_buffer = cinfo->src->bytes_in_buffer;
      }
      bytes_in_buffer--;
      c = GETJOCTET(*next_input_byte++);

      /* If it's 0xFF, check and discard stuffed zero byte */
      if (c == 0xFF) {
	/* Loop here to discard any padding FF's on terminating marker,
	 * so that we can save a valid unread_marker value.  NOTE: we will
	 * accept multiple FF's followed by a 0 as meaning a single FF data
	 * byte.  This data pattern is not valid according to the standard.
	 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久这里只有精品首页| 精品国产一区二区在线观看| 亚洲精选视频免费看| 99re成人精品视频| 亚洲一区二区三区视频在线播放| 欧美精品一卡两卡| 国产成人午夜高潮毛片| 亚洲精品久久久久久国产精华液| 欧美日韩精品综合在线| 国产精品影视在线| 亚洲精品免费视频| 久久精品视频在线免费观看| 色综合视频一区二区三区高清| 性感美女久久精品| 欧美激情资源网| 在线观看一区二区精品视频| 久色婷婷小香蕉久久| 一区二区三区四区视频精品免费| 欧美成人激情免费网| 欧洲生活片亚洲生活在线观看| 久久国产尿小便嘘嘘尿| 亚洲综合在线观看视频| 国产午夜精品理论片a级大结局| 欧美日韩在线播放三区| 国产凹凸在线观看一区二区| 亚洲国产精品影院| 亚洲天堂成人网| 欧美亚洲图片小说| 粉嫩嫩av羞羞动漫久久久| 日韩三级伦理片妻子的秘密按摩| 亚洲精品乱码久久久久久久久 | 7777精品伊人久久久大香线蕉的| 在线精品亚洲一区二区不卡| 欧美无人高清视频在线观看| 色狠狠一区二区| 成人性视频网站| 偷拍日韩校园综合在线| 亚洲精品一区二区三区蜜桃下载| 99久久99久久久精品齐齐| 成人免费看黄yyy456| 裸体健美xxxx欧美裸体表演| 7777精品久久久大香线蕉| 麻豆成人91精品二区三区| 中文av一区二区| 91在线一区二区| 久久日韩粉嫩一区二区三区 | 日韩免费观看2025年上映的电影| 久久国产乱子精品免费女| 欧美一区二区三区在线电影| 国产福利电影一区二区三区| 日韩美女精品在线| 欧美一区二区三区四区久久| 欧美日韩一区不卡| 337p亚洲精品色噜噜| 成人国产电影网| 床上的激情91.| 午夜影院在线观看欧美| 精品国产伦一区二区三区免费 | 国产成人精品一区二区三区四区| 一区二区三区.www| 91亚洲精品一区二区乱码| 一个色妞综合视频在线观看| 26uuu国产日韩综合| 97久久人人超碰| 久久精品国产亚洲aⅴ | 日韩欧美一区在线观看| 久久精品国产精品亚洲红杏| 日韩一级免费一区| 色美美综合视频| 亚洲成人在线免费| 日韩精品欧美成人高清一区二区| 亚洲成人av电影| 美女脱光内衣内裤视频久久网站 | 五月天久久比比资源色| 最新国产精品久久精品| 久久精品欧美一区二区三区不卡| 国产欧美日韩视频在线观看| 中文字幕成人在线观看| 亚洲人成电影网站色mp4| 亚洲在线成人精品| 午夜欧美视频在线观看| 亚洲h精品动漫在线观看| 亚洲国产成人av网| 日本不卡免费在线视频| 国产在线精品一区二区三区不卡 | 成人不卡免费av| 91国产福利在线| 欧美日韩国产大片| 日韩欧美国产wwwww| 久久久美女艺术照精彩视频福利播放| 国产精品女同一区二区三区| 亚洲自拍偷拍网站| 麻豆91在线观看| 国产九九视频一区二区三区| 成人av资源站| 在线看日韩精品电影| 日韩一二三区视频| 日韩欧美色综合网站| 中文在线免费一区三区高中清不卡| 亚洲啪啪综合av一区二区三区| 性做久久久久久免费观看| 精品午夜一区二区三区在线观看 | 丁香一区二区三区| 欧美日韩国产123区| 国产色产综合色产在线视频| 亚洲综合在线观看视频| 精品在线免费视频| 91在线视频播放地址| 欧美日韩视频一区二区| 91精品国产91久久久久久一区二区 | 亚洲bt欧美bt精品| 国产99久久久精品| 欧美日韩电影在线| 中文字幕av免费专区久久| 琪琪久久久久日韩精品| 91精品久久久久久久91蜜桃| 亚洲九九爱视频| 99精品在线观看视频| 中文字幕国产一区| 国产一区二区三区香蕉| 日韩欧美精品三级| 日韩激情一区二区| 欧美日韩一级片网站| 亚洲老司机在线| 一本大道综合伊人精品热热| 中文一区在线播放| 国产91精品精华液一区二区三区 | 久久色在线视频| 麻豆国产91在线播放| 欧美精品777| 丝袜亚洲另类欧美| 欧美喷潮久久久xxxxx| 五月天丁香久久| 欧美午夜精品一区| 亚洲国产精品一区二区久久| 97国产精品videossex| 国产精品久久久久精k8| 99国产欧美另类久久久精品| 国产精品免费网站在线观看| 北岛玲一区二区三区四区| 中文字幕欧美一区| 色婷婷综合久色| 一区二区三区免费| 欧美色涩在线第一页| 亚洲国产精品自拍| 欧美性极品少妇| 日韩综合一区二区| 日韩精品专区在线| 国产乱码精品一区二区三区忘忧草| 日韩欧美一级特黄在线播放| 韩国v欧美v亚洲v日本v| 久久久久国产免费免费| 成人精品视频一区| 一区二区三区高清不卡| 91.麻豆视频| 日本va欧美va精品| 久久久精品一品道一区| 国产91丝袜在线观看| 亚洲欧美视频一区| 欧美日韩综合不卡| 久热成人在线视频| 国产精品天干天干在观线| 91农村精品一区二区在线| 亚洲成人你懂的| 2欧美一区二区三区在线观看视频| 国产成人av电影在线| 亚洲精品自拍动漫在线| 欧美一卡二卡在线| 成人高清视频在线观看| 午夜激情一区二区| 久久精品日产第一区二区三区高清版| 99精品视频在线播放观看| 亚洲一区二区三区四区五区中文 | 亚洲另类在线视频| 欧美一级黄色大片| 99精品视频在线观看免费| 天堂久久一区二区三区| 久久―日本道色综合久久| 色狠狠综合天天综合综合| 久久精品久久久精品美女| 中文字幕一区日韩精品欧美| 91精品国产手机| 99久久er热在这里只有精品15 | 成人午夜精品在线| 亚洲午夜精品在线| 国产视频一区二区在线| 欧美日免费三级在线| 国产98色在线|日韩| 三级一区在线视频先锋| 国产精品视频你懂的| 在线播放国产精品二区一二区四区| 国产成人免费高清| 日韩电影在线观看一区| 亚洲男人的天堂一区二区| 欧美成人三级电影在线| 欧美三级视频在线播放| 国产成人精品亚洲午夜麻豆| 日本不卡的三区四区五区| 亚洲人成影院在线观看| 国产亚洲综合在线|