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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jcsample.c

?? WinCE開發(fā)技巧與實例的配套源碼
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三级| 国产欧美精品一区二区三区四区| 久久99精品久久久久久动态图| 国产精品久久看| 欧美一区二区三区的| 成人av网站在线观看免费| 午夜精彩视频在线观看不卡| 国产精品久久久久久福利一牛影视| 4438x成人网最大色成网站| 99久久精品免费观看| 国产精华液一区二区三区| 亚洲sss视频在线视频| 亚洲欧美日本韩国| 亚洲国产精品国自产拍av| 日韩一区二区三区电影| 欧美人妖巨大在线| 91搞黄在线观看| 99久久精品一区| av在线不卡网| 成人污视频在线观看| 国产精品一区在线观看你懂的| 青青草97国产精品免费观看| 午夜精品一区二区三区三上悠亚| 有码一区二区三区| 亚洲伦理在线精品| 亚洲男人的天堂av| 亚洲精品ww久久久久久p站| 日本一区二区不卡视频| 欧美激情一区二区三区不卡 | 亚洲精品乱码久久久久久| 国产网红主播福利一区二区| 久久综合色婷婷| 精品盗摄一区二区三区| 精品国产一区二区三区av性色| 日韩美女在线视频| 精品福利在线导航| www国产精品av| 久久久99精品免费观看不卡| 精品成a人在线观看| 欧美mv日韩mv| 国产日韩欧美一区二区三区综合| 久久女同精品一区二区| 久久婷婷国产综合国色天香| 久久精品人人爽人人爽| 国产精品嫩草影院com| 综合激情成人伊人| 一区二区三国产精华液| 亚洲国产欧美另类丝袜| 五月婷婷色综合| 久久精品国产第一区二区三区| 久久99精品一区二区三区三区| 老司机精品视频导航| 国产成人午夜精品影院观看视频 | 国产精品一区不卡| 国产精品一区二区黑丝| 99久久99久久精品免费看蜜桃| 色综合久久久久综合体桃花网| 欧洲视频一区二区| 欧美一区日韩一区| 久久先锋影音av| 亚洲视频一区二区在线观看| 亚洲国产精品嫩草影院| 男人操女人的视频在线观看欧美 | 99re这里只有精品视频首页| 色噜噜狠狠色综合中国| 欧美美女一区二区| 日韩欧美一卡二卡| 国产精品美女久久久久aⅴ| 亚洲综合一区在线| 国内精品国产成人国产三级粉色| 国产成人h网站| 欧美天堂一区二区三区| 精品国产99国产精品| 亚洲欧美在线aaa| 日韩av成人高清| av资源网一区| 欧美一级片在线| 日韩一区在线免费观看| 免费的国产精品| 99久久久无码国产精品| 91精品综合久久久久久| 国产蜜臀av在线一区二区三区| 一区二区三区**美女毛片| 久草精品在线观看| 色婷婷一区二区| 久久婷婷国产综合精品青草| 亚洲国产综合人成综合网站| 国产精品91一区二区| 欧美精品在线观看一区二区| 国产精品卡一卡二卡三| 日韩国产高清在线| 99精品1区2区| 久久精品亚洲麻豆av一区二区 | 欧美一区二区国产| 最新日韩av在线| 精品在线播放免费| 欧美性受xxxx黑人xyx| 国产日韩亚洲欧美综合| 日韩电影网1区2区| 色综合久久久久| 国产亚洲欧美日韩俺去了| 午夜视频久久久久久| av不卡一区二区三区| 久久网站热最新地址| 日韩二区三区四区| 欧美亚一区二区| 中文字幕一区日韩精品欧美| 激情综合亚洲精品| 欧美福利一区二区| 伊人夜夜躁av伊人久久| 成人国产精品免费观看动漫| 精品成人一区二区三区| 蜜臀av一区二区在线观看| 欧美午夜宅男影院| 亚洲日本va午夜在线影院| 风流少妇一区二区| 久久精品水蜜桃av综合天堂| 美日韩一区二区| 欧美一区二区在线视频| 日韩中文字幕91| 欧美猛男gaygay网站| 亚洲自拍欧美精品| 在线精品视频小说1| 国产精品久久久久久久浪潮网站| 国产美女精品人人做人人爽| 日韩欧美亚洲另类制服综合在线| 三级欧美韩日大片在线看| 欧美日韩一区不卡| 亚洲国产视频一区| 欧美日韩一区二区不卡| 香蕉加勒比综合久久| 欧美午夜精品免费| 亚洲综合精品自拍| 欧美午夜精品一区二区蜜桃| 亚洲成人av在线电影| 在线播放日韩导航| 日本不卡视频在线| 日韩欧美成人一区二区| 六月丁香综合在线视频| 久久综合狠狠综合久久激情 | 成人免费观看视频| 中文字幕的久久| 99精品欧美一区| 一区二区三区在线免费观看| 在线亚洲人成电影网站色www| 一区二区三区精品| 欧美精品少妇一区二区三区| 日韩不卡一二三区| 精品福利二区三区| 国产精品一二三四五| 国产精品久久久久一区二区三区| 91在线观看成人| 亚洲一区二区欧美激情| 欧美一级二级在线观看| 国产在线精品一区二区夜色 | 亚洲欧洲国产日本综合| 欧美性色黄大片| 日本不卡的三区四区五区| 精品剧情在线观看| 成人高清免费在线播放| 亚洲国产欧美在线| 欧美成人aa大片| 成人v精品蜜桃久久一区| 亚洲激情校园春色| 91精品国产综合久久精品app| 国产最新精品精品你懂的| 亚洲三级理论片| 91精品国产综合久久精品app| 国产成人丝袜美腿| 综合久久久久综合| 日韩欧美的一区| 9l国产精品久久久久麻豆| 丝瓜av网站精品一区二区| 久久久久国色av免费看影院| 91丨porny丨国产| 麻豆一区二区三区| 综合欧美一区二区三区| 日韩欧美久久久| 色综合久久久久久久久久久| 久久se这里有精品| 一区二区免费视频| 久久综合av免费| 欧美午夜精品一区| 国产**成人网毛片九色| 亚洲bdsm女犯bdsm网站| 国产精品嫩草久久久久| 欧美一级日韩一级| 日本道在线观看一区二区| 精品一区二区三区欧美| 一区二区三区在线视频免费| 精品欧美一区二区三区精品久久| 91久久线看在观草草青青| 韩国女主播成人在线| 午夜视频在线观看一区| ...中文天堂在线一区| 26uuu另类欧美亚洲曰本| 欧美日韩国产免费| 91丨porny丨蝌蚪视频| 国产高清成人在线| 久久成人羞羞网站|