コード例 #1
0
void common_wrapper(UArg arg0, UArg arg1)
{
	taskArgs* t = (taskArgs*)arg0 ;
	int tid = (int)arg1 ;
	int i, j, k ;
	
	for(i=0 ; i<NUM_ITER ; i++) {
		if(tid == 0) {
			callBarrier(0, /*lock_id=*/4) ;
		}

		callLocalBarrier() ;
		compute_histo(t->buffer1, t->buffer2, t->start_indx, t->end_indx) ;
		Cache_wbInv (t->buffer2, HISTO_SIZE*4, Cache_Type_ALL, FALSE) ;
		callLocalBarrier() ;
		if(tid == 0) {
			callBarrier(1, /*lock_id=*/4) ;
			compute_gray_level_mapping() ;
		}
		callLocalBarrier() ;
		compute_image(t->buffer1, m3_gray_level_mapping, t->start_indx, t->end_indx) ;

		if(tid == 0)
			Cache_wbInv (t->buffer1, IMG_SIZE*IMG_SIZE*4, Cache_Type_ALL, FALSE);
	}

	if(tid == 0)
		Event_post(edgeDetectEvent, Event_Id_00) ;
	else
		Event_post(edgeDetectEvent, Event_Id_01) ;
}
コード例 #2
0
TEST(Image, Diagonal)
{
  AbelianGroup X(0, 2);
  X(0) = 2;
  X(1) = 2;

  AbelianGroup Y(0, 2);
  Y(0) = 2;
  Y(1) = 2;

  MatrixQ f = {{0, 6}, {0, 0}};

  // MatrixQList from_X = {MatrixQ::identity(f.width())};
  // GroupWithMorphisms K = compute_kernel(3, f, X, Y, MatrixQRefList(), ref(from_X));
  // EXPECT_EQ(0, K.group.free_rank());
  // EXPECT_EQ(2, K.group.tor_rank());
  // EXPECT_EQ(1 + 2, K.group(0) + K.group(1));
  // EXPECT_EQ(1 * 2, K.group(0) * K.group(1));
  // MatrixQ expected = {{1, 0}, {0, 3}};
  // EXPECT_EQ(expected, K.maps_from[0]);

  GroupWithMorphisms I = compute_image(3, f, X, Y);

  EXPECT_EQ(0, I.group.free_rank());
  ASSERT_EQ(1, I.group.tor_rank());
  EXPECT_EQ(1, I.group(0));
}
コード例 #3
0
ファイル: main.cpp プロジェクト: Chinmay-at-git/M1UPS
/**
 * \callgraph
 */
int main () {

        //make_platon_scene (LARGEUR, HAUTEUR);
        make_default_scene(LARGEUR, HAUTEUR);

	compute_image();
	
	save_image ("monimage.exr");

	return 0;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: Chinmay-at-git/M1UPS
/**
 * \callgraph
 */
int main () {

  // At the end of practical work, the following will give you the default scene
  // make_default_scene(800, 600);
  // At the end of the homework, the following will give you the validation scene
  make_test_scene(800, 800);
	
	compute_image();
	std::cerr << "Sauvegarde image ... " << std::endl;
  save_image ("monimage.exr");

	return 0;
}
コード例 #5
0
ファイル: image_generator.cpp プロジェクト: biddisco/hpxcl
hpx::lcos::future<boost::shared_ptr<std::vector<char>>>
image_generator::
compute_image(double posx,
              double posy,
              double zoom,
              double rotation,
              size_t img_width,
              size_t img_height)
{

    return compute_image(posx, posy, zoom, rotation,
                         img_width, img_height,
                         false, img_width, 1);

}
コード例 #6
0
ファイル: van-gogh-lic.c プロジェクト: AdamGrzonkowski/gimp-1
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpDrawable      *drawable;
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  /* Set default values */
  /* ================== */

  set_default_settings ();

  /* Possibly retrieve data */
  /* ====================== */

  gimp_get_data (PLUG_IN_PROC, &licvals);

  /* Get the specified drawable */
  /* ========================== */

  drawable = gimp_drawable_get (param[2].data.d_drawable);

  if (status == GIMP_PDB_SUCCESS)
    {
      /* Make sure that the drawable is RGBA or RGB color */
      /* ================================================ */

      if (gimp_drawable_is_rgb (drawable->drawable_id))
        {
          /* Set the tile cache size */
          /* ======================= */

          gimp_tile_cache_ntiles (2*(drawable->width / gimp_tile_width () + 1));

          switch (run_mode)
            {
              case GIMP_RUN_INTERACTIVE:
                if (create_main_dialog ())
                  compute_image (drawable);

                gimp_set_data (PLUG_IN_PROC, &licvals, sizeof (LicValues));
              break;
              case GIMP_RUN_WITH_LAST_VALS:
                compute_image (drawable);
                break;
              default:
                break;
            }
        }
      else
        status = GIMP_PDB_EXECUTION_ERROR;
    }

  values[0].data.d_status = status;
  gimp_drawable_detach (drawable);
}
コード例 #7
0
ファイル: map-object-main.c プロジェクト: AjayRamanathan/gimp
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpDrawable      *drawable;
  GimpRunMode    run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  gint               i;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  values[0].type = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  *nreturn_vals = 1;
  *return_vals = values;

  /* Set default values */
  /* ================== */

  set_default_settings ();

  /* Get the specified drawable */
  /* ========================== */

  image_id = param[1].data.d_int32;
  drawable = gimp_drawable_get (param[2].data.d_drawable);

  switch (run_mode)
    {
      case GIMP_RUN_INTERACTIVE:

        /* Possibly retrieve data */
        /* ====================== */

        gimp_get_data (PLUG_IN_PROC, &mapvals);
        check_drawables (drawable);
        if (main_dialog (drawable))
          {
            compute_image ();

            gimp_set_data (PLUG_IN_PROC, &mapvals, sizeof (MapObjectValues));
          }
        break;

      case GIMP_RUN_WITH_LAST_VALS:
        gimp_get_data (PLUG_IN_PROC, &mapvals);
        check_drawables (drawable);
        image_setup (drawable, FALSE);
        compute_image ();
        break;

      case GIMP_RUN_NONINTERACTIVE:
        if (nparams != 49)
          {
            status = GIMP_PDB_CALLING_ERROR;
          }
        else
          {
            mapvals.maptype                 = (MapType) param[3].data.d_int32;
            mapvals.viewpoint.x             = param[4].data.d_float;
            mapvals.viewpoint.y             = param[5].data.d_float;
            mapvals.viewpoint.z             = param[6].data.d_float;
            mapvals.position.x              = param[7].data.d_float;
            mapvals.position.y              = param[8].data.d_float;
            mapvals.position.z              = param[9].data.d_float;
            mapvals.firstaxis.x             = param[10].data.d_float;
            mapvals.firstaxis.y             = param[11].data.d_float;
            mapvals.firstaxis.z             = param[12].data.d_float;
            mapvals.secondaxis.x            = param[13].data.d_float;
            mapvals.secondaxis.y            = param[14].data.d_float;
            mapvals.secondaxis.z            = param[15].data.d_float;
            mapvals.alpha                   = param[16].data.d_float;
            mapvals.beta                    = param[17].data.d_float;
            mapvals.gamma                   = param[18].data.d_float;
            mapvals.lightsource.type        = (LightType) param[19].data.d_int32;
            mapvals.lightsource.color       = param[20].data.d_color;
            mapvals.lightsource.position.x  = param[21].data.d_float;
            mapvals.lightsource.position.y  = param[22].data.d_float;
            mapvals.lightsource.position.z  = param[23].data.d_float;
            mapvals.lightsource.direction.x = param[24].data.d_float;
            mapvals.lightsource.direction.y = param[25].data.d_float;
            mapvals.lightsource.direction.z = param[26].data.d_float;
            mapvals.material.ambient_int    = param[27].data.d_float;
            mapvals.material.diffuse_int    = param[28].data.d_float;
            mapvals.material.diffuse_ref    = param[29].data.d_float;
            mapvals.material.specular_ref   = param[30].data.d_float;
            mapvals.material.highlight      = param[31].data.d_float;
            mapvals.antialiasing            = (gint) param[32].data.d_int32;
            mapvals.tiled                   = (gint) param[33].data.d_int32;
            mapvals.create_new_image        = (gint) param[34].data.d_int32;
            mapvals.transparent_background  = (gint) param[35].data.d_int32;
            mapvals.radius                  = param[36].data.d_float;
            mapvals.cylinder_radius         = param[36].data.d_float;
            mapvals.scale.x                 = param[37].data.d_float;
            mapvals.scale.y                 = param[38].data.d_float;
            mapvals.scale.z                 = param[39].data.d_float;
            mapvals.cylinder_length         = param[40].data.d_float;

            for (i = 0; i < 6; i++)
              mapvals.boxmap_id[i] = param[41+i].data.d_drawable;

            for (i = 0; i < 2; i++)
              mapvals.cylindermap_id[i] = param[47+i].data.d_drawable;

            check_drawables (drawable);
            image_setup (drawable, FALSE);
            compute_image ();
          }
        break;
    }

  values[0].data.d_status = status;

  if (run_mode != GIMP_RUN_NONINTERACTIVE)
    gimp_displays_flush ();

  gimp_drawable_detach (drawable);
}
コード例 #8
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpDrawable      *drawable;
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  *nreturn_vals = 1;
  *return_vals = values;

  values[0].type = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  /* Set default values */
  /* ================== */

  set_default_settings ();

  /* Possibly retrieve data */
  /* ====================== */

  gimp_get_data (PLUG_IN_PROC, &mapvals);

  /* Get the specified drawable */
  /* ========================== */

  drawable = gimp_drawable_get (param[2].data.d_drawable);

  mapvals.drawable_id = drawable->drawable_id;

  check_drawables ();

  if (status == GIMP_PDB_SUCCESS)
    {
      /* Make sure that the drawable is RGBA or RGB color */
      /* ================================================ */

      if (gimp_drawable_is_rgb (drawable->drawable_id))
        {
          /* Set the tile cache size */
          /* ======================= */

          gimp_tile_cache_ntiles (TILE_CACHE_SIZE);

          switch (run_mode)
            {
              case GIMP_RUN_INTERACTIVE:
                if (main_dialog (drawable))
                  {
                    compute_image ();

                    gimp_set_data (PLUG_IN_PROC,
                                   &mapvals, sizeof (LightingValues));
                    gimp_displays_flush ();
                  }
              break;

              case GIMP_RUN_WITH_LAST_VALS:
                if (image_setup (drawable, FALSE))
                  compute_image ();
                gimp_displays_flush ();
                break;

              case GIMP_RUN_NONINTERACTIVE:
                if (nparams != 24)
                  {
                    status = GIMP_PDB_CALLING_ERROR;
                  }
                else
                  {
                    mapvals.bumpmap_id                 = param[3].data.d_drawable;
                    mapvals.envmap_id                  = param[4].data.d_drawable;
                    mapvals.bump_mapped                = (gint) param[5].data.d_int32;
                    mapvals.env_mapped                 = (gint) param[6].data.d_int32;
                    mapvals.bumpmaptype                = (gint) param[7].data.d_int32;
                    mapvals.lightsource[0].type        = (LightType) param[8].data.d_int32;
                    mapvals.lightsource[0].color       = param[9].data.d_color;
                    mapvals.lightsource[0].position.x  = param[10].data.d_float;
                    mapvals.lightsource[0].position.y  = param[11].data.d_float;
                    mapvals.lightsource[0].position.z  = param[12].data.d_float;
                    mapvals.lightsource[0].direction.x = param[13].data.d_float;
                    mapvals.lightsource[0].direction.y = param[14].data.d_float;
                    mapvals.lightsource[0].direction.z = param[15].data.d_float;
                    mapvals.material.ambient_int       = param[16].data.d_float;
                    mapvals.material.diffuse_int       = param[17].data.d_float;
                    mapvals.material.diffuse_ref       = param[18].data.d_float;
                    mapvals.material.specular_ref      = param[19].data.d_float;
                    mapvals.material.highlight         = param[20].data.d_float;
                    mapvals.antialiasing               = (gint) param[21].data.d_int32;
                    mapvals.create_new_image           = (gint) param[22].data.d_int32;
                    mapvals.transparent_background     = (gint) param[23].data.d_int32;

                    check_drawables ();
                    if (image_setup (drawable, FALSE))
                      compute_image ();
                  }
              default:
                break;
            }
        }
      else
        status = GIMP_PDB_EXECUTION_ERROR;
    }

  values[0].data.d_status = status;
  gimp_drawable_detach (drawable);

  g_free (xpostab);
  g_free (ypostab);
}