View Bug Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002592 | DCP-o-matic | Features | public | 2023-07-28 17:05 | 2023-08-13 12:17 |
Reporter | overlookmotel | Assigned To | carl | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | acknowledged | Resolution | open | ||
Product Version | 2.16.59 | ||||
Target Version | 2.16.x | ||||
Summary | 0002592: Use 3D LUT for RGB/YUV to XYZ colour space conversion? | ||||
Description | As far as I can see, libdcp does RGB to XYZ colour space conversion using a fairly calculation-heavy process. Applying 2.6 gamma for XYZ uses a LUT (presumably to avoid slow Judging by (also I'm not sure if For at least some input colour spaces, I wonder if it'd be workable to use a 3D LUT which maps from all possible RGB/YUV inputs to XYZ output. The two most common sources I make DCPs from are:
Memory required for 3D LUTs mapping all possible input RGB/YUV values to 12-bit XYZ would be: 8 bit input: 2^24 2 bytes/pixel = 32 MiB These numbers could be reduced by 25% by packing the bits, at the cost of extra operations to unpack them. Obviously 128 GiB is too much memory! But 32 MiB seems quite modest, and for computers with plenty of RAM, 2 GiB is also not entirely unreasonable. I often see a single browser tab in Chrome eating up 200+ MB. I assume that a single LUT lookup per pixel would be faster than all the calculations involved in YUV -> RGB -> XYZ conversion, and it'd also improve accuracy by dispensing with the approximated gamma LUT. This would be a trade-off between memory usage and processing speed and/or accuracy, but for some common inputs, I think the trade-off might be worthwhile (though I have no idea if colour space conversion is a drop in the ocean compared to the computation required to compress JPEG2000). Do you think this might be worth investigating? I'd be happy to write a test implementation and benchmark it if you think this may have potential (but in Rust, not C++, I'm afraid). | ||||
Tags | No tags attached. | ||||
Branch | |||||
Estimated weeks required | |||||
Estimated work required | Undecided | ||||
|
I got my maths wrong! Size of the LUTs would be: 8 bit: 2^24 x 36 bits = 72 MiB (this time assuming tightly packed data) If input is legal range YUV (typical for ProRes), and it's acceptable to clamp values to legal range before using the LUT, LUTs could be smaller: 8 bit: 47.8 MiB 4.5 GiB or 3.0 GiB are a bit large for comfort, but I'd say still workable for some users. On a machine with 16 GB RAM, it'd work for me, for example. |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-07-28 17:05 | overlookmotel | New Bug | |
2023-07-28 21:44 | overlookmotel | Note Added: 0005862 | |
2023-08-13 11:19 | carl | Assigned To | => carl |
2023-08-13 11:19 | carl | Status | new => acknowledged |
2023-08-13 12:17 | carl | Target Version | => 2.16.x |
2023-08-13 12:17 | carl | Estimated work required | => Undecided |