亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
成人一区二区三区中文字幕| 中文av一区特黄| 91色九色蝌蚪| 91影院在线观看| k8久久久一区二区三区| 国产成人精品在线看| 国产精品亚洲一区二区三区在线| 日本美女一区二区三区| 日韩精品一二区| 日韩精品乱码av一区二区| 亚洲自拍偷拍图区| 午夜视频在线观看一区| 五月天久久比比资源色| 亚洲成人精品在线观看| 亚洲成av人影院| 麻豆精品久久精品色综合| 久久99久国产精品黄毛片色诱| 麻豆视频观看网址久久| 九九九精品视频| 成人黄色小视频| 色综合一个色综合亚洲| 欧美日韩精品福利| 日韩精品一区二区三区中文精品| 精品国产一区二区在线观看| 国产女主播一区| 一区二区三区久久| 麻豆中文一区二区| 本田岬高潮一区二区三区| 欧洲一区在线电影| 精品国产乱码久久久久久影片| 国产三级精品三级在线专区| 亚洲人成亚洲人成在线观看图片 | 亚洲精品一区二区三区影院| 国产精品理论在线观看| 亚洲成人中文在线| 国产精品中文欧美| 欧洲亚洲精品在线| 国产三级三级三级精品8ⅰ区| 亚洲免费av高清| 九九精品一区二区| 色综合视频在线观看| 日韩视频不卡中文| 亚洲女人的天堂| 国产裸体歌舞团一区二区| 在线播放国产精品二区一二区四区| 欧美成人高清电影在线| 一区二区三区四区高清精品免费观看| 日韩成人精品在线观看| 99re热这里只有精品视频| 日韩三级视频在线观看| 亚洲黄色片在线观看| 国产一本一道久久香蕉| 欧美日韩一区二区欧美激情| 国产欧美一区二区精品性| 日韩国产欧美一区二区三区| 91香蕉国产在线观看软件| 精品福利二区三区| 五月婷婷久久综合| 在线国产亚洲欧美| 中文字幕日韩精品一区| 国产一区二三区好的| 欧美夫妻性生活| 亚洲国产日韩一级| 在线免费观看一区| 国产精品久久久久一区二区三区共 | 婷婷丁香久久五月婷婷| 99久久婷婷国产综合精品电影 | 国产 欧美在线| 久久免费精品国产久精品久久久久 | 国产在线播精品第三| 欧美精品久久天天躁| 亚洲男人的天堂网| 91在线观看污| 亚洲欧美激情在线| 91亚洲精华国产精华精华液| 欧美极品另类videosde| 国产乱码精品1区2区3区| 日韩免费视频一区| 韩国av一区二区三区在线观看| 欧美一区日韩一区| 日韩精品国产精品| 日韩一区二区三区四区五区六区| 石原莉奈在线亚洲三区| 欧美性一区二区| 亚洲大片一区二区三区| 欧美猛男男办公室激情| 亚洲成av人片| 91精品国产91热久久久做人人| 日本aⅴ精品一区二区三区| 制服丝袜亚洲精品中文字幕| 视频一区国产视频| 精品国产乱码久久久久久闺蜜| 精品在线你懂的| 国产精品美女久久久久久2018 | 狠狠色狠狠色综合| 国产亚洲午夜高清国产拍精品| 国产成人av电影| 亚洲色图.com| 欧美精品在线观看播放| 蜜臀久久久久久久| 国产欧美一区二区精品秋霞影院| 在线观看一区日韩| 日韩电影在线免费| 国产欧美日产一区| 色哟哟一区二区三区| 男人的j进女人的j一区| 国产亚洲综合色| 欧美性欧美巨大黑白大战| 五月婷婷久久丁香| 中文字幕 久热精品 视频在线| 在线免费亚洲电影| 国产综合色精品一区二区三区| 亚洲天天做日日做天天谢日日欢| 制服丝袜中文字幕一区| 国产成人免费视频网站高清观看视频| 亚洲一区二区三区四区五区中文| 欧美一区午夜精品| 91亚洲精品久久久蜜桃网站| 日本欧洲一区二区| 国产精品美女久久久久久久网站| 欧美人动与zoxxxx乱| www.亚洲色图| 久久成人免费网| 亚洲国产一区二区在线播放| 国产亚洲欧美色| 9191国产精品| 欧美做爰猛烈大尺度电影无法无天| 精品制服美女久久| 亚洲成av人片在www色猫咪| 国产精品美女久久久久久| 91精品久久久久久久91蜜桃| a级精品国产片在线观看| 久久精品国产亚洲a| 亚洲一区中文日韩| 国产精品久久久久一区二区三区| 欧美刺激午夜性久久久久久久| 在线亚洲一区二区| av不卡一区二区三区| 精品一区二区免费视频| 亚洲二区在线观看| 亚洲人妖av一区二区| 日本一区二区三区四区在线视频| 日韩精品一区二区三区四区视频| 欧美影视一区二区三区| 99国产精品久久| 99久久99久久精品免费观看| 国产乱子伦一区二区三区国色天香| 爽好久久久欧美精品| 一片黄亚洲嫩模| 伊人开心综合网| 亚洲男女一区二区三区| 国产精品免费视频一区| 国产精品欧美一级免费| 国产精品久久久久一区二区三区| 中文字幕欧美国产| 亚洲欧洲成人精品av97| 中文字幕国产精品一区二区| 国产欧美日韩不卡| 中文字幕一区二区三区精华液 | 亚洲午夜私人影院| 亚洲午夜国产一区99re久久| 一级做a爱片久久| 亚洲综合无码一区二区| 香蕉久久夜色精品国产使用方法| 午夜在线成人av| 精品一区二区免费视频| 成人精品国产一区二区4080| 91视频在线观看| 欧美片在线播放| 精品日韩欧美一区二区| 国产欧美一区二区三区沐欲| 1024成人网| 丝袜亚洲精品中文字幕一区| 九色综合狠狠综合久久| 国产成人综合网站| 91免费视频大全| 色嗨嗨av一区二区三区| 欧美女孩性生活视频| 欧美色综合影院| 在线播放欧美女士性生活| 亚洲免费观看在线视频| 亚洲一区免费在线观看| 亚洲成a人v欧美综合天堂| 国产清纯在线一区二区www| 一区二区三区在线视频观看 | 天堂成人国产精品一区| 国产精品一二三| 成人h精品动漫一区二区三区| 99在线视频精品| 欧美一区二区三区免费在线看 | 一本色道久久综合亚洲91| 5月丁香婷婷综合| 日韩欧美在线一区二区三区| 欧美一级日韩一级| 亚洲国产精品精华液2区45| 日韩伦理av电影| 日本视频免费一区| 激情亚洲综合在线| 欧美系列日韩一区| 欧美成人精品1314www|