RSS/Atom feed Twitter
Site is read-only, email is disabled

Is ~30 seconds for 750 × 120 0 pixels slow or fast?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Is ~30 seconds for 750 × 1200 pixels slow or fast? Louise Hoffman 29 Dec 01:49
  Is ~30 seconds for 750 × 1200 pixels slow or fast? Tim Chen 29 Dec 08:19
  Is ~30 seconds for 750 × 120 0 pixels slow or fast? Sven Neumann 29 Dec 12:56
Louise Hoffman
2009-12-29 01:49:15 UTC (over 15 years ago)

Is ~30 seconds for 750 × 1200 pixels slow or fast?

Dear developers,

I am now more or less finished with my plugin which draws spectrograms from audio signals.

It takes about 30 seconds to draw 750 × 1200 pixels on my 3Ghz.

Is that slow or fast?

The code that does the drawing is this one:

gboolean s; guint8 pixel[] = { 0x00 };

double d; for (int n = 0; n < data->width; n++) { for (int m = 0; m < data->height; m++) { /* make coef_db start from zero */ d = (data->coef_db)[m+n*data->M] + data->coef_db_min; /* quantize so values are from 0 to 255 */ /* The absolut value of min is added to max */ pixel[0] = quantize(d, fabs(data->coef_db_min) + data->coef_db_max); /* set the pixel */
/* coef_db have x=0,y=0 at buttom left corner and gimp have 0,0 at top left corner */
s = gimp_drawable_set_pixel(data->layer, n, data->height - m, 1, (guint8 *)pixel );
}
}

data->display = gimp_display_new(data->image);

...

/* quantize double to 8bit int */ unsigned char quantize(double d, double max) { return (unsigned char)((d / max) * 255.0); }

Hugs,
Louise

Tim Chen
2009-12-29 08:19:59 UTC (over 15 years ago)

Is ~30 seconds for 750 × 1200 pixels slow or fast?

I think using gimp_pixel_rgn functions could improve its performance a lot

Please take a look at

http://developer.gimp.org/writing-a-plug-in/2/index.html

HiH, Tim

On Tue, Dec 29, 2009 at 8:49 AM, Louise Hoffman wrote:

Dear developers,

I am now more or less finished with my plugin which draws spectrograms from audio signals.

It takes about 30 seconds to draw 750 × 1200 pixels on my 3Ghz.

Is that slow or fast?

The code that does the drawing is this one:

gboolean s; guint8 pixel[] = { 0x00 };

double d; for (int n = 0; n < data->width; n++) { for (int m = 0; m < data->height; m++) { /* make coef_db start from zero */ d = (data->coef_db)[m+n*data->M] + data->coef_db_min; /* quantize so values are from 0 to 255 */ /* The absolut value of min is added to max */ pixel[0] = quantize(d, fabs(data->coef_db_min) + data->coef_db_max); /* set the pixel */
/* coef_db have x=0,y=0 at buttom left corner and gimp have 0,0 at top left corner */
s = gimp_drawable_set_pixel(data->layer, n, data->height - m, 1, (guint8 *)pixel );
}
}

data->display = gimp_display_new(data->image);

...

/* quantize double to 8bit int */ unsigned char quantize(double d, double max) { return (unsigned char)((d / max) * 255.0); }

Hugs,
Louise

Sven Neumann
2009-12-29 12:56:02 UTC (over 15 years ago)

Is ~30 seconds for 750 × 120 0 pixels slow or fast?

On Tue, 2009-12-29 at 01:49 +0100, Louise Hoffman wrote:

Dear developers,

I am now more or less finished with my plugin which draws spectrograms from audio signals.

It takes about 30 seconds to draw 750 × 1200 pixels on my 3Ghz.

Is that slow or fast?

It is damned slow. But this is not surprising as you are setting a single pixel at a time. Didn't you tell us that you read the plug-in tutorial at developer.gimp.org? Perhaps you want to read it again. In particular the parts where it explains how to access and change pixel data efficiently.

Sven