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

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

?? jcsample.c

?? JPEG source code converts the image into compressed format
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * jcsample.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 downsampling routines.
 *
 * Downsampling input data is counted in "row groups".  A row group
 * is defined to be max_v_samp_factor pixel rows of each component,
 * from which the downsampler produces v_samp_factor sample rows.
 * A single row group is processed in each call to the downsampler module.
 *
 * The downsampler is responsible for edge-expansion of its output data
 * to fill an integral number of DCT blocks horizontally.  The source buffer
 * may be modified if it is helpful for this purpose (the source buffer is
 * allocated wide enough to correspond to the desired output width).
 * The caller (the prep controller) is responsible for vertical padding.
 *
 * The downsampler may request "context rows" by setting need_context_rows
 * during startup.  In this case, the input arrays will contain at least
 * one row group's worth of pixels above and below the passed-in data;
 * the caller will create dummy rows at image top and bottom by replicating
 * the first or last real pixel row.
 *
 * An excellent reference for image resampling is
 *   Digital Image Warping, George Wolberg, 1990.
 *   Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
 *
 * The downsampling algorithm used here is a simple average of the source
 * pixels covered by the output pixel.  The hi-falutin sampling literature
 * refers to this as a "box filter".  In general the characteristics of a box
 * filter are not very good, but for the specific cases we normally use (1:1
 * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
 * nearly so bad.  If you intend to use other sampling ratios, you'd be well
 * advised to improve this code.
 *
 * A simple input-smoothing capability is provided.  This is mainly intended
 * for cleaning up color-dithered GIF input files (if you find it inadequate,
 * we suggest using an external filtering program such as pnmconvol).  When
 * enabled, each input pixel P is replaced by a weighted sum of itself and its
 * eight neighbors.  P's weight is 1-8*SF and each neighbor's weight is SF,
 * where SF = (smoothing_factor / 1024).
 * Currently, smoothing is only supported for 2h2v sampling factors.
 */

#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"


/* Pointer to routine to downsample a single component */
typedef JMETHOD(void, downsample1_ptr,
		(j_compress_ptr cinfo, jpeg_component_info * compptr,
		 JSAMPARRAY input_data, JSAMPARRAY output_data));

/* Private subobject */

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

  /* Downsampling method pointers, one per component */
  downsample1_ptr methods[MAX_COMPONENTS];
} my_downsampler;

typedef my_downsampler * my_downsample_ptr;


/*
 * Initialize for a downsampling pass.
 */

METHODDEF(void)
start_pass_downsample (j_compress_ptr cinfo)
{
  /* no work for now */
}


/*
 * Expand a component horizontally from width input_cols to width output_cols,
 * by duplicating the rightmost samples.
 */

LOCAL(void)
expand_right_edge (JSAMPARRAY image_data, int num_rows,
		   JDIMENSION input_cols, JDIMENSION output_cols)
{
  register JSAMPROW ptr;
  register JSAMPLE pixval;
  register int count;
  int row;
  int numcols = (int) (output_cols - input_cols);

  if (numcols > 0) {
    for (row = 0; row < num_rows; row++) {
      ptr = image_data[row] + input_cols;
      pixval = ptr[-1];		/* don't need GETJSAMPLE() here */
      for (count = numcols; count > 0; count--)
	*ptr++ = pixval;
    }
  }
}


/*
 * Do downsampling for a whole row group (all components).
 *
 * In this version we simply downsample each component independently.
 */

METHODDEF(void)
sep_downsample (j_compress_ptr cinfo,
		JSAMPIMAGE input_buf, JDIMENSION in_row_index,
		JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
{
  my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
  int ci;
  jpeg_component_info * compptr;
  JSAMPARRAY in_ptr, out_ptr;

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    in_ptr = input_buf[ci] + in_row_index;
    out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
    (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
  }
}


/*
 * Downsample pixel values of a single component.
 * One row group is processed per call.
 * This version handles arbitrary integral sampling ratios, without smoothing.
 * Note that this version is not actually used for customary sampling ratios.
 */

METHODDEF(void)
int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
		JSAMPARRAY input_data, JSAMPARRAY output_data)
{
  int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
  JDIMENSION outcol, outcol_h;	/* outcol_h == outcol*h_expand */
  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
  JSAMPROW inptr, outptr;
  INT32 outvalue;

  h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
  v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
  numpix = h_expand * v_expand;
  numpix2 = numpix/2;

  /* Expand input data enough to let all the output samples be generated
   * by the standard loop.  Special-casing padded output would be more
   * efficient.
   */
  expand_right_edge(input_data, cinfo->max_v_samp_factor,
		    cinfo->image_width, output_cols * h_expand);

  inrow = 0;
  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
    outptr = output_data[outrow];
    for (outcol = 0, outcol_h = 0; outcol < output_cols;
	 outcol++, outcol_h += h_expand) {
      outvalue = 0;
      for (v = 0; v < v_expand; v++) {
	inptr = input_data[inrow+v] + outcol_h;
	for (h = 0; h < h_expand; h++) {
	  outvalue += (INT32) GETJSAMPLE(*inptr++);
	}
      }
      *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
    }
    inrow += v_expand;
  }
}


/*
 * Downsample pixel values of a single component.
 * This version handles the special case of a full-size component,
 * without smoothing.
 */

METHODDEF(void)
fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
		     JSAMPARRAY input_data, JSAMPARRAY output_data)
{
  /* Copy the data */
  jcopy_sample_rows(input_data, 0, output_data, 0,
		    cinfo->max_v_samp_factor, cinfo->image_width);
  /* Edge-expand */
  expand_right_edge(output_data, cinfo->max_v_samp_factor,
		    cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
}


/*
 * Downsample pixel values of a single component.
 * This version handles the common case of 2:1 horizontal and 1:1 vertical,
 * without smoothing.
 *
 * A note about the "bias" calculations: when rounding fractional values to
 * integer, we do not want to always round 0.5 up to the next integer.
 * If we did that, we'd introduce a noticeable bias towards larger values.
 * Instead, this code is arranged so that 0.5 will be rounded up or down at
 * alternate pixel locations (a simple ordered dither pattern).
 */

METHODDEF(void)
h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
		 JSAMPARRAY input_data, JSAMPARRAY output_data)
{
  int outrow;
  JDIMENSION outcol;
  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
  register JSAMPROW inptr, outptr;
  register int bias;

  /* Expand input data enough to let all the output samples be generated
   * by the standard loop.  Special-casing padded output would be more
   * efficient.
   */
  expand_right_edge(input_data, cinfo->max_v_samp_factor,
		    cinfo->image_width, output_cols * 2);

  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
    outptr = output_data[outrow];
    inptr = input_data[outrow];
    bias = 0;			/* bias = 0,1,0,1,... for successive samples */
    for (outcol = 0; outcol < output_cols; outcol++) {
      *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
			      + bias) >> 1);
      bias ^= 1;		/* 0=>1, 1=>0 */
      inptr += 2;
    }
  }
}


/*
 * Downsample pixel values of a single component.
 * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
 * without smoothing.
 */

METHODDEF(void)
h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
		 JSAMPARRAY input_data, JSAMPARRAY output_data)
{
  int inrow, outrow;
  JDIMENSION outcol;
  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
  register JSAMPROW inptr0, inptr1, outptr;
  register int bias;

  /* Expand input data enough to let all the output samples be generated
   * by the standard loop.  Special-casing padded output would be more
   * efficient.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本欧美加勒比视频| 欧美日韩三级在线| 欧美精品久久99久久在免费线 | 亚洲色图都市小说| 精品一区二区成人精品| 欧美在线免费播放| 1024成人网| 粉嫩蜜臀av国产精品网站| 91精品在线一区二区| 亚洲综合免费观看高清完整版在线 | 亚洲一区二区三区爽爽爽爽爽| 国产一区二区三区美女| 在线成人av影院| 亚洲综合一区二区三区| www.久久精品| 国产精品卡一卡二卡三| 国产成人av电影在线播放| 精品久久久久av影院 | 日韩一区二区三区观看| 亚洲成人精品一区| 在线精品视频小说1| 亚洲图片激情小说| 91在线你懂得| 亚洲视频在线观看三级| 国产91精品精华液一区二区三区 | 久久精品国产99久久6| 在线电影院国产精品| 舔着乳尖日韩一区| 欧美精品日韩一区| 日韩av中文字幕一区二区三区| 欧美挠脚心视频网站| 亚洲第一久久影院| 91精品在线麻豆| 石原莉奈在线亚洲二区| 91精品国产色综合久久久蜜香臀| 视频一区欧美精品| 日韩午夜在线观看视频| 国产在线精品一区二区夜色| 亚洲精品一区二区三区香蕉| 国产精品一区专区| 国产精品网站在线播放| 色综合天天综合给合国产| 亚洲精品免费看| 欧美福利一区二区| 久久国产精品99久久久久久老狼| 26uuu国产日韩综合| 国产精品综合久久| 亚洲三级电影全部在线观看高清| 欧美视频一区二区| 日韩成人免费在线| 国产亚洲成av人在线观看导航| 成人免费三级在线| 亚洲电影一级黄| 日韩欧美激情四射| 成人网在线免费视频| 亚洲精品免费视频| 精品欧美乱码久久久久久| 成人爱爱电影网址| 首页欧美精品中文字幕| 久久久天堂av| 欧美三级中文字幕在线观看| 老司机免费视频一区二区三区| 国产清纯美女被跳蛋高潮一区二区久久w | 国产精品一区久久久久| 亚洲三级理论片| 精品国产乱子伦一区| 91视频在线观看| 麻豆91在线播放| 亚洲日本韩国一区| 日韩欧美国产精品一区| av资源网一区| 久久国产精品露脸对白| 亚洲摸摸操操av| 26uuu亚洲综合色| 欧美色涩在线第一页| 国产老肥熟一区二区三区| 亚洲国产一区视频| 国产欧美日韩精品在线| 91精品国产一区二区三区| 99久久精品久久久久久清纯| 久久国产成人午夜av影院| 亚洲一区二区欧美日韩| 日本一区二区三区dvd视频在线| 91.麻豆视频| 91官网在线免费观看| 丁香激情综合国产| 精品一区二区三区免费播放| 午夜精品久久久久久| 亚洲精品亚洲人成人网在线播放| 国产欧美一区二区三区在线看蜜臀 | 欧美亚洲另类激情小说| 懂色av一区二区在线播放| 麻豆免费看一区二区三区| 一区二区三区不卡视频| 中文字幕在线不卡| 欧美国产激情二区三区| 精品久久久久av影院| 91精品国产综合久久国产大片| 欧美伊人久久久久久久久影院| 99久久99久久综合| 成人91在线观看| 成人激情视频网站| 国产一区二区导航在线播放| 蜜桃在线一区二区三区| 成人免费视频app| 韩国精品主播一区二区在线观看 | 欧美日韩一级视频| 色视频成人在线观看免| 欧美成人一区二区| 9191久久久久久久久久久| 欧美日韩一二三| 欧美美女一区二区在线观看| 在线免费不卡视频| 欧美日韩国产高清一区二区三区 | 亚洲三级电影全部在线观看高清| 国产精品色哟哟网站| 国产精品素人一区二区| 中文字幕av一区二区三区| 国产精品日日摸夜夜摸av| 国产精品美女久久久久久2018| 国产精品区一区二区三区| 国产肉丝袜一区二区| 国产精品美女www爽爽爽| 中文字幕一区二区视频| 亚洲三级在线播放| 亚洲一区二区在线免费观看视频 | 精品国产百合女同互慰| 精品蜜桃在线看| 国产日韩高清在线| 亚洲欧美偷拍另类a∨色屁股| 亚洲综合精品自拍| 蜜臀av一区二区在线免费观看 | 99久久精品国产观看| 色美美综合视频| 欧美精品丝袜中出| 精品va天堂亚洲国产| 国产精品女主播av| 亚洲一卡二卡三卡四卡无卡久久| 日韩av网站在线观看| 国产主播一区二区| 色综合激情久久| 日韩欧美一级二级三级| 国产人成一区二区三区影院| 樱花影视一区二区| 麻豆精品一区二区| 99精品一区二区| 欧美一区二区三级| 国产精品剧情在线亚洲| 亚洲国产一区二区视频| 国产精品一区二区久久不卡| 色婷婷av一区| 日韩你懂的在线观看| 国产精品电影一区二区三区| 日产国产高清一区二区三区| 波多野结衣在线一区| 欧美一区二区三区思思人| 国产精品久久精品日日| 热久久免费视频| 色视频一区二区| 国产色91在线| 男人的天堂亚洲一区| 91麻豆精东视频| 国产三级精品三级| 美脚の诱脚舐め脚责91 | 91亚洲精华国产精华精华液| 日韩欧美在线1卡| 一区二区三区四区中文字幕| 国产自产高清不卡| 6080日韩午夜伦伦午夜伦| 国产精品福利在线播放| 极品少妇xxxx精品少妇| 欧美乱熟臀69xxxxxx| 亚洲视频免费看| 成人理论电影网| 久久婷婷成人综合色| 七七婷婷婷婷精品国产| 国产三级久久久| 麻豆精品一区二区| 欧美日韩不卡一区| 亚洲国产中文字幕| 91国偷自产一区二区三区观看| 中文字幕巨乱亚洲| 国产成人亚洲综合a∨婷婷图片| 91麻豆精品国产91久久久资源速度| 亚洲欧美aⅴ...| 成人av电影在线播放| 中文字幕第一区| 国产福利一区二区| 久久伊人蜜桃av一区二区| 九九精品一区二区| 欧美v日韩v国产v| 狠狠色综合日日| 欧美成人艳星乳罩| 国内精品视频一区二区三区八戒| 欧美一级高清片| 久久成人久久鬼色| 久久综合九色综合97婷婷女人| 精品综合免费视频观看| 久久天天做天天爱综合色| 国产老肥熟一区二区三区|