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

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

?? wrgif.c

?? 這是JPEG解碼、編碼的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * wrgif.c
 *
 * Copyright (C) 1991-1996, 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.
 *
 **************************************************************************
 * WARNING: You will need an LZW patent license from Unisys in order to   *
 * use this file legally in any commercial or shareware application.      *
 **************************************************************************
 *
 * This file contains routines to write output images in GIF format.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume output to
 * an ordinary stdio stream.
 */

/*
 * This code is loosely based on ppmtogif from the PBMPLUS distribution
 * of Feb. 1991.  That file contains the following copyright notice:
 *    Based on GIFENCODE by David Rowley <mgardi@watdscu.waterloo.edu>.
 *    Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al.
 *    Copyright (C) 1989 by Jef Poskanzer.
 *    Permission to use, copy, modify, and distribute this software and its
 *    documentation for any purpose and without fee is hereby granted, provided
 *    that the above copyright notice appear in all copies and that both that
 *    copyright notice and this permission notice appear in supporting
 *    documentation.  This software is provided "as is" without express or
 *    implied warranty.
 *
 * We are also required to state that
 *    "The Graphics Interchange Format(c) is the Copyright property of
 *    CompuServe Incorporated. GIF(sm) is a Service Mark property of
 *    CompuServe Incorporated."
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

#ifdef GIF_SUPPORTED


#define	MAX_LZW_BITS	12	/* maximum LZW code size (4096 symbols) */

typedef INT16 code_int;		/* must hold -1 .. 2**MAX_LZW_BITS */

#define LZW_TABLE_SIZE	((code_int) 1 << MAX_LZW_BITS)

#define HSIZE		5003	/* hash table size for 80% occupancy */

typedef int hash_int;		/* must hold -2*HSIZE..2*HSIZE */

#define MAXCODE(n_bits)	(((code_int) 1 << (n_bits)) - 1)


/*
 * The LZW hash table consists of two parallel arrays:
 *   hash_code[i]	code of symbol in slot i, or 0 if empty slot
 *   hash_value[i]	symbol's value; undefined if empty slot
 * where slot values (i) range from 0 to HSIZE-1.  The symbol value is
 * its prefix symbol's code concatenated with its suffix character.
 *
 * Algorithm:  use open addressing double hashing (no chaining) on the
 * prefix code / suffix character combination.  We do a variant of Knuth's
 * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
 * secondary probe.
 *
 * The hash_value[] table is allocated from FAR heap space since it would
 * use up rather a lot of the near data space in a PC.
 */

typedef INT32 hash_entry;	/* must hold (code_int<<8) | byte */

#define HASH_ENTRY(prefix,suffix)  ((((hash_entry) (prefix)) << 8) | (suffix))


/* Private version of data destination object */

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

  j_decompress_ptr cinfo;	/* back link saves passing separate parm */

  /* State for packing variable-width codes into a bitstream */
  int n_bits;			/* current number of bits/code */
  code_int maxcode;		/* maximum code, given n_bits */
  int init_bits;		/* initial n_bits ... restored after clear */
  INT32 cur_accum;		/* holds bits not yet output */
  int cur_bits;			/* # of bits in cur_accum */

  /* LZW string construction */
  code_int waiting_code;	/* symbol not yet output; may be extendable */
  boolean first_byte;		/* if TRUE, waiting_code is not valid */

  /* State for LZW code assignment */
  code_int ClearCode;		/* clear code (doesn't change) */
  code_int EOFCode;		/* EOF code (ditto) */
  code_int free_code;		/* first not-yet-used symbol code */

  /* LZW hash table */
  code_int *hash_code;		/* => hash table of symbol codes */
  hash_entry FAR *hash_value;	/* => hash table of symbol values */

  /* GIF data packet construction buffer */
  int bytesinpkt;		/* # of bytes in current packet */
  char packetbuf[256];		/* workspace for accumulating packet */

} gif_dest_struct;

typedef gif_dest_struct * gif_dest_ptr;


/*
 * Routines to package compressed data bytes into GIF data blocks.
 * A data block consists of a count byte (1..255) and that many data bytes.
 */

LOCAL(void)
flush_packet (gif_dest_ptr dinfo)
/* flush any accumulated data */
{
  if (dinfo->bytesinpkt > 0) {	/* never write zero-length packet */
    dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++;
    if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt)
	!= (size_t) dinfo->bytesinpkt)
      ERREXIT(dinfo->cinfo, JERR_FILE_WRITE);
    dinfo->bytesinpkt = 0;
  }
}


/* Add a character to current packet; flush to disk if necessary */
#define CHAR_OUT(dinfo,c)  \
	{ (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c);  \
	    if ((dinfo)->bytesinpkt >= 255)  \
	      flush_packet(dinfo);  \
	}


/* Routine to convert variable-width codes into a byte stream */

LOCAL(void)
output (gif_dest_ptr dinfo, code_int code)
/* Emit a code of n_bits bits */
/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */
{
  dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits;
  dinfo->cur_bits += dinfo->n_bits;

  while (dinfo->cur_bits >= 8) {
    CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF);
    dinfo->cur_accum >>= 8;
    dinfo->cur_bits -= 8;
  }

  /*
   * If the next entry is going to be too big for the code size,
   * then increase it, if possible.  We do this here to ensure
   * that it's done in sync with the decoder's codesize increases.
   */
  if (dinfo->free_code > dinfo->maxcode) {
    dinfo->n_bits++;
    if (dinfo->n_bits == MAX_LZW_BITS)
      dinfo->maxcode = LZW_TABLE_SIZE; /* free_code will never exceed this */
    else
      dinfo->maxcode = MAXCODE(dinfo->n_bits);
  }
}


/* The LZW algorithm proper */


LOCAL(void)
clear_hash (gif_dest_ptr dinfo)
/* Fill the hash table with empty entries */
{
  /* It's sufficient to zero hash_code[] */
  MEMZERO(dinfo->hash_code, HSIZE * SIZEOF(code_int));
}


LOCAL(void)
clear_block (gif_dest_ptr dinfo)
/* Reset compressor and issue a Clear code */
{
  clear_hash(dinfo);			/* delete all the symbols */
  dinfo->free_code = dinfo->ClearCode + 2;
  output(dinfo, dinfo->ClearCode);	/* inform decoder */
  dinfo->n_bits = dinfo->init_bits;	/* reset code size */
  dinfo->maxcode = MAXCODE(dinfo->n_bits);
}


LOCAL(void)
compress_init (gif_dest_ptr dinfo, int i_bits)
/* Initialize LZW compressor */
{
  /* init all the state variables */
  dinfo->n_bits = dinfo->init_bits = i_bits;
  dinfo->maxcode = MAXCODE(dinfo->n_bits);
  dinfo->ClearCode = ((code_int) 1 << (i_bits - 1));
  dinfo->EOFCode = dinfo->ClearCode + 1;
  dinfo->free_code = dinfo->ClearCode + 2;
  dinfo->first_byte = TRUE;	/* no waiting symbol yet */
  /* init output buffering vars */
  dinfo->bytesinpkt = 0;
  dinfo->cur_accum = 0;
  dinfo->cur_bits = 0;
  /* clear hash table */
  clear_hash(dinfo);
  /* GIF specifies an initial Clear code */
  output(dinfo, dinfo->ClearCode);
}


LOCAL(void)
compress_byte (gif_dest_ptr dinfo, int c)
/* Accept and compress one 8-bit byte */
{
  register hash_int i;
  register hash_int disp;
  register hash_entry probe_value;

  if (dinfo->first_byte) {	/* need to initialize waiting_code */
    dinfo->waiting_code = c;
    dinfo->first_byte = FALSE;
    return;
  }

  /* Probe hash table to see if a symbol exists for
   * waiting_code followed by c.
   * If so, replace waiting_code by that symbol and return.
   */
  i = ((hash_int) c << (MAX_LZW_BITS-8)) + dinfo->waiting_code;
  /* i is less than twice 2**MAX_LZW_BITS, therefore less than twice HSIZE */
  if (i >= HSIZE)
    i -= HSIZE;

  probe_value = HASH_ENTRY(dinfo->waiting_code, c);
  
  if (dinfo->hash_code[i] != 0) { /* is first probed slot empty? */
    if (dinfo->hash_value[i] == probe_value) {
      dinfo->waiting_code = dinfo->hash_code[i];
      return;
    }
    if (i == 0)			/* secondary hash (after G. Knott) */
      disp = 1;
    else
      disp = HSIZE - i;
    for (;;) {
      i -= disp;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩人成在线播放| 国产三级久久久| 成人精品电影在线观看| 男男成人高潮片免费网站| 亚洲一区二区三区免费视频| 亚洲欧美国产三级| 亚洲图片欧美综合| 亚洲电影一级片| 午夜精品久久久久久久| 日韩成人av影视| 日韩成人免费电影| 精品一区在线看| 久久精品99久久久| 国产精品12区| 不卡一区二区中文字幕| 在线免费不卡视频| 欧美喷水一区二区| 日韩一区二区精品在线观看| 欧美一卡2卡3卡4卡| 欧美大肚乱孕交hd孕妇| 欧美精品一区二区三| 日本一区二区不卡视频| 亚洲欧美日韩在线播放| 日韩高清一级片| 国产精品亚洲а∨天堂免在线| 成人丝袜18视频在线观看| fc2成人免费人成在线观看播放 | 手机精品视频在线观看| 午夜精品一区二区三区电影天堂 | 2024国产精品| 中文一区一区三区高中清不卡| 最新日韩av在线| 日韩中文字幕1| 国产成人精品1024| 欧美蜜桃一区二区三区| 久久久噜噜噜久久中文字幕色伊伊| 中文字幕一区二区三区色视频| 亚洲电影一区二区三区| 极品尤物av久久免费看| 欧洲亚洲国产日韩| 久久影院视频免费| 一区二区三区中文在线| 九九视频精品免费| 欧美日韩视频不卡| 国产精品久久久久久久久动漫| 亚洲.国产.中文慕字在线| 国产成人精品综合在线观看| 欧美二区乱c少妇| 国产精品无遮挡| 理论片日本一区| 色菇凉天天综合网| 国产日韩精品久久久| 日本aⅴ亚洲精品中文乱码| 99re亚洲国产精品| 欧美精品一区二区在线播放| 午夜影院久久久| 91视频国产资源| 国产嫩草影院久久久久| 精品亚洲成av人在线观看| 欧美三级三级三级爽爽爽| 国产精品伦理在线| 国产精品白丝jk白祙喷水网站| 欧美日韩大陆一区二区| 亚洲精品乱码久久久久久黑人| 成人中文字幕在线| 26uuu久久综合| 日韩国产欧美三级| 欧美性欧美巨大黑白大战| 国产精品灌醉下药二区| 国产精品1区2区3区在线观看| 日韩三级高清在线| 日产国产欧美视频一区精品| 欧美三级视频在线观看| 亚洲精品国产a久久久久久| 99vv1com这只有精品| 国产精品美女久久久久久久| 国产福利不卡视频| 国产精品网站导航| 成人ar影院免费观看视频| 国产精品网友自拍| 成人国产精品免费观看| 国产精品素人视频| 成人高清av在线| 国产精品国产三级国产专播品爱网| 国产成人精品一区二区三区四区 | 国产精品久久久久久久久免费桃花 | 精品一区二区三区久久久| 91精品国产入口在线| 日本不卡不码高清免费观看| 日韩一区二区三区四区| 国产一区二区女| 国产精品日日摸夜夜摸av| 91捆绑美女网站| 亚洲麻豆国产自偷在线| 欧美日韩国产首页在线观看| 秋霞影院一区二区| 亚洲精品在线电影| 成人动漫精品一区二区| 亚洲女子a中天字幕| 欧美日韩一区二区三区不卡| 免费成人小视频| 中文字幕精品一区二区三区精品 | 亚洲欧洲美洲综合色网| 在线观看欧美日本| 日本va欧美va欧美va精品| 国产日韩影视精品| 日本道在线观看一区二区| 久热成人在线视频| 国产女人aaa级久久久级| 欧美在线你懂得| 国产米奇在线777精品观看| 最新日韩av在线| 日韩视频一区二区| 99re8在线精品视频免费播放| 午夜精品123| 国产日本亚洲高清| 欧美日韩亚州综合| 国产一区二区免费在线| 亚洲一区二区黄色| 欧美激情一区三区| 制服丝袜av成人在线看| 国产高清成人在线| 丝袜a∨在线一区二区三区不卡| 久久久99免费| 在线播放国产精品二区一二区四区| 国产精品1区2区3区在线观看| 亚洲v中文字幕| 亚洲欧洲日产国产综合网| 久久伊99综合婷婷久久伊| 欧美日韩国产美女| www.久久久久久久久| 日本系列欧美系列| 亚洲综合在线免费观看| 久久精品人人做人人爽97| 91麻豆精品国产| 在线观看视频91| eeuss鲁片一区二区三区| 国产综合色精品一区二区三区| 性做久久久久久久免费看| 亚洲色欲色欲www在线观看| 久久久精品免费网站| 欧美成人vps| 欧美一区二区三区性视频| 欧美色视频一区| 欧美亚洲国产bt| 91成人免费电影| aaa国产一区| 成人晚上爱看视频| 成人福利电影精品一区二区在线观看| 精品午夜一区二区三区在线观看| 日产国产欧美视频一区精品| 天天综合色天天综合色h| 亚洲已满18点击进入久久| 一区二区三区在线免费视频| 亚洲女同一区二区| 一区二区不卡在线播放| 一区二区三区欧美久久| 一区二区三区中文在线| 一区二区三区加勒比av| 亚洲在线观看免费视频| 亚洲一区二区三区四区五区中文 | 青青青伊人色综合久久| 日韩av成人高清| 精品写真视频在线观看| 国产一区二区美女诱惑| 国模娜娜一区二区三区| 粉嫩高潮美女一区二区三区| 国产高清亚洲一区| 99国产精品久久久久久久久久| 日本道色综合久久| 欧美日韩免费电影| 日韩欧美一级二级三级| 久久九九影视网| 亚洲另类色综合网站| 午夜伦欧美伦电影理论片| 日韩av电影一区| 国产精品一区二区三区乱码| 国产成人av一区| 欧美视频你懂的| 91精品婷婷国产综合久久竹菊| 亚洲精品一区二区三区蜜桃下载| 中文字幕第一区综合| 亚洲在线视频一区| 麻豆精品视频在线观看免费| 国产99久久久国产精品潘金网站| 菠萝蜜视频在线观看一区| 欧美撒尿777hd撒尿| 欧美岛国在线观看| 中文字幕一区二区三区四区| 日韩精品一二区| 成人av网址在线观看| 7777精品伊人久久久大香线蕉的 | 丝袜脚交一区二区| 成人性生交大片免费看在线播放 | 国产成人精品影视| 欧美三日本三级三级在线播放| 久久这里只有精品首页| 夜夜嗨av一区二区三区网页| 韩国女主播成人在线观看| 色婷婷激情久久|