• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BITREAD_LOAD_STATE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BITREAD_LOAD_STATE函数的典型用法代码示例。如果您正苦于以下问题:C++ BITREAD_LOAD_STATE函数的具体用法?C++ BITREAD_LOAD_STATE怎么用?C++ BITREAD_LOAD_STATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BITREAD_LOAD_STATE函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: decode_mcu_DC_first

decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{   
  j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec;
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private;
  int Al = cinfo->Al;
  register int s, r;
  int blkn, ci;
  JBLOCKROW block;
  BITREAD_STATE_VARS;
  savable_state state;
  d_derived_tbl * tbl;
  jpeg_component_info * compptr;

  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
    return FALSE;
  }

  /* If we've run out of data, just leave the MCU set to zeroes.
   * This way, we return uniform gray for the remainder of the segment.
   */
  if (! entropy->insufficient_data) {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) {
      block = MCU_data[blkn];
      ci = cinfo->MCU_membership[blkn];
      compptr = cinfo->cur_comp_info[ci];
      tbl = entropy->derived_tbls[compptr->dc_tbl_no];

      /* Decode a single block's worth of coefficients */

      /* Section F.2.2.1: decode the DC coefficient difference */
      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
      if (s) {
    CHECK_BIT_BUFFER(br_state, s, return FALSE);
    r = GET_BITS(s);
    s = HUFF_EXTEND(r, s);
      }

      /* Convert DC difference to actual value, update last_dc_val */
      s += state.last_dc_val[ci];
      state.last_dc_val[ci] = s;
      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
      (*block)[0] = (JCOEF) (s << Al);
    }

    /* Completed MCU, so update state */
    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(entropy->saved, state);
  }
开发者ID:AlfiyaZi,项目名称:DCMTK,代码行数:58,代码来源:jdphuff.c


示例2: decode_mcu_slow

decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
  BITREAD_STATE_VARS;
  int blkn;
  savable_state state;
  /* Outer loop handles each block in the MCU */

  /* Load up working state */
  BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
  ASSIGN_STATE(state, entropy->saved);

  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
    d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn];
    d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn];
    register int s, k, r;

    /* Decode a single block's worth of coefficients */

    /* Section F.2.2.1: decode the DC coefficient difference */
    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
    if (s) {
      CHECK_BIT_BUFFER(br_state, s, return FALSE);
      r = GET_BITS(s);
      s = HUFF_EXTEND(r, s);
    }

    if (entropy->dc_needed[blkn]) {
      /* Convert DC difference to actual value, update last_dc_val */
      int ci = cinfo->MCU_membership[blkn];
      s += state.last_dc_val[ci];
      state.last_dc_val[ci] = s;
      if (block) {
        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
        (*block)[0] = (JCOEF) s;
      }
    }

    if (entropy->ac_needed[blkn] && block) {

      /* Section F.2.2.2: decode the AC coefficients */
      /* Since zeroes are skipped, output area must be cleared beforehand */
      for (k = 1; k < DCTSIZE2; k++) {
        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);

        r = s >> 4;
        s &= 15;

        if (s) {
          k += r;
          CHECK_BIT_BUFFER(br_state, s, return FALSE);
          r = GET_BITS(s);
          s = HUFF_EXTEND(r, s);
          /* Output coefficient in natural (dezigzagged) order.
           * Note: the extra entries in jpeg_natural_order[] will save us
           * if k >= DCTSIZE2, which could happen if the data is corrupted.
           */
          (*block)[jpeg_natural_order[k]] = (JCOEF) s;
        } else {
          if (r != 15)
            break;
          k += 15;
        }
      }

    } else {

      /* Section F.2.2.2: decode the AC coefficients */
      /* In this path we just discard the values */
      for (k = 1; k < DCTSIZE2; k++) {
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:71,代码来源:jdhuff.c


示例3: decode_mcu_AC_first

METHODDEF       boolean decode_mcu_AC_first(j_decompress_ptr cinfo, JBLOCKROW * MCU_data)
{
	phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
	int             Se = cinfo->Se;
	int             Al = cinfo->Al;
	register int    s, k, r;
	unsigned int    EOBRUN;
	JBLOCKROW       block;

	BITREAD_STATE_VARS;
	d_derived_tbl  *tbl;

	/* Process restart marker if needed; may have to suspend */
	if(cinfo->restart_interval)
	{
		if(entropy->restarts_to_go == 0)
			if(!process_restart(cinfo))
				return FALSE;
	}

	/* Load up working state.
	 * We can avoid loading/saving bitread state if in an EOB run.
	 */
	EOBRUN = entropy->saved.EOBRUN;	/* only part of saved state we care about */

	/* There is always only one block per MCU */

	if(EOBRUN > 0)				/* if it's a band of zeroes... */
		EOBRUN--;				/* ...process it now (we do nothing) */
	else
	{
		BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
		block = MCU_data[0];
		tbl = entropy->ac_derived_tbl;

		for(k = cinfo->Ss; k <= Se; k++)
		{
			HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
			r = s >> 4;
			s &= 15;
			if(s)
			{
				k += r;
				CHECK_BIT_BUFFER(br_state, s, return FALSE);
				r = GET_BITS(s);
				s = HUFF_EXTEND(r, s);
				/* Scale and output coefficient in natural (dezigzagged) order */
				(*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
			}
			else
			{
				if(r == 15)
				{				/* ZRL */
					k += 15;	/* skip 15 zeroes in band */
				}
				else
				{				/* EOBr, run length is 2^r + appended bits */
					EOBRUN = 1 << r;
					if(r)
					{			/* EOBr, r > 0 */
						CHECK_BIT_BUFFER(br_state, r, return FALSE);
						r = GET_BITS(r);
						EOBRUN += r;
					}
					EOBRUN--;	/* this band is processed at this moment */
					break;		/* force end-of-band */
				}
			}
		}

		BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
	}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:72,代码来源:jdphuff.c


示例4: decode_mcu

decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
    huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
    register int s, k, r;
    int blkn, ci;
    JBLOCKROW block;
    BITREAD_STATE_VARS;
    savable_state state;
    d_derived_tbl * dctbl;
    d_derived_tbl * actbl;
    jpeg_component_info * compptr;

    /* Process restart marker if needed; may have to suspend */
    if (cinfo->restart_interval) {
        if (entropy->restarts_to_go == 0)
            if (! process_restart(cinfo))
                return FALSE;
    }

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
        block = MCU_data[blkn];
        ci = cinfo->MCU_membership[blkn];
        compptr = cinfo->cur_comp_info[ci];
        dctbl = entropy->dc_derived_tbls[compptr->dc_tbl_no];
        actbl = entropy->ac_derived_tbls[compptr->ac_tbl_no];

        /* Decode a single block's worth of coefficients */

        /* Section F.2.2.1: decode the DC coefficient difference */
        HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
        if (s) {
            CHECK_BIT_BUFFER(br_state, s, return FALSE);
            r = GET_BITS(s);
            s = HUFF_EXTEND(r, s);
        }

        /* Shortcut if component's values are not interesting */
        if (! compptr->component_needed)
            goto skip_ACs;

        /* Convert DC difference to actual value, update last_dc_val */
        s += state.last_dc_val[ci];
        state.last_dc_val[ci] = s;
        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
        (*block)[0] = (JCOEF) s;

        /* Do we need to decode the AC coefficients for this component? */
        if (compptr->DCT_scaled_size > 1) {

            /* Section F.2.2.2: decode the AC coefficients */
            /* Since zeroes are skipped, output area must be cleared beforehand */
            for (k = 1; k < DCTSIZE2; k++) {
                HUFF_DECODE(s, br_state, actbl, return FALSE, label2);

                r = s >> 4;
                s &= 15;

                if (s) {
                    k += r;
                    CHECK_BIT_BUFFER(br_state, s, return FALSE);
                    r = GET_BITS(s);
                    s = HUFF_EXTEND(r, s);
                    /* Output coefficient in natural (dezigzagged) order.
                     * Note: the extra entries in jpeg_natural_order[] will save us
                     * if k >= DCTSIZE2, which could happen if the data is corrupted.
                     */
                    (*block)[jpeg_natural_order[k]] = (JCOEF) s;
                } else {
                    if (r != 15)
                        break;
                    k += 15;
                }
            }

        } else {
开发者ID:vugluskr86,项目名称:SeaOfMemes,代码行数:81,代码来源:jdhuff.cpp


示例5: decode_mcus

decode_mcus (j_decompress_ptr cinfo, JDIFFIMAGE diff_buf,
         JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU)
{
  j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsd->entropy_private;
  unsigned int mcu_num;
  int sampn, ci, yoffset, MCU_width, ptrn;
  BITREAD_STATE_VARS;

  /* Set output pointer locations based on MCU_col_num */
  for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) {
    ci = entropy->output_ptr_info[ptrn].ci;
    yoffset = entropy->output_ptr_info[ptrn].yoffset;
    MCU_width = entropy->output_ptr_info[ptrn].MCU_width;
    entropy->output_ptr[ptrn] =
      diff_buf[ci][MCU_row_num + (JDIMENSION)yoffset] + MCU_col_num * (JDIMENSION)MCU_width;
  }

  /*
   * If we've run out of data, zero out the buffers and return.
   * By resetting the undifferencer, the output samples will be CENTERJSAMPLE.
   *
   * NB: We should find a way to do this without interacting with the
   * undifferencer module directly.
   */
  if (entropy->insufficient_data) {
    for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++)
      jzero_far((void FAR *) entropy->output_ptr[ptrn],
        nMCU * (size_t)entropy->output_ptr_info[ptrn].MCU_width * SIZEOF(JDIFF));

    (*losslsd->predict_process_restart) (cinfo);
  }

  else {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);

    /* Outer loop handles the number of MCU requested */

    for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {

      /* Inner loop handles the samples in the MCU */
      for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) {
    d_derived_tbl * dctbl = entropy->cur_tbls[sampn];
    register int s, r;

    /* Section H.2.2: decode the sample difference */
    HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
    if (s) {
      if (s == 16)  /* special case: always output 32768 */
        s = 32768;
      else {    /* normal case: fetch subsequent bits */
        CHECK_BIT_BUFFER(br_state, s, return mcu_num);
        r = GET_BITS(s);
        s = HUFF_EXTEND(r, s);
      }
    }

    /* Output the sample difference */
    *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF) s;
      }

      /* Completed MCU, so update state */
      BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
    }
  }

 return nMCU;
}
开发者ID:Anvendir,项目名称:aplikacjaSerwer,代码行数:70,代码来源:jdlhuff.c


示例6: decode_mcu

decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
  j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec;
  shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyd->entropy_private;
  int blkn;
  BITREAD_STATE_VARS;
  savable_state state;

  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
	return FALSE;
  }

  /* If we've run out of data, just leave the MCU set to zeroes.
   * This way, we return uniform gray for the remainder of the segment.
   */
  if (! entropy->insufficient_data) {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) {
      JBLOCKROW block = MCU_data[blkn];
      d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn];
      d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn];
      register int s, k, r;

      /* Decode a single block's worth of coefficients */

      /* Section F.2.2.1: decode the DC coefficient difference */
      HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
      if (s) {
	CHECK_BIT_BUFFER(br_state, s, return FALSE);
	r = GET_BITS(s);
	s = HUFF_EXTEND(r, s);
      }

      if (entropy->dc_needed[blkn]) {
	/* Convert DC difference to actual value, update last_dc_val */
	int ci = cinfo->MCU_membership[blkn];
	s += state.last_dc_val[ci];
	state.last_dc_val[ci] = s;
	/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
	(*block)[0] = (JCOEF) s;
      }

      if (entropy->ac_needed[blkn]) {

	/* Section F.2.2.2: decode the AC coefficients */
	/* Since zeroes are skipped, output area must be cleared beforehand */
	for (k = 1; k < DCTSIZE2; k++) {
	  HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
      
	  r = s >> 4;
	  s &= 15;
      
	  if (s) {
	    k += r;
	    CHECK_BIT_BUFFER(br_state, s, return FALSE);
	    r = GET_BITS(s);
	    s = HUFF_EXTEND(r, s);
	    /* Output coefficient in natural (dezigzagged) order.
	     * Note: the extra entries in jpeg_natural_order[] will save us
	     * if k >= DCTSIZE2, which could happen if the data is corrupted.
	     */
	    (*block)[jpeg_natural_order[k]] = (JCOEF) s;
	  } else {
	    if (r != 15)
	      break;
	    k += 15;
	  }
	}

      } else {

	/* Section F.2.2.2: decode the AC coefficients */
	/* In this path we just discard the values */
	for (k = 1; k < DCTSIZE2; k++) {
开发者ID:151706061,项目名称:ClearCanvas,代码行数:83,代码来源:jdshuff.c


示例7: decode_mcu

decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
__boundcheck_metadata_store((void *)(&entropy),(void *)((size_t)(&entropy)+sizeof(entropy)*8-1));

  register int s, k, r;
  int blkn;
__boundcheck_metadata_store((void *)(&blkn),(void *)((size_t)(&blkn)+sizeof(blkn)*8-1));
int  ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

  JBLOCKROW block;
__boundcheck_metadata_store((void *)(&block),(void *)((size_t)(&block)+sizeof(block)*8-1));

  BITREAD_STATE_VARS;
__boundcheck_metadata_store((void *)(&br_state),(void *)((size_t)(&br_state)+sizeof(br_state)*8-1));

  savable_state state;
__boundcheck_metadata_store((void *)(&state),(void *)((size_t)(&state)+sizeof(state)*8-1));

  d_derived_tbl * dctbl;
__boundcheck_metadata_store((void *)(&dctbl),(void *)((size_t)(&dctbl)+sizeof(dctbl)*8-1));

  d_derived_tbl * actbl;
__boundcheck_metadata_store((void *)(&actbl),(void *)((size_t)(&actbl)+sizeof(actbl)*8-1));

  jpeg_component_info * compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));


  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
	return FALSE;
  }

  /* Load up working state */
  BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
  ASSIGN_STATE(state, entropy->saved);

  /* Outer loop handles each block in the MCU */

  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    block = (*(JBLOCKROW *)(__boundcheck_ptr_reference(463,13,"decode_mcu",(void *)(&MCU_data[0]),(void *)(&MCU_data[blkn]))));
    ci = cinfo->MCU_membership[_RV_insert_check(0,10,464,10,"decode_mcu",blkn)];
    compptr = cinfo->cur_comp_info[_RV_insert_check(0,4,465,15,"decode_mcu",ci)];
    dctbl = entropy->dc_derived_tbls[_RV_insert_check(0,4,466,13,"decode_mcu",compptr->dc_tbl_no)];
    actbl = entropy->ac_derived_tbls[_RV_insert_check(0,4,467,13,"decode_mcu",compptr->ac_tbl_no)];

    /* Decode a single block's worth of coefficients */

    /* Section F.2.2.1: decode the DC coefficient difference */
    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
    if (s) {
      CHECK_BIT_BUFFER(br_state, s, return FALSE);
      r = GET_BITS(s);
      s = HUFF_EXTEND(r, s);
    }

    /* Shortcut if component's values are not interesting */
    if (! compptr->component_needed)
      goto skip_ACs;

    /* Convert DC difference to actual value, update last_dc_val */
    s += state.last_dc_val[_RV_insert_check(0,4,484,10,"decode_mcu",ci)];
    state.last_dc_val[_RV_insert_check(0,4,485,5,"decode_mcu",ci)] = s;
    /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
    (*(JBLOCKROW)(__boundcheck_ptr_reference(487,7,"decode_mcu",(void *)(block),(void *)(block))))[0] = (JCOEF) s;

    /* Do we need to decode the AC coefficients for this component? */
    if (compptr->DCT_scaled_size > 1) {

      /* Section F.2.2.2: decode the AC coefficients */
      /* Since zeroes are skipped, output area must be cleared beforehand */
      for (k = 1; k < DCTSIZE2; k++) {
	HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
      
	r = s >> 4;
	s &= 15;
      
	if (s) {
	  k += r;
	  CHECK_BIT_BUFFER(br_state, s, return FALSE);
	  r = GET_BITS(s);
	  s = HUFF_EXTEND(r, s);
	  /* Output coefficient in natural (dezigzagged) order.
	   * Note: the extra entries in jpeg_natural_order[] will save us
	   * if k >= DCTSIZE2, which could happen if the data is corrupted.
	   */
	  (*(JBLOCKROW)(__boundcheck_ptr_reference(509,6,"decode_mcu",(void *)(block),(void *)(block))))[(*(const int *)(__boundcheck_ptr_reference(509,13,"decode_mcu",(void *)(&jpeg_natural_order[0]),(void *)(&jpeg_natural_order[k]))))] = (JCOEF) s;
	} else {
	  if (r != 15)
	    break;
	  k += 15;
	}
      }

    } else {
开发者ID:Rambonuaa,项目名称:BoundCheck4,代码行数:99,代码来源:jdhuff.c


示例8: decode_mcu_AC_first

boolean decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
    phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
    int Se = cinfo->Se;
    int Al = cinfo->Al;
    register int s, k, r;
    unsigned int EOBRUN;
    JBLOCKROW block;
    BITREAD_STATE_VARS;
    d_derived_tbl * tbl;

    /* Process restart marker if needed; may have to suspend */
    if (cinfo->restart_interval)
    {
        if (entropy->restarts_to_go == 0)
            if (! process_restart(cinfo))
                return FALSE;
    }

    /* If we've run out of data, just leave the MCU set to zeroes.
     * This way, we return uniform gray for the remainder of the segment.
     */
    if (! entropy->pub.insufficient_data)
    {

        /* Load up working state.
         * We can avoid loading/saving bitread state if in an EOB run.
         */
        EOBRUN = entropy->saved.EOBRUN;	/* only part of saved state we need */

        /* There is always only one block per MCU */

        if (EOBRUN > 0)		/* if it's a band of zeroes... */
            EOBRUN--;			/* ...process it now (we do nothing) */
        else
        {
            BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
            block = MCU_data[0];
            tbl = entropy->ac_derived_tbl;

            for (k = cinfo->Ss; k <= Se; k++)
            {
                if ( ! br_state.HUFF_DECODE(s, bits_left, get_buffer, tbl) )
                    return FALSE;

                r = s >> 4;
                s &= 15;
                if (s)
                {
                    k += r;
                    if ( ! br_state.CHECK_BIT_BUFFER(s, bits_left, get_buffer) )
                        return FALSE;

                    r = GET_BITS(s);
                    s = HUFF_EXTEND(r, s);
                    /* Scale and output coefficient in natural (dezigzagged) order */
                    (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
                }
                else
                {
                    if (r == 15)  	/* ZRL */
                    {
                        k += 15;		/* skip 15 zeroes in band */
                    }
                    else  		/* EOBr, run length is 2^r + appended bits */
                    {
                        EOBRUN = 1 << r;
                        if (r)  		/* EOBr, r > 0 */
                        {
                            if ( ! br_state.CHECK_BIT_BUFFER(r, bits_left, get_buffer) )
                                return FALSE;
                            r = GET_BITS(r);
                            EOBRUN += r;
                        }
                        EOBRUN--;		/* this band is processed at this moment */
                        break;		/* force end-of-band */
                    }
                }
            }

            BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
        }

        /* Completed MCU, so update state */
        entropy->saved.EOBRUN = EOBRUN;	/* only part of saved state we need */
    }
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:86,代码来源:jdphuff.cpp


示例9: decode_mcu_DC_first

decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{   
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
__boundcheck_metadata_store((void *)(&entropy),(void *)((size_t)(&entropy)+sizeof(entropy)*8-1));

  int Al = cinfo->Al;
__boundcheck_metadata_store((void *)(&Al),(void *)((size_t)(&Al)+sizeof(Al)*8-1));

  register int s, r;
  int blkn;
__boundcheck_metadata_store((void *)(&blkn),(void *)((size_t)(&blkn)+sizeof(blkn)*8-1));
int  ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

  JBLOCKROW block;
__boundcheck_metadata_store((void *)(&block),(void *)((size_t)(&block)+sizeof(block)*8-1));

  BITREAD_STATE_VARS;
__boundcheck_metadata_store((void *)(&br_state),(void *)((size_t)(&br_state)+sizeof(br_state)*8-1));

  savable_state state;
__boundcheck_metadata_store((void *)(&state),(void *)((size_t)(&state)+sizeof(state)*8-1));

  d_derived_tbl * tbl;
__boundcheck_metadata_store((void *)(&tbl),(void *)((size_t)(&tbl)+sizeof(tbl)*8-1));

  jpeg_component_info * compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));


  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
	return FALSE;
  }

  /* Load up working state */
  BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
  ASSIGN_STATE(state, entropy->saved);

  /* Outer loop handles each block in the MCU */

  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    block = (*(JBLOCKROW *)(__boundcheck_ptr_reference(307,13,"decode_mcu_DC_first",(void *)(&MCU_data[0]),(void *)(&MCU_data[blkn]))));
    ci = cinfo->MCU_membership[_RV_insert_check(0,10,308,10,"decode_mcu_DC_first",blkn)];
    compptr = cinfo->cur_comp_info[_RV_insert_check(0,4,309,15,"decode_mcu_DC_first",ci)];
    tbl = entropy->derived_tbls[_RV_insert_check(0,4,310,11,"decode_mcu_DC_first",compptr->dc_tbl_no)];

    /* Decode a single block's worth of coefficients */

    /* Section F.2.2.1: decode the DC coefficient difference */
    HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
    if (s) {
      CHECK_BIT_BUFFER(br_state, s, return FALSE);
      r = GET_BITS(s);
      s = HUFF_EXTEND(r, s);
    }

    /* Convert DC difference to actual value, update last_dc_val */
    s += state.last_dc_val[_RV_insert_check(0,4,323,10,"decode_mcu_DC_first",ci)];
    state.last_dc_val[_RV_insert_check(0,4,324,5,"decode_mcu_DC_first",ci)] = s;
    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
    (*(JBLOCKROW)(__boundcheck_ptr_reference(326,7,"decode_mcu_DC_first",(void *)(block),(void *)(block))))[0] = (JCOEF) (s << Al);
  }

  /* Completed MCU, so update state */
  BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
  ASSIGN_STATE(entropy->saved, state);

  /* Account for restart interval (no-op if not using restarts) */
  entropy->restarts_to_go--;

  return TRUE;
}
开发者ID:Rambonuaa,项目名称:BoundCheck4,代码行数:75,代码来源:jdphuff.c


示例10: decode_mcu_DC_first

decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  int Al = cinfo->Al;
  int blkn;
  BITREAD_STATE_VARS;
  savable_state state;

  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
	return FALSE;
  }

  /* If we've run out of data, just leave the MCU set to zeroes.
   * This way, we return uniform gray for the remainder of the segment.
   */
  if (! entropy->pub.insufficient_data) {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
      JBLOCKROW block = MCU_data[blkn];
      int ci = cinfo->MCU_membership[blkn];
      d_derived_tbl * tbl = entropy->dc_derived_tbls[ci];
      register int s;

      /* Decode a single block's worth of coefficients */

      /* Section F.2.2.1: decode the DC coefficient difference */
      {		/* HUFFX_DECODE */
	register int nb, look, t;
	if (bits_left < HUFFX_LOOKAHEAD) {
	  register const JOCTET * next_input_byte = br_state.next_input_byte;
	  register size_t         bytes_in_buffer = br_state.bytes_in_buffer;
	  if (cinfo->unread_marker == 0) {
	    while (bits_left < MIN_GET_BITS) {
	      register int c;
	      if (bytes_in_buffer == 0 ||
		  (c = GETJOCTET(*next_input_byte)) == 0xFF) {
		goto label11; }
	      bytes_in_buffer--; next_input_byte++;
	      get_buffer = (get_buffer << 8) | c;
	      bits_left += 8;
	    }
	    br_state.next_input_byte = next_input_byte;
	    br_state.bytes_in_buffer = bytes_in_buffer;
	  } else {
	label11:
	    br_state.next_input_byte = next_input_byte;
	    br_state.bytes_in_buffer = bytes_in_buffer;
	    if (! jpeg_fill_bit_buffer(&br_state,get_buffer,bits_left, 0)) {
	      return FALSE; }
	    get_buffer = br_state.get_buffer; bits_left = br_state.bits_left;
	    if (bits_left < HUFFX_LOOKAHEAD) {
	      nb = 1; goto label1;
	    }
	  }
	}
	look = PEEK_BITS(HUFFX_LOOKAHEAD);
	if ((nb = tbl->lookx_nbits[look]) != 0) {
	  s = tbl->lookx_val[look];
	  if (nb <= HUFFX_LOOKAHEAD) {
	    DROP_BITS(nb);
	  } else {
	    DROP_BITS(HUFFX_LOOKAHEAD);
	    nb -= HUFFX_LOOKAHEAD;
	    CHECK_BIT_BUFFER(br_state, nb, return FALSE);
	    s += GET_BITS(nb);
	  }
	} else {
	  nb = HUFFX_LOOKAHEAD;
      label1:
	  if ((s=jpeg_huff_decode(&br_state,get_buffer,bits_left,tbl,nb))
	       < 0) { return FALSE; }
	  get_buffer = br_state.get_buffer; bits_left = br_state.bits_left;
	  if (s) {
	    CHECK_BIT_BUFFER(br_state, s, return FALSE);
	    t = GET_BITS(s);
	    s = HUFF_EXTEND(t, s);
	  }
	}
      }
开发者ID:AndreiLazarescu,项目名称:ariavg,代码行数:88,代码来源:jdphuff.c



注:本文中的BITREAD_LOAD_STATE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BITSET函数代码示例发布时间:2022-05-30
下一篇:
C++ BITMASK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap