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

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

?? jcphuff.c

?? windows CE下jpeg壓縮源碼
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
    }
    
    /* Find the number of bits needed for the magnitude of the coefficient */
    nbits = 0;
    while (temp) {
      nbits++;
      temp >>= 1;
    }
    /* Check for out-of-range coefficient values.
     * Since we're encoding a difference, the range limit is twice as much.
     */
    if (nbits > MAX_COEF_BITS+1)
      ERREXIT(cinfo, JERR_BAD_DCT_COEF);
    
    /* Count/emit the Huffman-coded symbol for the number of bits */
    emit_symbol(entropy, compptr->dc_tbl_no, nbits);
    
    /* Emit that number of bits of the value, if positive, */
    /* or the complement of its magnitude, if negative. */
    if (nbits)			/* emit_bits rejects calls with size 0 */
      emit_bits(entropy, (unsigned int) temp2, nbits);
  }

  cinfo->dest->next_output_byte = entropy->next_output_byte;
  cinfo->dest->free_in_buffer = entropy->free_in_buffer;

  /* Update restart-interval state too */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0) {
      entropy->restarts_to_go = cinfo->restart_interval;
      entropy->next_restart_num++;
      entropy->next_restart_num &= 7;
    }
    entropy->restarts_to_go--;
  }

  return TRUE;
}


/*
 * MCU encoding for AC initial scan (either spectral selection,
 * or first pass of successive approximation).
 */

METHODDEF(boolean)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  register int temp, temp2;
  register int nbits;
  register int r, k;
  int Se = cinfo->Se;
  int Al = cinfo->Al;
  JBLOCKROW block;

  entropy->next_output_byte = cinfo->dest->next_output_byte;
  entropy->free_in_buffer = cinfo->dest->free_in_buffer;

  /* Emit restart marker if needed */
  if (cinfo->restart_interval)
    if (entropy->restarts_to_go == 0)
      emit_restart(entropy, entropy->next_restart_num);

  /* Encode the MCU data block */
  block = MCU_data[0];

  /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
  
  r = 0;			/* r = run length of zeros */
   
  for (k = cinfo->Ss; k <= Se; k++) {
    if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
      r++;
      continue;
    }
    /* We must apply the point transform by Al.  For AC coefficients this
     * is an integer division with rounding towards 0.  To do this portably
     * in C, we shift after obtaining the absolute value; so the code is
     * interwoven with finding the abs value (temp) and output bits (temp2).
     */
    if (temp < 0) {
      temp = -temp;		/* temp is abs value of input */
      temp >>= Al;		/* apply the point transform */
      /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
      temp2 = ~temp;
    } else {
      temp >>= Al;		/* apply the point transform */
      temp2 = temp;
    }
    /* Watch out for case that nonzero coef is zero after point transform */
    if (temp == 0) {
      r++;
      continue;
    }

    /* Emit any pending EOBRUN */
    if (entropy->EOBRUN > 0)
      emit_eobrun(entropy);
    /* if run length > 15, must emit special run-length-16 codes (0xF0) */
    while (r > 15) {
      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
      r -= 16;
    }

    /* Find the number of bits needed for the magnitude of the coefficient */
    nbits = 1;			/* there must be at least one 1 bit */
    while ((temp >>= 1))
      nbits++;
    /* Check for out-of-range coefficient values */
    if (nbits > MAX_COEF_BITS)
      ERREXIT(cinfo, JERR_BAD_DCT_COEF);

    /* Count/emit Huffman symbol for run length / number of bits */
    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);

    /* Emit that number of bits of the value, if positive, */
    /* or the complement of its magnitude, if negative. */
    emit_bits(entropy, (unsigned int) temp2, nbits);

    r = 0;			/* reset zero run length */
  }

  if (r > 0) {			/* If there are trailing zeroes, */
    entropy->EOBRUN++;		/* count an EOB */
    if (entropy->EOBRUN == 0x7FFF)
      emit_eobrun(entropy);	/* force it out to avoid overflow */
  }

  cinfo->dest->next_output_byte = entropy->next_output_byte;
  cinfo->dest->free_in_buffer = entropy->free_in_buffer;

  /* Update restart-interval state too */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0) {
      entropy->restarts_to_go = cinfo->restart_interval;
      entropy->next_restart_num++;
      entropy->next_restart_num &= 7;
    }
    entropy->restarts_to_go--;
  }

  return TRUE;
}


/*
 * MCU encoding for DC successive approximation refinement scan.
 * Note: we assume such scans can be multi-component, although the spec
 * is not very clear on the point.
 */

METHODDEF(boolean)
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  register int temp;
  int blkn;
  int Al = cinfo->Al;
  JBLOCKROW block;

  entropy->next_output_byte = cinfo->dest->next_output_byte;
  entropy->free_in_buffer = cinfo->dest->free_in_buffer;

  /* Emit restart marker if needed */
  if (cinfo->restart_interval)
    if (entropy->restarts_to_go == 0)
      emit_restart(entropy, entropy->next_restart_num);

  /* Encode the MCU data blocks */
  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    block = MCU_data[blkn];

    /* We simply emit the Al'th bit of the DC coefficient value. */
    temp = (*block)[0];
    emit_bits(entropy, (unsigned int) (temp >> Al), 1);
  }

  cinfo->dest->next_output_byte = entropy->next_output_byte;
  cinfo->dest->free_in_buffer = entropy->free_in_buffer;

  /* Update restart-interval state too */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0) {
      entropy->restarts_to_go = cinfo->restart_interval;
      entropy->next_restart_num++;
      entropy->next_restart_num &= 7;
    }
    entropy->restarts_to_go--;
  }

  return TRUE;
}


/*
 * MCU encoding for AC successive approximation refinement scan.
 */

METHODDEF(boolean)
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  register int temp;
  register int r, k;
  int EOB;
  char *BR_buffer;
  unsigned int BR;
  int Se = cinfo->Se;
  int Al = cinfo->Al;
  JBLOCKROW block;
  int absvalues[DCTSIZE2];

  entropy->next_output_byte = cinfo->dest->next_output_byte;
  entropy->free_in_buffer = cinfo->dest->free_in_buffer;

  /* Emit restart marker if needed */
  if (cinfo->restart_interval)
    if (entropy->restarts_to_go == 0)
      emit_restart(entropy, entropy->next_restart_num);

  /* Encode the MCU data block */
  block = MCU_data[0];

  /* It is convenient to make a pre-pass to determine the transformed
   * coefficients' absolute values and the EOB position.
   */
  EOB = 0;
  for (k = cinfo->Ss; k <= Se; k++) {
    temp = (*block)[jpeg_natural_order[k]];
    /* We must apply the point transform by Al.  For AC coefficients this
     * is an integer division with rounding towards 0.  To do this portably
     * in C, we shift after obtaining the absolute value.
     */
    if (temp < 0)
      temp = -temp;		/* temp is abs value of input */
    temp >>= Al;		/* apply the point transform */
    absvalues[k] = temp;	/* save abs value for main pass */
    if (temp == 1)
      EOB = k;			/* EOB = index of last newly-nonzero coef */
  }

  /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
  
  r = 0;			/* r = run length of zeros */
  BR = 0;			/* BR = count of buffered bits added now */
  BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */

  for (k = cinfo->Ss; k <= Se; k++) {
    if ((temp = absvalues[k]) == 0) {
      r++;
      continue;
    }

    /* Emit any required ZRLs, but not if they can be folded into EOB */
    while (r > 15 && k <= EOB) {
      /* emit any pending EOBRUN and the BE correction bits */
      emit_eobrun(entropy);
      /* Emit ZRL */
      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
      r -= 16;
      /* Emit buffered correction bits that must be associated with ZRL */
      emit_buffered_bits(entropy, BR_buffer, BR);
      BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
      BR = 0;
    }

    /* If the coef was previously nonzero, it only needs a correction bit.
     * NOTE: a straight translation of the spec's figure G.7 would suggest
     * that we also need to test r > 15.  But if r > 15, we can only get here
     * if k > EOB, which implies that this coefficient is not 1.
     */
    if (temp > 1) {
      /* The correction bit is the next bit of the absolute value. */
      BR_buffer[BR++] = (char) (temp & 1);
      continue;
    }

    /* Emit any pending EOBRUN and the BE correction bits */
    emit_eobrun(entropy);

    /* Count/emit Huffman symbol for run length / number of bits */
    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);

    /* Emit output bit for newly-nonzero coef */
    temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
    emit_bits(entropy, (unsigned int) temp, 1);

    /* Emit buffered correction bits that must be associated with this code */
    emit_buffered_bits(entropy, BR_buffer, BR);
    BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
    BR = 0;
    r = 0;			/* reset zero run length */
  }

  if (r > 0 || BR > 0) {	/* If there are trailing zeroes, */
    entropy->EOBRUN++;		/* count an EOB */
    entropy->BE += BR;		/* concat my correction bits to older ones */
    /* We force out the EOB if we risk either:
     * 1. overflow of the EOB counter;
     * 2. overflow of the correction bit buffer during the next MCU.
     */
    if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
      emit_eobrun(entropy);
  }

  cinfo->dest->next_output_byte = entropy->next_output_byte;
  cinfo->dest->free_in_buffer = entropy->free_in_buffer;

  /* Update restart-interval state too */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0) {
      entropy->restarts_to_go = cinfo->restart_interval;
      entropy->next_restart_num++;
      entropy->next_restart_num &= 7;
    }
    entropy->restarts_to_go--;
  }

  return TRUE;
}


/*
 * Finish up at the end of a Huffman-compressed progressive scan.
 */

METHODDEF(void)
finish_pass_phuff (j_compress_ptr cinfo)
{   
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;

  entropy->next_output_byte = cinfo->dest->next_output_byte;
  entropy->free_in_buffer = cinfo->dest->free_in_buffer;

  /* Flush out any buffered data */
  emit_eobrun(entropy);
  flush_bits(entropy);

  cinfo->dest->next_output_byte = entropy->next_output_byte;
  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
}


/*
 * Finish up a statistics-gathering pass and create the new Huffman tables.
 */

METHODDEF(void)
finish_pass_gather_phuff (j_compress_ptr cinfo)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  boolean is_DC_band;
  int ci, tbl;
  jpeg_component_info * compptr;
  JHUFF_TBL **htblptr;
  boolean did[NUM_HUFF_TBLS];

  /* Flush out buffered data (all we care about is counting the EOB symbol) */
  emit_eobrun(entropy);

  is_DC_band = (cinfo->Ss == 0);

  /* It's important not to apply jpeg_gen_optimal_table more than once
   * per table, because it clobbers the input frequency counts!
   */
  MEMZERO(did, SIZEOF(did));

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    if (is_DC_band) {
      if (cinfo->Ah != 0)	/* DC refinement needs no table */
	continue;
      tbl = compptr->dc_tbl_no;
    } else {
      tbl = compptr->ac_tbl_no;
    }
    if (! did[tbl]) {
      if (is_DC_band)
        htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
      else
        htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
      if (*htblptr == NULL)
        *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
      did[tbl] = TRUE;
    }
  }
}


/*
 * Module initialization routine for progressive Huffman entropy encoding.
 */

GLOBAL(void)
jinit_phuff_encoder (j_compress_ptr cinfo)
{
  phuff_entropy_ptr entropy;
  int i;

  entropy = (phuff_entropy_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(phuff_entropy_encoder));
  cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
  entropy->pub.start_pass = start_pass_phuff;

  /* Mark tables unallocated */
  for (i = 0; i < NUM_HUFF_TBLS; i++) {
    entropy->derived_tbls[i] = NULL;
    entropy->count_ptrs[i] = NULL;
  }
  entropy->bit_buffer = NULL;	/* needed only in AC refinement scan */
}

#endif /* C_PROGRESSIVE_SUPPORTED */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产欧美日韩| 成人美女视频在线观看| 色综合久久久久综合99| 精品国产乱码久久久久久浪潮 | 成人黄色综合网站| 91精品国产综合久久蜜臀| 亚洲男同性视频| 岛国精品在线播放| 精品黑人一区二区三区久久| 亚洲国产视频直播| 91在线国产观看| 国产欧美日韩另类一区| 久久精品国产亚洲一区二区三区| 在线观看成人小视频| 最新热久久免费视频| 国产福利一区二区| 337p粉嫩大胆噜噜噜噜噜91av| 视频一区欧美精品| 91福利社在线观看| 亚洲天堂2016| 成人精品视频.| 国产人妖乱国产精品人妖| 精品一区二区av| 日韩欧美在线网站| 免费看日韩a级影片| 欧美男生操女生| 亚洲第一二三四区| 欧美在线免费播放| 一区二区三区色| 成人午夜电影小说| 中文一区一区三区高中清不卡| 国产精品18久久久久久久久| 26uuu精品一区二区在线观看| 久久99精品久久久久久国产越南| 欧美高清视频一二三区| 婷婷久久综合九色国产成人| 欧美色综合网站| 午夜精品久久久久久久99水蜜桃| 欧美性xxxxx极品少妇| 一区二区三区四区在线免费观看 | 麻豆国产一区二区| 91精品国产免费| 久久机这里只有精品| 欧美精品一区二区三区蜜臀| 经典一区二区三区| 久久久综合激的五月天| 国产成人综合视频| 中文字幕一区二区三区在线播放| 成人18视频日本| 亚洲乱码国产乱码精品精可以看 | 成人国产亚洲欧美成人综合网| 国产精品无人区| 99国产精品国产精品毛片| 亚洲精品一二三| 欧美色区777第一页| 日韩经典中文字幕一区| 日韩美女主播在线视频一区二区三区| 久久精品国产第一区二区三区| 精品国产一二三| 国产91精品久久久久久久网曝门| 国产精品久久久久久久午夜片| 91免费视频大全| 香蕉久久一区二区不卡无毒影院 | 成人一区在线观看| 亚洲天堂精品在线观看| 欧美日韩中文一区| 精品一区二区三区影院在线午夜| 亚洲国产电影在线观看| 色综合色综合色综合色综合色综合| 亚洲自拍偷拍图区| 日韩免费电影一区| 成人激情图片网| 亚洲综合网站在线观看| 日韩片之四级片| 成人午夜av在线| 午夜欧美视频在线观看| 精品国产亚洲一区二区三区在线观看| 成人激情小说乱人伦| 亚洲成av人影院| 国产亚洲欧美一级| 欧美影院精品一区| 国产一区二区精品久久| 亚洲柠檬福利资源导航| 国产精品久久一卡二卡| 国产精品国产三级国产aⅴ中文| av在线不卡观看免费观看| 亚洲自拍偷拍九九九| 欧美成人r级一区二区三区| 成人免费精品视频| 三级久久三级久久久| 久久这里都是精品| 欧美在线色视频| 国产美女av一区二区三区| 亚洲欧美日韩久久| 精品国产1区二区| 91成人在线精品| 国产一区91精品张津瑜| 亚洲高清中文字幕| 欧美激情综合在线| 在线不卡一区二区| 国产69精品久久777的优势| 性做久久久久久久免费看| 国产三级精品三级在线专区| 欧美日韩一本到| 成人午夜av在线| 麻豆成人久久精品二区三区红| 亚洲色图欧美激情| 久久综合九色综合97婷婷女人| 日本韩国精品在线| 国产精品亚洲一区二区三区妖精| 国产成人免费视频一区| 一区在线观看免费| 精品久久人人做人人爰| 亚洲欧洲另类国产综合| 日韩欧美一区在线观看| 在线这里只有精品| 国产成+人+日韩+欧美+亚洲| 午夜精品久久久久久久久久| 中文字幕一区免费在线观看| 久久亚洲欧美国产精品乐播| 69堂亚洲精品首页| 在线视频你懂得一区| 成人在线视频首页| 国产真实乱子伦精品视频| 肉色丝袜一区二区| 亚洲综合自拍偷拍| 国产精品超碰97尤物18| 精品成人一区二区三区| 5566中文字幕一区二区电影| 欧美亚洲高清一区二区三区不卡| 丁香一区二区三区| 国产一区二区不卡老阿姨| 久久精品av麻豆的观看方式| 天天综合天天做天天综合| 一区二区三区国产豹纹内裤在线 | 91麻豆精东视频| 国产黑丝在线一区二区三区| 蜜桃视频一区二区三区在线观看| 五月婷婷色综合| 亚洲国产日韩综合久久精品| 亚洲欧美国产77777| 中文字幕中文在线不卡住| 国产日产欧美一区| 国产性天天综合网| 久久美女艺术照精彩视频福利播放| 欧美成人官网二区| 欧美大片免费久久精品三p| 4438亚洲最大| 欧美一卡二卡在线观看| 制服.丝袜.亚洲.中文.综合| 欧美群妇大交群的观看方式| 欧美另类z0zxhd电影| 欧美三级在线播放| 欧美精品第1页| 欧美精品久久一区| 欧美一区午夜视频在线观看| 欧美一三区三区四区免费在线看 | 欧美成人国产一区二区| 日韩欧美国产电影| 精品三级在线观看| 久久亚洲一区二区三区四区| 久久久久久久久99精品| 国产人成亚洲第一网站在线播放| 国产欧美日韩在线视频| 国产精品水嫩水嫩| 国产精品久久久久aaaa| 亚洲欧洲成人自拍| 一区二区激情视频| 亚洲va欧美va人人爽| 日av在线不卡| 国内久久精品视频| 成人午夜激情在线| 色av成人天堂桃色av| 欧美在线小视频| 欧美精品日韩一区| 欧美成人性战久久| 国产欧美精品日韩区二区麻豆天美| 26uuu亚洲综合色欧美| 国产女人水真多18毛片18精品视频| **性色生活片久久毛片| 一区二区在线看| 亚洲午夜精品17c| 青青草97国产精品免费观看无弹窗版 | 91精品欧美福利在线观看| 精品久久久久久久久久久久久久久| 国产无一区二区| 一区二区三区 在线观看视频| 日韩国产精品大片| 国产在线精品国自产拍免费| 成人不卡免费av| 欧美日韩专区在线| 精品国产一区二区亚洲人成毛片| 国产精品日日摸夜夜摸av| 亚洲一区二区四区蜜桃| 美国十次综合导航| 99久久精品国产一区二区三区 | 在线影视一区二区三区| 欧美一区二区三区播放老司机| 久久久久久免费| 一级女性全黄久久生活片免费|