当前位置: 首页>>代码示例>>C++>>正文


C++ WARNMS函数代码示例

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


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

示例1: Mgr_skip_input_data_fcn

void Mgr_skip_input_data_fcn(j_decompress_ptr cinfo, long num_bytes) {
    // Cannot skip negative or 0 bytes.
    if (num_bytes <= 0) {
        LOGW("skipping 0 bytes in InputStream");
        return;
    }
    SourceManager *src = reinterpret_cast<SourceManager*>(cinfo->src);
    if (src->mgr.bytes_in_buffer >= num_bytes) {
        src->mgr.bytes_in_buffer -= num_bytes;
        src->mgr.next_input_byte += num_bytes;
    } else {
        // if skipping more bytes than remain in buffer, set skip_bytes
        int64_t skip = num_bytes - src->mgr.bytes_in_buffer;
        src->mgr.next_input_byte += src->mgr.bytes_in_buffer;
        src->mgr.bytes_in_buffer = 0;
        int64_t actual = src->inStream->skip(skip);
        if (actual < 0) {
            ERREXIT(cinfo, JERR_FILE_READ);
        }
        skip -= actual;
        while (skip > 0) {
            actual = src->inStream->skip(skip);
            if (actual < 0) {
                ERREXIT(cinfo, JERR_FILE_READ);
            }
            skip -= actual;
            if (actual == 0) {
                // Multiple zero byte skips, likely EOF
                WARNMS(cinfo, JWRN_JPEG_EOF);
                return;
            }
        }
    }
}
开发者ID:AOSB,项目名称:android_packages_apps_Gallery2,代码行数:34,代码来源:jpeg_hook.cpp

示例2: my_fill_input_buffer

static boolean my_fill_input_buffer (j_decompress_ptr cinfo)
{
  my_src_ptr src = (my_src_ptr) cinfo->src;
  size_t nbytes;

  if (src->src_size > INPUT_BUF_SIZE)
    nbytes = INPUT_BUF_SIZE;
  else
    nbytes = src->src_size;

  memcpy (src->buffer, src->src_buffer, nbytes);
  src->src_buffer += nbytes;
  src->src_size -= nbytes;

  if (nbytes <= 0) {
    if (src->start_of_file)	/* Treat empty input file as fatal error */
      ERREXIT(cinfo, JERR_INPUT_EMPTY);
    WARNMS(cinfo, JWRN_JPEG_EOF);
    /* Insert a fake EOI marker */
    src->buffer[0] = (JOCTET) 0xFF;
    src->buffer[1] = (JOCTET) JPEG_EOI;
    nbytes = 2;
  }

  src->pub.next_input_byte = src->buffer;
  src->pub.bytes_in_buffer = nbytes;
  src->start_of_file = FALSE;

  return TRUE;
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:30,代码来源:jpeg.cpp

示例3: stdio_fill_input_buffer

static boolean
stdio_fill_input_buffer (j_decompress_ptr cinfo)
{
  stdio_src_ptr src = (stdio_src_ptr) cinfo->src;
  size_t nbytes;

  nbytes = fread (src->buffer, 1, JPEG_PROG_BUF_SIZE, src->infile);

  if (nbytes <= 0) {
#if 0
    if (src->start_of_file)	/* Treat empty input file as fatal error */
      ERREXIT(cinfo, JERR_INPUT_EMPTY);
    WARNMS(cinfo, JWRN_JPEG_EOF);
#endif
    /* Insert a fake EOI marker */
    src->buffer[0] = (JOCTET) 0xFF;
    src->buffer[1] = (JOCTET) JPEG_EOI;
    nbytes = 2;
  }

  src->pub.next_input_byte = src->buffer;
  src->pub.bytes_in_buffer = nbytes;
  src->start_of_file = FALSE;

  return TRUE;
}
开发者ID:AlexiaChen,项目名称:ImageMagick_Cmake,代码行数:26,代码来源:io-jpeg.c

示例4: fill_input_buffer

fill_input_buffer (j_decompress_ptr cinfo)
{
#ifndef USE_SYMBIAN
	my_src_ptr src = (my_src_ptr) cinfo->src;
	int nbytes;

	nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE);

	if (nbytes <= 0) {
		if (src->start_of_file)	/* Treat empty input file as fatal error */
			ERREXIT(cinfo, JERR_INPUT_EMPTY);
		WARNMS(cinfo, JWRN_JPEG_EOF);
		/* Insert a fake EOI marker */
		src->buffer[0] = (JOCTET) 0xFF;
		src->buffer[1] = (JOCTET) JPEG_EOI;
		nbytes = 2;
	}

	src->pub.next_input_byte = src->buffer;
	src->pub.bytes_in_buffer = nbytes;
	src->start_of_file = FALSE;
#endif

  return TRUE;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:25,代码来源:jdatasrc.c

示例5: fill_input_buffer

fill_input_buffer (j_decompress_ptr cinfo) {
	freeimage_src_ptr src = (freeimage_src_ptr) cinfo->src;

	size_t nbytes = src->m_io->read_proc(src->buffer, 1, INPUT_BUF_SIZE, src->infile);

	if (nbytes <= 0) {
		if (src->start_of_file)	/* Treat empty input file as fatal error */
			throw(cinfo, JERR_INPUT_EMPTY);

		WARNMS(cinfo, JWRN_JPEG_EOF);

		/* Insert a fake EOI marker */

		src->buffer[0] = (JOCTET) 0xFF;
		src->buffer[1] = (JOCTET) JPEG_EOI;

		nbytes = 2;
	}

	src->pub.next_input_byte = src->buffer;
	src->pub.bytes_in_buffer = nbytes;
	src->start_of_file = FALSE;

	return TRUE;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:25,代码来源:PluginJPEG.cpp

示例6: jpeg_read_raw_data

jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
		    JDIMENSION max_lines)
{
  JDIMENSION lines_per_iMCU_row;

  if (cinfo->global_state != DSTATE_RAW_OK)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  if (cinfo->output_scanline >= cinfo->output_height) {
    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
    return 0;
  }

  /* Call progress monitor hook if present */
  if (cinfo->progress != NULL) {
    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
    cinfo->progress->pass_limit = (long) cinfo->output_height;
    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
  }

  /* Verify that at least one iMCU row can be returned. */
  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
  if (max_lines < lines_per_iMCU_row)
    ERREXIT(cinfo, JERR_BUFFER_SIZE);

  /* Decompress directly into user's buffer. */
  if (! (*cinfo->coef->decompress_data) (cinfo, data))
    return 0;			/* suspension forced, can do nothing more */

  /* OK, we processed one iMCU row. */
  cinfo->output_scanline += lines_per_iMCU_row;
  return lines_per_iMCU_row;
}
开发者ID:JourneyRoad,项目名称:VC_sln,代码行数:32,代码来源:JDAPISTD.C

示例7: bmJpegFillInputBuffer

static boolean bmJpegFillInputBuffer(	j_decompress_ptr	cinfo )
    {
    BmJpegInputSource *		bjis= (BmJpegInputSource *)cinfo->src;
    size_t			nbytes;

    nbytes= sioInReadBytes( bjis->bjisSis,
				bjis->bjisReadBuffer, INPUT_BUF_SIZE );

    if  ( nbytes <= 0 )
	{
	if  ( bjis->bjisAtBeginOfInput )	/* Treat empty input	*/
						/* file as fatal error	*/
	    { ERREXIT( cinfo, JERR_INPUT_EMPTY );	}

	WARNMS(cinfo, JWRN_JPEG_EOF);

	/* Insert a fake EOI marker */
	bjis->bjisReadBuffer[0] = (JOCTET) 0xFF;
	bjis->bjisReadBuffer[1] = (JOCTET) JPEG_EOI;
	nbytes = 2;
	}

    bjis->pub.next_input_byte= bjis->bjisReadBuffer;
    bjis->pub.bytes_in_buffer= nbytes;
    bjis->bjisAtBeginOfInput= FALSE;

    return TRUE;
    }
开发者ID:dimkr,项目名称:ted,代码行数:28,代码来源:bmjpeg.c

示例8: fill_input_buffer

fill_input_buffer (j_decompress_ptr cinfo)
{
    stream_source_mgr* src = (stream_source_mgr*) cinfo->src;
    size_t nbytes;

    nbytes = stream_get_callbacks(src->stream)
      ->read(src->buffer, 1, INPUT_BUF_SIZE, src->stream);

    if (nbytes <= 0) {
	/* original: Treat empty input file as fatal error
	if (src->start_of_file_p)
	    ERREXIT(cinfo, JERR_INPUT_EMPTY);
	*/
	ERREXIT(cinfo, JERR_INPUT_EOF);
	WARNMS(cinfo, JWRN_JPEG_EOF);
	/* Insert a fake EOI marker */
	src->buffer[0] = (JOCTET) 0xFF;
	src->buffer[1] = (JOCTET) JPEG_EOI;
	nbytes = 2;
    }

    src->pub.next_input_byte = src->buffer;
    src->pub.bytes_in_buffer = nbytes;
    src->start_of_file_p     = FALSE;

    return TRUE;
}
开发者ID:ALPHA-60,项目名称:plus-one-minus-one,代码行数:27,代码来源:image_load_jpeg.c

示例9: jpeg_read_scanlines

jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
		     JDIMENSION max_lines)
{
  JDIMENSION row_ctr;

  if (cinfo->global_state != DSTATE_SCANNING)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  if (cinfo->output_scanline >= cinfo->output_height) {
    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
    return 0;
  }

  /* Call progress monitor hook if present */
  if (cinfo->progress != NULL) {
    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
    cinfo->progress->pass_limit = (long) cinfo->output_height;
    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
  }

  /* Process some data */
  row_ctr = 0;
  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
  cinfo->output_scanline += row_ctr;
  return row_ctr;
}
开发者ID:JourneyRoad,项目名称:VC_sln,代码行数:25,代码来源:JDAPISTD.C

示例10: sun_jpeg_fill_input_buffer

sun_jpeg_fill_input_buffer(j_decompress_ptr cinfo)
{
    sun_jpeg_source_ptr src = (sun_jpeg_source_ptr) cinfo->src;
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    int ret, buflen;

    if (src->suspendable) {
        return FALSE;
    }
    if (src->remaining_skip) {
        src->pub.skip_input_data(cinfo, 0);
    }
    RELEASE_ARRAYS(env, src);
    buflen = (*env)->GetArrayLength(env, src->hInputBuffer);
    ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
                                src->hInputBuffer, 0, buflen);
    if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
        cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
    }
    if (ret <= 0) {
        /* Silently accept truncated JPEG files */
        WARNMS(cinfo, JWRN_JPEG_EOF);
        src->inbuf[0] = (JOCTET) 0xFF;
        src->inbuf[1] = (JOCTET) JPEG_EOI;
        ret = 2;
    }

    src->pub.next_input_byte = src->inbuf;
    src->pub.bytes_in_buffer = ret;

    return TRUE;
}
开发者ID:AntinZhu,项目名称:jdk-source,代码行数:32,代码来源:jpegdecoder.c

示例11: _jpeg_fill_input_buffer

_jpeg_fill_input_buffer(j_decompress_ptr cinfo) {
    WARNMS(cinfo, JWRN_JPEG_EOF);

    /* Insert a fake EOI marker */
    cinfo->src->next_input_byte = fake_EOI;
    cinfo->src->bytes_in_buffer = sizeof(fake_EOI);
    return TRUE;
}
开发者ID:bohwaz,项目名称:epeg-transform,代码行数:8,代码来源:epeg_main.c

示例12: pgui_jpeg_fill_input_buffer

boolean pgui_jpeg_fill_input_buffer (j_decompress_ptr cinfo)
{
  pgui_jpeg_src_ptr src = (pgui_jpeg_src_ptr) cinfo->src;
  size_t nbytes;
  int size=INPUT_BUF_SIZE;

  // make sure we don't read past "size".. since we kept that in the jpeg_data structure,
  // artifically increment nbytes to look like it incremented the right size. (BUF_SIZE,
  // or remaining bytes left from jpeg_data->size
  size = ((g_jpeg_data.size-g_jpeg_data.copied_size) > INPUT_BUF_SIZE) ?  
    INPUT_BUF_SIZE : 
    (g_jpeg_data.size - g_jpeg_data.copied_size);

  memcpy(src->buffer, g_jpeg_data.lastptr, size);
  if(g_jpeg_data.copied_size < (g_jpeg_data.size - INPUT_BUF_SIZE)) { 
    nbytes=INPUT_BUF_SIZE;
    g_jpeg_data.lastptr+=nbytes;
  } else {
    nbytes=(g_jpeg_data.size - g_jpeg_data.copied_size);
  }

  g_jpeg_data.copied_size+=nbytes;
 
  // if there is no data, and we have just started, mark an exit
  if (nbytes <= 0) {
    if (src->start_of_file){	/* Treat empty input file as fatal error */
      printf("error: no data!\n");
      WARNMS(cinfo, JERR_INPUT_EMPTY); 
      return FALSE;

    }
    WARNMS(cinfo, JWRN_JPEG_EOF);
    /* Insert a fake EOI marker */
    src->buffer[0] = (JOCTET) 0xFF;
    src->buffer[1] = (JOCTET) JPEG_EOI;
    nbytes = 2;
  }

  src->pub.next_input_byte = src->buffer;
  src->pub.bytes_in_buffer = nbytes;
  src->start_of_file = FALSE;

  return TRUE;
}
开发者ID:scanlime,项目名称:picogui,代码行数:44,代码来源:jpeg.c

示例13: fill_input_buffer

safeboolean
fill_input_buffer (j_decompress_ptr cinfo)
{
  my_src_ptr src = (my_src_ptr) cinfo->src;
  /* 2.0.12: signed size. Thanks to Geert Jansen */
  /* 2.0.14: some platforms (mingw-msys) don't have ssize_t. Call 
     an int an int. */
  int nbytes = 0;
  memset (src->buffer, 0, INPUT_BUF_SIZE);

  while (nbytes < INPUT_BUF_SIZE)
    {

      int got = gdGetBuf (src->buffer + nbytes,
			  INPUT_BUF_SIZE - nbytes,
			  src->infile);

      if ((got == EOF) || (got == 0))
	{

	  /* EOF or error. If we got any data, don't worry about it.
	     If we didn't, then this is unexpected. */
	  if (!nbytes)
	    {

	      nbytes = -1;

	    }

	  break;

	}

      nbytes += got;

    }

  if (nbytes <= 0)
    {
      if (src->start_of_file)	/* Treat empty input file as fatal error */
	ERREXIT (cinfo, JERR_INPUT_EMPTY);
      WARNMS (cinfo, JWRN_JPEG_EOF);
      /* Insert a fake EOI marker */
      src->buffer[0] = (unsigned char) 0xFF;
      src->buffer[1] = (unsigned char) JPEG_EOI;
      nbytes = 2;
    }

  src->pub.next_input_byte = src->buffer;
  src->pub.bytes_in_buffer = nbytes;
  src->start_of_file = FALSE;

  return TRUE;
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:54,代码来源:gd_jpeg.c

示例14: start_pass_huff_decoder

METHODDEF void
start_pass_huff_decoder(j_decompress_ptr cinfo)
{
	huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
	int ci, dctbl, actbl;
	jpeg_component_info *compptr;

	/* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
	 * This ought to be an error condition, but we make it a warning because
	 * there are some baseline files out there with all zeroes in these bytes.
	 */
	if(cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
	        cinfo->Ah != 0 || cinfo->Al != 0)
	{
		WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
	}

	for(ci = 0; ci < cinfo->comps_in_scan; ci++)
	{
		compptr = cinfo->cur_comp_info[ci];
		dctbl = compptr->dc_tbl_no;
		actbl = compptr->ac_tbl_no;

		/* Make sure requested tables are present */
		if(dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
		        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
		{
			ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
		}

		if(actbl < 0 || actbl >= NUM_HUFF_TBLS ||
		        cinfo->ac_huff_tbl_ptrs[actbl] == NULL)
		{
			ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
		}

		/* Compute derived values for Huffman tables */
		/* We may do this more than once for a table, but it's not expensive */
		jpeg_make_d_derived_tbl(cinfo, cinfo->dc_huff_tbl_ptrs[dctbl],
		                        &entropy->dc_derived_tbls[dctbl]);
		jpeg_make_d_derived_tbl(cinfo, cinfo->ac_huff_tbl_ptrs[actbl],
		                        &entropy->ac_derived_tbls[actbl]);
		/* Initialize DC predictions to 0 */
		entropy->saved.last_dc_val[ci] = 0;
	}

	/* Initialize bitread state variables */
	entropy->bitstate.bits_left = 0;
	entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
	entropy->bitstate.printed_eod = FALSE;

	/* Initialize restart counter */
	entropy->restarts_to_go = cinfo->restart_interval;
}
开发者ID:Diskutant,项目名称:RTCW-SP,代码行数:54,代码来源:jdhuff.c

示例15: start_pass_huff_decoder

start_pass_huff_decoder (j_decompress_ptr cinfo)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
  int ci, blkn, dctbl, actbl;
  d_derived_tbl **pdtbl;
  jpeg_component_info * compptr;

  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   * This ought to be an error condition, but we make it a warning because
   * there are some baseline files out there with all zeroes in these bytes.
   */
  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
      cinfo->Ah != 0 || cinfo->Al != 0)
    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    dctbl = compptr->dc_tbl_no;
    actbl = compptr->ac_tbl_no;
    /* Compute derived values for Huffman tables */
    /* We may do this more than once for a table, but it's not expensive */
    pdtbl = entropy->dc_derived_tbls + dctbl;
    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
    pdtbl = entropy->ac_derived_tbls + actbl;
    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
    /* Initialize DC predictions to 0 */
    entropy->saved.last_dc_val[ci] = 0;
  }

  /* Precalculate decoding info for each block in an MCU of this scan */
  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    ci = cinfo->MCU_membership[blkn];
    compptr = cinfo->cur_comp_info[ci];
    /* Precalculate which table to use for each block */
    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
    /* Decide whether we really care about the coefficient values */
    if (compptr->component_needed) {
      entropy->dc_needed[blkn] = TRUE;
      /* we don't need the ACs if producing a 1/8th-size image */
      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
    } else {
      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
    }
  }

  /* Initialize bitread state variables */
  entropy->bitstate.bits_left = 0;
  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  entropy->pub.insufficient_data = FALSE;

  /* Initialize restart counter */
  entropy->restarts_to_go = cinfo->restart_interval;
}
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:54,代码来源:jdhuff.c


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