"Fossies" - the Fresh Open Source Software Archive

Member "darktable-3.6.1/doc/thumbnail_color_management.txt" (10 Sep 2021, 4085 Bytes) of package /linux/misc/darktable-3.6.1.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 to ease debugging the code will use DT_COLORSPACE_DISPLAY for images loaded without a color space mentioned in Exif or when explicitly exporting
    2 for the Display profile, while buffers get initialized as DT_COLORSPACE_NONE. if ever such a thumbnail gets encountered there is a bug
    3 (i.e., a code path where a thumbnail gets loaded without the color space being set).
    4 
    5 
    6 DRAWING/EXPOSE
    7 
    8 - thumbnails are tagged as sRGB, AdobeRGB, Display or None
    9   None means that we got a code path which doesn't set the color space -> BUG
   10 - check config if thumbnails should be color managed
   11     - no: just dump whatever we have on the screen
   12     - yes:
   13         * transform sRGB and AdobeRGB using lcms2 to current display profile, use the others as-is
   14         * put the resulting pixels on the screen
   15 
   16 
   17 WRITING CACHE TO DISK
   18 
   19 - thumbnails are tagged as sRGB, AdobeRGB, Display or None
   20 - mark sRGB and AdobeRGB in Exif
   21 - write JPEG
   22 
   23 
   24 REQUESTING MIPMAP
   25 
   26 - reading thumbnail from disk cache
   27     - read JPEG
   28     - check if file is tagged as sRGB or AdobeRGB in Exif
   29         * yes: tag thumbnail accordingly
   30         * no: tag thumbnail as Display since that's what we had before as processed thumbnails
   31 - loading embedded thumbnail (in general it's a JPEG but might be TIFF or such like)
   32     - read data
   33     - tag thumbnail as sRGB (TODO: verify if that's always true, might be AdobeRGB when the camera was set accordingly?)
   34 - loading full ldr image
   35     - try to get the color space from the file. this only returns correct results for sRGB or AdobeRGB files at the moment
   36 - processing image
   37     - image goes through pipe
   38     - set output profile in colorout's commit_params to AdobeRGB when thumbnail color management is on, use Display otherwise
   39     - tag resulting thumbnail accordingly
   40 
   41 
   42 
   43 CONCLUSION
   44 
   45 when thumbnail color management is on:
   46 - we export new thumbnails as AdobeRGB
   47 - when reading cached thumbnails they are either new and tagged or old and were exported using the Display profile. they get tagged accordingly
   48 - when displaying thumbnails the tagged ones (sRGB / AdobeRGB) are correctly transformed to the Display profile,
   49   old thumbnails were exported using the Display profile and are thus also shown correctly (provided the display profile is still correct)
   50 - when writing thumbnails back they are either tagged and we keep that information, or they are untagged and we keep that, too
   51 
   52 when thumbnail color management is off:
   53 - we export new thumbnails for the Display profile
   54 - when reading cached thumbnails they might be tagged or not. we remember that information
   55 - when displaying thumbnails we just dump the pixels to the screen. that will result in wrong colors in case of thumbnails tagged as sRGB or
   56   AdobeRGB. this can happen when the user once had thumbnail color management on, generated some thumbnails and then turned it off again
   57 - when writing thumbnails back they are either tagged and we keep that information, or they are untagged and we keep that, too
   58 
   59 there are two cases where colors would be wrong:
   60 - old thumbnails or those created with thumbnail color management turned off are not tagged, so they get displayed wrongly when the display profile
   61   changed. there isn't much we can do about that, old thumbnails will always have unknown color space, and dealing with display icc profiles is
   62   probably too expensive for new ones
   63 - thumbnails created with thumbnail color management turned on and then used with it being turned off are not in Display color space but sRGB (when
   64   read from embedded thumbnails) or AdobeRGB (when created by our pipe). Just dumping these on the screen will give wrong colors. one possible way
   65   around that would be ditching tagged thumbnails when reading from disk while thumbnail color management is off (i.e., pretending they were not in
   66   the cache when reading them)
   67 
   68 
   69 TODO
   70 what to do when loading a jpeg or other file to create a thumbnail and it's neither sRGB nor AdobeRGB but some random other format? Convert to
   71 AdobeRGB? dump pixels to screen and wait for the full pipe to run eventually to get color managed thumbnails?