Re: [Gegl-developer] Choosing the operation input format based the connected nodes output format



Thanks. If the behavior of ppm-load is considered buggy, then it all makes sense. I'll use the output format if it is set, or otherwise I will fallback to RGBA within prepare.

Regards,
Dov



On Thu, May 30, 2013 at 10:54 AM, Daniel Sabo <danielsabo gmail com> wrote:
My first instinct would be to say that ppm-load not setting it's output format is a bug, and that it should try to sniff the file in prepare() inorder to set the correct format. If you do format switching in gaussian-blur's process() then you'll also spoil the format detection of whatever is connected to gaussian's output.

As an alternative to that, I would be inclined to process ppm-load to a buffer then pass that buffer to a second graph.

Finally (and please don't use this option), the reason you get that error is because the parent implementation of process() in gegl/operation/gegl-operation-filter.c calls gegl_operation_context_get_target for you, it is possible to override this and still use the rest of the filter class (see operations/common/over.c).


On Wed, May 29, 2013 at 8:58 PM, Dov Grobgeld <dov grobgeld gmail com> wrote:
Hi all,

Yesterday night I started playing around with converting the gaussian-blur operation to only work on the channels that are part of the input pad. My goal was to make the operation "format transparent", in the sense that the output format should be equal to the input format. But after several failures, I realized that I was stuck.

The problem is as follows. I want to set my input format based on the output format of the previous node. I'm building the following network:

gegl:ppm-load → gegl:gaussian-blur → gegl:npy-save

and I feed the ppm-load with a "Y u8" image. Now, the problem is that if I in the gaussian-blur prepare function call: 

gegl_operation_get_source_format(operation, "input")

it returns NULL. Why is that? Am I correct to assume that the prepare calls are done before any processing has taken place? If so the ppm-load still doesn't know what format it will set in its output pad.

So instead I asked about the format in process(). But then I get the following warning:

(test-npy.py:2383): GEGL-gegl-operation-context.c-WARNING **: no format for gegl:gaussian-blur 0x95bb9b0 presuming RGBA float

I still haven't figured out exactly why this happens, but I would still like to know if anyone knows what I'm doing wrong, and whether dynamically choosing the input format based on the previous output format is even possible?

Thanks!
Dov


_______________________________________________
gegl-developer-list mailing list
gegl-developer-list gnome org
https://mail.gnome.org/mailman/listinfo/gegl-developer-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]