Пример #1
0
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
		     JDIMENSION max_lines)
{
  JDIMENSION row_ctr;
__boundcheck_metadata_store((void *)(&row_ctr),(void *)((size_t)(&row_ctr)+sizeof(row_ctr)*8-1));


  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;
    (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(168,24,"jpeg_read_scanlines",(void *)(cinfo->progress->progress_monitor),(void *)cinfo->progress->progress_monitor))) ((j_common_ptr) cinfo);
  }

  /* Process some data */
  row_ctr = 0;
  (*(void (*)(j_decompress_ptr, JSAMPARRAY, JDIMENSION *, JDIMENSION))(__boundcheck_ptr_reference(173,18,"jpeg_read_scanlines",(void *)(cinfo->main->process_data),(void *)cinfo->main->process_data))) (cinfo, scanlines, &row_ctr, max_lines);
  cinfo->output_scanline += row_ctr;
  return row_ctr;
}
Пример #2
0
jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
		   JSAMPARRAY output_array, int dest_row,
		   int num_rows, JDIMENSION num_cols)
/* Copy some rows of samples from one place to another.
 * num_rows rows are copied from input_array[source_row++]
 * to output_array[dest_row++]; these areas may overlap for duplication.
 * The source and destination arrays must be at least as wide as num_cols.
 */
{
  register JSAMPROW inptr, outptr;
#ifdef FMEMCOPY
  register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
#else
  register JDIMENSION count;
#endif
  register int row;

  input_array += source_row;
  output_array += dest_row;

  for (row = num_rows; row > 0; row--) {
    inptr = *(JSAMPARRAY)(__boundcheck_ptr_reference(132,25,"jcopy_sample_rows",(void *)(input_array),(void *)(input_array++)));
    outptr = *(JSAMPARRAY)(__boundcheck_ptr_reference(133,27,"jcopy_sample_rows",(void *)(output_array),(void *)(output_array++)));
#ifdef FMEMCOPY
    FMEMCOPY(outptr, inptr, count);
#else
    for (count = num_cols; count > 0; count--)
      *outptr++ = *inptr++;	/* needn't bother with GETJSAMPLE() here */
#endif
  }
}
Пример #3
0
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
		    JDIMENSION max_lines)
{
  JDIMENSION lines_per_iMCU_row;
__boundcheck_metadata_store((void *)(&lines_per_iMCU_row),(void *)((size_t)(&lines_per_iMCU_row)+sizeof(lines_per_iMCU_row)*8-1));


  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;
    (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(201,24,"jpeg_read_raw_data",(void *)(cinfo->progress->progress_monitor),(void *)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 (! (*(int (*)(j_decompress_ptr, JSAMPIMAGE))(__boundcheck_ptr_reference(210,24,"jpeg_read_raw_data",(void *)(cinfo->coef->decompress_data),(void *)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;
}
Пример #4
0
Boolean_T crc32file(char *name, DWORD *crc, long *charcnt)
{
      register FILE *fin;
      register DWORD oldcrc32;
      register int c;

      oldcrc32 = 0xFFFFFFFF; *(long *)(__boundcheck_ptr_reference(131,31,"crc32file",(void *)(charcnt),(void *)(charcnt))) = 0;
#ifdef MSDOS
      if ((fin=fopen(name, "rb"))==NULL)
#else
      if ((fin=fopen(name, "r"))==NULL)
#endif
      {
            perror(name);
            return Error_;
      }
      while ((c=getc(fin))!=EOF)
      {
            ++*(long *)(__boundcheck_ptr_reference(143,16,"crc32file",(void *)(charcnt),(void *)(charcnt)));
            oldcrc32 = UPDC32(c, oldcrc32);
      }

      if (ferror(fin))
      {
            perror(name);
            *(long *)(__boundcheck_ptr_reference(150,14,"crc32file",(void *)(charcnt),(void *)(charcnt))) = -1;
      }
      fclose(fin);

      *(DWORD *)(__boundcheck_ptr_reference(154,8,"crc32file",(void *)(crc),(void *)(crc))) = oldcrc32 = ~oldcrc32;

      return Success_;
}
Пример #5
0
read_text_integer (FILE * file, long * result, int * termchar)
/* Read an unsigned decimal integer from a file, store it in result */
/* Reads one trailing character after the integer; returns it in termchar */
{
  register int ch;
  register long val;
  
  /* Skip any leading whitespace, detect EOF */
  do {
    ch = text_getc(file);
    if (ch == EOF) {
      *(int *)(__boundcheck_ptr_reference(49,8,"read_text_integer",(void *)(termchar),(void *)(termchar))) = ch;
      return FALSE;
    }
  } while (isspace(ch));
  
  if (! isdigit(ch)) {
    *(int *)(__boundcheck_ptr_reference(55,6,"read_text_integer",(void *)(termchar),(void *)(termchar))) = ch;
    return FALSE;
  }

  val = ch - '0';
  while ((ch = text_getc(file)) != EOF) {
    if (! isdigit(ch))
      break;
    val *= 10;
    val += ch - '0';
  }
  *(long *)(__boundcheck_ptr_reference(66,4,"read_text_integer",(void *)(result),(void *)(result))) = val;
  *(int *)(__boundcheck_ptr_reference(67,4,"read_text_integer",(void *)(termchar),(void *)(termchar))) = ch;
  return TRUE;
}
Пример #6
0
read_scan_integer (FILE * file, long * result, int * termchar)
/* Variant of read_text_integer that always looks for a non-space termchar;
 * this simplifies parsing of punctuation in scan scripts.
 */
{
  register int ch;

  if (! read_text_integer(file, result, termchar))
    return FALSE;
  ch = *(int *)(__boundcheck_ptr_reference(138,9,"read_scan_integer",(void *)(termchar),(void *)(termchar)));
  while (ch != EOF && isspace(ch))
    ch = text_getc(file);
  if (isdigit(ch)) {		/* oops, put it back */
    if (ungetc(ch, file) == EOF)
      return FALSE;
    ch = ' ';
  } else {
    /* Any separators other than ';' and ':' are ignored;
     * this allows user to insert commas, etc, if desired.
     */
    if (ch != EOF && ch != ';' && ch != ':')
      ch = ' ';
  }
  *(int *)(__boundcheck_ptr_reference(152,4,"read_scan_integer",(void *)(termchar),(void *)(termchar))) = ch;
  return TRUE;
}
Пример #7
0
make_funny_pointers (j_decompress_ptr cinfo)
/* Create the funny pointer lists discussed in the comments above.
 * The actual workspace is already allocated (in main->buffer),
 * and the space for the pointer lists is allocated too.
 * This routine just fills in the curiously ordered lists.
 * This will be repeated at the beginning of each pass.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));

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

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

  JSAMPARRAY buf;
__boundcheck_metadata_store((void *)(&buf),(void *)((size_t)(&buf)+sizeof(buf)*8-1));
JSAMPARRAY  xbuf0;
__boundcheck_metadata_store((void *)(&xbuf0),(void *)((size_t)(&xbuf0)+sizeof(xbuf0)*8-1));
JSAMPARRAY  xbuf1;
__boundcheck_metadata_store((void *)(&xbuf1),(void *)((size_t)(&xbuf1)+sizeof(xbuf1)*8-1));


  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    xbuf0 = main->xbuffer[_RV_insert_check(0,2,213,13,"make_funny_pointers",0)][_RV_insert_check(0,2,213,13,"make_funny_pointers",ci)];
    xbuf1 = main->xbuffer[_RV_insert_check(0,2,214,13,"make_funny_pointers",1)][_RV_insert_check(0,2,214,13,"make_funny_pointers",ci)];
    /* First copy the workspace pointers as-is */
    buf = main->buffer[_RV_insert_check(0,10,216,11,"make_funny_pointers",ci)];
    for (i = 0; i < rgroup * (M + 2); i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(218,7,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(218,18,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(218,29,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[i]))));
    }
    /* In the second list, put the last four row groups in swapped order */
    for (i = 0; i < rgroup * 2; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(222,7,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * (M - 2) + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(222,33,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[rgroup * M + i]))));
      (*(JSAMPROW *)(__boundcheck_ptr_reference(223,7,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * M + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(223,29,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[rgroup * (M - 2) + i]))));
    }
    /* The wraparound pointers at top and bottom will be filled later
     * (see set_wraparound_pointers, below).  Initially we want the "above"
     * pointers to duplicate the first actual data line.  This only needs
     * to happen in xbuffer[0].
     */
    for (i = 0; i < rgroup; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(231,7,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i - rgroup])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(231,27,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[0]))));
    }
  }
}
Пример #8
0
jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
{
  my_coef_ptr coef;
__boundcheck_metadata_store((void *)(&coef),(void *)((size_t)(&coef)+sizeof(coef)*8-1));


  coef = (my_coef_ptr)
    (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(409,19,"jinit_c_coef_controller",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_coef_controller));
  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
  coef->pub.start_pass = start_pass_coef;

  /* Create the coefficient buffer. */
  if (need_full_buffer) {
#ifdef FULL_COEF_BUFFER_SUPPORTED
    /* Allocate a full-image virtual array for each component, */
    /* padded to a multiple of samp_factor DCT blocks in each direction. */
    int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

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


    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      coef->whole_image[_RV_insert_check(0,10,424,7,"jinit_c_coef_controller",ci)] = (*(jvirt_barray_ptr (*)(j_common_ptr, int, boolean, JDIMENSION, JDIMENSION, JDIMENSION))(__boundcheck_ptr_reference(424,45,"jinit_c_coef_controller",(void *)(cinfo->mem->request_virt_barray),(void *)cinfo->mem->request_virt_barray)))
	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
				(long) compptr->h_samp_factor),
	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
				(long) compptr->v_samp_factor),
	 (JDIMENSION) compptr->v_samp_factor);
    }
#else
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif
  } else {
    /* We only need a single-MCU buffer. */
    JBLOCKROW buffer;
__boundcheck_metadata_store((void *)(&buffer),(void *)((size_t)(&buffer)+sizeof(buffer)*8-1));

    int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));


    buffer = (JBLOCKROW)
      (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(441,21,"jinit_c_coef_controller",(void *)(cinfo->mem->alloc_large),(void *)cinfo->mem->alloc_large))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
      coef->MCU_buffer[_RV_insert_check(0,10,444,7,"jinit_c_coef_controller",i)] = buffer + i;
    }
    coef->whole_image[_RV_insert_check(0,10,446,5,"jinit_c_coef_controller",0)] = NULL; /* flag for no virtual arrays */
  }
}
Пример #9
0
void show_2d_array(int array[][10], int rows)
{
   int i, j;

	for (i = 0; i < rows; i++)
		for (j = 0; j < 10; j++)
	{
//		printf("array[%d][%d] = %d\n", i, j, *(*(array+i+1)+j));
		printf("array[%d][%d] = %d\n", i, j, *(int *)(__boundcheck_ptr_reference(9,46,"show_2d_array",(void *)(&array[i]),(void *)(&array[i][j]))));
		printf("array[%d][%d] = %d\n", i, j, *(int *)(__boundcheck_ptr_reference(9,46,"show_2d_array",(void *)(*(array + i)),(void *)(*(array+i)+j))));
	}
//printf("array[%d][%d] = %d\n", i, j, *(*(int **)(__boundcheck_ptr_reference(10,41,"main",(void *)(array),(void *)(array+1)))));
}
Пример #10
0
add_huff_table (j_compress_ptr cinfo,
		JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
/* Define a Huffman table */
{
  if (*(JHUFF_TBL **)(__boundcheck_ptr_reference(151,8,"add_huff_table",(void *)(htblptr),(void *)(htblptr))) == NULL)
    *(JHUFF_TBL **)(__boundcheck_ptr_reference(152,6,"add_huff_table",(void *)(htblptr),(void *)(htblptr))) = jpeg_alloc_huff_table((j_common_ptr) cinfo);
  
  MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
  MEMCOPY((*htblptr)->huffval, val, SIZEOF((*htblptr)->huffval));

  /* Initialize sent_table FALSE so table will be written to JPEG file. */
  (*(JHUFF_TBL **)(__boundcheck_ptr_reference(158,5,"add_huff_table",(void *)(htblptr),(void *)(htblptr))))->sent_table = FALSE;
}
Пример #11
0
jpeg_start_decompress (j_decompress_ptr cinfo)
{
  if (cinfo->global_state == DSTATE_READY) {
    /* First call: initialize master control, select active modules */
    jinit_master_decompress(cinfo);
    if (cinfo->buffered_image) {
      /* No more work here; expecting jpeg_start_output next */
      cinfo->global_state = DSTATE_BUFIMAGE;
      return TRUE;
    }
    cinfo->global_state = DSTATE_PRELOAD;
  }
  if (cinfo->global_state == DSTATE_PRELOAD) {
    /* If file has multiple scans, absorb them all into the coef buffer */
    if (cinfo->inputctl->has_multiple_scans) {
#ifdef D_MULTISCAN_FILES_SUPPORTED
      for (;;) {
	int retcode;
__boundcheck_metadata_store((void *)(&retcode),(void *)((size_t)(&retcode)+sizeof(retcode)*8-1));

	/* Call progress monitor hook if present */
	if (cinfo->progress != NULL)
	  (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(58,23,"jpeg_start_decompress",(void *)(cinfo->progress->progress_monitor),(void *)cinfo->progress->progress_monitor))) ((j_common_ptr) cinfo);
	/* Absorb some more input */
	retcode = (*(int (*)(j_decompress_ptr))(__boundcheck_ptr_reference(60,31,"jpeg_start_decompress",(void *)(cinfo->inputctl->consume_input),(void *)cinfo->inputctl->consume_input))) (cinfo);
	if (retcode == JPEG_SUSPENDED)
	  return FALSE;
	if (retcode == JPEG_REACHED_EOI)
	  break;
	/* Advance progress counter if appropriate */
	if (cinfo->progress != NULL &&
	    (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
	  if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
	    /* jdmaster underestimated number of scans; ratchet up one scan */
	    cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
	  }
	}
      }
#else
      ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif /* D_MULTISCAN_FILES_SUPPORTED */
    }
    cinfo->output_scan_number = cinfo->input_scan_number;
  } else if (cinfo->global_state != DSTATE_PRESCAN)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  /* Perform any dummy output passes, and set up for the final pass */
  return output_pass_setup(cinfo);
}
Пример #12
0
int main()
{
  int a=5;
__boundcheck_metadata_store((void *)(&a),(void *)((size_t)(&a)+sizeof(a)*8-1));

  int *b=&a;
__boundcheck_metadata_store((void *)(&b),(void *)((size_t)(&b)+sizeof(b)*8-1));

  int ** c = &b;
__boundcheck_metadata_store((void *)(&c),(void *)((size_t)(&c)+sizeof(c)*8-1));

  printf("%d\n",*(int *)(__boundcheck_ptr_reference(7,19,"main",(void *)(*c),(void *)*c)));
  *(int *)(__boundcheck_ptr_reference(8,5,"main",(void *)(*c),(void *)*c)) =10;
  printf("a=**c=%d\n",*(int *)(__boundcheck_ptr_reference(9,25,"main",(void *)(*c),(void *)*c)));
  return 1;
}
Пример #13
0
process_restart (j_decompress_ptr cinfo)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
__boundcheck_metadata_store((void *)(&entropy),(void *)((size_t)(&entropy)+sizeof(entropy)*8-1));

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


  /* Throw away any unused bits remaining in bit buffer; */
  /* include any full bytes in next_marker's count of discarded bytes */
  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  entropy->bitstate.bits_left = 0;

  /* Advance past the RSTn marker */
  if (! (*(jpeg_marker_parser_method)(__boundcheck_ptr_reference(404,26,"process_restart",(void *)(cinfo->marker->read_restart_marker),(void *)cinfo->marker->read_restart_marker))) (cinfo))
    return FALSE;

  /* Re-initialize DC predictions to 0 */
  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
    entropy->saved.last_dc_val[_RV_insert_check(0,4,409,5,"process_restart",ci)] = 0;

  /* Reset restart counter */
  entropy->restarts_to_go = cinfo->restart_interval;

  /* Next segment can get another out-of-data warning */
  entropy->bitstate.printed_eod = FALSE;

  return TRUE;
}
Пример #14
0
alloc_funny_pointers (j_decompress_ptr cinfo)
/* Allocate space for the funny pointer lists.
 * This is done only once, not once per pass.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));

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

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

  JSAMPARRAY xbuf;
__boundcheck_metadata_store((void *)(&xbuf),(void *)((size_t)(&xbuf)+sizeof(xbuf)*8-1));


  /* Get top-level space for component array pointers.
   * We alloc both arrays with one call to save a few cycles.
   */
  main->xbuffer[_RV_insert_check(0,2,171,3,"alloc_funny_pointers",0)] = (JSAMPIMAGE)
    (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(172,19,"alloc_funny_pointers",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
  main->xbuffer[_RV_insert_check(0,2,174,3,"alloc_funny_pointers",1)] = main->xbuffer[_RV_insert_check(0,2,174,22,"alloc_funny_pointers",0)] + cinfo->num_components;

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    /* Get space for pointer lists --- M+4 row groups in each list.
     * We alloc both pointer lists with one call to save a few cycles.
     */
    xbuf = (JSAMPARRAY)
      (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(184,21,"alloc_funny_pointers",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
    xbuf += rgroup;		/* want one row group at negative offsets */
    main->xbuffer[_RV_insert_check(0,2,187,5,"alloc_funny_pointers",0)][_RV_insert_check(0,2,187,5,"alloc_funny_pointers",ci)] = xbuf;
    xbuf += rgroup * (M + 4);
    main->xbuffer[_RV_insert_check(0,2,189,5,"alloc_funny_pointers",1)][_RV_insert_check(0,2,189,5,"alloc_funny_pointers",ci)] = xbuf;
  }
}
Пример #15
0
bool conver(int d[],int b[])
{
   int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  *p;
__boundcheck_metadata_store((void *)(&p),(void *)((size_t)(&p)+sizeof(p)*8-1));
int  *q;
__boundcheck_metadata_store((void *)(&q),(void *)((size_t)(&q)+sizeof(q)*8-1));

   p=b;
__boundcheck_metadata_trans_check((void *)(p),(void *)(b),(void *)(b));

   printf("%d\n",*(int *)(__boundcheck_ptr_reference(8,23,"conver",(void *)(p),(void *)(p+2))));
   for(i=0;i<5;i++)
      (*(int *)(__boundcheck_ptr_reference(10,7,"conver",(void *)(&d[0]),(void *)(&d[i]))))=(*(int *)(__boundcheck_ptr_reference(10,12,"conver",(void *)(&b[0]),(void *)(&b[i]))));    
   return 1;
}
Пример #16
0
jinit_compress_master (j_compress_ptr cinfo)
{
  /* Initialize master control (includes parameter checking/processing) */
  jinit_c_master_control(cinfo, FALSE /* full compression */);

  /* Preprocessing */
  if (! cinfo->raw_data_in) {
    jinit_color_converter(cinfo);
    jinit_downsampler(cinfo);
    jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
  }
  /* Forward DCT */
  jinit_forward_dct(cinfo);
  /* Entropy encoding: either Huffman or arithmetic coding. */
  if (cinfo->arith_code) {
    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  } else {
    if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
      jinit_phuff_encoder(cinfo);
#else
      ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
    } else
      jinit_huff_encoder(cinfo);
  }

  /* Need a full-image coefficient buffer in any multi-pass mode. */
  jinit_c_coef_controller(cinfo,
			  (cinfo->num_scans > 1 || cinfo->optimize_coding));
  jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);

  jinit_marker_writer(cinfo);

  /* We can now tell the memory manager to allocate virtual arrays. */
  (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(65,17,"jinit_compress_master",(void *)(cinfo->mem->realize_virt_arrays),(void *)cinfo->mem->realize_virt_arrays))) ((j_common_ptr) cinfo);

  /* Write the datastream header (SOI) immediately.
   * Frame and scan headers are postponed till later.
   * This lets application insert special markers after the SOI.
   */
  (*(void (*)(j_compress_ptr))(__boundcheck_ptr_reference(71,20,"jinit_compress_master",(void *)(cinfo->marker->write_file_header),(void *)cinfo->marker->write_file_header))) (cinfo);
}
Пример #17
0
output_pass_setup (j_decompress_ptr cinfo)
{
  if (cinfo->global_state != DSTATE_PRESCAN) {
    /* First call: do pass setup */
    (*(void (*)(j_decompress_ptr))(__boundcheck_ptr_reference(99,22,"output_pass_setup",(void *)(cinfo->master->prepare_for_output_pass),(void *)cinfo->master->prepare_for_output_pass))) (cinfo);
    cinfo->output_scanline = 0;
    cinfo->global_state = DSTATE_PRESCAN;
  }
  /* Loop over any required dummy passes */
  while (cinfo->master->is_dummy_pass) {
#ifdef QUANT_2PASS_SUPPORTED
    /* Crank through the dummy pass */
    while (cinfo->output_scanline < cinfo->output_height) {
      JDIMENSION last_scanline;
__boundcheck_metadata_store((void *)(&last_scanline),(void *)((size_t)(&last_scanline)+sizeof(last_scanline)*8-1));

      /* 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;
	(*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(113,21,"output_pass_setup",(void *)(cinfo->progress->progress_monitor),(void *)cinfo->progress->progress_monitor))) ((j_common_ptr) cinfo);
      }
      /* Process some data */
      last_scanline = cinfo->output_scanline;
      (*(void (*)(j_decompress_ptr, JSAMPARRAY, JDIMENSION *, JDIMENSION))(__boundcheck_ptr_reference(117,22,"output_pass_setup",(void *)(cinfo->main->process_data),(void *)cinfo->main->process_data))) (cinfo, (JSAMPARRAY) NULL,
				    &cinfo->output_scanline, (JDIMENSION) 0);
      if (cinfo->output_scanline == last_scanline)
	return FALSE;		/* No progress made, must suspend */
    }
    /* Finish up dummy pass, and set up for another one */
    (*(void (*)(j_decompress_ptr))(__boundcheck_ptr_reference(123,22,"output_pass_setup",(void *)(cinfo->master->finish_output_pass),(void *)cinfo->master->finish_output_pass))) (cinfo);
    (*(void (*)(j_decompress_ptr))(__boundcheck_ptr_reference(124,22,"output_pass_setup",(void *)(cinfo->master->prepare_for_output_pass),(void *)cinfo->master->prepare_for_output_pass))) (cinfo);
    cinfo->output_scanline = 0;
#else
    ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif /* QUANT_2PASS_SUPPORTED */
  }
  /* Ready for application to drive output pass through
   * jpeg_read_scanlines or jpeg_read_raw_data.
   */
  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  return TRUE;
}
Пример #18
0
set_sample_factors (j_compress_ptr cinfo, char *arg)
/* Process a sample-factors parameter string, of the form
 *     HxV[,HxV,...]
 * If there are more components than parameters, "1x1" is assumed for the rest.
 */
{
  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  val1;
__boundcheck_metadata_store((void *)(&val1),(void *)((size_t)(&val1)+sizeof(val1)*8-1));
int  val2;
__boundcheck_metadata_store((void *)(&val2),(void *)((size_t)(&val2)+sizeof(val2)*8-1));

  char ch1;
__boundcheck_metadata_store((void *)(&ch1),(void *)((size_t)(&ch1)+sizeof(ch1)*8-1));
char  ch2;
__boundcheck_metadata_store((void *)(&ch2),(void *)((size_t)(&ch2)+sizeof(ch2)*8-1));


  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
    if (*(char *)(__boundcheck_ptr_reference(311,10,"set_sample_factors",(void *)(arg),(void *)(arg)))) {
      ch2 = ',';		/* if not set by sscanf, will be ',' */
      if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3)
	return FALSE;
      if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */
	return FALSE;
      if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) {
	fprintf(stderr, "JPEG sampling factors must be 1..4\n");
	return FALSE;
      }
      cinfo->comp_info[ci].h_samp_factor = val1;
      cinfo->comp_info[ci].v_samp_factor = val2;
      while (*(char *)(__boundcheck_ptr_reference(323,15,"set_sample_factors",(void *)(arg),(void *)(arg))) && *(char *)(__boundcheck_ptr_reference(323,26,"set_sample_factors",(void *)(arg),(void *)(arg++))) != ',') /* advance to next segment of arg string */
	;
    } else {
      /* reached end of parameter, set remaining components to 1x1 sampling */
      cinfo->comp_info[ci].h_samp_factor = 1;
      cinfo->comp_info[ci].v_samp_factor = 1;
    }
  }
  return TRUE;
}
Пример #19
0
set_wraparound_pointers (j_decompress_ptr cinfo)
/* Set up the "wraparound" pointers at top and bottom of the pointer lists.
 * This changes the pointer list state from top-of-image to the normal state.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));

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

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

  JSAMPARRAY xbuf0;
__boundcheck_metadata_store((void *)(&xbuf0),(void *)((size_t)(&xbuf0)+sizeof(xbuf0)*8-1));
JSAMPARRAY  xbuf1;
__boundcheck_metadata_store((void *)(&xbuf1),(void *)((size_t)(&xbuf1)+sizeof(xbuf1)*8-1));


  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    xbuf0 = main->xbuffer[_RV_insert_check(0,2,253,13,"set_wraparound_pointers",0)][_RV_insert_check(0,2,253,13,"set_wraparound_pointers",ci)];
    xbuf1 = main->xbuffer[_RV_insert_check(0,2,254,13,"set_wraparound_pointers",1)][_RV_insert_check(0,2,254,13,"set_wraparound_pointers",ci)];
    for (i = 0; i < rgroup; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(256,7,"set_wraparound_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i - rgroup])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(256,27,"set_wraparound_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[rgroup * (M + 1) + i]))));
      (*(JSAMPROW *)(__boundcheck_ptr_reference(257,7,"set_wraparound_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[i - rgroup])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(257,27,"set_wraparound_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * (M + 1) + i]))));
      (*(JSAMPROW *)(__boundcheck_ptr_reference(258,7,"set_wraparound_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[rgroup * (M + 2) + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(258,33,"set_wraparound_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i]))));
      (*(JSAMPROW *)(__boundcheck_ptr_reference(259,7,"set_wraparound_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * (M + 2) + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(259,33,"set_wraparound_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[i]))));
    }
  }
}
Пример #20
0
jpeg_finish_output (j_decompress_ptr cinfo)
{
  if ((cinfo->global_state == DSTATE_SCANNING ||
       cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
    /* Terminate this pass. */
    /* We do not require the whole pass to have been completed. */
    (*(void (*)(j_decompress_ptr))(__boundcheck_ptr_reference(259,22,"jpeg_finish_output",(void *)(cinfo->master->finish_output_pass),(void *)cinfo->master->finish_output_pass))) (cinfo);
    cinfo->global_state = DSTATE_BUFPOST;
  } else if (cinfo->global_state != DSTATE_BUFPOST) {
    /* BUFPOST = repeat call after a suspension, anything else is error */
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  }
  /* Read markers looking for SOS or EOI */
  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
	 ! cinfo->inputctl->eoi_reached) {
    if ((*(int (*)(j_decompress_ptr))(__boundcheck_ptr_reference(268,28,"jpeg_finish_output",(void *)(cinfo->inputctl->consume_input),(void *)cinfo->inputctl->consume_input))) (cinfo) == JPEG_SUSPENDED)
      return FALSE;		/* Suspend, come back later */
  }
  cinfo->global_state = DSTATE_BUFIMAGE;
  return TRUE;
}
Пример #21
0
void show_2d_array(int array[][10], int rows)
 {
   int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));


   for (i = 0; i < rows; i++)
     for (j = 0; j < 10; j++)
       printf("array[%d][%d] = %d\n", i, j, *(int *)(__boundcheck_ptr_reference(9,59,"show_2d_array",(void *)(*(array + i)),(void *)(*(array+i)+j))));
 }
Пример #22
0
int main()
{
  int i=0;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));

  char *__tmp_string_2="tytui";
 __boundcheck_metadata_store((void *)(__tmp_string_2),(void *)(__tmp_string_2+5));
char *__tmp_string_1="rteyy";
 __boundcheck_metadata_store((void *)(__tmp_string_1),(void *)(__tmp_string_1+5));
char *__tmp_string_0="qwee";
 __boundcheck_metadata_store((void *)(__tmp_string_0),(void *)(__tmp_string_0+4));
char *a[3]={__tmp_string_0,__tmp_string_1,__tmp_string_2};__boundcheck_metadata_store(&a[0],&a[3-1]);

  int j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));

  char *string[10];__boundcheck_metadata_store(&string[0],&string[10-1]);

  char **p;
__boundcheck_metadata_store((void *)(&p),(void *)((size_t)(&p)+sizeof(p)*8-1));

  if(i)
   {
      for(j=0;j<10;j++)
      {
        string[_RV_insert_check(0,10,15,9,"main",j)]=(char *)__boundcheck_malloc(100*sizeof(char));
      }
      __boundcheck_strcpy(string[_RV_insert_check(0,10,17,14,"main",5)],"ASADAD");
      p=&string[_RV_insert_check(0,10,18,10,"main",5)];
   }
   else
      p=a;
__boundcheck_metadata_trans_check((void *)(p),(void *)(a),(void *)(a));

   printf("%s\n",*(char **)(__boundcheck_ptr_reference(22,19,"main",(void *)(p),(void *)(p))));
   printf("%c\n",*(char *)(__boundcheck_ptr_reference(23,20,"main",(void *)(*p),(void *)*p)));
   printf("a=%p a[0]=%p\n",&a,&a[_RV_insert_check(0,3,24,32,"main",0)]);
   printf("%p %p\n",&p,&(*(char **)(__boundcheck_ptr_reference(25,27,"main",(void *)(p),(void *)(p)))));
   return 1;
}
Пример #23
0
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
		      const unsigned int *basic_table,
		      int scale_factor, boolean force_baseline)
/* Define a quantization table equal to the basic_table times
 * a scale factor (given as a percentage).
 * If force_baseline is TRUE, the computed quantization table entries
 * are limited to 1..255 for JPEG baseline compatibility.
 */
{
  JQUANT_TBL ** qtblptr = & cinfo->quant_tbl_ptrs[_RV_insert_check(0,4,32,29,"jpeg_add_quant_table",which_tbl)];
__boundcheck_metadata_store((void *)(&qtblptr),(void *)((size_t)(&qtblptr)+sizeof(qtblptr)*8-1));

  int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));

  long temp;
__boundcheck_metadata_store((void *)(&temp),(void *)((size_t)(&temp)+sizeof(temp)*8-1));


  /* Safety check to ensure start_compress not called yet. */
  if (cinfo->global_state != CSTATE_START)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

  if (*(JQUANT_TBL **)(__boundcheck_ptr_reference(40,8,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))) == NULL)
    *(JQUANT_TBL **)(__boundcheck_ptr_reference(41,6,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))) = jpeg_alloc_quant_table((j_common_ptr) cinfo);

  for (i = 0; i < DCTSIZE2; i++) {
    temp = ((long) (*(const unsigned int *)(__boundcheck_ptr_reference(44,20,"jpeg_add_quant_table",(void *)(&basic_table[0]),(void *)(&basic_table[i])))) * scale_factor + 50L) / 100L;
    /* limit the values to the valid range */
    if (temp <= 0L) temp = 1L;
    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
    if (force_baseline && temp > 255L)
      temp = 255L;		/* limit to baseline range if requested */
    (*(JQUANT_TBL **)(__boundcheck_ptr_reference(50,7,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))))->quantval[_RV_insert_check(0,64,50,5,"jpeg_add_quant_table",i)] = (UINT16) temp;
  }

  /* Initialize sent_table FALSE so table will be written to JPEG file. */
  (*(JQUANT_TBL **)(__boundcheck_ptr_reference(54,5,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))))->sent_table = FALSE;
}
Пример #24
0
set_quant_slots (j_compress_ptr cinfo, char *arg)
/* Process a quantization-table-selectors parameter string, of the form
 *     N[,N,...]
 * If there are more components than parameters, the last value is replicated.
 */
{
  int val = 0;
__boundcheck_metadata_store((void *)(&val),(void *)((size_t)(&val)+sizeof(val)*8-1));
			/* default table # */
  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

  char ch;
__boundcheck_metadata_store((void *)(&ch),(void *)((size_t)(&ch)+sizeof(ch)*8-1));


  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
    if (*(char *)(__boundcheck_ptr_reference(277,10,"set_quant_slots",(void *)(arg),(void *)(arg)))) {
      ch = ',';			/* if not set by sscanf, will be ',' */
      if (sscanf(arg, "%d%c", &val, &ch) < 1)
	return FALSE;
      if (ch != ',')		/* syntax check */
	return FALSE;
      if (val < 0 || val >= NUM_QUANT_TBLS) {
	fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n",
		NUM_QUANT_TBLS-1);
	return FALSE;
      }
      cinfo->comp_info[ci].quant_tbl_no = val;
      while (*(char *)(__boundcheck_ptr_reference(289,15,"set_quant_slots",(void *)(arg),(void *)(arg))) && *(char *)(__boundcheck_ptr_reference(289,26,"set_quant_slots",(void *)(arg),(void *)(arg++))) != ',') /* advance to next segment of arg string */
	;
    } else {
      /* reached end of parameter, set remaining components to last table */
      cinfo->comp_info[ci].quant_tbl_no = val;
    }
  }
  return TRUE;
}
Пример #25
0
set_bottom_pointers (j_decompress_ptr cinfo)
/* Change the pointer lists to duplicate the last sample row at the bottom
 * of the image.  whichptr indicates which xbuffer holds the final iMCU row.
 * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));
int  iMCUheight;
__boundcheck_metadata_store((void *)(&iMCUheight),(void *)((size_t)(&iMCUheight)+sizeof(iMCUheight)*8-1));
int  rows_left;
__boundcheck_metadata_store((void *)(&rows_left),(void *)((size_t)(&rows_left)+sizeof(rows_left)*8-1));

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

  JSAMPARRAY xbuf;
__boundcheck_metadata_store((void *)(&xbuf),(void *)((size_t)(&xbuf)+sizeof(xbuf)*8-1));


  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Count sample rows in one iMCU row and in one row group */
    iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size;
    rgroup = iMCUheight / cinfo->min_DCT_scaled_size;
    /* Count nondummy sample rows remaining for this component */
    rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);
    if (rows_left == 0) rows_left = iMCUheight;
    /* Count nondummy row groups.  Should get same answer for each component,
     * so we need only do it once.
     */
    if (ci == 0) {
      main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
    }
    /* Duplicate the last real sample row rgroup*2 times; this pads out the
     * last partial rowgroup and ensures at least one full rowgroup of context.
     */
    xbuf = main->xbuffer[_RV_insert_check(0,2,294,12,"set_bottom_pointers",main->whichptr)][_RV_insert_check(0,2,294,12,"set_bottom_pointers",ci)];
    for (i = 0; i < rgroup * 2; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(296,7,"set_bottom_pointers",(void *)(&xbuf[0]),(void *)(&xbuf[rows_left + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(296,29,"set_bottom_pointers",(void *)(&xbuf[0]),(void *)(&xbuf[rows_left - 1]))));
    }
  }
}
Пример #26
0
void show_3d_array(int values[][3][4],int rows)
{
	int row;
//__boundcheck_metadata_store(&(row),&(row));
int column;
//__boundcheck_metadata_store(&(column),&(column));
int table;
//__boundcheck_metadata_store(&(table),&(table));

	for (row = 0; row < 2; row++)
		for (column = 0; column < 3; column++)
			for (table = 0; table < rows; table++)
				printf("values[%d][%d][%d] = %d\n", row,column,table,*(int *)(__boundcheck_ptr_reference(9,46,"show_2d_array",(void *)(&values[row][column]),(void *)(&values[row][column][table]))));
}
Пример #27
0
void show_3d_array(int values[][3][4],int rows)
{
	int row;
__boundcheck_metadata_store((void *)(&row),(void *)((size_t)(&row)+sizeof(row)*8-1));
int column;
__boundcheck_metadata_store((void *)(&column),(void *)((size_t)(&column)+sizeof(column)*8-1));
int table;
__boundcheck_metadata_store((void *)(&table),(void *)((size_t)(&table)+sizeof(table)*8-1));

	for (row = 0; row < 2; row++)
		for (column = 0; column < 3; column++)
			for (table = 0; table < rows; table++)
				printf("values[%d][%d][%d] = %d\n", row,column,table,(*(int *)(__boundcheck_ptr_reference(18,58,"show_3d_array",(void *)(&values[row][column][0]),(void *)(&values[row][column][table])))));
}
Пример #28
0
add_map_entry (j_decompress_ptr cinfo, int R, int G, int B)
{
  JSAMPROW colormap0 = cinfo->colormap[0];
__boundcheck_metadata_store((void *)(&colormap0),(void *)((size_t)(&colormap0)+sizeof(colormap0)*8-1));

  JSAMPROW colormap1 = cinfo->colormap[1];
__boundcheck_metadata_store((void *)(&colormap1),(void *)((size_t)(&colormap1)+sizeof(colormap1)*8-1));

  JSAMPROW colormap2 = cinfo->colormap[2];
__boundcheck_metadata_store((void *)(&colormap2),(void *)((size_t)(&colormap2)+sizeof(colormap2)*8-1));

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

  int index;
__boundcheck_metadata_store((void *)(&index),(void *)((size_t)(&index)+sizeof(index)*8-1));


  /* Check for duplicate color. */
  for (index = 0; index < ncolors; index++) {
    if (GETJSAMPLE(colormap0[index]) == R &&
	GETJSAMPLE(colormap1[index]) == G &&
	GETJSAMPLE(colormap2[index]) == B)
      return;			/* color is already in map */
  }

  /* Check for map overflow. */
  if (ncolors >= (MAXJSAMPLE+1))
    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, (MAXJSAMPLE+1));

  /* OK, add color to map. */
  (*(JSAMPLE *)(__boundcheck_ptr_reference(67,3,"add_map_entry",(void *)(&colormap0[0]),(void *)(&colormap0[ncolors])))) = (JSAMPLE) R;
  (*(JSAMPLE *)(__boundcheck_ptr_reference(68,3,"add_map_entry",(void *)(&colormap1[0]),(void *)(&colormap1[ncolors])))) = (JSAMPLE) G;
  (*(JSAMPLE *)(__boundcheck_ptr_reference(69,3,"add_map_entry",(void *)(&colormap2[0]),(void *)(&colormap2[ncolors])))) = (JSAMPLE) B;
  cinfo->actual_number_of_colors++;
}
Пример #29
0
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
{
  my_main_ptr main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));
int  ngroups;
__boundcheck_metadata_store((void *)(&ngroups),(void *)((size_t)(&ngroups)+sizeof(ngroups)*8-1));

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


  main = (my_main_ptr)
    (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(483,19,"jinit_d_main_controller",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_main_controller));
  cinfo->main = (struct jpeg_d_main_controller *) main;
  main->pub.start_pass = start_pass_main;

  if (need_full_buffer)		/* shouldn't happen */
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  /* Allocate the workspace.
   * ngroups is the number of row groups we need.
   */
  if (cinfo->upsample->need_context_rows) {
    if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */
      ERREXIT(cinfo, JERR_NOTIMPL);
    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
    ngroups = cinfo->min_DCT_scaled_size + 2;
  } else {
    ngroups = cinfo->min_DCT_scaled_size;
  }

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    main->buffer[_RV_insert_check(0,10,507,5,"jinit_d_main_controller",ci)] = (*(JSAMPARRAY (*)(j_common_ptr, int, JDIMENSION, JDIMENSION))(__boundcheck_ptr_reference(507,38,"jinit_d_main_controller",(void *)(cinfo->mem->alloc_sarray),(void *)cinfo->mem->alloc_sarray)))
			((j_common_ptr) cinfo, JPOOL_IMAGE,
			 compptr->width_in_blocks * compptr->DCT_scaled_size,
			 (JDIMENSION) (rgroup * ngroups));
  }
}
Пример #30
0
read_color_map (j_decompress_ptr cinfo, FILE * infile)
{
  /* Allocate space for a color map of maximum supported size. */
  cinfo->colormap = (*(JSAMPARRAY (*)(j_common_ptr, int, JDIMENSION, JDIMENSION))(__boundcheck_ptr_reference(234,35,"read_color_map",(void *)(cinfo->mem->alloc_sarray),(void *)cinfo->mem->alloc_sarray)))
    ((j_common_ptr) cinfo, JPOOL_IMAGE,
     (JDIMENSION) (MAXJSAMPLE+1), (JDIMENSION) 3);
  cinfo->actual_number_of_colors = 0; /* initialize map to empty */

  /* Read first byte to determine file format */
  switch (getc(infile)) {
  case 'G':
    read_gif_map(cinfo, infile);
    break;
  case 'P':
    read_ppm_map(cinfo, infile);
    break;
  default:
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    break;
  }
}