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

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

?? jcsample.c

?? 這是JPEG解碼、編碼的源代碼
?? 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一区二区三区免费野_久草精品视频
国产精品88888| 日韩一区二区影院| 国产精品资源站在线| 成人网男人的天堂| 国产精品白丝jk黑袜喷水| 91一区二区在线| 色屁屁一区二区| 在线看国产一区二区| 在线精品视频一区二区三四| 欧美成人三级电影在线| 精品国产免费人成电影在线观看四季 | 精品久久一二三区| 亚洲一区二区三区国产| 亚洲成在人线免费| 亚洲国产欧美另类丝袜| 日本成人在线网站| 久久精品国产**网站演员| 国产精品 日产精品 欧美精品| 国产成人综合精品三级| 日韩视频中午一区| 天天操天天综合网| 国产精品18久久久久久久久久久久 | 国产精品久久久久7777按摩| 国产精品久久影院| 国产剧情av麻豆香蕉精品| 日韩欧美卡一卡二| 国产精品免费网站在线观看| 亚洲电影视频在线| 色狠狠一区二区三区香蕉| 日韩美女在线视频| 青青草国产精品亚洲专区无| 成人av资源网站| 777精品伊人久久久久大香线蕉| 欧美精品一区二区三区四区| 久久草av在线| 精品国精品国产尤物美女| 青青草97国产精品免费观看| 91精品蜜臀在线一区尤物| 水蜜桃久久夜色精品一区的特点| 国产+成+人+亚洲欧洲自线| 欧美视频在线观看一区二区| 久久久99免费| 亚洲素人一区二区| 久草在线在线精品观看| 99re热视频精品| 欧美电影免费观看高清完整版| 奇米四色…亚洲| 26uuu国产一区二区三区| 亚洲午夜一二三区视频| 欧美三区在线视频| 亚洲欧洲一区二区在线播放| 久久精品理论片| 精品粉嫩aⅴ一区二区三区四区| 国产专区欧美精品| 日韩精品专区在线| 国产精品中文欧美| 亚洲婷婷综合色高清在线| 色婷婷亚洲精品| 日本美女一区二区三区| 久久精品在线观看| 9色porny自拍视频一区二区| 中文字幕欧美国产| 欧美日韩一区高清| 欧美二区乱c少妇| 久99久精品视频免费观看| 久久99蜜桃精品| 欧美福利电影网| 亚洲国产精品麻豆| 97久久人人超碰| 日韩伦理av电影| 色妹子一区二区| 一区二区免费视频| 国产剧情一区在线| 欧美日韩黄色影视| 久久久久久久久久久99999| 日韩精品视频网| 亚洲国产经典视频| 欧美一区二区在线免费播放| 美腿丝袜在线亚洲一区| 久久av资源站| 中文字幕欧美一区| 精品国产伦一区二区三区免费| 懂色av一区二区三区免费观看 | 波多野结衣中文一区| 天堂久久一区二区三区| 亚洲欧洲日产国产综合网| 欧美一区二区大片| 欧美曰成人黄网| 不卡视频一二三| 国产精品综合网| 伦理电影国产精品| 亚洲成a人片综合在线| 国产精品毛片久久久久久| 717成人午夜免费福利电影| 91捆绑美女网站| 丁香激情综合五月| 久久国产生活片100| 五月天久久比比资源色| 亚洲欧美国产毛片在线| 色老头久久综合| 成人午夜av电影| 黄色日韩三级电影| 香蕉久久夜色精品国产使用方法| 亚洲欧洲三级电影| 国产精品女主播av| 久久综合狠狠综合久久综合88| 欧美一级日韩一级| 欧美高清视频不卡网| 欧洲精品视频在线观看| 99re亚洲国产精品| 成人av在线网站| 成人高清视频在线| 成人三级在线视频| 成人夜色视频网站在线观看| 国产经典欧美精品| 国产成人精品免费视频网站| 国产精品一级在线| 国产91精品露脸国语对白| 国产成人综合亚洲网站| 成人午夜视频网站| 99这里都是精品| 色婷婷久久一区二区三区麻豆| 色香蕉成人二区免费| 在线看国产一区二区| 欧美三级一区二区| 538prom精品视频线放| 日韩欧美一级精品久久| 久久久久久一二三区| 国产欧美久久久精品影院| 欧美日韩国产综合一区二区| 欧美性受xxxx黑人xyx性爽| 欧美日韩一区在线| 日韩一卡二卡三卡国产欧美| 精品福利在线导航| ...xxx性欧美| 亚洲成年人影院| 久久99精品国产91久久来源| 国产激情一区二区三区桃花岛亚洲| 国产99久久久精品| 色琪琪一区二区三区亚洲区| 538在线一区二区精品国产| 精品国产区一区| 亚洲人成人一区二区在线观看| 亚洲主播在线观看| 极品美女销魂一区二区三区免费 | 日本免费在线视频不卡一不卡二| 久久精品国产99| 99精品国产视频| 欧美日韩高清不卡| 国产亚洲一区二区三区在线观看| 国产精品国产馆在线真实露脸| 亚洲一区二区三区三| 久久精工是国产品牌吗| 99久久精品国产毛片| 欧美美女网站色| 一区在线观看视频| 久久aⅴ国产欧美74aaa| 色嗨嗨av一区二区三区| 久久久综合激的五月天| 一区二区三区四区不卡视频 | 成人综合激情网| 91麻豆精品国产91久久久使用方法 | 国产真实乱偷精品视频免| 91天堂素人约啪| 精品蜜桃在线看| 亚洲一区二区在线视频| 国内国产精品久久| 欧美日韩高清一区二区不卡| 亚洲欧洲色图综合| 国产一区二区三区| 国产盗摄一区二区| 91精品午夜视频| 久久久久9999亚洲精品| 免费成人深夜小野草| 精品一区二区影视| 99久久99久久精品免费看蜜桃| 欧美性猛交xxxx乱大交退制版| 久久精品一区二区三区不卡牛牛| 亚洲宅男天堂在线观看无病毒| 国产一区二区网址| 69堂精品视频| 一区二区三区波多野结衣在线观看 | 极品少妇一区二区| 欧美日韩国产美女| 精久久久久久久久久久| 8v天堂国产在线一区二区| 亚洲男同性恋视频| 99久久er热在这里只有精品15| 久久蜜桃av一区二区天堂| 免费在线看成人av| 欧美日韩国产另类不卡| 亚洲一卡二卡三卡四卡五卡| 99re这里只有精品视频首页| 国产精品入口麻豆原神| 国产一区二区三区av电影 | 久久先锋资源网| 日韩成人精品在线观看| 欧美伊人精品成人久久综合97| 亚洲色图.com| 91丨九色丨尤物|