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

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

?? rdcolmap.c

?? 這是JPEG解碼、編碼的源代碼
?? C
字號:
/*
 * rdcolmap.c
 *
 * Copyright (C) 1994-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.
 *
 * This file implements djpeg's "-map file" switch.  It reads a source image
 * and constructs a colormap to be supplied to the JPEG decompressor.
 *
 * Currently, these file formats are supported for the map file:
 *   GIF: the contents of the GIF's global colormap are used.
 *   PPM (either text or raw flavor): the entire file is read and
 *      each unique pixel value is entered in the map.
 * Note that reading a large PPM file will be horrendously slow.
 * Typically, a PPM-format map file should contain just one pixel
 * of each desired color.  Such a file can be extracted from an
 * ordinary image PPM file with ppmtomap(1).
 *
 * Rescaling a PPM that has a maxval unequal to MAXJSAMPLE is not
 * currently implemented.
 */

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

#ifdef QUANT_2PASS_SUPPORTED	/* otherwise can't quantize to supplied map */

/* Portions of this code are based on the PBMPLUS library, which is:
**
** Copyright (C) 1988 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.
*/


/*
 * Add a (potentially) new color to the color map.
 */

LOCAL(void)
add_map_entry (j_decompress_ptr cinfo, int R, int G, int B)
{
  JSAMPROW colormap0 = cinfo->colormap[0];
  JSAMPROW colormap1 = cinfo->colormap[1];
  JSAMPROW colormap2 = cinfo->colormap[2];
  int ncolors = cinfo->actual_number_of_colors;
  int index;

  /* Check for duplicate color. */
  for (index = 0; index < ncolors; index++) {
    if (GETJSAMPLE(colormap0[index]) == R &&
	GETJSAMPLE(colormap1[index]) == G &&
	GETJSAMPLE(colormap2[index]) == B)
      return;			/* color is already in map */
  }

  /* Check for map overflow. */
  if (ncolors >= (MAXJSAMPLE+1))
    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, (MAXJSAMPLE+1));

  /* OK, add color to map. */
  colormap0[ncolors] = (JSAMPLE) R;
  colormap1[ncolors] = (JSAMPLE) G;
  colormap2[ncolors] = (JSAMPLE) B;
  cinfo->actual_number_of_colors++;
}


/*
 * Extract color map from a GIF file.
 */

LOCAL(void)
read_gif_map (j_decompress_ptr cinfo, FILE * infile)
{
  int header[13];
  int i, colormaplen;
  int R, G, B;

  /* Initial 'G' has already been read by read_color_map */
  /* Read the rest of the GIF header and logical screen descriptor */
  for (i = 1; i < 13; i++) {
    if ((header[i] = getc(infile)) == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
  }

  /* Verify GIF Header */
  if (header[1] != 'I' || header[2] != 'F')
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* There must be a global color map. */
  if ((header[10] & 0x80) == 0)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* OK, fetch it. */
  colormaplen = 2 << (header[10] & 0x07);

  for (i = 0; i < colormaplen; i++) {
    R = getc(infile);
    G = getc(infile);
    B = getc(infile);
    if (R == EOF || G == EOF || B == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    add_map_entry(cinfo,
		  R << (BITS_IN_JSAMPLE-8),
		  G << (BITS_IN_JSAMPLE-8),
		  B << (BITS_IN_JSAMPLE-8));
  }
}


/* Support routines for reading PPM */


LOCAL(int)
pbm_getc (FILE * infile)
/* Read next char, skipping over any comments */
/* A comment/newline sequence is returned as a newline */
{
  register int ch;
  
  ch = getc(infile);
  if (ch == '#') {
    do {
      ch = getc(infile);
    } while (ch != '\n' && ch != EOF);
  }
  return ch;
}


LOCAL(unsigned int)
read_pbm_integer (j_decompress_ptr cinfo, FILE * infile)
/* Read an unsigned decimal integer from the PPM file */
/* Swallows one trailing character after the integer */
/* Note that on a 16-bit-int machine, only values up to 64k can be read. */
/* This should not be a problem in practice. */
{
  register int ch;
  register unsigned int val;
  
  /* Skip any leading whitespace */
  do {
    ch = pbm_getc(infile);
    if (ch == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
  } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
  
  if (ch < '0' || ch > '9')
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
  
  val = ch - '0';
  while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
    val *= 10;
    val += ch - '0';
  }
  return val;
}


/*
 * Extract color map from a PPM file.
 */

LOCAL(void)
read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
{
  int c;
  unsigned int w, h, maxval, row, col;
  int R, G, B;

  /* Initial 'P' has already been read by read_color_map */
  c = getc(infile);		/* save format discriminator for a sec */

  /* while we fetch the remaining header info */
  w = read_pbm_integer(cinfo, infile);
  h = read_pbm_integer(cinfo, infile);
  maxval = read_pbm_integer(cinfo, infile);

  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* For now, we don't support rescaling from an unusual maxval. */
  if (maxval != (unsigned int) MAXJSAMPLE)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  switch (c) {
  case '3':			/* it's a text-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = read_pbm_integer(cinfo, infile);
	G = read_pbm_integer(cinfo, infile);
	B = read_pbm_integer(cinfo, infile);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  case '6':			/* it's a raw-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = pbm_getc(infile);
	G = pbm_getc(infile);
	B = pbm_getc(infile);
	if (R == EOF || G == EOF || B == EOF)
	  ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  default:
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    break;
  }
}


/*
 * Main entry point from djpeg.c.
 *  Input: opened input file (from file name argument on command line).
 *  Output: colormap and actual_number_of_colors fields are set in cinfo.
 */

GLOBAL(void)
read_color_map (j_decompress_ptr cinfo, FILE * infile)
{
  /* Allocate space for a color map of maximum supported size. */
  cinfo->colormap = (*cinfo->mem->alloc_sarray)
    ((j_common_ptr) cinfo, JPOOL_IMAGE,
     (JDIMENSION) (MAXJSAMPLE+1), (JDIMENSION) 3);
  cinfo->actual_number_of_colors = 0; /* initialize map to empty */

  /* Read first byte to determine file format */
  switch (getc(infile)) {
  case 'G':
    read_gif_map(cinfo, infile);
    break;
  case 'P':
    read_ppm_map(cinfo, infile);
    break;
  default:
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    break;
  }
}

#endif /* QUANT_2PASS_SUPPORTED */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本道色综合久久| 99精品国产91久久久久久| 亚洲线精品一区二区三区八戒| 久久麻豆一区二区| 久久亚洲综合色一区二区三区| 欧美成人bangbros| 久久综合久久综合九色| 亚洲国产高清aⅴ视频| 亚洲欧洲美洲综合色网| 亚洲柠檬福利资源导航| 一区二区久久久| 日韩成人午夜电影| 国产精品自拍一区| 9人人澡人人爽人人精品| 色噜噜狠狠成人中文综合 | 亚洲国产精品成人久久综合一区| 久久久亚洲综合| 亚洲日本丝袜连裤袜办公室| 亚洲一卡二卡三卡四卡| 日本美女视频一区二区| 韩国女主播成人在线观看| 成人免费av网站| 在线观看日产精品| 精品三级在线观看| 亚洲色图.com| 美女在线视频一区| 成人免费看的视频| 777久久久精品| 久久精品这里都是精品| 怡红院av一区二区三区| 狠狠色2019综合网| 91黄视频在线观看| 欧美精品一区在线观看| 亚洲欧美一区二区三区极速播放 | 亚洲sss视频在线视频| 国产成人免费视| 欧美三级一区二区| 中文字幕乱码久久午夜不卡| 午夜视频久久久久久| 国产激情一区二区三区四区| 欧美日韩一区二区三区在线| 337p粉嫩大胆色噜噜噜噜亚洲 | 欧美韩国日本综合| 日韩电影在线观看一区| 91蜜桃婷婷狠狠久久综合9色| 日韩一二三四区| 一区二区三区小说| 成人毛片视频在线观看| 欧美成人欧美edvon| 亚洲亚洲精品在线观看| 99麻豆久久久国产精品免费| 日韩亚洲欧美中文三级| 亚洲国产成人av网| 不卡一卡二卡三乱码免费网站| 欧美一区二区精品久久911| 亚洲卡通欧美制服中文| jizzjizzjizz欧美| 久久久久久免费| 麻豆一区二区三| 欧美日韩不卡在线| 亚洲高清免费视频| 欧美色综合天天久久综合精品| 国产精品理论片| 成人午夜在线免费| 欧美韩日一区二区三区四区| 国产成人免费网站| 国产视频视频一区| 福利一区二区在线| 亚洲国产精品传媒在线观看| 国产精品一区二区在线看| 欧美精品一区二区精品网| 蜜桃视频一区二区三区在线观看| 欧美二区三区的天堂| 五月婷婷综合网| 日韩欧美不卡在线观看视频| 老汉av免费一区二区三区| 欧美一区二区三区在线观看视频| 日韩精品久久理论片| 日韩一区二区麻豆国产| 国产一区二区不卡| 欧美高清在线一区| 色综合久久久久久久久久久| 一区二区久久久久| 欧美肥妇毛茸茸| 国产呦精品一区二区三区网站 | 成人精品小蝌蚪| 国产精品少妇自拍| 91美女福利视频| 亚洲成a人片综合在线| 欧美美女一区二区在线观看| 蜜桃视频在线一区| 国产精品情趣视频| 欧美在线观看18| 蜜臀精品久久久久久蜜臀| 久久一二三国产| 972aa.com艺术欧美| 三级久久三级久久| 久久久精品人体av艺术| 91亚洲精华国产精华精华液| 亚洲图片欧美综合| 欧美精品一区二区久久婷婷| www.亚洲激情.com| 五月婷婷久久综合| 中文字幕国产精品一区二区| 欧美视频一区二区在线观看| 国产在线看一区| 亚洲色图在线播放| 日韩欧美第一区| 91成人在线精品| 国产一区二区精品久久99| 一区二区三区四区av| 精品国产电影一区二区| av一区二区三区在线| 日韩和的一区二区| 亚洲天堂2014| 久久久久久久久久久黄色| 欧美图区在线视频| 成人一区二区三区中文字幕| 日韩1区2区日韩1区2区| 自拍偷拍欧美精品| 国产亚洲欧美色| 91精品国产91综合久久蜜臀| 99久久99久久精品免费观看| 精品在线播放午夜| 亚洲一区视频在线观看视频| 国产日韩欧美电影| 日韩视频不卡中文| 欧美视频在线观看一区| 972aa.com艺术欧美| 成人综合婷婷国产精品久久| 日韩国产精品久久| 亚洲综合无码一区二区| 自拍偷拍国产精品| 成人欧美一区二区三区| 国产午夜精品理论片a级大结局| 在线成人av影院| 欧美日韩国产影片| 欧美日韩亚洲不卡| 色噜噜狠狠一区二区三区果冻| 国产99久久久精品| 福利91精品一区二区三区| 激情伊人五月天久久综合| 日本一道高清亚洲日美韩| 亚洲在线免费播放| 亚洲在线观看免费视频| 亚洲综合色噜噜狠狠| 亚洲精品精品亚洲| 亚洲精品亚洲人成人网在线播放| 中文字幕在线一区二区三区| 国产精品欧美久久久久一区二区| 国产亚洲成aⅴ人片在线观看| 久久久久久久久久看片| 国产三级欧美三级日产三级99 | 麻豆视频一区二区| 美女任你摸久久 | 色呦呦国产精品| 色婷婷亚洲精品| 色久优优欧美色久优优| 欧美日韩三级一区二区| 在线不卡免费欧美| 日韩欧美的一区| 久久女同性恋中文字幕| 中文字幕成人av| 有码一区二区三区| 日韩极品在线观看| 久久99精品国产.久久久久| 国产在线精品视频| 91麻豆免费看| 欧美精品123区| 久久九九国产精品| 一区二区在线观看不卡| 婷婷中文字幕综合| 国产乱码精品1区2区3区| av电影在线不卡| 欧美日韩一区视频| 久久精品免视看| 一区二区三区在线观看国产| 午夜电影网一区| 国产很黄免费观看久久| 99精品黄色片免费大全| 日韩一区二区电影在线| 国产精品污www在线观看| 夜夜夜精品看看| 久久超碰97中文字幕| bt7086福利一区国产| 欧美精品高清视频| 国产视频亚洲色图| 视频一区中文字幕| 国产成人亚洲精品狼色在线| 色综合天天综合给合国产| 欧美一级午夜免费电影| 中文久久乱码一区二区| 午夜成人免费电影| 成人的网站免费观看| 欧美一区二区三区在线电影| 国产精品久线观看视频| 久久成人麻豆午夜电影| 欧美日韩成人一区二区| 国产精品久久国产精麻豆99网站| 三级成人在线视频|