After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789642 - operations/common/saturation: Support consuming data from operations not setting an output format in "prepare"
operations/common/saturation: Support consuming data from operations not sett...
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: operations
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2017-10-30 08:21 UTC by Debarshi Ray
Modified: 2017-10-30 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
operations/common/gblur-1d: Fix the input and output Babl formats (2.30 KB, patch)
2017-10-30 08:22 UTC, Debarshi Ray
none Details | Review
operations/common/saturation: Always set input & output formats (1.38 KB, patch)
2017-10-30 11:00 UTC, Debarshi Ray
committed Details | Review
operations/common/gblur-1d: Explicitly set the input format (1002 bytes, patch)
2017-10-30 11:00 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-10-30 08:21:44 UTC
It is ready to accept any input format (eg., CIE Lab, sRGB, etc.) and claims to be able to output linear RGB with premultiplied alpha. That's wrong.
Comment 1 Debarshi Ray 2017-10-30 08:22:32 UTC
Created attachment 362521 [details] [review]
operations/common/gblur-1d: Fix the input and output Babl formats
Comment 2 Massimo 2017-10-30 09:20:47 UTC
(In reply to Debarshi Ray from comment #0)
> It is ready to accept any input format (eg., CIE Lab, sRGB, etc.) and claims
> to be able to output linear RGB with premultiplied alpha. That's wrong.

I don't understand what's wrong. Do you have a failing test case?

The input format is not used, the input buffer is converted to the
output format when it is read.

OTOH with the attached patch gegl crashes when the input operation
does not set the output format, for instance:

> $ gegl -x '<gegl><gegl:crop width="128" height="128"/><gegl:color/></gegl>' -o tmp.gegl
> $ gegl -x '<gegl><gegl:gblur-1d/><gegl:load path="tmp.gegl"/></gegl>' -o tmp.ppm
Comment 3 Debarshi Ray 2017-10-30 10:57:50 UTC
(In reply to Massimo from comment #2)
> (In reply to Debarshi Ray from comment #0)
> > It is ready to accept any input format (eg., CIE Lab, sRGB, etc.) and claims
> > to be able to output linear RGB with premultiplied alpha. That's wrong.
> 
> I don't understand what's wrong. Do you have a failing test case?

No. I was reading the code to understand what Babl conversions are being used by gegl:shadows-highlights so that I could speed things up. The lack of an input format surprised me. I missed the fact that the input format is being implicitly enforced while reading the source buffer.

Sorry about that.

> The input format is not used, the input buffer is converted to the
> output format when it is read.

Could we still explicitly specify the input format in prepare, even though it's not necessary? It might make the code marginally easier to read.

> OTOH with the attached patch gegl crashes when the input operation
> does not set the output format, for instance:
> 
> > $ gegl -x '<gegl><gegl:crop width="128" height="128"/><gegl:color/></gegl>' -o tmp.gegl
> > $ gegl -x '<gegl><gegl:gblur-1d/><gegl:load path="tmp.gegl"/></gegl>' -o tmp.ppm

Interesting. I didn't realize that many of the sources never specify their output formats during "prepare". This means that at least gegl:saturation needs to be fixed. Maybe we should update the test suite to cover this scenario?
Comment 4 Debarshi Ray 2017-10-30 11:00:21 UTC
Created attachment 362536 [details] [review]
operations/common/saturation: Always set input & output formats
Comment 5 Debarshi Ray 2017-10-30 11:00:39 UTC
Created attachment 362537 [details] [review]
operations/common/gblur-1d: Explicitly set the input format
Comment 6 Massimo 2017-10-30 11:43:08 UTC
(In reply to Debarshi Ray from comment #3)
> (In reply to Massimo from comment #2)
...
> 
> > The input format is not used, the input buffer is converted to the
> > output format when it is read.
> 
> Could we still explicitly specify the input format in prepare, even though
> it's not necessary? It might make the code marginally easier to read.
> 

I find it confusing when it is not used (directly or in the base), but 
I learned to ignore it in these cases. So for me yes.

> > OTOH with the attached patch gegl crashes when the input operation
> > does not set the output format, for instance:
> > 
> > > $ gegl -x '<gegl><gegl:crop width="128" height="128"/><gegl:color/></gegl>' -o tmp.gegl
> > > $ gegl -x '<gegl><gegl:gblur-1d/><gegl:load path="tmp.gegl"/></gegl>' -o tmp.ppm
> 
> Interesting. I didn't realize that many of the sources never specify their
> output formats during "prepare". This means that at least gegl:saturation
> needs to be fixed. Maybe we should update the test suite to cover this
> scenario?

Test suite or not, operations are better be coded to deal with the case
where the output format is not set.
Comment 7 Debarshi Ray 2017-10-30 12:19:51 UTC
Ok, thanks Massimo. I pushed the patches to master. Sorry for the confusion.