Exemple #1
0
PIXMAN_EXPORT void
pixman_add_trapezoids (pixman_image_t *          image,
                       int16_t                   x_off,
                       int                       y_off,
                       int                       ntraps,
                       const pixman_trapezoid_t *traps)
{
    int i;

#if 0
    dump_image (image, "before");
#endif

    for (i = 0; i < ntraps; ++i)
    {
	const pixman_trapezoid_t *trap = &(traps[i]);

	if (!pixman_trapezoid_valid (trap))
	    continue;

	pixman_rasterize_trapezoid (image, trap, x_off, y_off);
    }

#if 0
    dump_image (image, "after");
#endif
}
Exemple #2
0
static void
dump_bootinfo(void)
{
	static const char strtype[][9] = \
		{ "", "USABLE", "MEMHOLE", "RESERVED", "BOOTDISK" };
	struct module *m;
	int i;

	printf("[Boot information]\n");

	printf("nr_rams=%d\n", bootinfo->nr_rams);
	for (i = 0; i < bootinfo->nr_rams; i++) {
		if (bootinfo->ram[i].type != 0) {
			printf("ram[%d]:  base=%x size=%x type=%s\n", i,
			       (int)bootinfo->ram[i].base,
			       (int)bootinfo->ram[i].size,
			       strtype[bootinfo->ram[i].type]);
		}
	}

	printf("bootdisk: base=%x size=%x\n",
	       (int)bootinfo->bootdisk.base,
	       (int)bootinfo->bootdisk.size);

	printf("entry    phys     size     text     data     bss      ksym     "
	       "textsz   datasz   bsssz    module\n");
	printf("-------- -------- -------- -------- -------- -------- -------- "
	       "-------- -------- -------- ------\n");
	dump_image(&bootinfo->kernel);
	dump_image(&bootinfo->driver);

	m = (struct module *)&bootinfo->tasks[0];
	for (i = 0; i < bootinfo->nr_tasks; i++, m++)
		dump_image(m);
}
void GLCpuPosInstancedArraysBench::onDraw(const int loops, SkCanvas* canvas) {
    const GrGLContext* ctx = get_gl_context(canvas);
    if (!ctx) {
        return;
    }

    const GrGLInterface* gl = ctx->interface();

    uint32_t maxTrianglesPerFlush = fDrawDiv == 0 ?  kNumTri :
                                                     kDrawMultiplier / fDrawDiv;
    uint32_t trianglesToDraw = loops * kDrawMultiplier;

    if (kUseInstance_VboSetup == fVboSetup) {
        while (trianglesToDraw > 0) {
            uint32_t triangles = SkTMin(trianglesToDraw, maxTrianglesPerFlush);
            GR_GL_CALL(gl, DrawArraysInstanced(GR_GL_TRIANGLES, 0, kVerticesPerTri, triangles));
            trianglesToDraw -= triangles;
        }
    } else {
        while (trianglesToDraw > 0) {
            uint32_t triangles = SkTMin(trianglesToDraw, maxTrianglesPerFlush);
            GR_GL_CALL(gl, DrawArrays(GR_GL_TRIANGLES, 0, kVerticesPerTri * triangles));
            trianglesToDraw -= triangles;
        }
    }

#ifdef DUMP_IMAGES
    //const char* filename = "/data/local/tmp/out.png";
    SkString filename("out");
    filename.appendf("_%s.png", this->getName());
    dump_image(gl, kScreenWidth, kScreenHeight, filename.c_str());
#endif
}
Exemple #4
0
void dump_layer(tmx_layer *l, unsigned int tc) {
	unsigned int i;
	printf("\nlayer={");
	if (!l) {
		printf(" (NULL) }");
	} else {
		printf("\n\t" "name='%s'", l->name);
		printf("\n\t" "visible=%s", str_bool(l->visible));
		printf("\n\t" "opacity='%f'", l->opacity);
		if (l->type == L_LAYER && l->content.gids) {
			printf("\n\t" "type=Layer" "\n\t" "tiles=");
			for (i=0; i<tc; i++) {
				printf("%d,", l->content.gids[i] & TMX_FLIP_BITS_REMOVAL);
			}
		} else if (l->type == L_OBJGR) {
			printf("\n\t" "color=#%.6X", l->content.objgr->color);
			printf("\n\t" "draworder="); print_draworder(l->content.objgr->draworder);
			printf("\n\t" "type=ObjectGroup");
			dump_objects(l->content.objgr->head, 1);
		} else if (l->type == L_IMAGE) {
			printf("\n\t" "x_offset=%d", l->x_offset);
			printf("\n\t" "y_offset=%d", l->y_offset);
			printf("\n\t" "type=ImageLayer");
			dump_image(l->content.image, 1);
		}
		dump_prop(l->properties, 1);
		printf("\n}");
	}

	if (l) {
		if (l->next) dump_layer(l->next, tc);
	}
}
Exemple #5
0
void dump_tile(tmx_tile *t) {
	unsigned int i;
	printf("\n\t" "tile={");
	if (t) {
		printf("\n\t\t" "id=%u", t->id);
		dump_image(t->image, 2);
		dump_prop(t->properties, 2);
		dump_objects(t->collision, 2);

		if (t->animation) {
			printf("\n\t\t" "animation={");
			for (i=0; i<t->animation_len; i++) {
				printf("\n\t\t\t" "tile=%3d (%6dms)", t->animation[i].tile_id, t->animation[i].duration);
			}
			printf("\n\t\t}");
		}

		printf("\n\t}");
	} else {
		printf(" (NULL) }");
	}

	if (t && t->next) {
		dump_tile(t->next);
	}
}
Exemple #6
0
void cpu_compute (char *name) {
    int i, j, mx;
    char str[1024];
    int64_t *img, v0;
    int64_t *B_correct;
    uint8_t V[9], rr;

    B_correct = (int64_t*) Cache_Aligned_Allocate (SZ);

    for (i=0; i<SN-(WN-1); i++)
        for (j=0; j<SM-(WM-1); j++) {
            V[0] = REF(A,i,j);
            V[1] = REF(A,i,j+1);
            V[2] = REF(A,i,j+2);
            V[3] = REF(A,i+1,j);
            V[4] = REF(A,i+1,j+1);
            V[5] = REF(A,i+1,j+2);
            V[6] = REF(A,i+2,j);
            V[7] = REF(A,i+2,j+1);
            V[8] = REF(A,i+2,j+2);
	    rr = cpu_median (V);
	    REF(B_correct,i,j) = rr;
            }

    dump_image (B_correct, name);
    }
int		main(int ac, char **av)
{
  Image		*img;
  int		*histogram;

  InitializeMagick("./");
  img = get_image_from_path(av[1]);
  img = get_grayscale_image(img);
  histogram = create_histogram(img);
  dump_histogram(histogram, av[2]);
  dump_image(img, "./", "gray", "jpeg");
  return (0);
}
void GLGpuPosInstancedArraysBench::onDraw(const int loops, SkCanvas* canvas) {
    const GrGLInterface* gl = get_interface(canvas);
    if (!gl) {
        return;
    }

    GR_GL_CALL(gl, DrawArraysInstanced(GR_GL_TRIANGLES, 0, 6, fNumQuads));

#ifdef DUMP_IMAGES
    const char* filename = "out.png";
    dump_image(gl, kScreenWidth, kScreenHeight, filename);
#endif
    SkFAIL("done\n");
}
void decode_c63_frame(struct c63_common *cm, FILE *fout)
{
  /* Motion Compensation */
  if (!cm->curframe->keyframe) { c63_motion_compensate(cm); }

  /* Decode residuals */
  dequantize_idct(cm->curframe->residuals->Ydct, cm->curframe->predicted->Y,
      cm->ypw, cm->yph, cm->curframe->recons->Y, cm->quanttbl[0]);
  dequantize_idct(cm->curframe->residuals->Udct, cm->curframe->predicted->U,
      cm->upw, cm->uph, cm->curframe->recons->U, cm->quanttbl[1]);
  dequantize_idct(cm->curframe->residuals->Vdct, cm->curframe->predicted->V,
      cm->vpw, cm->vph, cm->curframe->recons->V, cm->quanttbl[2]);

#ifndef C63_PRED
  /* Write result */
  dump_image(cm->curframe->recons, cm->width, cm->height, fout);
#else
  /* To dump the predicted frames, use this instead */
  dump_image(cm->curframe->predicted, cm->width, cm->height, fout);
#endif

  ++cm->framenum;
}
Exemple #10
0
void dump_tileset(tmx_tileset t) {
	printf("tileset={");
	if (t) {
		printf("\n\tname=%s", t->name);
		printf("\n\ttile_height=%d", t->tile_height);
		printf("\n\ttile_width=%d", t->tile_width);
		printf("\n\tfirstgid=%d", t->firstgid);
		printf("\n\tmargin=%d", t->margin);
		printf("\n\tspacing=%d", t->spacing);
	} else {
		fputs("\n(NULL)", stdout);
	}
	puts("\n}");

	if (t) {
		if (t->image) dump_image(t->image);
		if (t->next) dump_tileset(t->next);
	}
}
Exemple #11
0
int main(int argc, char **argv)
{
    ssize_t (*read_func) (MtdReadContext *, char *, size_t);
    MtdReadContext *in;
    const MtdPartition *partition;
    char buf[BLOCK_SIZE + SPARE_SIZE];
    size_t partition_size;
    size_t read_size;
    size_t total;
    int fd;
    int wrote;
    int len;

    if (argc != 3) {
        fprintf(stderr, "usage: %s partition file.img\n", argv[0]);
        return 2;
    }

    return dump_image(argv[1], argv[2], NULL);
}
Exemple #12
0
void run_repl()
{
  switch (setjmp (mainloop))
    {
    case 0: case 1:
      {
	static char line[257];
	while( EOF != just_one_line(stdin, 256, line) )
	  {
	    Vm_eval(line);
	    if ( Vm_Save_image ) 
	      {
		Vm_Save_image = 0;
		dump_image();
	      }
	  }
      case 2:
	break;
      default:
	abort ();
      }
    }
}
Exemple #13
0
void dump_tileset(tmx_tileset *t) {
	printf("\ntileset={");
	if (t) {
		printf("\n\t" "name=%s", t->name);
		printf("\n\t" "firstgid=%u", t->firstgid);
		printf("\n\t" "tile_height=%d", t->tile_height);
		printf("\n\t" "tile_width=%d", t->tile_width);
		printf("\n\t" "firstgid=%d", t->firstgid);
		printf("\n\t" "margin=%d", t->margin);
		printf("\n\t" "spacing=%d", t->spacing);
		printf("\n\t" "x_offset=%d", t->x_offset);
		printf("\n\t" "y_offset=%d", t->y_offset);
		dump_image(t->image, 1);
		dump_tile(t->tiles);
		dump_prop(t->properties, 1);
		printf("\n}");
	} else {
		printf(" (NULL) }");
	}

	if (t && t->next) {
		dump_tileset(t->next);
	}
}
Exemple #14
0
int main (int argc, char *argv[]) {
    int64_t time;

    if (argc < 2) {
        fprintf (stderr, "need image file source as arg\n");
	exit (1);
	}

    map_allocate (1);

    read_image (argv[1]);

    subr (A, B, SN, SM, SZ/8, &time, 0);

    printf ("%lld clocks\n", time);

    dump_image (B, "res_map.pgm");

    map_free (1);

    cpu_compute ("res_cpu.pgm");

    exit (0);
    }
int		main(int ac, char **av)
{
  char		*image_path;
  char		*image_name;
  RectangleInfo *portion;
  struct dirent **names;
  int		nb;
  int		i = 0;
  int		j = 0;
  Image		*img;
  Image		*img_channel;
Image		*img_tmp;

  ac = ac;

  InitializeMagick("./");

  portion = malloc(sizeof(*portion));

  portion->width = 5538 - 3602;
  portion->height = 1523;
  portion->x = 3602;
  portion->y = 0;


  nb = scandir(av[1], &names, NULL, versionsort);
  while (i < nb)
    {
      if (check_extension(names[i]->d_name, ".jpeg"))
	{
	  printf("\rImage => %i", j);
	  fflush(stdout);
	  asprintf(&image_path, "%s/%s", av[1], names[i]->d_name);
	  if ((img = get_image_from_path(image_path)) == NULL)
	    printf("Failed to load the image from disk!\n");
	  /*	  asprintf(&image_name, "%i_rgb", j);
	  	  img = crop_image_from_path(image_path, portion);
		  dump_image(img, "/media/Data/histology/brain_2", image_name, "jpeg");
		  free(image_name); */

	  if ((img_channel = get_red_channe_image(img)) == NULL)
	    printf("Filed to extract the red channel from the image");
	  asprintf(&image_name, "%i_r", j);
	  dump_image(img_channel, "/media/Data/histology/brain_1_r", image_name, "jpeg");
	  DestroyImage(img_channel);
	  free(image_name);

	  if ((img_channel = get_green_channe_image(img)) == NULL)
	    printf("Filed to extract the green channel from the image");
	  asprintf(&image_name, "%i_g", j);
	  dump_image(img_channel, "/media/Data/histology/brain_1_g", image_name, "jpeg");
	  free(image_name);
	  DestroyImage(img_channel);

	  if ((img_channel = get_blue_channe_image(img)) == NULL)
	    printf("Filed to extract the blue channel from the image");
	  asprintf(&image_name, "%i_b", j);
	  dump_image(img_channel, "/media/Data/histology/brain_1_b", image_name, "jpeg");
	  free(image_name);
	  DestroyImage(img_channel);



	if ((img_tmp = apply_green_contrast(img, 0, 100)) == NULL)
	    printf("Filed to extract the - channel from the image");
	  asprintf(&image_name, "%i_gr", j);
	  dump_image(img_tmp, "/media/Data/histology/brain_1_gr", image_name, "jpeg");
	  free(image_name);

/*	  DestroyImage(img_channel); */

	if ((img_channel = get_green_grayscale_image(img_tmp)) == NULL)
	    printf("Filed to extract the - channel from the image");
	  asprintf(&image_name, "%i_g", j);
	  dump_image(img_channel, "/media/Data/histology/brain_1_gr", image_name, "jpeg");
	  free(image_name);
	 DestroyImage(img_tmp);

	img_tmp = img_channel;

	if ((img_channel = substract_grayscale_to_original(img, img_tmp, 20, 255)) == NULL)
	    printf("Filed to extract the - channel from the image");
	  asprintf(&image_name, "%i_final", j);
	  dump_image(img_channel, "/media/Data/histology/brain_1_gr", image_name, "jpeg");
	  free(image_name);
	  DestroyImage(img_channel);

	 DestroyImage(img_tmp);

	  DestroyImage(img);
	  free(image_path);
	  j++;
	}
      i++;
    }
  printf("\n");
  return (0);
}
int read_raw_image(const char* partition, const char* filename) {
    return dump_image(partition, filename, NULL);
}
/*     check image processing is working for currection         */
void image_correction(char *path, char *output_path){
    Image           *final_img = NULL;
    DIR             *FD;
    struct dirent   *in_file;
    char            *imagePath;
    //char            *imageName;
    char            *name;
    int             count = 1;

    if (NULL == (FD = opendir(path)))
    {
        fprintf(stderr, "Error : Failed to open input directory - %s\n", strerror(errno));
        free(FD);
        return;
    }
    
    c_threshold *t   = malloc(sizeof(*t));
    
    t->max_threshold = 10;
    
    while ((in_file = readdir(FD)))
    {
        if (!strcmp (in_file->d_name, "."))
            continue;
        if (!strcmp (in_file->d_name, ".."))
            continue;
        //APPLE Dir ISSUE
        if (!strcmp (in_file->d_name, ".DS_Store"))
            continue;
        
        asprintf(&imagePath, "%s%s", path, in_file->d_name);
        final_img = get_image_from_path(imagePath);
        
        printf("File name: %s\n", in_file->d_name);
        
        /*  put your image processing function/measure here !   */
        /*  crop image before reconstruction (IMAGE_WIDTH, IMAGE_HEIGHT, WIDTH_OFFSET, HEIGHT_OFFSET)   */
        //final_img = crop_image(final_img, imagePath, 1300, 1150, 1700, 3150); //brain_2
        //final_img = crop_image(final_img, imageName, 1727, 1575, 2450, 1850); //blockface 08.05.2013
        
        //final_img = rotate_image(final_img, 90);
        
        asprintf(&name, "%.4i%s", count, "_image");
        dump_image(final_img, output_path, name, "jpg");
        count ++;
        printf("Name Changed: %s\n", name);
        
        /*
        for (int i = 0 ; i < 6 ; i ++) {
            asprintf(&name, "%.4i%s", count, "_image");
            dump_multi_image(final_img, output_path, name, "jpg");
            count ++;
            printf("Name Changed: %s\n", name);
        }
        DestroyImage(final_img);
        */
    }
    closedir(FD);
    free(t);
    return;
}