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

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

?? jcphuff.c

?? MPEG4解碼程序源代碼(能夠對各種MPEG4文件進行解碼)
?? C
?? 第 1 頁 / 共 2 頁
字號:
    /* Compute the DC value after the required point transform by Al.
     * This is simply an arithmetic right shift.
     */
    temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);

    /* DC differences are figured on the point-transformed values. */
    temp = temp2 - entropy->last_dc_val[ci];
    entropy->last_dc_val[ci] = temp2;

    /* Encode the DC coefficient difference per section G.1.2.1 */
    temp2 = temp;
    if (temp < 0) {
      temp = -temp;		/* temp is abs value of input */
      /* For a negative input, want temp2 = bitwise complement of abs(input) */
      /* This code assumes we are on a two's complement machine */
      temp2--;
    }
    
    /* Find the number of bits needed for the magnitude of the coefficient */
    nbits = 0;
    while (temp) {
      nbits++;
      temp >>= 1;
    }
    
    /* 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++;

    /* 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 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青青草伊人久久| 欧美韩国日本综合| 日本欧美大码aⅴ在线播放| 欧美三级电影一区| 亚洲成人1区2区| 欧美日韩日日骚| 蜜芽一区二区三区| 精品国产免费一区二区三区四区| 国产成人综合视频| 日本一区二区综合亚洲| 99久久婷婷国产| 亚洲亚洲人成综合网络| 日韩一区二区麻豆国产| 国产麻豆精品95视频| 国产欧美精品区一区二区三区 | 粉嫩av一区二区三区粉嫩| 精品免费一区二区三区| 成人精品一区二区三区四区| ㊣最新国产の精品bt伙计久久| 亚洲国产成人av| 91麻豆精品国产91久久久资源速度| 久久精品在这里| 91免费小视频| 日本va欧美va精品| 国产日韩一级二级三级| 在线观看日产精品| 久久国产麻豆精品| 亚洲视频在线观看一区| 91精品国产91久久综合桃花| 国产精品自拍一区| 一区二区三区蜜桃网| 精品美女在线观看| 在线一区二区三区四区五区| 久久99精品久久久久久国产越南| 欧美无人高清视频在线观看| 紧缚奴在线一区二区三区| 亚洲男人天堂一区| 日韩欧美一区二区视频| av在线这里只有精品| 免费成人深夜小野草| 亚洲日本电影在线| 精品久久一区二区三区| 欧美视频中文字幕| 成人午夜私人影院| 久久精品国产秦先生| 亚洲另类一区二区| 国产日韩精品视频一区| 欧美一区二区在线视频| 日本久久一区二区| 国产白丝网站精品污在线入口| 国产亚洲精品超碰| 欧美一区二区三区视频| 在线视频国产一区| 99久久精品国产精品久久| 久久国产三级精品| 亚洲国产一二三| 亚洲色欲色欲www| 欧美韩国日本一区| 久久久久久久综合色一本| 欧美一级国产精品| 日本二三区不卡| 9l国产精品久久久久麻豆| 国产精品亚洲视频| 韩国三级电影一区二区| 丝袜美腿高跟呻吟高潮一区| 玉足女爽爽91| 亚洲美女免费视频| 综合分类小说区另类春色亚洲小说欧美 | 欧美日韩亚洲综合一区| heyzo一本久久综合| 国产999精品久久| 国产一区二区三区久久久| 蜜臀av性久久久久蜜臀aⅴ| 午夜精品一区在线观看| 亚洲一区二区精品久久av| 一区二区三区欧美久久| 亚洲免费在线视频一区 二区| 色综合天天综合网国产成人综合天 | 日韩一区二区三免费高清| 91久久国产最好的精华液| 91最新地址在线播放| 色香色香欲天天天影视综合网| 亚洲视频每日更新| 亚洲免费色视频| 最新国产の精品合集bt伙计| 国产日产欧美一区二区三区| 欧美极品aⅴ影院| 国产精品狼人久久影院观看方式| 欧洲一区在线观看| 欧美视频在线一区二区三区 | 一区二区三区在线免费播放| 亚洲精品成人精品456| 依依成人综合视频| 五月激情综合婷婷| 麻豆精品精品国产自在97香蕉| 中文一区二区在线观看| 久久久久久久一区| 亚洲国产电影在线观看| 亚洲柠檬福利资源导航| 亚洲大型综合色站| 裸体一区二区三区| 国产成人在线视频网站| 色偷偷久久一区二区三区| 欧美日韩二区三区| 精品国产sm最大网站免费看| 国产精品久久看| 亚洲精品国产一区二区精华液 | 一本色道**综合亚洲精品蜜桃冫| 免费成人小视频| www.在线成人| 欧美无砖砖区免费| 精品精品国产高清a毛片牛牛| 91美女在线看| 91精品国产麻豆国产自产在线 | 亚洲一区在线播放| 免费高清不卡av| 9人人澡人人爽人人精品| 欧美日本一区二区三区四区| 久久久精品综合| 夜夜嗨av一区二区三区中文字幕| 国产日韩精品一区| 亚洲电影一区二区| 粉嫩欧美一区二区三区高清影视 | 成人精品国产免费网站| 91成人免费网站| 久久精品一区二区| 五月婷婷激情综合| 成人免费看视频| 欧美男同性恋视频网站| 中文字幕中文乱码欧美一区二区| 久久久99免费| 一区二区欧美在线观看| 国产成a人无v码亚洲福利| 欧美一区二区三区日韩| 亚洲精品欧美专区| 国产精品亚洲视频| 欧美成人一级视频| 婷婷六月综合亚洲| 色诱视频网站一区| 亚洲国产成人在线| 国产一区二区久久| 日韩欧美国产一区二区三区| 亚洲一区二区精品视频| 93久久精品日日躁夜夜躁欧美| 在线观看日韩毛片| 国产精品传媒入口麻豆| 国产一区二区三区在线观看免费 | 欧美日本一区二区三区| 亚洲人妖av一区二区| 国模娜娜一区二区三区| 欧美高清一级片在线| 亚洲综合激情网| 97国产一区二区| 国产精品全国免费观看高清| 久久精品国产亚洲a| 日韩一区二区三区在线| 日韩精品福利网| 欧美色视频一区| 一区二区三区四区视频精品免费 | 91美女片黄在线观看91美女| 国产精品国产三级国产aⅴ中文 | 亚洲午夜三级在线| 97超碰欧美中文字幕| 亚洲国产成人在线| 成人精品国产一区二区4080| 亚洲国产激情av| 成人小视频在线观看| 国产精品麻豆欧美日韩ww| 国产成人精品免费在线| 久久久99免费| 成人av在线资源网| 亚洲欧美在线aaa| 99久久精品国产导航| 有码一区二区三区| 欧美日韩国产天堂| 日韩av电影免费观看高清完整版| 风流少妇一区二区| 国产精品乱码久久久久久| 成人黄页在线观看| 亚洲人成人一区二区在线观看| 五月天亚洲精品| 日韩一区二区免费视频| 激情综合网天天干| 国产欧美综合色| 一本色道久久综合狠狠躁的推荐 | 中文字幕在线不卡国产视频| 国产成人精品一区二区三区网站观看 | 久久精品欧美日韩精品| 成人va在线观看| 一二三区精品视频| 欧美一卡二卡在线观看| 国产一区在线视频| 国产精品全国免费观看高清| 色呦呦一区二区三区| 爽好久久久欧美精品| 久久人人97超碰com| 99精品欧美一区二区三区小说| 日韩女优电影在线观看| 国内精品伊人久久久久av一坑| 欧美男男青年gay1069videost|