xpra icon
Bug tracker and wiki

Version 26 (modified by Antoine Martin, 6 years ago) (diff)

--

Colourspace conversion step - CSC

Before passing the pixels to the video encoder, we may or may not include a colourspace conversion step. (some newer versions of x264 support BGRA pixels as input directly)

Information and Diagnostics

The pixel format used as input as well as the CSC module chosen to do this conversion work can be found via "xpra info". These should be chosen automatically based on the desired speed/quality settings. Note that the CSC step may degrade the quality of the picture (YUV444P mode does not, but YUV422P and YUV420P do).

CSC Modules

On the server side we currently support three modules for doing this step:

See below for some performance samples.

On the client side, if a CSC step is needed, it will use swscale. The OpenGL mode does not need a CSC step as it can display YUV pixels directly on screen.

Specify a module or mode

To choose a specific CSC module, use:

XPRA_CSC_TYPE=name xpra ...

Where name is one of the csc modules above.

One can also force the use a specific CSC mode:

XPRA_FORCE_CSC_MODE=cscmode xpra ...

Where cscmode is one of: YUV420P, YUV422P, YUV444P.

Some modules can be configured further, for example the csc_opencl module can select which device type is used as backend using:

XPRA_OPENCL_DEVICE_TYPE=devicetype xpra start ...

Where devicetype is either GPU or CPU.
Or even which specific OpenCL device is used:

XPRA_OPENCL_DEVICE_NAME="GeForce GTX 760" xpra ...

Scaling

As part of the colourspace conversion step, we can also downscale the frame if the XPRA_SCALING environment variable is unset or set to "1", and either:

  • the application requests scaling using the _XPRA_SCALING X11 window property (specified as a 32-bit fraction, 16-bits for each)
  • the XPRA_SCALING_HARDCODED environment variable is set on the server, using one of those 2 forms (the second one is preferred):
    • XPRA_SCALING_HARDCODED=N to downscale by N
    • XPRA_SCALING_HARDCODED=M:N to downscale by the fraction M/N
  • automatically, if the frame size is bigger than 1MPixels and the quality is low whilst the speed is high

Note: if the automatic heuristics turn on frame downscaling, this may introduce a colourspace conversion step where none was necessary before (when the encoder was previously handling RGB directly).

CSC Performance

You can get your own figures by running the tests:

Measured with r4272 (results are in MPixels/s):

  • 1920x1080 RGB to YUV???P:
Module CPU/GPU YUV420P YUV422P YUV444P
swscaleAMD FX 8150142182151
swscaleAMD X4 945120165131
swscaleAMD X2 260124170140
swscaleIntel Core i3-3110M164229181
swscale2xIntel Xeon E5-2670215322253
CUDA-NvidiaAMD X4 945 + GTS 450366341290
CUDA-Nvidia2xIntel Xeon E5-2670 / 2xK1173177160
OpenCL-NvidiaAMD FX8150 + GTX 760345303254
OpenCL-NvidiaAMD X4 945 + GTS 450357303260
OpenCL-Nvidia2xIntel Xeon E5-2670 / 2xK1210211192
OpenCL-NvidiaIntel Xeon E5-2620 / GTX 650ti502457399
OpenCL-IntelAMD FX 8150129114119
OpenCL-IntelIntel Core i3-3110M1419253
OpenCL-Intel2xIntel Xeon E5-2670472412263
OpenCL-IntelIntel Xeon E5-2620254213131
OpenCL-AMDAMD FX 8150 + Radeon HD54501104942
OpenCL-AMDAMD FX 8150937976
OpenCL-AMDAMD X4 945635453
OpenCL-AMDAMD M300141212
OpenCL-AMDAMD X2 + Radeon HD54501516157
OpenCL-AMDAMD X2151411
OpenCL-AMDIntel Core i3-3110M715863
OpenCL-AppleIntel Core2Duo P8600 + GeForce? 320222822
  • 1920x1080 RGB to GBR (simple byte swapping):
Module CPU/GPU MPixels/s
swscaleAMD FX 8150718
swscaleAMD X4 945524
swscaleAMD X2 260582
swscaleIntel Core i3-3110M550
swscale2xIntel Xeon E5-2670758
  • 1920x1080 YUV???P to BGR(X):
Module CPU/GPU YUV420P YUV422P YUV444P
swscaleAMD FX 8150381406416
swscaleAMD X4 945369323237
swscaleAMD X2 260312255330
swscaleIntel Core i3-3110M350309310
swscale2xIntel Xeon E5-2670177168163
CUDA-NvidiaAMD X4 945 + GTS 450202191180
CUDA-Nvidia2xIntel Xeon E5-2670 / 2xK1180155151
OpenCL-NvidiaAMD FX 8150 + GTX 760331289257
OpenCL-NvidiaAMD X4 945 + GTS 450???
OpenCL-NvidiaIntel Xeon E5-2620 / GTX 650ti458377358
OpenCL-Nvidia2xIntel Xeon E5-2670 / 2xK1190165148
OpenCL-IntelAMD FX 8150967067
OpenCL-IntelIntel Core i3-3110M828887
OpenCL-IntelIntel Xeon E5-2620146123116
OpenCL-Intel2xIntel Xeon E5-2670265271268
OpenCL-AMDAMD FX 8150 + Radeon HD5450848270
OpenCL-AMDAMD FX 8150605547
OpenCL-AMDAMD X4 945545150
OpenCL-AMDAMD M3001197
OpenCL-AMDAMD X2 260 + Radeon HD54501079898
OpenCL-AMDAMD X2 26011107
OpenCL-AMDIntel Core i3-3110M605658