xpra icon
Bug tracker and wiki

Version 2 (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 two 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.

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:

As of r4247:

  • 1920x1080 RGB(X) to YUV420P:
Module CPU/GPU MPixels/s
swscaleAMD 945120
swscaleIntel Core i3164
OpenCL-NVidiaAMD 945 + GTS 450211
OpenCL-AMDAMD 94563
OpenCL-AMDIntel Core i371
OpenCL-IntelIntel Core i3121
  • 1920x1080 RGB(X) to YUV422P:
Module CPU/GPU MPixels/s
swscaleAMD 945165
swscaleIntel Core i3229
OpenCL-NVidiaAMD 945 + GTS 450199
OpenCL-AMDAMD 94554
OpenCL-AMDIntel Core i358
OpenCL-IntelIntel Core i3105
  • 1920x1080 RGB(X) to YUV444P:
Module CPU/GPU MPixels/s
swscaleAMD 945131
swscaleIntel Core i3181
OpenCL-NVidiaAMD 945 + GTS 450174
OpenCL-AMDAMD 94553
OpenCL-AMDIntel Core i363
OpenCL-IntelIntel Core i3114
  • 1920x1080 RGB to GBR (simple byte swapping):
Module CPU/GPU MPixels/s
swscaleAMD 945524
swscaleIntel Core i3550
  • 1920x1080 YUV420P to BGR(X):
Module CPU/GPU MPixels/s
swscaleAMD 945369
swscaleIntel Core i3350
OpenCL-NVidiaAMD 945 + GTS 450223
OpenCL-AMDAMD 94554
OpenCL-AMDIntel Core i360
OpenCL-IntelIntel Core i3103
  • 1920x1080 YUV422P to BGR(X):
Module CPU/GPU MPixels/s
swscaleAMD 945323
swscaleIntel Core i3309
OpenCL-NVidiaAMD 945 + GTS 450180
OpenCL-AMDAMD 94551
OpenCL-AMDIntel Core i356
OpenCL-IntelIntel Core i3109
  • 1920x1080 YUV444P to BGR(X):
Module CPU/GPU MPixels/s
swscaleAMD 945237
swscaleIntel Core i3310
OpenCL-NVidiaAMD 945 + GTS 450136
OpenCL-AMDAMD 94550
OpenCL-AMDIntel Core i358
OpenCL-IntelIntel Core i3104