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

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

?? rdrle.c

?? 常好且全面的jpeg圖像壓縮算法
?? C
字號:
/*
 * rdrle.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 Utah RLE format.
 * The Utah Raster Toolkit library is required (version 3.1 or later).
 *
 * 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 RLE format).
 *
 * Based on code contributed by Mike Lijewski,
 * with updates from Robert Hutchinson.
 */

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

#ifdef RLE_SUPPORTED

/* rle.h is provided by the Utah Raster Toolkit. */

#include <rle.h>

/*
 * We assume that JSAMPLE has the same representation as rle_pixel,
 * to wit, "unsigned char".  Hence we can't cope with 12- or 16-bit samples.
 */

#if BITS_IN_JSAMPLE != 8
  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
#endif

/*
 * We support the following types of RLE files:
 *   
 *   GRAYSCALE   - 8 bits, no colormap
 *   MAPPEDGRAY  - 8 bits, 1 channel colomap
 *   PSEUDOCOLOR - 8 bits, 3 channel colormap
 *   TRUECOLOR   - 24 bits, 3 channel colormap
 *   DIRECTCOLOR - 24 bits, no colormap
 *
 * For now, we ignore any alpha channel in the image.
 */

typedef enum
  { GRAYSCALE, MAPPEDGRAY, PSEUDOCOLOR, TRUECOLOR, DIRECTCOLOR } rle_kind;


/*
 * Since RLE stores scanlines bottom-to-top, we have to invert the image
 * to conform to JPEG's top-to-bottom order.  To do this, we read the
 * incoming image into a virtual array on the first get_pixel_rows call,
 * then fetch the required row from the virtual array on subsequent calls.
 */

typedef struct _rle_source_struct * rle_source_ptr;

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

  rle_kind visual;              /* actual type of input file */
  jvirt_sarray_ptr image;       /* virtual array to hold the image */
  JDIMENSION row;		/* current row # in the virtual array */
  rle_hdr header;               /* Input file information */
  rle_pixel** rle_row;          /* holds a row returned by rle_getrow() */

} rle_source_struct;


/*
 * Read the file header; return image size and component count.
 */

METHODDEF(void)
start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
  rle_source_ptr source = (rle_source_ptr) sinfo;
  JDIMENSION width, height;
#ifdef PROGRESS_REPORT
  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
#endif

  /* Use RLE library routine to get the header info */
  source->header = *rle_hdr_init(NULL);
  source->header.rle_file = source->pub.input_file;
  switch (rle_get_setup(&(source->header))) {
  case RLE_SUCCESS:
    /* A-OK */
    break;
  case RLE_NOT_RLE:
    ERREXIT(cinfo, JERR_RLE_NOT);
    break;
  case RLE_NO_SPACE:
    ERREXIT(cinfo, JERR_RLE_MEM);
    break;
  case RLE_EMPTY:
    ERREXIT(cinfo, JERR_RLE_EMPTY);
    break;
  case RLE_EOF:
    ERREXIT(cinfo, JERR_RLE_EOF);
    break;
  default:
    ERREXIT(cinfo, JERR_RLE_BADERROR);
    break;
  }

  /* Figure out what we have, set private vars and return values accordingly */
  
  width  = source->header.xmax - source->header.xmin + 1;
  height = source->header.ymax - source->header.ymin + 1;
  source->header.xmin = 0;		/* realign horizontally */
  source->header.xmax = width-1;

  cinfo->image_width      = width;
  cinfo->image_height     = height;
  cinfo->data_precision   = 8;  /* we can only handle 8 bit data */

  if (source->header.ncolors == 1 && source->header.ncmap == 0) {
    source->visual     = GRAYSCALE;
    TRACEMS2(cinfo, 1, JTRC_RLE_GRAY, width, height);
  } else if (source->header.ncolors == 1 && source->header.ncmap == 1) {
    source->visual     = MAPPEDGRAY;
    TRACEMS3(cinfo, 1, JTRC_RLE_MAPGRAY, width, height,
             1 << source->header.cmaplen);
  } else if (source->header.ncolors == 1 && source->header.ncmap == 3) {
    source->visual     = PSEUDOCOLOR;
    TRACEMS3(cinfo, 1, JTRC_RLE_MAPPED, width, height,
	     1 << source->header.cmaplen);
  } else if (source->header.ncolors == 3 && source->header.ncmap == 3) {
    source->visual     = TRUECOLOR;
    TRACEMS3(cinfo, 1, JTRC_RLE_FULLMAP, width, height,
	     1 << source->header.cmaplen);
  } else if (source->header.ncolors == 3 && source->header.ncmap == 0) {
    source->visual     = DIRECTCOLOR;
    TRACEMS2(cinfo, 1, JTRC_RLE, width, height);
  } else
    ERREXIT(cinfo, JERR_RLE_UNSUPPORTED);
  
  if (source->visual == GRAYSCALE || source->visual == MAPPEDGRAY) {
    cinfo->in_color_space   = JCS_GRAYSCALE;
    cinfo->input_components = 1;
  } else {
    cinfo->in_color_space   = JCS_RGB;
    cinfo->input_components = 3;
  }

  /*
   * A place to hold each scanline while it's converted.
   * (GRAYSCALE scanlines don't need converting)
   */
  if (source->visual != GRAYSCALE) {
    source->rle_row = (rle_pixel**) (*cinfo->mem->alloc_sarray)
      ((j_common_ptr) cinfo, JPOOL_IMAGE,
       (JDIMENSION) width, (JDIMENSION) cinfo->input_components);
  }

  /* request a virtual array to hold the image */
  source->image = (*cinfo->mem->request_virt_sarray)
    ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
     (JDIMENSION) (width * source->header.ncolors),
     (JDIMENSION) height, (JDIMENSION) 1);

#ifdef PROGRESS_REPORT
  if (progress != NULL) {
    /* count file input as separate pass */
    progress->total_extra_passes++;
  }
#endif

  source->pub.buffer_height = 1;
}


/*
 * Read one row of pixels.
 * Called only after load_image has read the image into the virtual array.
 * Used for GRAYSCALE, MAPPEDGRAY, TRUECOLOR, and DIRECTCOLOR images.
 */

METHODDEF(JDIMENSION)
get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
  rle_source_ptr source = (rle_source_ptr) sinfo;

  source->row--;
  source->pub.buffer = (*cinfo->mem->access_virt_sarray)
    ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);

  return 1;
}

/*
 * Read one row of pixels.
 * Called only after load_image has read the image into the virtual array.
 * Used for PSEUDOCOLOR images.
 */

METHODDEF(JDIMENSION)
get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
  rle_source_ptr source = (rle_source_ptr) sinfo;
  JSAMPROW src_row, dest_row;
  JDIMENSION col;
  rle_map *colormap;
  int val;

  colormap = source->header.cmap;
  dest_row = source->pub.buffer[0];
  source->row--;
  src_row = * (*cinfo->mem->access_virt_sarray)
    ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);

  for (col = cinfo->image_width; col > 0; col--) {
    val = GETJSAMPLE(*src_row++);
    *dest_row++ = (JSAMPLE) (colormap[val      ] >> 8);
    *dest_row++ = (JSAMPLE) (colormap[val + 256] >> 8);
    *dest_row++ = (JSAMPLE) (colormap[val + 512] >> 8);
  }

  return 1;
}


/*
 * Load the image into a virtual array.  We have to do this because RLE
 * files start at the lower left while the JPEG standard has them starting
 * in the upper left.  This is called the first time we want to get a row
 * of input.  What we do is load the RLE data into the array and then call
 * the appropriate routine to read one row from the array.  Before returning,
 * we set source->pub.get_pixel_rows so that subsequent calls go straight to
 * the appropriate row-reading routine.
 */

METHODDEF(JDIMENSION)
load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
  rle_source_ptr source = (rle_source_ptr) sinfo;
  JDIMENSION row, col;
  JSAMPROW  scanline, red_ptr, green_ptr, blue_ptr;
  rle_pixel **rle_row;
  rle_map *colormap;
  char channel;
#ifdef PROGRESS_REPORT
  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
#endif

  colormap = source->header.cmap;
  rle_row = source->rle_row;

  /* Read the RLE data into our virtual array.
   * We assume here that (a) rle_pixel is represented the same as JSAMPLE,
   * and (b) we are not on a machine where FAR pointers differ from regular.
   */
  RLE_CLR_BIT(source->header, RLE_ALPHA); /* don't read the alpha channel */

#ifdef PROGRESS_REPORT
  if (progress != NULL) {
    progress->pub.pass_limit = cinfo->image_height;
    progress->pub.pass_counter = 0;
    (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
  }
#endif

  switch (source->visual) {

  case GRAYSCALE:
  case PSEUDOCOLOR:
    for (row = 0; row < cinfo->image_height; row++) {
      rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
         ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
      rle_getrow(&source->header, rle_row);
#ifdef PROGRESS_REPORT
      if (progress != NULL) {
        progress->pub.pass_counter++;
        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
      }
#endif
    }
    break;

  case MAPPEDGRAY:
  case TRUECOLOR:
    for (row = 0; row < cinfo->image_height; row++) {
      scanline = * (*cinfo->mem->access_virt_sarray)
        ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
      rle_row = source->rle_row;
      rle_getrow(&source->header, rle_row);

      for (col = 0; col < cinfo->image_width; col++) {
        for (channel = 0; channel < source->header.ncolors; channel++) {
          *scanline++ = (JSAMPLE)
            (colormap[GETJSAMPLE(rle_row[channel][col]) + 256 * channel] >> 8);
        }
      }

#ifdef PROGRESS_REPORT
      if (progress != NULL) {
        progress->pub.pass_counter++;
        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
      }
#endif
    }
    break;

  case DIRECTCOLOR:
    for (row = 0; row < cinfo->image_height; row++) {
      scanline = * (*cinfo->mem->access_virt_sarray)
        ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
      rle_getrow(&source->header, rle_row);

      red_ptr   = rle_row[0];
      green_ptr = rle_row[1];
      blue_ptr  = rle_row[2];

      for (col = cinfo->image_width; col > 0; col--) {
        *scanline++ = *red_ptr++;
        *scanline++ = *green_ptr++;
        *scanline++ = *blue_ptr++;
      }

#ifdef PROGRESS_REPORT
      if (progress != NULL) {
        progress->pub.pass_counter++;
        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
      }
#endif
    }
  }

#ifdef PROGRESS_REPORT
  if (progress != NULL)
    progress->completed_extra_passes++;
#endif

  /* Set up to call proper row-extraction routine in future */
  if (source->visual == PSEUDOCOLOR) {
    source->pub.buffer = source->rle_row;
    source->pub.get_pixel_rows = get_pseudocolor_row;
  } else {
    source->pub.get_pixel_rows = get_rle_row;
  }
  source->row = cinfo->image_height;

  /* And fetch the topmost (bottommost) row */
  return (*source->pub.get_pixel_rows) (cinfo, sinfo);   
}


/*
 * Finish up at the end of the file.
 */

METHODDEF(void)
finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
  /* no work */
}


/*
 * The module selection routine for RLE format input.
 */

GLOBAL(cjpeg_source_ptr)
jinit_read_rle (j_compress_ptr cinfo)
{
  rle_source_ptr source;

  /* Create module interface object */
  source = (rle_source_ptr)
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
                                  SIZEOF(rle_source_struct));
  /* Fill in method ptrs */
  source->pub.start_input = start_input_rle;
  source->pub.finish_input = finish_input_rle;
  source->pub.get_pixel_rows = load_image;

  return (cjpeg_source_ptr) source;
}

#endif /* RLE_SUPPORTED */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品视频在线观看视频| 亚洲综合自拍偷拍| 色婷婷综合久久| 免费成人你懂的| 亚洲欧洲精品一区二区三区| 日韩一区二区中文字幕| 成人在线视频首页| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品久久久久9999吃药| 欧美一卡在线观看| 99久久婷婷国产| 精品夜夜嗨av一区二区三区| 亚洲一区二区精品久久av| 国产欧美精品区一区二区三区| 欧美精品乱码久久久久久| 色哟哟日韩精品| 成人美女视频在线看| 另类人妖一区二区av| 亚洲一区电影777| 亚洲视频在线观看三级| 国产欧美精品日韩区二区麻豆天美| 欧美一区二区精品久久911| 色狠狠综合天天综合综合| 成人美女在线视频| 国产麻豆成人精品| 男人的天堂久久精品| 亚洲电影一区二区三区| 自拍偷在线精品自拍偷无码专区 | 一区二区三区在线免费观看 | 精品成人一区二区| 3d动漫精品啪啪1区2区免费| 色呦呦国产精品| 97久久精品人人做人人爽50路 | 欧美精品久久天天躁| 欧美最猛黑人xxxxx猛交| 97se狠狠狠综合亚洲狠狠| 国产精品一区二区久激情瑜伽| 日本不卡123| 全国精品久久少妇| 蜜芽一区二区三区| 免费三级欧美电影| 久久99精品久久久久久国产越南 | 亚洲精品国产一区二区三区四区在线 | 成人黄色电影在线| 国产成人av电影在线观看| 国产一区二区成人久久免费影院| 久久国产福利国产秒拍| 久久电影网站中文字幕 | 福利一区福利二区| 波多野洁衣一区| 95精品视频在线| 91成人免费电影| 欧美日韩精品一区二区在线播放| 国产亚洲欧美日韩日本| 国产视频不卡一区| 国产精品伦一区| 一区二区在线观看视频| 亚洲一区二区三区四区在线观看| 亚洲va国产va欧美va观看| 日本成人中文字幕| 国产一区二区三区| fc2成人免费人成在线观看播放| 91天堂素人约啪| 欧美日本一道本| www国产成人免费观看视频 深夜成人网| 精品福利视频一区二区三区| 久久久不卡网国产精品二区| 中文字幕中文字幕一区二区| 一区二区视频在线看| 天涯成人国产亚洲精品一区av| 日本不卡一区二区三区高清视频| 狠狠色狠狠色合久久伊人| 国产福利视频一区二区三区| 白白色 亚洲乱淫| 欧美午夜理伦三级在线观看| 日韩精品一区二| 中文字幕二三区不卡| 亚洲一区二区三区美女| 韩国一区二区在线观看| 99re热这里只有精品免费视频| 欧美三级日韩在线| 2022国产精品视频| 亚洲精品乱码久久久久久久久| 免费欧美日韩国产三级电影| 懂色av中文字幕一区二区三区 | 香蕉久久一区二区不卡无毒影院 | 欧美欧美欧美欧美首页| 久久久久久久久久久久电影| 亚洲一区二区不卡免费| 国产原创一区二区| 色婷婷精品久久二区二区蜜臂av| 欧美一区二区国产| 国产精品福利在线播放| 日韩成人伦理电影在线观看| 成人激情小说乱人伦| 欧美日韩亚州综合| 国产免费观看久久| 天天影视色香欲综合网老头| 成人深夜在线观看| 91精品久久久久久久91蜜桃| 国产精品色在线| 久久精品久久99精品久久| 一本色道亚洲精品aⅴ| 久久久www成人免费无遮挡大片 | 日韩精品欧美精品| av在线播放不卡| 欧美哺乳videos| 亚洲成av人综合在线观看| 国产不卡在线播放| 欧美一卡二卡三卡| 亚洲精品日日夜夜| 风流少妇一区二区| 精品国产一区二区精华| 亚洲国产精品久久人人爱| 成人永久免费视频| 欧美大片在线观看| 婷婷国产在线综合| 欧美专区日韩专区| 亚洲少妇最新在线视频| 高清在线成人网| 精品国产伦一区二区三区观看方式 | 久久99国产精品免费网站| 欧美乱熟臀69xxxxxx| 亚洲精品菠萝久久久久久久| 成人精品视频.| 国产欧美精品区一区二区三区 | 亚洲午夜精品网| 色综合视频在线观看| 中文字幕亚洲在| 风流少妇一区二区| 国产女人aaa级久久久级| 国产在线乱码一区二区三区| 日韩一本二本av| 日韩高清在线电影| 欧美精品久久久久久久多人混战| 一区二区免费看| 91在线视频播放| 亚洲视频你懂的| 91免费看`日韩一区二区| 中文字幕在线一区免费| av一区二区三区在线| 亚洲日穴在线视频| 在线一区二区视频| 夜夜嗨av一区二区三区四季av| 91小视频免费观看| 一级做a爱片久久| 欧美日韩激情一区二区三区| 天天综合色天天综合| 日韩欧美国产精品| 国内精品免费**视频| 国产午夜精品在线观看| 国产成人一区在线| 国产精品久久久久久久第一福利 | 国产在线精品一区二区夜色| 久久久国产午夜精品| 不卡的av电影在线观看| 亚洲日本丝袜连裤袜办公室| 在线欧美一区二区| 天堂久久一区二区三区| 欧美电影免费提供在线观看| 国产麻豆视频一区| 成人欧美一区二区三区黑人麻豆 | 91麻豆产精品久久久久久| 一区二区理论电影在线观看| 日韩欧美综合在线| 国产成人免费在线视频| 中文字幕一区二区三区在线播放 | 捆绑紧缚一区二区三区视频| 久久女同精品一区二区| 91在线无精精品入口| 水野朝阳av一区二区三区| 欧美精品一区二| 色www精品视频在线观看| 日本aⅴ亚洲精品中文乱码| 国产欧美一区二区精品久导航| 91影院在线观看| 久久精品国产精品亚洲精品| 国产丝袜欧美中文另类| 色偷偷一区二区三区| 久久精品国产澳门| 亚洲日穴在线视频| 日韩精品资源二区在线| 色综合久久久久久久久| 免费成人深夜小野草| 亚洲欧美日韩一区二区| 欧美肥妇free| 不卡视频免费播放| 日韩电影一区二区三区| 中文字幕精品一区二区三区精品| 欧美亚洲日本国产| 国产在线播放一区二区三区| 亚洲国产精品自拍| 国产视频一区二区在线| 91精品久久久久久蜜臀| 91蝌蚪porny| 国产成人免费高清| 图片区小说区区亚洲影院| 国产精品色哟哟| 精品久久一二三区| 欧美美女bb生活片|