Bug 407921 - LUT management with defined OCIO doesn't work on Linux
Summary: LUT management with defined OCIO doesn't work on Linux
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: HDR (show other bugs)
Version: 4.2.0-beta
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL: https://github.com/AcademySoftwareFou...
Keywords:
Depends on:
Blocks: 435474
  Show dependency treegraph
 
Reported: 2019-05-24 23:28 UTC by iszotic
Modified: 2021-10-19 19:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description iszotic 2019-05-24 23:28:57 UTC
SUMMARY
Blender OCIO doesn't work with Linux, I tried with Windows 10 and it's working as expected,  when you change the settings in linux it throws this error in the console 

Error The specified transform file '/home/voltam/Downloads/blender-2.79b-linux-glibc219-x86_64/2.79/datafiles/colormanagement/luts/srgb_inv.spi1d' could not be loaded. Invalid 'From' Tag sending event 3 to object qt_scrollarea_viewport

I tried with blender 2.80's OCIO file and the same happens

STEPS TO REPRODUCE
1. Open an OpenEXR file made with blender
2. Enable OpenColorIO, set color engine to OCIO, set the configuration to blender's OCIO, in blender's installation folder.
3. To get a standard color, set input ColorSpace to Linear, Display device to sRGB, view to default and look to none, this works in windows but in linux not.

OBSERVED RESULT

A defined OCIO is not working in linux

EXPECTED RESULT

Change the color from linear gamma to corrected gamma (without setting the gamma in the LUT docker) in linux.

Krita

 Version: 4.2.0-beta
 Languages: en_US
 Hidpi: true

Qt

  Version (compiled): 5.9.5
  Version (loaded): 5.9.5

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.15.0-50-generic
  Pretty Productname: Ubuntu 18.04.2 LTS
  Product Type: ubuntu
  Product Version: 18.04


Hardware Information

  GPU Acceleration: auto
  Memory: 32164 Mb
  Number of Cores: 16
  Swap Location: /tmp

OpenGL Info
 
  Vendor:  "X.Org" 
  Renderer:  "Radeon RX Vega (VEGA10, DRM 3.31.0, 4.15.0-50-generic, LLVM 9.0.0)" 
  Version:  "4.5 (Compatibility Profile) Mesa 19.1.0-devel - padoka PPA" 
  Shading language:  "4.50" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 0, profile  QSurfaceFormat::OpenGLContextProfile(CompatibilityProfile)) 
  Current format:    QSurfaceFormat(version 4.5, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 0, profile  QSurfaceFormat::OpenGLContextProfile(CompatibilityProfile)) 
     Version: 4.5
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 
== log ==
 Supported renderers: QFlags(0x2|0x4) 
Surface format preference list: 
* QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 0, profile  QSurfaceFormat::OpenGLContextProfile(CompatibilityProfile)) 
    QSurfaceFormat::RenderableType(OpenGL) 
* QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 0, profile  QSurfaceFormat::OpenGLContextProfile(CompatibilityProfile)) 
    QSurfaceFormat::RenderableType(OpenGLES) 
Probing format... QSurfaceFormat::RenderableType(OpenGL) 
Found format: QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 0, profile  QSurfaceFormat::OpenGLContextProfile(CompatibilityProfile)) 
    QSurfaceFormat::RenderableType(OpenGL)
Comment 1 iszotic 2019-05-25 00:50:24 UTC
Doing more testing, converting to different color profiles icc doesn't work either in linux, :( only on windows...
Comment 2 Halla Rempt 2019-05-25 10:12:36 UTC
Zut... I can confirm the regression. It must have happened when we merged the HDR display code.

I also get things like

Error The specified transform file '/home/boud/imageworks-OpenColorIO-Configs-0bb079c/spi-vfx/luts/vd16.spi1d' could not be loaded. Invalid 'From' Tag sending event 43 to object
Comment 3 wolthera 2019-05-25 12:03:31 UTC
boud, can I ask you to doublecheck you're running Krita with LC_ALL=C ? OCIO has a huge issue with locale stuff.

https://docs.krita.org/en/reference_manual/dockers/lut_management.html

Because it works here on 220be8f with all of the ocio configs I have here.
Comment 4 iszotic 2019-05-25 14:04:37 UTC
(In reply to wolthera from comment #3)
> boud, can I ask you to doublecheck you're running Krita with LC_ALL=C ? OCIO
> has a huge issue with locale stuff.
> 
> https://docs.krita.org/en/reference_manual/dockers/lut_management.html
> 
> Because it works here on 220be8f with all of the ocio configs I have here.

>_<, it was that and changing the image's color profile works too... in linux krita could show a warning in console when OCIO is used, just saying
Comment 5 Halla Rempt 2019-05-25 16:26:33 UTC
I'm pretty sure all my laptops are LC_ALL=C, but I will check.
Comment 6 wolthera 2019-05-25 18:33:34 UTC
I build 77c9d6b and yes, if I don't run use 'LC_ALL=C krita' specifically, ocio won't work for me. My previous test was also with 'LC_ALL=C krita', despite my pc set to american localization, so whatever is causing the ocio bug, it's very very special.
Comment 7 Halla Rempt 2019-05-26 19:57:39 UTC
Okay, downgrading this then.
Comment 8 amyspark 2021-09-06 21:52:20 UTC
This is a bug in OCIO itself. They're using sscanf to parse floating-point numbers in LUTs. This implicitly assumes the files will be parsed using the C  locale, which is not the case if you have changed your environment's LANG or LC_* variables.

The particular error seen here is triggered by https://github.com/AcademySoftwareFoundation/OpenColorIO/blame/7fece5efb4fecc675376d8d921affb253e52a704/src/core/FileFormatSpi1D.cpp#L131, and is reported in https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/297.

I will add a patch for our app's usage as part of 435474. I'm also tagging the relevant bug report upstream.
Comment 9 amyspark 2021-10-19 19:36:33 UTC
Git commit 49eae9041fe56f12296fe4f0692cc31006c1c16f by L. E. Segovia.
Committed on 19/10/2021 at 16:39.
Pushed by lsegovia into branch 'master'.

OpenColorIO: use Natron's workaround for parsing LUTs on localized systems

A  +66   -0    plugins/dockers/lut/kis_context_thread_locale.h     [License: GPL(v2.0+)]
M  +3    -0    plugins/dockers/lut/ocio_display_filter_vfx2020.cpp
M  +3    -0    plugins/dockers/lut/ocio_display_filter_vfx2021.cpp

https://invent.kde.org/graphics/krita/commit/49eae9041fe56f12296fe4f0692cc31006c1c16f
Comment 10 amyspark 2021-10-19 19:42:47 UTC
Git commit 009ea16f93c26ff428ed68de1e0c19949ec2524c by L. E. Segovia.
Committed on 19/10/2021 at 19:42.
Pushed by lsegovia into branch 'krita/5.0'.

OpenColorIO: use Natron's workaround for parsing LUTs on localized systems
(cherry picked from commit 49eae9041fe56f12296fe4f0692cc31006c1c16f)

A  +66   -0    plugins/dockers/lut/kis_context_thread_locale.h     [License: GPL(v2.0+)]
M  +3    -0    plugins/dockers/lut/ocio_display_filter_vfx2020.cpp
M  +3    -0    plugins/dockers/lut/ocio_display_filter_vfx2021.cpp

https://invent.kde.org/graphics/krita/commit/009ea16f93c26ff428ed68de1e0c19949ec2524c