Xpra: Ticket #1438: decode jpeg to YUV

Split from #1423.

For some unknown reason, the YUV data loses some precision and so we decompress to RGB. The opengl backend could use the YUV data directly. (the code is commented out as of r15062)



Sun, 26 Nov 2017 13:36:40 GMT - Antoine Martin: status, summary, milestone changed


Thu, 30 Nov 2017 14:32:30 GMT - Antoine Martin:

The type of colour shade that goes MIA is seen here: ticket:1423#comment:3. webp doesn't have this problem (only the subsampling issue), so the paint code is unlikely to be the problem.


Tue, 06 Feb 2018 09:06:14 GMT - Antoine Martin:

jpeg uses BT.601, but using full range values. Y, Cb and Cr all use the full range of 0-255, with 128 being "0" for Cb and Cr: Full-range Y’CbCr in JPEG: If you are ever concerned about correctness, the easiest way is to simply never think about full-range Y’Cb'Cr'

So we'll need to use a different shader for those frames, and a new flag of some sort.


Tue, 06 Feb 2018 12:26:41 GMT - Antoine Martin: attachment set

source for clamped shader


Tue, 06 Feb 2018 12:26:55 GMT - Antoine Martin: attachment set

source for full range shader


Tue, 06 Feb 2018 12:50:03 GMT - Antoine Martin: status changed; resolution set

Finally fixed in r18330. Decoding to YUV is now the default in r18331. Thanks to wikipedia : YCbCr, we now use those authoritative matrix values in r18332.

Had to:

That was hard because those values are divided by 219 in the shader we have, and I had to figure that out... 219 is the limited range used by this encoding: 235-16! Also, modulo minor floating point number inaccuracies, they must have used values with more precision?

To compile those shaders, find the nvidia cdc compiler somewhere, then run:

cgc -profile arbfp1 -o yuv.pso yuv.cg
cgc -profile arbfp1 -o yuv16.pso yuv16.cg

Tue, 06 Feb 2018 13:02:44 GMT - Antoine Martin: summary changed

edit title: we're not dealing with webp yuv decoding, see #1764


Sat, 17 Feb 2018 06:14:46 GMT - Antoine Martin:

Caused a regression: #1769


Sat, 23 Jan 2021 05:24:19 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1438