= Colourspace conversion step - CSC = Before passing the pixels to the [/wiki/Encodings video encoder], we may or may not include a colourspace conversion step. (ie: newer versions of x264 support {{{BGRA}}} pixels as input directly) [[BR]] {{{#!div class="box" == 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}}}". [[BR]] It will 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). }}} {{{#!div class="box" == CSC Modules == On the server side we currently (as of v0.11) support 4 modules for doing this step: * [/browser/xpra/trunk/src/xpra/codecs/csc_swscale csc_swscale] which uses [http://www.ffmpeg.org/ FFmpeg]'s swscale (CPU based) * [/wiki/CSC#csc_opencl csc_opencl] (GPU or CPU based via [http://www.khronos.org/opencl/ OpenCL]) * [/wiki/CSC#csc_nvcuda csc_nvcuda] (GPU based via [http://www.nvidia.com/object/cuda_home_new.html CUDA]) * [/browser/xpra/trunk/src/xpra/codecs/csc_cython csc_cython] (a slower fallback module in Cython) Note: some of those modules may require you to add some libraries to your library path (ie: {{{CUDA}}} often does, {{{Nvidia}}}'s {{{OpenCL}}} libraries do too) [[BR]] 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. }}} {{{#!div class="box" == Choosing a CSC module == The best way to choose a CSC module is to test them all and [/wiki/CSC/Performance compare them]. }}} {{{#!div class="box" == 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, see below: }}} {{{#!div class="box" == {{{csc_opencl}}} == Links: * this module relies on [http://documen.tician.de/pyopencl/ PyOpenCL] * original feature request ticket with more information: #422 * [/browser/xpra/trunk/src/xpra/codecs/csc_opencl csc_opencl module source] ---- Options: * select which device type is used as backend using: {{{ XPRA_OPENCL_DEVICE_TYPE=devicetype xpra start ... }}} Where `devicetype` is either {{{GPU}}} or {{{CPU}}}. [[BR]] * choose the {{{OpenCL}}} implementation to use when more than one are installed: {{{ XPRA_OPENCL_PLATFORM="Intel" xpra ... }}} * select a specific {{{OpenCL}}} device when more than one is available: {{{ XPRA_OPENCL_DEVICE_NAME="GeForce GTX 760" xpra ... }}} To get more information use: {{{ XPRA_OPENCL_DEBUG=1 xpra ... }}} }}} {{{#!div class="box" == {{{csc_nvcuda}}} == You may need to build xpra with the flag "{{{--with-csc_nvcuda}}}". You must use a sufficiently recent versionof the {{{nvidia}}} video driver, preferably obtained directly from nvidia, and not the {{{nouveau}}} drivers (which you should probably remove). [[BR]] Links: * this module relies on [http://documen.tician.de/pycuda/ PyCUDA] * original feature request ticket with more information: #384 * [/browser/xpra/trunk/src/xpra/codecs/csc_nvcuda csc_nvcuda module source] ---- Options: * choose the device used with: {{{ XPRA_CUDA_DEVICE=N xpra ... }}} Where `N` is the device ID. Use: {{{ XPRA_CUDA_DEBUG=1 xpra ... }}} to get more information. }}} {{{#!div class="box" == 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, using some heuristics (the bigger the picture size and the lower the quality + the higher the speed - the more likely it is that it will be enabled) * manually using {{{xpra control}}} at runtime (see ticket:461#comment:9): {{{ xpra control DISPLAY scaling "*" 2:3 }}} will scale all windows ("*") by 2/3rd on `DISPLAY` (replace with your actual display number or URI) [[BR]] Note: when downscaling is enabled, this may introduce a colourspace conversion step where none was necessary before (when the encoder was previously handling RGB pixel data directly). Only some encoders can handle the scaling natively (and therefore at almost no cost), [/wiki/Encodings/nvenc nvenc] does. }}}