亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产剧情一区二区| 国产精品亚洲午夜一区二区三区| 精品国内二区三区| 一区二区中文视频| 一级女性全黄久久生活片免费| 国产欧美精品一区aⅴ影院| 亚洲激情校园春色| 在线看一区二区| 亚洲欧洲成人精品av97| 91视视频在线观看入口直接观看www | 亚洲三级久久久| 一区二区三区91| 精品一区二区免费| 久久亚洲影视婷婷| 高清国产午夜精品久久久久久| 日韩一区二区电影网| 国产91精品一区二区麻豆网站| av成人老司机| 亚洲美女在线一区| 99精品久久免费看蜜臀剧情介绍| 欧美国产精品中文字幕| 国产一区二区三区四| 日本伦理一区二区| 亚洲午夜精品一区二区三区他趣| 欧美一卡在线观看| 国产精品亚洲午夜一区二区三区| 亚洲尤物在线视频观看| 91麻豆精品久久久久蜜臀| 亚洲一区二区三区四区在线免费观看| 97久久精品人人做人人爽50路| 一区二区三区在线不卡| 成人国产电影网| 五月天激情小说综合| 精品国产免费视频| 成人一区二区三区中文字幕| 欧美亚洲国产bt| 亚洲乱码国产乱码精品精可以看 | 色综合天天狠狠| 亚洲国产综合91精品麻豆| 欧美美女网站色| 99久久精品国产毛片| 亚洲午夜精品网| 无码av免费一区二区三区试看| 亚洲图片另类小说| 久久精品人人做人人综合| 国产一区二区久久| 国产美女精品一区二区三区| 青青草国产成人av片免费| 中文字幕一区二| 欧美国产丝袜视频| 国产精品丝袜91| 亚洲品质自拍视频| 国产精品免费aⅴ片在线观看| 欧美人动与zoxxxx乱| 91在线精品秘密一区二区| 91麻豆成人久久精品二区三区| 国产精品影视天天线| www.欧美亚洲| 欧美亚洲国产bt| 91精品久久久久久久99蜜桃| 中文字幕乱码日本亚洲一区二区| 精品嫩草影院久久| 欧美国产国产综合| 亚洲国产成人精品视频| 亚洲激情自拍偷拍| 亚洲成人免费av| 国产大陆亚洲精品国产| 99久久久久久| 欧美视频一区二区在线观看| 久久久久99精品国产片| 亚洲午夜免费视频| 成人免费毛片a| 欧美日韩精品欧美日韩精品一 | 欧美国产激情二区三区| 亚洲自拍偷拍麻豆| 成人高清伦理免费影院在线观看| 欧美天堂亚洲电影院在线播放| 欧洲激情一区二区| 亚洲国产精品一区二区久久恐怖片| 婷婷开心激情综合| 大陆成人av片| 精品视频在线免费看| 欧美色视频在线| 久久网站热最新地址| 亚洲精品国产成人久久av盗摄| 亚洲超丰满肉感bbw| 从欧美一区二区三区| 欧美一区二区三区婷婷月色| 免费在线观看精品| 成人av午夜电影| 中文在线一区二区| 国产又黄又大久久| 91亚洲国产成人精品一区二区三| 日韩视频在线观看一区二区| 亚洲第一福利视频在线| 日韩三级视频中文字幕| 亚洲人成影院在线观看| 国产成人h网站| 性做久久久久久免费观看| 成人看片黄a免费看在线| 欧美性生活一区| 亚洲六月丁香色婷婷综合久久| 国产一区二区免费看| 精品va天堂亚洲国产| 国产激情精品久久久第一区二区| 视频一区二区中文字幕| 日韩欧美成人一区二区| 麻豆91在线观看| 久久一区二区视频| 成人免费高清在线| 国产三级久久久| 欧美精品日韩精品| 久久精品国产999大香线蕉| 国产精品美女久久久久久久久久久| 欧美一区二区免费观在线| 欧美性大战久久| 色综合久久综合网欧美综合网| 亚洲免费av在线| 中文字幕一区二区三区在线不卡| av电影在线观看不卡| 久88久久88久久久| 国产在线看一区| 一区二区三区在线视频免费观看| 欧美一区二区三区成人| 91黄视频在线观看| 国产高清久久久久| 成人深夜视频在线观看| 国产在线视频精品一区| 亚洲一区二区偷拍精品| 亚洲卡通欧美制服中文| 中文字幕高清一区| 精品日产卡一卡二卡麻豆| 欧美一区二视频| 欧美日韩黄视频| 日韩欧美一二三| 国产精品久久久久久久久久久免费看 | 美女一区二区三区在线观看| 欧美xingq一区二区| 一本久久a久久免费精品不卡| 国产精品综合在线视频| 性做久久久久久久久| 日韩成人精品在线观看| 麻豆国产91在线播放| 亚洲一区国产视频| 婷婷久久综合九色国产成人| 亚洲成国产人片在线观看| 国内外成人在线| 91激情五月电影| 精品国产免费视频| 亚洲永久精品大片| 韩国视频一区二区| 欧美精品xxxxbbbb| 亚洲视频电影在线| 国产一区二区三区在线观看精品| 99久久精品国产毛片| 久久久久久久综合日本| 亚洲激情自拍视频| 色狠狠桃花综合| 一区二区三区在线免费观看| 偷窥少妇高潮呻吟av久久免费| 五月天激情综合网| 成人精品免费看| 国产精品久久久久久久久久免费看| 国产激情91久久精品导航 | 欧美性猛交一区二区三区精品| 欧美理论在线播放| 欧美一区二区在线播放| 久久免费的精品国产v∧| 中文字幕欧美一区| 日本视频在线一区| 欧美午夜精品久久久久久超碰| 国产亚洲人成网站| 欧美性三三影院| 麻豆国产精品一区二区三区| 欧美精品一区二区三区在线| 一区二区三区成人| 99国产麻豆精品| 日韩精品免费专区| 欧美日韩精品欧美日韩精品一| 国内精品国产成人国产三级粉色| 91精品欧美久久久久久动漫| 亚洲18女电影在线观看| 欧美精品国产精品| 免费观看91视频大全| 日韩一区二区电影网| 亚洲午夜私人影院| 欧美一区二区视频网站| 丝袜亚洲精品中文字幕一区| 亚洲精品在线三区| 国产一区二区三区观看| 亚洲国产视频一区| 欧美精品在欧美一区二区少妇| 国产成人鲁色资源国产91色综 | 麻豆精品视频在线| 欧美日韩一区二区电影| 成人精品视频网站| 肉肉av福利一精品导航| 亚洲欧美日韩久久| 中文字幕欧美国产| 日韩三级精品电影久久久|