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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jchuff.c

?? EVM板JPEG實(shí)現(xiàn),Texas Instruments TMS320C54x EVM JPEG
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
 * jchuff.c
 *
 * Copyright (C) 1991, 1992, 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 encoding routines.
 * These routines are invoked via the methods entropy_encode,
 * entropy_encode_init/term, and entropy_optimize.
 */

/* Changes were made to this program by eliminating the error messages,
   because the SWDS does not suppot direct file i/o.  Christopher Chang
   Summer 1993.
*/

#include "jinclude.h"


/* Static variables to avoid passing 'round extra parameters */

static compress_info_ptr cinfo;

static INT32 huff_put_buffer;   /* current bit-accumulation buffer */
static int huff_put_bits;   /* # of bits now in it */

static char * output_buffer;    /* output buffer */
static int bytes_in_buffer;



LOCAL void
fix_huff_tbl (HUFF_TBL * htbl)
/* Compute derived values for a Huffman table */
{
  int p, i, l, lastp, si;
  char huffsize[257];
  UINT16 huffcode[257];
  UINT16 code;
  
  /* Figure C.1: make table of Huffman code length for each symbol */
  /* Note that this is in code-length order. */

  p = 0;
  for (l = 1; l <= 16; l++) {
	for (i = 1; i <= (int) htbl->bits[l]; i++)
	  huffsize[p++] = (char) l;
  }
  huffsize[p] = 0;
  lastp = p;
  
  /* Figure C.2: generate the codes themselves */
  /* Note that this is in code-length order. */
  
  code = 0;
  si = huffsize[0];
  p = 0;
  while (huffsize[p]) {
	while (((int) huffsize[p]) == si) {
	  huffcode[p++] = code;
	  code++;
	}
	code <<= 1;
	si++;
  }
  
  /* Figure C.3: generate encoding tables */
  /* These are code and size indexed by symbol value */

  /* Set any codeless symbols to have code length 0;
   * this allows emit_bits to detect any attempt to emit such symbols.
   */
  MEMZERO(htbl->ehufsi, SIZEOF(htbl->ehufsi));

  for (p = 0; p < lastp; p++) {
	htbl->ehufco[htbl->huffval[p]] = huffcode[p];
	htbl->ehufsi[htbl->huffval[p]] = huffsize[p];
  }
  
  /* We don't bother to fill in the decoding tables mincode[], maxcode[], */
  /* and valptr[], since they are not used for encoding. */
}


/* Outputting bytes to the file */

LOCAL void
flush_bytes (void)
{
  if (bytes_in_buffer)
	(*cinfo->methods->entropy_output) (cinfo, output_buffer, bytes_in_buffer);
  bytes_in_buffer = 0;
}


#define emit_byte(val)  \
  MAKESTMT( if (bytes_in_buffer >= JPEG_BUF_SIZE) \
		  flush_bytes(); \
		output_buffer[bytes_in_buffer++] = (char) (val); )



/* Outputting bits to the file */

/* Only the right 24 bits of huff_put_buffer are used; the valid bits are
 * left-justified in this part.  At most 16 bits can be passed to emit_bits
 * in one call, and we never retain more than 7 bits in huff_put_buffer
 * between calls, so 24 bits are sufficient.
 */

INLINE
LOCAL void
emit_bits (UINT16 code, int size)
{
  /* This routine is heavily used, so it's worth coding tightly. */
  register INT32 put_buffer = code;
  register int put_bits = huff_put_bits;

  /* if size is 0, caller used an invalid Huffman table entry */

/*************************DID NOT SUPPORT THIS ERROR**********************  
  if (size == 0)                       
	ERREXIT(cinfo->emethods);
		(cinfo->emethods, "Missing Huffman code table entry");
**************************************************************************/
																		 
  put_buffer &= (((INT32) 1) << size) - 1; /* Mask off any excess bits in code */
  
  put_bits += size;     /* new number of bits in buffer */
  
  put_buffer <<= 24 - put_bits; /* align incoming bits */

  put_buffer |= huff_put_buffer; /* and merge with old buffer contents */
  
  while (put_bits >= 8) {
	int c = (int) ((put_buffer >> 16) & 0xFF);
	
	emit_byte(c);
	if (c == 0xFF) {        /* need to stuff a zero byte? */
	  emit_byte(0);
	}
	put_buffer <<= 8;
	put_bits -= 8;
  }

  huff_put_buffer = put_buffer; /* Update global variables */
  huff_put_bits = put_bits;
}


LOCAL void
flush_bits (void)
{
  emit_bits((UINT16) 0x7F, 7);  /* fill any partial byte with ones */
  huff_put_buffer = 0;      /* and reset bit-buffer to empty */
  huff_put_bits = 0;
}



/* Encode a single block's worth of coefficients */
/* Note that the DC coefficient has already been converted to a difference */

LOCAL void
encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl)
{
  register int temp, temp2;
  register int nbits;
  register int k, r, i;
  
  /* Encode the DC coefficient difference per section F.1.2.1 */
  
  temp = temp2 = block[0];

  if (temp < 0) {
	temp = -temp;       /* temp is abs value of input */
	/* For a negative input, want temp2 = bitwise complement of abs(input) */
	/* This code assumes we are on a two's complement machine */
	temp2--;
  }
  
  /* Find the number of bits needed for the magnitude of the coefficient */
  nbits = 0;
  while (temp) {
	nbits++;
	temp >>= 1;
  }
  
  /* Emit the Huffman-coded symbol for the number of bits */
  emit_bits(dctbl->ehufco[nbits], dctbl->ehufsi[nbits]);

  /* Emit that number of bits of the value, if positive, */
  /* or the complement of its magnitude, if negative. */
  if (nbits)            /* emit_bits rejects calls with size 0 */
	emit_bits((UINT16) temp2, nbits);
  
  /* Encode the AC coefficients per section F.1.2.2 */
  
  r = 0;            /* r = run length of zeros */
  
  for (k = 1; k < DCTSIZE2; k++) {
	if ((temp = block[k]) == 0) {
	  r++;
	} else {
	  /* if run length > 15, must emit special run-length-16 codes (0xF0) */
	  while (r > 15) {
	emit_bits(actbl->ehufco[0xF0], actbl->ehufsi[0xF0]);
	r -= 16;
	  }

	  temp2 = temp;
	  if (temp < 0) {
	temp = -temp;       /* temp is abs value of input */
	/* This code assumes we are on a two's complement machine */
	temp2--;
	  }
	  
	  /* Find the number of bits needed for the magnitude of the coefficient */
	  nbits = 1;        /* there must be at least one 1 bit */
	  while (temp >>= 1)
	nbits++;
	  
	  /* Emit Huffman symbol for run length / number of bits */
	  i = (r << 4) + nbits;
	  emit_bits(actbl->ehufco[i], actbl->ehufsi[i]);
	  
	  /* Emit that number of bits of the value, if positive, */
	  /* or the complement of its magnitude, if negative. */
	  emit_bits((UINT16) temp2, nbits);
	  
	  r = 0;
	}
  }

  /* If the last coef(s) were zero, emit an end-of-block code */
  if (r > 0)
	emit_bits(actbl->ehufco[0], actbl->ehufsi[0]);
}



/*
 * Initialize for a Huffman-compressed scan.
 * This is invoked after writing the SOS marker.
 * The pipeline controller must establish the entropy_output method pointer
 * before calling this routine.
 */

METHODDEF void
huff_init (compress_info_ptr xinfo)
{
  short ci;
  jpeg_component_info * compptr;

  /* Initialize static variables */
  cinfo = xinfo;
  huff_put_buffer = 0;
  huff_put_bits = 0;

  /* Initialize the output buffer */
  output_buffer = (char *) (*cinfo->emethods->alloc_small)
				((size_t) JPEG_BUF_SIZE);
  bytes_in_buffer = 0;

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
	compptr = cinfo->cur_comp_info[ci];
	/* Make sure requested tables are present */

/*******************DID NOT SUPPORT THIS ERROR MESSAGE********************
if (cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no] == NULL ||
	cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no] == NULL)
	ERREXIT(cinfo->emethods);  
***************************************************************************/      

	  /*(cinfo->emethods, "Use of undefined Huffman table");*/
	/* Compute derived values for Huffman tables */
	/* We may do this more than once for same table, but it's not a big deal */
	fix_huff_tbl(cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no]);
	fix_huff_tbl(cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]);
	/* Initialize DC predictions to 0 */
	cinfo->last_dc_val[ci] = 0;
  }

  /* Initialize restart stuff */
  cinfo->restarts_to_go = cinfo->restart_interval;
  cinfo->next_restart_num = 0;
}


/*
 * Emit a restart marker & resynchronize predictions.
 */

LOCAL void
emit_restart (compress_info_ptr cinfo)
{
  short ci;

  flush_bits();

  emit_byte(0xFF);
  emit_byte(RST0 + cinfo->next_restart_num);

  /* Re-initialize DC predictions to 0 */
  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
	cinfo->last_dc_val[ci] = 0;

  /* Update restart state */
  cinfo->restarts_to_go = cinfo->restart_interval;
  cinfo->next_restart_num++;
  cinfo->next_restart_num &= 7;
}


/*
 * Encode and output one MCU's worth of Huffman-compressed coefficients.
 */

METHODDEF void
huff_encode (compress_info_ptr cinfo, JBLOCK *MCU_data)
{
  short blkn, ci;
  jpeg_component_info * compptr;
  JCOEF temp;

  /* Account for restart interval, emit restart marker if needed */
  if (cinfo->restart_interval) {
	if (cinfo->restarts_to_go == 0)
	  emit_restart(cinfo);
	cinfo->restarts_to_go--;
  }

  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
	ci = cinfo->MCU_membership[blkn];
	compptr = cinfo->cur_comp_info[ci];
	/* Convert DC value to difference, update last_dc_val */
	temp = MCU_data[blkn][0];
	MCU_data[blkn][0] -= cinfo->last_dc_val[ci];
	cinfo->last_dc_val[ci] = temp;
	encode_one_block(MCU_data[blkn],
			 cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no],
			 cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]);
  }
}


/*
 * Finish up at the end of a Huffman-compressed scan.
 */

METHODDEF void
huff_term (compress_info_ptr cinfo)
{
  /* Flush out the last data */
  flush_bits();
  flush_bytes();
  /* Release the I/O buffer */
  (*cinfo->emethods->free_small) ((void *) output_buffer);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲在线视频网站| 欧美日韩aaaaa| 国产三级久久久| av在线一区二区三区| 亚洲自拍都市欧美小说| 欧美激情综合在线| 欧美日韩情趣电影| 国产高清一区日本| 亚洲一区二三区| 亚洲成av人片在线观看| 久久久.com| 69成人精品免费视频| 成人黄色国产精品网站大全在线免费观看 | 亚洲同性同志一二三专区| 欧美日韩免费电影| 在线不卡中文字幕播放| 色综合激情久久| 国产精品小仙女| 男女男精品视频网| 亚洲一二三区在线观看| 国产精品久久久久久久久快鸭| 日韩亚洲欧美一区二区三区| 91视频www| 福利91精品一区二区三区| 免费在线视频一区| 国产精品一区二区在线播放| av一区二区三区黑人| 欧美乱妇15p| 久久久午夜精品理论片中文字幕| 欧美精品精品一区| 久久久精品天堂| 亚洲黄色在线视频| 自拍av一区二区三区| 亚洲第一搞黄网站| 国产一区二区0| 国内精品不卡在线| 国产毛片一区二区| 一本色道综合亚洲| 欧美成人aa大片| 久久久久久久久久久电影| 最新热久久免费视频| 亚洲欧美激情在线| 亚洲精品视频在线看| 另类专区欧美蜜桃臀第一页| 琪琪一区二区三区| 成人ar影院免费观看视频| 91精品国产麻豆国产自产在线 | 日韩视频免费直播| 亚洲视频在线一区| 国产精品综合视频| 在线综合亚洲欧美在线视频| 国产精品久久影院| 经典三级视频一区| 成人黄色综合网站| 久久婷婷综合激情| 中文字幕精品综合| 久草中文综合在线| 欧美精品亚洲二区| 亚洲一区二区三区三| 成人av资源下载| 久久九九久精品国产免费直播| 日韩电影网1区2区| 国产不卡视频在线观看| 日韩欧美的一区二区| 国产三级精品视频| 久久99国产精品麻豆| 欧美日韩一区二区三区四区| 亚洲欧美经典视频| 色婷婷综合久久| 亚洲天堂福利av| zzijzzij亚洲日本少妇熟睡| 久久久噜噜噜久久中文字幕色伊伊| 七七婷婷婷婷精品国产| 欧美高清精品3d| 日韩精品一级中文字幕精品视频免费观看| 日韩不卡一二三区| 91麻豆精品国产91久久久资源速度 | 国产高清精品网站| 久久久久国产精品人| 国产在线不卡一区| 国产日韩欧美精品一区| 国产91精品精华液一区二区三区 | 国产拍揄自揄精品视频麻豆| 国产在线精品一区二区夜色| 精品国产三级电影在线观看| 中文字幕佐山爱一区二区免费| 粉嫩嫩av羞羞动漫久久久| 欧美经典一区二区三区| 盗摄精品av一区二区三区| 日韩一区二区在线免费观看| 奇米四色…亚洲| 欧美电影免费观看完整版| 国产一区二区在线免费观看| 国产精品福利影院| 欧洲一区二区三区免费视频| 国产精品久久看| 91黄色激情网站| 中文字幕一区二区三| 91小视频免费观看| 日韩成人一级大片| 久久理论电影网| 99精品国产热久久91蜜凸| 国产三级精品视频| 在线观看亚洲精品视频| 亚洲sss视频在线视频| 日韩精品一区二区三区视频播放| 国产成人在线看| 亚洲精品国产视频| 日韩欧美第一区| 一本色道久久综合狠狠躁的推荐 | 99视频国产精品| 日韩黄色片在线观看| 久久久久久夜精品精品免费| av一区二区三区| 加勒比av一区二区| 一区二区三区在线观看视频| 99免费精品在线观看| 青青国产91久久久久久| 国产精品网站一区| 99精品在线观看视频| 日本在线不卡视频| 亚洲日本护士毛茸茸| 日韩精品一区二区三区三区免费 | 亚洲成a人v欧美综合天堂| 久久日韩精品一区二区五区| 欧美探花视频资源| 首页国产欧美日韩丝袜| 欧美高清在线精品一区| 91麻豆精品国产91久久久资源速度| 成人av电影在线| 久久精品国产一区二区三区免费看| 国产精品久久久久久久久动漫| 欧美乱妇15p| 日本韩国欧美在线| 成人久久18免费网站麻豆 | 国产精品久久三| xnxx国产精品| 欧美一二三区在线观看| 日本丶国产丶欧美色综合| 成人免费高清在线| 国产精品亚洲午夜一区二区三区 | 精品一二三四在线| 丝袜美腿亚洲色图| 亚洲一卡二卡三卡四卡| 亚洲激情中文1区| 国产精品国产三级国产aⅴ原创| 精品1区2区在线观看| 日韩西西人体444www| 欧美一区二区视频在线观看2020| 在线观看www91| 欧美影院精品一区| 欧美日韩一区高清| 欧美乱妇15p| 欧美一区二区人人喊爽| 日韩一区二区三区视频在线| 欧美一区二区女人| 精品99久久久久久| 国产视频亚洲色图| 中文字幕中文乱码欧美一区二区| 欧美国产一区视频在线观看| 国产欧美精品一区二区三区四区| 国产欧美视频一区二区| 首页欧美精品中文字幕| 午夜精品一区在线观看| 国产亚洲制服色| 国产精品丝袜在线| 亚洲美女免费在线| 手机精品视频在线观看| 久久99热狠狠色一区二区| 精品一区二区在线免费观看| 国产成人激情av| 91香蕉视频在线| 7777精品久久久大香线蕉| 欧美精品一区二区三区久久久| 2024国产精品| 最新国产の精品合集bt伙计| 亚洲图片有声小说| 精品系列免费在线观看| 99久久精品国产毛片| 欧美人xxxx| 国产日产欧美一区二区视频| 亚洲视频在线一区| 久久国产精品区| 成人不卡免费av| 欧美色综合久久| 久久这里只有精品视频网| 中文字幕一区二区在线观看| 午夜欧美在线一二页| 国产精品一区专区| 欧美性猛交xxxx乱大交退制版| 日韩一区二区三区电影| 综合久久久久综合| 蜜桃91丨九色丨蝌蚪91桃色| 在线精品视频一区二区三四| 91精品国产品国语在线不卡| 国产精品人妖ts系列视频| 天堂一区二区在线| 成人av电影在线观看| 欧美成人伊人久久综合网| 亚洲男女一区二区三区|