lcms high bit depth update: getting closer, but undo doesn't work
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.
lcms high bit depth update: getting closer, but undo doesn't work | Elle Stone | 23 Nov 23:33 |
lcms high bit depth update: getting closer, but undo doesn't work | Øyvind Kolås | 24 Nov 04:12 |
lcms high bit depth update: getting closer, but undo doesn't work | Elle Stone | 24 Nov 11:19 |
lcms high bit depth update: getting closer, but undo doesn't work | Elle Stone | 25 Nov 00:35 |
lcms high bit depth update: getting closer, but undo doesn't work | Tobias Jakobs | 28 Nov 09:11 |
lcms high bit depth update: getting closer, but undo doesn't work | Elle Stone | 28 Nov 13:04 |
lcms high bit depth update: getting closer, but undo doesn't work
Mitch very kindly cleaned up my lcms.c code to meet Gimp coding standards, took care of some memory leaks, and fixed a few problematic lines of code. I've been testing the resulting code.
The situation regarding what works and what doesn't work has changed considerably for the better. I suspect Mitch might have modified some other Gimp files to work better with the lcms.c plug-in (to not call certain babl functions in the middle of the color conversion), but that's just a guess based on the fact that the code paths as revealed by "write" statements seem to have changed a bit.
The good news is that high bit depth color conversion works for indexed, 8-bit integer, 16-bit integer, and 32-bit floating point *if* some changes are made to either babl/babl/base/util.h or to babl/babl/base/model-rgb.c. With the modified babl file, the color conversions work for single layer, multiple layers, with and without masks, and with and without alpha channels.
The other good news is that even without modifying any babl files, 8-bit integer and 16-bit integer color conversions both work (8-bit worked before, but 16-bit didn't).
Unfortunately, indexed image and 32-bit floating point color conversions don't work unless one or the other babl file is modified.
Also "undo" after a color conversion doesn't work, except for indexed images*if* the babl file is modified. For the other image formats, modifying or not modifying the babl file makes no difference, "undo" doesn't work. What happens instead is the source profile is embedded, but the color conversion isn't actually undone.
I posted a summary, along with a terminal output comparison of the
code paths comparing 8-bit integer with 8-bit indexed, and 16-bit
integer with floating point. 8-bit integer and 16-bit integer follow
the same path now - they didn't before (probably not a reflection of
the actual lcms.c code itself):
http://ninedegreesbelow.com/temp/gimp-lcms-8.html
I think the next logical step is getting "undo" to work. I'm not familiar with Gimp's overall "undo" code path, so any guidance, suggestions, input is more than welcome, whether by email or IRC or etc.
Kindest regards,
Elle Stone http://ninedegreesbelow.com - articles on open source digital photography
lcms high bit depth update: getting closer, but undo doesn't work
On Sat, Nov 24, 2012 at 10:33 AM, Elle Stone wrote:
some changes are made to either babl/babl/base/util.h or to babl/babl/base/model-rgb.c. With the modified babl file, the color conversions work for single layer, multiple layers, with and without masks, and with and without alpha channels.
As said earlier such changes in babl are non-sensical, and applying such hacks in babl will only mask issues elsewhere ;). The issues being masked will be issues where GIMP is using the _wrong_ Babl formats (linear vs sRGB gamma) for buffers.
/yvind K.
The future is already here. It's just not very evenly distributed -- William Gibson http://pippin.gimp.org/ http://ffii.org/
lcms high bit depth update: getting closer, but undo doesn't work
I'm not suggesting a hack. I'm using modified vs unmodified babl files as a diagnostic tool.
If something works when the babl file *is* modified to eliminate the back and forth conversions, and doesn't work when the babl file *isn't* modified, that suggests that some bit of Gimp code - code that is not inside the lcms.c plugin itself - is calling those babl files *during* the ICC color space conversion process.
I wanted to know which babl functions are being invoked in "case A - the babl files are *not* interfering with the ICC profile color conversion process (8-bit and 16-bit integer)" compared to "case B - the babl files *are* interfering with the ICC profile color conversion process (indexed and 32-bit floating point)".
So I added write statements to the babl "model-rgb.c" functions and to the "lcms.c" plug-in functions, to locate where indexed and 32-bit floating point color conversions (which *don't* work unless the babl file is modified) and 8-bit/16-bit integer color conversions (which work *without* modifying the babl file) diverge in the model-rgb.c babl functions that are called during the color conversion process.
Hopefully the resulting terminal output will be useful in tracking down which Gimp functions (not lcms.c functions) are calling which babl functions during the ICC profile conversion process.
On 11/23/12, yvind Kols wrote:
On Sat, Nov 24, 2012 at 10:33 AM, Elle Stone wrote:
some changes are made to either babl/babl/base/util.h or to babl/babl/base/model-rgb.c. With the modified babl file, the color conversions work for single layer, multiple layers, with and without masks, and with and without alpha channels.
As said earlier such changes in babl are non-sensical, and applying such hacks in babl will only mask issues elsewhere ;). The issues being masked will be issues where GIMP is using the _wrong_ Babl formats (linear vs sRGB gamma) for buffers.
/yvind K. --
The future is already here. It's just not very evenly distributed -- William Gibson http://pippin.gimp.org/ http://ffii.org/
Elle Stone http://ninedegreesbelow.com - articles on open source digital photography
lcms high bit depth update: getting closer, but undo doesn't work
On 11/24/12, Elle Stone wrote:
If something works when the babl file *is* modified to eliminate the back and forth conversions, and doesn't work when the babl file *isn't* modified, that suggests that some bit of Gimp code - code that is not inside the lcms.c plugin itself - is calling those babl files *during* the ICC color space conversion process.
Turns out it wasn't the babl files after all, and it wasn't any Gimp code, either. I didn't write the gegl iterators correctly (thank you Mike Henning for writing the patch and showing how the iterators should be written!).
lcms high bit depth update: getting closer, but undo doesn't work
On 11/24/12, Elle Stone wrote:
Turns out it wasn't the babl files after all, and it wasn't any Gimp code, either. I didn't write the gegl iterators correctly (thank you Mike Henning for writing the patch and showing how the iterators should be written!).
Hello Ellen,
with all this changes and the recent work in git it looks very promising. Thank you and every one from the Gimp Team who help for this work. Could you perhaps give us short status update about what is now working and what is still missing?
Kindest regards, Tobias
lcms high bit depth update: getting closer, but undo doesn't work
On Wed, Nov 28, 2012 at 4:11 AM, Tobias Jakobs wrote:
with all this changes and the recent work in git it looks very promising.
Thank you and every one from the Gimp Team who help for this work. Could you perhaps give us short status update about what is now working and what is still missing?
The modified lcms.c plug-in code is now in master. The lcms.c plug-in uses LCMS2 (as does the rest of Gimp from git, thanks to Mitch and Laurent Martelli), and can do ICC profile conversions on the following image file types:
*8-bit and 16-bit integer RGB images
*indexed RGB images
*32-bit floating point RGB images
*single and multiple layer images
*with and without masks
*with and without alpha channels
It *can't* (yet) do profile conversions on 32-bit integer/16-bit floating point images or non-RGB images.
The code is fully "geglified" (is that the right word?): It doesn't use any deprecated functions (and doesn't need any modified babl files). And "Undo" works.
Everything that worked in the old plug-in, still works, with the following caveats:
*The information presented in the Image Properties/Color Profile box needs to be rewritten to make better use of V4 Profile tags. This is at the top of my "to-do" list.
*During an ICC profile conversion, the progress bar updates only once per layer instead of continuously. I don't know how to fix this.
*When doing an ICC profile conversion on an indexed image, you have to "touch" the image after the conversion (and also after "undo") to get the image on the screen to update. The easiest thing to do is click and unclick a visibility button. I don't know how to fix this.
*Thumbnails assume the image is in the sRGB color space - is this an lcms plug-in issue?
To summarize, high bit ICC profile conversion works on all supported image types: 8-bit and 16-bit integer, indexed, and 32-bit floating point RGB images. You'll get an error message if you try to do a profile conversion on any other image type.
Everyone on the Gimp developer's list has been incredibly patient and supportive during my struggles to get the lcms.c plug-in to do high bit depth color conversions - every time I couldn't figure out what to do next, someone else stepped in, wrote code, pointed the way - thank you!
Kindest regards, Elle