View Issue Details

IDProjectCategoryView StatusLast Update
0000238Cinelerra-GG[All Projects] Featurepublic2023-06-06 17:29
ReporterOlaf Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000238: Compositor: ICC profile support
DescriptionSupport of ICC (display) profiles for the Compositor/Viewer. Cinelerra-GG recently started advertising with "8K Support" and "10-bit Color Space". Such promises have to be kept.

Compositor/Viewer are stuck without profiles in the color space sRGB of X11, which can amount to that: What you see is not what you get. Color grading becomes a shot in the dark, false colors after export (colorspace BT.709, BT.2020) can be the result. A color correction can only work correctly in a controlled color space. The BT.2020 color space is of no use to you because you are forced to set the monitor down to sRGB to see what you are doing. Exporting to a larger color space then makes the colors visible that were not visible during editing.

The media player mpv can integrate such profiles, maybe it serves as a source.
TagsColor Space, Compositor, ICC profile

Activities

Andrew-R

Andrew-R

2023-06-06 17:29

reporter   ~0005495

update: I found external compiz 0.8.x plugin doing ICC transform.

https://github.com/compiz-reloaded/compicc
https://sourceforge.net/p/compicc/wiki/Home/

"The Compiz ICC colour server, or short compicc, lets you colour manage your whole desktop at once and in hardware. Play movies, watch images on wide or narrow gamut displays. Each connected monitor is colour corrected for its own.

CompICC is written to help the many colour management unaware applications. It takes them off any decision, what to do around monitor profiles. To do so CompICC does its work unquestioned. The result is a more consistent desktop.

CompICC follows the opt out colour correction paradigm. Colour management unaware applications can continue to assume they are drawing in sRGB. They do not need any ICC profile nor any new library to do so. sRGB is the standard colour space for the internet. There are some applications, which want to do own colour corrections for displaying large gamut photos, proofing or monitor calibration. Those need to tell CompICC not to colour correct certain regions of their windows. This means slightly more work for aware applications to do advanced colour management other than sRGB."

idea is to keep Compositor fullscreen, and teach this plugin about selectable input colorspace, so it will do both ICC profile transform and display colorspace transform from linear/user defined at timeline.
Andrew-R

Andrew-R

2022-05-06 07:58

reporter   ~0005299

ffmpeg git (on road to 5.1) has some work on ICC profile support in filters

https://git.ffmpeg.org/gitweb/ffmpeg.git?a=search&h=HEAD&st=commit&s=icc
Andrew-R

Andrew-R

2021-11-16 16:59

reporter   ~0005189

there is code from mlayer2, but I sadly have no skills for transplanting it..

https://github.com/astiob/mplayer2/blob/all/libvo/vo_gl3.c
Andrew-R

Andrew-R

2021-11-16 16:38

reporter   ~0005188

well, sadly implementing this a bit more than I can take.
I heard GSOC now is not limited to students - but for practicating as project we need programmer who understand Cin well enough, and those ppl a bit rare..
Andrea_Paz

Andrea_Paz

2021-11-16 12:30

manager   ~0005187

Looking at Olive 0.2 for 10-bit support, I saw their embedded OpenColorIO. They integrated Blender's ocio.conf file (with associated LUTs) to get that support. It can be found in:

/home/$USER/.cache/olivevideoeditor.org/Olive/ocioconf/ocio.conf

Do you think it is possible to use it in CinGG as well?

https://opencolorio.readthedocs.io/en/latest/quick_start/for_devs.html
Olaf

Olaf

2019-10-01 10:25

reporter   ~0002200

OpenColorIO makes sense, is currently also built into Olive. But it doesn't use anything as long as nobody can integrate it.
Andrew-R

Andrew-R

2019-09-27 06:38

reporter   ~0002185

Probably not very related to Compositor, but there are some patches for ffmpeg adding ICC profile reading/writing (against ffmpeg 4.3-dev):

http://ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250398.html
[FFmpeg-devel] [PATCH 0/5] adding ICC profile support to MOV decode/encode

Also potentially interesting patchset about dv encode/decode:
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-September/249794.html
[FFmpeg-devel] [PATCH] avcodec/dvdec: correctly decode bottom mb row in 1080i field mode

and next few patches ( [PATCH] avcodec/dvenc: support encoding dvcprohd , [PATCH] avcodec/dvdec: correctly set interlaced and tff)
Andrew-R

Andrew-R

2019-06-05 19:53

reporter   ~0001663

yeah, OpenColorIO seems to be more complete (capable?) solution. In c++. With GPU path (hopefully GLSL, and not just Cg from NVIDIA proprietary past) , too.
http://opencolorio.org/developers/usage_examples.html

But probably complete support will require also saving this 'color profile' info into image formats, and reading it back? Still, display seems to be first logical (most visibly) step.
PhyllisSmith

PhyllisSmith

2019-06-05 15:11

manager   ~0001660

I will close 64 since this refers to it and since I can still look at it for future information when/if we ever get to this ticket. Other than bugs and looking into CUDA, issue 0000002 of MASKING and all of its side issues is the oldest so takes the highest precedence.
Andrea_Paz

Andrea_Paz

2019-06-05 14:14

manager   ~0001659

A subject I'm very interested in.
On the color management there is also an old ticket (0000064); maybe you can close it and leave only this.
Andrew-R

Andrew-R

2019-06-05 11:09

reporter   ~0001657

and discussion on CPU-only threaded use:

https://sourceforge.net/p/lcms/mailman/message/30848823/
(relative to lcms2-2.4)
--------copy------
 Hughes wrote:
> Hi all,
>
> I'm trying to make my transform go fast. I've got a 1920x1080 RGB
> image being transformed from sRGB to the display profile. I've got a
> quad core processor on my development box, no shaders or GPU, and I'm
> trying to do the transform as quickly as possible.

Re: [Lcms-user] Threading performance in LCMS2
From: Sebastien Leon <sleon@po...> - 2013-05-30 20:32:04
  
  Hi Richard,

[....]

- littleCMS legacy code : 92.12 CPU Cycle per pixel transformed
- littleCMS hacked : 27.75 CPU Cycle per pixel transformed
--------copy end-----

so, for 2Mpx image (~fullHD) it will be ... 93 * 1920 * 1080 = 194,273,280 cycles. *30 fps = 5,828,198,400 = 6Ghz core ... Note at the same thread it was said "Note that I also rewrote the critic loop with SSE4 assembly code (just for fun). I found no real improvement because most of the work is about
memory exchange... So I kept the basic C code..." . Other links also alive (about measuring time spend in those transforms).

Not sure if those transforms will work directly on yuv data ... so, probably initial implementation can only work with some project colorspaces (RGBA8/float?) and some video outputs (GL/X11) ?
Andrew-R

Andrew-R

2019-06-04 18:36

reporter   ~0001653

Not sure if this will be of any use, but there was little discussion about OpenGL and iccpprofiles:

https://sourceforge.net/p/lcms/mailman/message/33575634/

-----------------copy--------------------
Re: [Lcms-user] Adobe's Color Engine, GPUs, And Other Rambling
From: Gerhard Fuernkranz <nospam456@gm...> - 2015-03-10 19:25:03
 Attachments: Message as HTML
  Create an RGB -> RGB transform and re-sample it on a regular grid,
for instance like below (code is a bit older, still using lcms1, though).

Regards,
Gerhard


#define GRIDPOINTS 64

static GLushort clut[GRIDPOINTS][GRIDPOINTS][GRIDPOINTS][3];

static GLuint img_texture;
static GLuint clut_texture;
static GLfloat clut_scale;
static GLfloat clut_offset;

void
make_clut_texture(const char *profile_name)
{
     int r, g, b, n = GRIDPOINTS;
     cmsHPROFILE sRGB, monitor;
     cmsHTRANSFORM xform;

     sRGB = cmsCreate_sRGBProfile (); // image profile
     monitor = cmsOpenProfileFromFile (profile_name, "r");

     if (monitor == NULL) {
         fprintf(stderr, "Cannot open display profile %s\n", profile_name);
         exit(1);
     }

     xform = cmsCreateTransform (sRGB, TYPE_RGB_16, monitor, TYPE_RGB_16,
                                 INTENT_PERCEPTUAL, cmsFLAGS_NOTPRECALC);

     if (xform == NULL) {
         fprintf(stderr, "Failed to create transformation\n");
         exit(1);
     }

     clut_scale = (double) (n - 1) / n;
     clut_offset = 1.0 / (2 * n);

     for (r = 0; r < n; r++) {
         for (g = 0; g < n; g++) {
             for (b = 0; b < n; b++) {
                 unsigned short in[3];
                 in[0] = floor ((double) r / (n - 1) * 65535.0 + 0.5);
                 in[1] = floor ((double) g / (n - 1) * 65535.0 + 0.5);
                 in[2] = floor ((double) b / (n - 1) * 65535.0 + 0.5);
                 cmsDoTransform (xform, in, clut[b][g][r], 1);
             }
         }
     }

     cmsDeleteTransform (xform);
     cmsCloseProfile (monitor);
     cmsCloseProfile (sRGB);

     glGenTextures (1, &clut_texture);
     /* texture 1 = clut */
     glActiveTextureARB (GL_TEXTURE0_ARB + 1);
     glBindTexture (GL_TEXTURE_3D, clut_texture);

     glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
     glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
     glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
     glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

     glTexImage3D (GL_TEXTURE_3D, 0, GL_RGB16, n, n, n,
                   0, GL_RGB, GL_UNSIGNED_SHORT, clut);

     /* back to texture 0 = image */
     glActiveTextureARB (GL_TEXTURE0_ARB);
}
-------------------copy end------

additionally there was this comment at the end:

----copy------------
Re: [Lcms-user] Adobe's Color Engine, GPUs, And Other Rambling
From: Gerhard Fuernkranz <nospam456@gm...> - 2015-03-10 23:54:12
  
  Am 11.03.2015 um 00:36 schrieb marti.maria@...:
>
> Quoting Gerhard Fuernkranz <nospam456@...>:
>
>> Create an RGB -> RGB transform and re-sample it on a regular grid,
>> for instance like below (code is a bit older, still using lcms1, though).
>
> Great idea. lcms2 works fine in this way. Please note in lcms2 you can get float, double or "half float" values directly, so you need not to downscale to 16 bits anymore. For instance, in half float type, use TYPE_RGB_HALF_FLT as formatter.

The reason for the integer LUT texture was actually the inability of my GPU to interpolate 3D float textures with GL_LINEAR filter, when I wrote this stuff quite some years ago. Likely, recent GPUs don't suffer from such a limitation any more.

Regards,
Gerhard
--------------------copy end-------------------

so, this might help with X11-OpenGL. For plain X11 - just same thing via CPU? (GIMP 2.10.x probably uses software/CPU method)
Olaf

Olaf

2019-06-04 11:40

reporter  

Issue History

Date Modified Username Field Change
2019-06-04 11:40 Olaf New Issue
2019-06-04 11:40 Olaf File Added: Compsotor-mpv_with_display_profile.jpg
2019-06-04 11:48 Olaf Tag Attached: Compositor
2019-06-04 11:48 Olaf Tag Attached: Color Space
2019-06-04 11:48 Olaf Tag Attached: ICC profile
2019-06-04 18:36 Andrew-R Note Added: 0001653
2019-06-05 11:09 Andrew-R Note Added: 0001657
2019-06-05 14:14 Andrea_Paz Note Added: 0001659
2019-06-05 15:11 PhyllisSmith Note Added: 0001660
2019-06-05 19:53 Andrew-R Note Added: 0001663
2019-09-27 06:38 Andrew-R Note Added: 0002185
2019-10-01 10:25 Olaf Note Added: 0002200
2021-11-16 12:30 Andrea_Paz Note Added: 0005187
2021-11-16 16:38 Andrew-R Note Added: 0005188
2021-11-16 16:59 Andrew-R Note Added: 0005189
2022-05-06 07:58 Andrew-R Note Added: 0005299
2023-06-06 17:29 Andrew-R Note Added: 0005495