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

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

?? rdtarga.c

?? JPEG source code converts the image into compressed format
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * rdtarga.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.
 *
 * This file contains routines to read input images in Targa format.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed Targa format).
 *
 * Based on code contributed by Lee Daniel Crocker.
 */

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

#ifdef TARGA_SUPPORTED


/* Macros to deal with unsigned chars as efficiently as compiler allows */

#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char U_CHAR;
#define UCH(x)	((int) (x))
#else /* !HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char U_CHAR;
#define UCH(x)	((int) (x))
#else
typedef char U_CHAR;
#define UCH(x)	((int) (x) & 0xFF)
#endif
#endif /* HAVE_UNSIGNED_CHAR */


#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))


/* Private version of data source object */

typedef struct _tga_source_struct * tga_source_ptr;

typedef struct _tga_source_struct {
  struct cjpeg_source_struct pub; /* public fields */

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

  JSAMPARRAY colormap;		/* Targa colormap (converted to my format) */

  jvirt_sarray_ptr whole_image;	/* Needed if funny input row order */
  JDIMENSION current_row;	/* Current logical row number to read */

  /* Pointer to routine to extract next Targa pixel from input file */
  JMETHOD(void, read_pixel, (tga_source_ptr sinfo));

  /* Result of read_pixel is delivered here: */
  U_CHAR tga_pixel[4];

  int pixel_size;		/* Bytes per Targa pixel (1 to 4) */

  /* State info for reading RLE-coded pixels; both counts must be init to 0 */
  int block_count;		/* # of pixels remaining in RLE block */
  int dup_pixel_count;		/* # of times to duplicate previous pixel */

  /* This saves the correct pixel-row-expansion method for preload_image */
  JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
				       cjpeg_source_ptr sinfo));
} tga_source_struct;


/* For expanding 5-bit pixel values to 8-bit with best rounding */

static const UINT8 c5to8bits[32] = {
    0,   8,  16,  25,  33,  41,  49,  58,
   66,  74,  82,  90,  99, 107, 115, 123,
  132, 140, 148, 156, 165, 173, 181, 189,
  197, 206, 214, 222, 230, 239, 247, 255
};



LOCAL(int)
read_byte (tga_source_ptr sinfo)
/* Read next byte from Targa file */
{
  register FILE *infile = sinfo->pub.input_file;
  register int c;

  if ((c = getc(infile)) == EOF)
    ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
  return c;
}


LOCAL(void)
read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize)
/* Read the colormap from a Targa file */
{
  int i;

  /* Presently only handles 24-bit BGR format */
  if (mapentrysize != 24)
    ERREXIT(sinfo->cinfo, JERR_TGA_BADCMAP);

  for (i = 0; i < cmaplen; i++) {
    sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo);
    sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo);
    sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo);
  }
}


/*
 * read_pixel methods: get a single pixel from Targa file into tga_pixel[]
 */

METHODDEF(void)
read_non_rle_pixel (tga_source_ptr sinfo)
/* Read one Targa pixel from the input file; no RLE expansion */
{
  register FILE *infile = sinfo->pub.input_file;
  register int i;

  for (i = 0; i < sinfo->pixel_size; i++) {
    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
  }
}


METHODDEF(void)
read_rle_pixel (tga_source_ptr sinfo)
/* Read one Targa pixel from the input file, expanding RLE data as needed */
{
  register FILE *infile = sinfo->pub.input_file;
  register int i;

  /* Duplicate previously read pixel? */
  if (sinfo->dup_pixel_count > 0) {
    sinfo->dup_pixel_count--;
    return;
  }

  /* Time to read RLE block header? */
  if (--sinfo->block_count < 0) { /* decrement pixels remaining in block */
    i = read_byte(sinfo);
    if (i & 0x80) {		/* Start of duplicate-pixel block? */
      sinfo->dup_pixel_count = i & 0x7F; /* number of dups after this one */
      sinfo->block_count = 0;	/* then read new block header */
    } else {
      sinfo->block_count = i & 0x7F; /* number of pixels after this one */
    }
  }

  /* Read next pixel */
  for (i = 0; i < sinfo->pixel_size; i++) {
    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
  }
}


/*
 * Read one row of pixels.
 *
 * We provide several different versions depending on input file format.
 */


METHODDEF(JDIMENSION)
get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 8-bit grayscale pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 8-bit colormap indexes */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register int t;
  register JSAMPROW ptr;
  register JDIMENSION col;
  register JSAMPARRAY colormap = source->colormap;

  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    t = UCH(source->tga_pixel[0]);
    *ptr++ = colormap[0][t];
    *ptr++ = colormap[1][t];
    *ptr++ = colormap[2][t];
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 16-bit pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register int t;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    t = UCH(source->tga_pixel[0]);
    t += UCH(source->tga_pixel[1]) << 8;
    /* We expand 5 bit data to 8 bit sample width.
     * The format of the 16-bit (LSB first) input word is
     *     xRRRRRGGGGGBBBBB
     */
    ptr[2] = (JSAMPLE) c5to8bits[t & 0x1F];
    t >>= 5;
    ptr[1] = (JSAMPLE) c5to8bits[t & 0x1F];
    t >>= 5;
    ptr[0] = (JSAMPLE) c5to8bits[t & 0x1F];
    ptr += 3;
  }
  return 1;
}

METHODDEF(JDIMENSION)
get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
/* This version is for reading 24-bit pixels */
{
  tga_source_ptr source = (tga_source_ptr) sinfo;
  register JSAMPROW ptr;
  register JDIMENSION col;
  
  ptr = source->pub.buffer[0];
  for (col = cinfo->image_width; col > 0; col--) {
    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[2]); /* change BGR to RGB order */
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]);
    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉成人啪国产精品视频综合网| 欧美久久一二区| 久久综合九色综合97婷婷女人| 最新中文字幕一区二区三区| 日本91福利区| 欧美在线一区二区| 中文字幕巨乱亚洲| 国产一区二区91| 欧美不卡一二三| 蜜桃视频在线一区| 欧美亚洲高清一区二区三区不卡| 中文字幕在线不卡一区二区三区| 国产在线精品一区二区三区不卡| 欧美群妇大交群的观看方式| 国产蜜臀av在线一区二区三区| 日韩中文字幕一区二区三区| 欧美日免费三级在线| 亚洲福利视频一区| 一二三区精品视频| 成人免费看的视频| 亚洲伦理在线精品| 欧美日韩一本到| 日韩中文字幕1| 欧美电影在哪看比较好| 美女视频黄 久久| 欧美精品一区二区久久久| 久久爱另类一区二区小说| 久久久综合视频| 成人免费看片app下载| 国产精品99久久久久久有的能看| 久久先锋影音av鲁色资源网| 成人av电影在线网| 亚洲一二三四在线观看| 制服丝袜av成人在线看| 美腿丝袜在线亚洲一区| 国产精品视频免费看| 色久综合一二码| 麻豆视频一区二区| 国产精品毛片久久久久久久| www.日韩av| 麻豆中文一区二区| 亚洲欧洲日韩av| 3d动漫精品啪啪1区2区免费| 国产精品一品二品| 亚洲va欧美va人人爽午夜| 久久久精品欧美丰满| 欧美日韩在线直播| 国产一区欧美日韩| 亚洲一区二区三区四区五区黄| 九九**精品视频免费播放| 国产亚洲欧美在线| 欧美三级中文字| 国产suv精品一区二区三区| 丝袜美腿亚洲综合| 久久久久青草大香线综合精品| 在线看日本不卡| 91在线看国产| 国产一区二区三区国产| 舔着乳尖日韩一区| 亚洲伦在线观看| 中文字幕一区二区三区在线观看| 日韩一区二区免费电影| 91激情在线视频| 国产精品一级片在线观看| 偷拍一区二区三区四区| 亚洲精品免费一二三区| 亚洲人成网站在线| 1区2区3区国产精品| 久久久久九九视频| 91精品午夜视频| 99国产一区二区三精品乱码| 国产高清精品网站| 免费看黄色91| 精品一区二区三区免费毛片爱| 日韩电影免费一区| 日韩中文字幕91| 久久99精品国产91久久来源| 久久精品国产久精国产| 日韩电影在线免费| 午夜av一区二区三区| 蜜臀久久久久久久| 久久99精品国产麻豆不卡| 欧美va亚洲va| 精品盗摄一区二区三区| 国产视频视频一区| 亚洲美女偷拍久久| 午夜免费久久看| 日本中文字幕一区二区有限公司| 国产精品成人免费精品自在线观看 | 亚洲高清免费一级二级三级| 亚洲欧美日韩久久| 中文字幕一区二区三区在线不卡| 国产精品福利一区| 亚洲精品欧美在线| 亚洲成人动漫一区| 日本亚洲天堂网| 精品一区二区三区影院在线午夜| 蜜桃传媒麻豆第一区在线观看| 精品在线一区二区三区| 福利一区福利二区| 久久综合99re88久久爱| 国产精品国产三级国产专播品爱网| 天堂影院一区二区| 色综合久久综合| 久久综合色鬼综合色| 亚洲va在线va天堂| 成人影视亚洲图片在线| 9191精品国产综合久久久久久| 久久久久久久国产精品影院| 亚洲最快最全在线视频| 久久精品国产99国产| 91国在线观看| 欧美激情一区三区| 日日夜夜精品视频免费| 欧美日韩国产区一| 亚洲成人自拍一区| 欧洲av一区二区嗯嗯嗯啊| 亚洲精品中文字幕在线观看| 欧美aaaaaa午夜精品| 欧美一区二区三区视频免费| 精品一区二区三区日韩| 国产欧美日韩三区| 色拍拍在线精品视频8848| 夜夜操天天操亚洲| 精品久久久久一区二区国产| 成人午夜在线视频| 国产精品成人网| 色综合天天天天做夜夜夜夜做| 亚洲欧美国产高清| 在线中文字幕一区二区| 亚洲一区二区五区| 日韩手机在线导航| 国产精品77777| 国产精品成人一区二区艾草 | 欧美一级一区二区| 精品一区二区在线视频| 国产精品美女视频| 欧美日韩国产综合一区二区| 另类小说色综合网站| 国产农村妇女精品| 欧美四级电影网| 久久99国产精品麻豆| 综合久久综合久久| 欧美一卡二卡在线| av综合在线播放| 免费看欧美美女黄的网站| 国产精品麻豆久久久| 亚洲国产欧美在线| 国产欧美一区二区三区网站| 欧美日韩国产首页| 成人一区二区三区视频 | 成人免费小视频| 欧美群妇大交群中文字幕| 国产成人精品免费一区二区| 亚洲一级片在线观看| 国产精品午夜久久| 欧美大白屁股肥臀xxxxxx| 色婷婷综合久久久久中文| 国产一区二区0| 麻豆中文一区二区| 亚洲电影在线免费观看| 国产精品人成在线观看免费| 日韩一区二区在线播放| 欧美综合天天夜夜久久| 成人午夜私人影院| 国产精品99久久久久久似苏梦涵| 天天影视网天天综合色在线播放| 亚洲人妖av一区二区| 国产午夜精品一区二区三区视频| 欧美一区二区在线不卡| 欧美午夜精品一区二区三区| 99re热视频精品| 91免费看视频| av男人天堂一区| 99热在这里有精品免费| 不卡一卡二卡三乱码免费网站| 精东粉嫩av免费一区二区三区| 日韩成人av影视| 免费看日韩a级影片| 精品一区二区三区免费| 麻豆精品精品国产自在97香蕉| 美美哒免费高清在线观看视频一区二区| 亚洲电影一区二区| 日韩av二区在线播放| 日本欧美大码aⅴ在线播放| 理论片日本一区| 国产一区二区免费看| 成人免费va视频| 色噜噜狠狠成人中文综合 | 91国在线观看| 在线播放一区二区三区| 日韩欧美国产1| 国产精品污www在线观看| 中文字幕一区二区在线播放| 亚洲综合在线观看视频| 日日夜夜一区二区| 免播放器亚洲一区| 不卡一区二区在线| 6080日韩午夜伦伦午夜伦| 久久中文字幕电影|