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

babl: format comparison

This discussion is connected to the gegl-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.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

babl: format comparison Daniel Hiepler 21 May 12:03
  babl: format comparison " 21 May 22:37
babl: format comparison Daniel Hiepler 22 May 10:26
  babl: format comparison " 22 May 11:36
Daniel Hiepler
2011-05-21 12:03:14 UTC (almost 14 years ago)

babl: format comparison

Hi,

what would be the best-practice to check if two BablFormats are the same? I would need something like:

Babl *format1 = babl_format("R'G'B' u8"); Babl *format2 = babl_format("CIE Lab float");

if(is_same_format(format1, format2)) { ... } else { ... }

Also I would need to get the current source- and destination-format of a fish.

Is that possible?

thanks in advance

"
2011-05-21 22:37:41 UTC (almost 14 years ago)

babl: format comparison

On Sat, May 21, 2011 at 12:03 PM, Daniel Hiepler wrote:

Hi,

what would be the best-practice to check if two BablFormats are the same? I would need something like:

Babl *format1 = babl_format("R'G'B' u8"); Babl *format2 = babl_format("CIE Lab float");

if(is_same_format(format1, format2))

if (format1 == format2)
{ ... } else { ... }

But do note that internally babl will provide you with a memcpy instead of a conversion if the passed in formats are the same; thus this should only be neccesary if direct access with no copies whatsoever is an option where used.

{ ... } else { ... }

Also I would need to get the current source- and destination-format of a fish.

Is that possible?

BablFishes never change their source nor destination formats, and at the moment the source and destination formats of fishes are not exposed bu the publicly installed headers for babl.

/Øyvind K.

«The future is already here. It's just not very evenly distributed»
                                                 -- William Gibson
http://pippin.gimp.org/                            http://ffii.org/
_______________________________________________
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
Daniel Hiepler
2011-05-22 10:26:59 UTC (almost 14 years ago)

babl: format comparison

Vom: Sat, 21 May 2011 22:37:41 +0000

Hi,

what would be the best-practice to check if two BablFormats are the same? I would need something like:

Babl *format1 = babl_format("R'G'B' u8"); Babl *format2 = babl_format("CIE Lab float");

if(is_same_format(format1, format2))

if (format1 == format2)
{ ... } else { ... }

But do note that internally babl will provide you with a memcpy instead of a conversion if the passed in formats are the same; thus

yep, i've seen that.

this should only be neccesary if direct access with no copies whatsoever is an option where used.

I don't quite understand. Without (my own) copies of the babl object?

Maybe types would be a better example. If I understand you right I can do this:

Babl *format = babl_format("R'G'B' u8");

...

if(babl_format_get_type(format) == babl_type("u8")) {
/* u8 type */
}
else
{
/* no u8 type */
}

BablFishes never change their source nor destination formats, and at the moment the source and destination formats of fishes are not exposed bu the publicly installed headers for babl.

Then it looks like I have to remember the formats of all created fish myself :(

best regards

"
2011-05-22 11:36:12 UTC (almost 14 years ago)

babl: format comparison

On Sun, May 22, 2011 at 10:26 AM, Daniel Hiepler wrote:

Vom: Sat, 21 May 2011 22:37:41 +0000 if(babl_format_get_type(format) == babl_type("u8")) {
       /* u8 type */
}
else
{
       /* no u8 type */
}

Yes, all Babl objects are effectively singletons - and the same internal object will be returned for all subsequent calls that refer to one.

BablFishes never change their source nor destination formats, and at the moment the source and destination formats of fishes are not exposed bu the publicly installed headers for babl.

Then it looks like I have to remember the formats of all created fish myself :(

This depends on what you are trying to do, if all you are trying to do is to avoid creating multiple fishes referring to the same two formats than babl already does this for you internally. Just like pixel formats and types, you should be getting the same fish, with significantly less computation needed. On subsequent requests.

/Øyvind K.

«The future is already here. It's just not very evenly distributed»
                                                 -- William Gibson
http://pippin.gimp.org/                            http://ffii.org/
_______________________________________________
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer