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

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

?? jctrans.cpp

?? Windows 圖形編程 書籍
?? CPP
字號:
//-------------------------------------------------------------------------//
//          Windows Graphics Programming: Win32 GDI and DirectDraw         //
//                        ISBN  0-13-086985-6                              //
//                                                                         //
//  Modified by: Yuan, Feng                             www.fengyuan.com   //
//  Changes    : C++, exception, in-memory source, BGR byte order          //
//  Version    : 1.00.000, May 31, 2000                                    //
//-------------------------------------------------------------------------//

/*
 * jctrans.c
 *
 * Copyright (C) 1995-1998, 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 library routines for transcoding compression,
 * that is, writing raw DCT coefficient arrays to an output JPEG file.
 * The routines in jcapimin.c will also be needed by a transcoder.
 */

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


/* Forward declarations */
LOCAL(void) transencode_master_selection(j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays);
LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays);


/*
 * Compression initialization for writing raw-coefficient data.
 * Before calling this, all parameters and a data destination must be set up.
 * Call jpeg_finish_compress() to actually write the data.
 *
 * The number of passed virtual arrays must match cinfo->num_components.
 * Note that the virtual arrays need not be filled or even realized at
 * the time write_coefficients is called; indeed, if the virtual arrays
 * were requested from this compression object's memory manager, they
 * typically will be realized during this routine and filled afterwards.
 */

GLOBAL(void)
jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
{
  if (cinfo->global_state != CSTATE_START)
    cinfo->ERREXIT1(JERR_BAD_STATE, cinfo->global_state);
  /* Mark all tables to be written */
  jpeg_suppress_tables(cinfo, FALSE);
  /* (Re)initialize error mgr and destination modules */
  cinfo->err->reset_error_mgr ();
  (*cinfo->dest->init_destination) (cinfo);
  /* Perform master selection of active modules */
  transencode_master_selection(cinfo, coef_arrays);
  /* Wait for jpeg_finish_compress() call */
  cinfo->next_scanline = 0;	/* so jpeg_write_marker works */
  cinfo->global_state = CSTATE_WRCOEFS;
}


/*
 * Initialize the compression object with default parameters,
 * then copy from the source object all parameters needed for lossless
 * transcoding.  Parameters that can be varied without loss (such as
 * scan script and Huffman optimization) are left in their default states.
 */

GLOBAL(void)
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
			       j_compress_ptr dstinfo)
{
  JQUANT_TBL ** qtblptr;
  jpeg_component_info *incomp, *outcomp;
  JQUANT_TBL *c_quant, *slot_quant;
  int tblno, ci, coefi;

  /* Safety check to ensure start_compress not called yet. */
  if (dstinfo->global_state != CSTATE_START)
    dstinfo->ERREXIT1(JERR_BAD_STATE, dstinfo->global_state);
  /* Copy fundamental image dimensions */
  dstinfo->image_width = srcinfo->image_width;
  dstinfo->image_height = srcinfo->image_height;
  dstinfo->input_components = srcinfo->num_components;
  dstinfo->in_color_space = srcinfo->jpeg_color_space;
  /* Initialize all parameters to default values */
  jpeg_set_defaults(dstinfo);
  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
   * Fix it to get the right header markers for the image colorspace.
   */
  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
  dstinfo->data_precision = srcinfo->data_precision;
  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
  /* Copy the source's quantization tables. */
  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
      if (*qtblptr == NULL)
	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
      memcpy((*qtblptr)->quantval,
	      srcinfo->quant_tbl_ptrs[tblno]->quantval,
	      sizeof((*qtblptr)->quantval));
      (*qtblptr)->sent_table = FALSE;
    }
  }
  /* Copy the source's per-component info.
   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
   */
  dstinfo->num_components = srcinfo->num_components;
  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
    dstinfo->ERREXIT2(JERR_COMPONENT_COUNT, dstinfo->num_components,
	     MAX_COMPONENTS);
  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
    outcomp->component_id = incomp->component_id;
    outcomp->h_samp_factor = incomp->h_samp_factor;
    outcomp->v_samp_factor = incomp->v_samp_factor;
    outcomp->quant_tbl_no = incomp->quant_tbl_no;
    /* Make sure saved quantization table for component matches the qtable
     * slot.  If not, the input file re-used this qtable slot.
     * IJG encoder currently cannot duplicate this.
     */
    tblno = outcomp->quant_tbl_no;
    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
	srcinfo->quant_tbl_ptrs[tblno] == NULL)
      dstinfo->ERREXIT1(JERR_NO_QUANT_TABLE, tblno);
    slot_quant = srcinfo->quant_tbl_ptrs[tblno];
    c_quant = incomp->quant_table;
    if (c_quant != NULL) {
      for (coefi = 0; coefi < DCTSIZE2; coefi++) {
	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
	  dstinfo->ERREXIT1(JERR_MISMATCHED_QUANT_TABLE, tblno);
      }
    }
    /* Note: we do not copy the source's Huffman table assignments;
     * instead we rely on jpeg_set_colorspace to have made a suitable choice.
     */
  }
  /* Also copy JFIF version and resolution information, if available.
   * Strictly speaking this isn't "critical" info, but it's nearly
   * always appropriate to copy it if available.  In particular,
   * if the application chooses to copy JFIF 1.02 extension markers from
   * the source file, we need to copy the version to make sure we don't
   * emit a file that has 1.02 extensions but a claimed version of 1.01.
   * We will *not*, however, copy version info from mislabeled "2.01" files.
   */
  if (srcinfo->saw_JFIF_marker) {
    if (srcinfo->JFIF_major_version == 1) {
      dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
      dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
    }
    dstinfo->density_unit = srcinfo->density_unit;
    dstinfo->X_density = srcinfo->X_density;
    dstinfo->Y_density = srcinfo->Y_density;
  }
}


/*
 * Master selection of compression modules for transcoding.
 * This substitutes for jcinit.c's initialization of the full compressor.
 */

LOCAL(void)
transencode_master_selection (j_compress_ptr cinfo,
			      jvirt_barray_ptr * coef_arrays)
{
  /* Although we don't actually use input_components for transcoding,
   * jcmaster.c's initial_setup will complain if input_components is 0.
   */
  cinfo->input_components = 1;
  /* Initialize master control (includes parameter checking/processing) */
  jinit_c_master_control(cinfo, TRUE /* transcode only */);

  /* Entropy encoding: either Huffman or arithmetic coding. */
  if (cinfo->arith_code) {
    cinfo->ERREXIT(JERR_ARITH_NOTIMPL);
  } else {
    if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
      jinit_phuff_encoder(cinfo);
#else
      cinfo->ERREXIT(JERR_NOT_COMPILED);
#endif
    } else
      jinit_huff_encoder(cinfo);
  }

  /* We need a special coefficient buffer controller. */
  transencode_coef_controller(cinfo, coef_arrays);

  jinit_marker_writer(cinfo);

  /* We can now tell the memory manager to allocate virtual arrays. */
  cinfo->mem->realize_virt_arrays();

  /* Write the datastream header (SOI, JFIF) immediately.
   * Frame and scan headers are postponed till later.
   * This lets application insert special markers after the SOI.
   */
  (*cinfo->marker->write_file_header) (cinfo);
}


/*
 * The rest of this file is a special implementation of the coefficient
 * buffer controller.  This is similar to jccoefct.c, but it handles only
 * output from presupplied virtual arrays.  Furthermore, we generate any
 * dummy padding blocks on-the-fly rather than expecting them to be present
 * in the arrays.
 */

/* Private buffer controller object */

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

  JDIMENSION iMCU_row_num;	/* iMCU row # within image */
  JDIMENSION mcu_ctr;		/* counts MCUs processed in current row */
  int MCU_vert_offset;		/* counts MCU rows within iMCU row */
  int MCU_rows_per_iMCU_row;	/* number of such rows needed */

  /* Virtual block array for each component. */
  jvirt_barray_ptr * whole_image;

  /* Workspace for constructing dummy blocks at right/bottom edges. */
  JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU];
} my_coef_controller;

typedef my_coef_controller * my_coef_ptr;


LOCAL(void)
start_iMCU_row (j_compress_ptr cinfo)
/* Reset within-iMCU-row counters for a new row */
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;

  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   * But at the bottom of the image, process only what's left.
   */
  if (cinfo->comps_in_scan > 1) {
    coef->MCU_rows_per_iMCU_row = 1;
  } else {
    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
    else
      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
  }

  coef->mcu_ctr = 0;
  coef->MCU_vert_offset = 0;
}


/*
 * Initialize for a processing pass.
 */

void start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;

  if (pass_mode != JBUF_CRANK_DEST)
    cinfo->ERREXIT(JERR_BAD_BUFFER_MODE);

  coef->iMCU_row_num = 0;
  start_iMCU_row(cinfo);
}


/*
 * Process some data.
 * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
 * per call, ie, v_samp_factor block rows for each component in the scan.
 * The data is obtained from the virtual arrays and fed to the entropy coder.
 * Returns TRUE if the iMCU row is completed, FALSE if suspended.
 *
 * NB: input_buf is ignored; it is likely to be a NULL pointer.
 */

LOCAL(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
  JDIMENSION MCU_col_num;	/* index of current MCU within row */
  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  int blkn, ci, xindex, yindex, yoffset, blockcnt;
  JDIMENSION start_col;
  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
  JBLOCKROW buffer_ptr;
  jpeg_component_info *compptr;

  /* Align the virtual buffers for the components used in this scan. */
  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    buffer[ci] = cinfo->mem->access_virt_barray
      (coef->whole_image[compptr->component_index],
       coef->iMCU_row_num * compptr->v_samp_factor,
       (JDIMENSION) compptr->v_samp_factor, FALSE);
  }

  /* Loop to process one whole iMCU row */
  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
       yoffset++) {
    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
	 MCU_col_num++) {
      /* Construct list of pointers to DCT blocks belonging to this MCU */
      blkn = 0;			/* index of current DCT block within MCU */
      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
	compptr = cinfo->cur_comp_info[ci];
	start_col = MCU_col_num * compptr->MCU_width;
	blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
						: compptr->last_col_width;
	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
	  if (coef->iMCU_row_num < last_iMCU_row ||
	      yindex+yoffset < compptr->last_row_height) {
	    /* Fill in pointers to real blocks in this row */
	    buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
	    for (xindex = 0; xindex < blockcnt; xindex++)
	      MCU_buffer[blkn++] = buffer_ptr++;
	  } else {
	    /* At bottom of image, need a whole row of dummy blocks */
	    xindex = 0;
	  }
	  /* Fill in any dummy blocks needed in this row.
	   * Dummy blocks are filled in the same way as in jccoefct.c:
	   * all zeroes in the AC entries, DC entries equal to previous
	   * block's DC value.  The init routine has already zeroed the
	   * AC entries, so we need only set the DC entries correctly.
	   */
	  for (; xindex < compptr->MCU_width; xindex++) {
	    MCU_buffer[blkn] = coef->dummy_buffer[blkn];
	    MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
	    blkn++;
	  }
	}
      }
      /* Try to write the MCU. */
      if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
	/* Suspension forced; update state counters and exit */
	coef->MCU_vert_offset = yoffset;
	coef->mcu_ctr = MCU_col_num;
	return FALSE;
      }
    }
    /* Completed an MCU row, but perhaps not an iMCU row */
    coef->mcu_ctr = 0;
  }
  /* Completed the iMCU row, advance counters for next one */
  coef->iMCU_row_num++;
  start_iMCU_row(cinfo);
  return TRUE;
}


/*
 * Initialize coefficient buffer controller.
 *
 * Each passed coefficient array must be the right size for that
 * coefficient: width_in_blocks wide and height_in_blocks high,
 * with unitheight at least v_samp_factor.
 */

LOCAL(void)
transencode_coef_controller (j_compress_ptr cinfo,
			     jvirt_barray_ptr * coef_arrays)
{
	my_coef_ptr coef;
	JBLOCKROW buffer;
  
	coef = (my_coef_ptr)
		cinfo->mem->alloc_small(JPOOL_IMAGE, sizeof(my_coef_controller));
	cinfo->coef = (struct jpeg_c_coef_controller *) coef;
	coef->pub.start_pass = start_pass_coef;
	coef->pub.compress_data = compress_output;

	/* Save pointer to virtual arrays */
	coef->whole_image = coef_arrays;

	/* Allocate and pre-zero space for dummy DCT blocks. */
	buffer = (JBLOCKROW)
				cinfo->mem->alloc_large(JPOOL_IMAGE,
					C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
	jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  
	for (int i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) 
	{
		coef->dummy_buffer[i] = buffer + i;
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品欧美一区二区三区麻豆| 中国色在线观看另类| 国产91精品久久久久久久网曝门| 亚洲精品久久久蜜桃| 精品国偷自产国产一区| 色综合天天综合| 国产精品系列在线观看| 日本色综合中文字幕| 一区二区三区免费| 中文无字幕一区二区三区 | 91福利国产成人精品照片| 精品一区二区在线观看| 视频一区视频二区中文字幕| 亚洲男同1069视频| 日本一区二区免费在线 | 欧美日韩在线一区二区| www.久久久久久久久| 国产一区二区三区电影在线观看| 视频一区二区国产| 亚洲成人激情av| 亚洲六月丁香色婷婷综合久久| 国产欧美一区二区三区网站| 日韩欧美一级精品久久| 欧美精品第1页| 欧美日韩国产美女| 在线一区二区视频| 91黄色免费网站| 色婷婷狠狠综合| 日本韩国欧美在线| 欧美性猛交xxxxxx富婆| 色诱视频网站一区| 91老师国产黑色丝袜在线| av亚洲精华国产精华精华| 不卡av免费在线观看| 成人禁用看黄a在线| 国产99久久久精品| 菠萝蜜视频在线观看一区| 不卡av在线网| 一本色道久久综合精品竹菊| 91免费观看在线| 日本电影欧美片| 欧美中文字幕一二三区视频| 欧美性大战久久| 在线不卡欧美精品一区二区三区| 欧美日韩在线免费视频| 欧美精品第1页| 日韩精品自拍偷拍| 久久久久久电影| 亚洲天堂a在线| 亚洲国产综合视频在线观看| 肉色丝袜一区二区| 国精产品一区一区三区mba桃花 | 自拍av一区二区三区| 亚洲激情欧美激情| 一区二区不卡在线播放| 日韩电影一二三区| 精品一二三四区| 成人免费视频视频在线观看免费| av中文字幕一区| 欧美日韩中文字幕一区| 精品国产免费一区二区三区四区| 国产亚洲综合av| 亚洲美女少妇撒尿| 日韩精品三区四区| 国产精品99久久久久久宅男| av亚洲精华国产精华精| 欧美人xxxx| 国产欧美视频一区二区| 亚洲精品国产视频| 日本免费在线视频不卡一不卡二| 国产美女视频一区| 91蜜桃网址入口| 欧美一级一区二区| 日本一二三不卡| 亚洲成人午夜影院| 国产精品一品视频| 欧美色综合网站| 国产午夜精品一区二区| 亚洲国产成人精品视频| 国产乱码精品一区二区三区忘忧草| 91麻豆精东视频| 精品国产1区二区| 一区二区在线观看免费| 蜜桃传媒麻豆第一区在线观看| 波多野结衣中文字幕一区二区三区| 欧美日韩夫妻久久| 国产精品午夜在线观看| 日韩精品电影一区亚洲| 97久久人人超碰| 久久人人超碰精品| 偷窥少妇高潮呻吟av久久免费| 国产精品911| 欧美丰满嫩嫩电影| 亚洲视频免费在线观看| 日本91福利区| 91视频你懂的| 久久久久成人黄色影片| 亚洲成人高清在线| 成人久久视频在线观看| 日韩欧美国产三级电影视频| 艳妇臀荡乳欲伦亚洲一区| 国产福利视频一区二区三区| 在线不卡的av| 亚洲电影一区二区三区| 91原创在线视频| 国产亚洲精品资源在线26u| 琪琪久久久久日韩精品| 色婷婷精品久久二区二区蜜臂av| 国产人成一区二区三区影院| 美女一区二区视频| 欧美日韩免费视频| 亚洲伦理在线精品| 国产91精品一区二区麻豆亚洲| 欧美一区二区观看视频| 亚洲电影视频在线| 色8久久精品久久久久久蜜| 国产欧美1区2区3区| 国内成人精品2018免费看| 欧美男人的天堂一二区| 亚洲精品福利视频网站| 大胆欧美人体老妇| 欧美精品一区二区三区在线播放| 日韩电影在线观看电影| 在线成人免费视频| 亚洲成人动漫在线观看| 欧美性猛交xxxxxx富婆| 亚洲一区二区三区自拍| 日本大香伊一区二区三区| 亚洲欧洲制服丝袜| 91尤物视频在线观看| 成人免费一区二区三区视频| 丁香桃色午夜亚洲一区二区三区| 久久色.com| 国产精品一区二区在线播放 | 亚洲一区二区美女| 欧美在线一二三| 五月天激情综合| 91精品国产综合久久福利| 日本欧美加勒比视频| 日韩美女视频一区二区在线观看| 精品一区二区在线播放| 国产亚洲欧洲997久久综合| 成人精品视频一区二区三区尤物| 中文av字幕一区| 在线视频你懂得一区| 亚洲成av人综合在线观看| 91精品一区二区三区在线观看| 蜜桃av一区二区三区| 久久精品夜夜夜夜久久| 不卡的av在线播放| 亚洲一区在线观看网站| 欧美日韩成人在线| 蜜桃传媒麻豆第一区在线观看| 久久久影院官网| 不卡的电影网站| 亚洲亚洲精品在线观看| 欧美精品成人一区二区三区四区| 久久99精品久久久| 国产精品乱码人人做人人爱| 一本久道久久综合中文字幕| 午夜成人在线视频| 久久这里只有精品视频网| 成人激情免费视频| 污片在线观看一区二区| 久久综合999| 99国产精品久久久久| 日日夜夜免费精品视频| 久久亚洲综合av| 色综合天天综合| 久久成人免费网| 中文子幕无线码一区tr| 欧美日韩免费不卡视频一区二区三区| 欧美a一区二区| 亚洲天天做日日做天天谢日日欢| 91.com在线观看| 99精品视频中文字幕| 日韩成人免费电影| 国产精品视频线看| 日韩一区二区免费电影| 99久久免费视频.com| 免费在线一区观看| 亚洲欧美综合色| 日韩精品综合一本久道在线视频| 99久久免费精品| 久久99精品久久久久久国产越南| 亚洲精品国产一区二区精华液 | 国产精品水嫩水嫩| 欧美日本韩国一区二区三区视频 | 美国欧美日韩国产在线播放| 国产精品色在线观看| 91精品欧美综合在线观看最新| 成人免费视频app| 麻豆精品视频在线| 亚洲一区视频在线| 国产精品视频九色porn| 337p粉嫩大胆色噜噜噜噜亚洲 | 日韩欧美一级精品久久| 91成人网在线| 99久久99久久综合| 韩国av一区二区三区在线观看|