Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can YUV -> RGB conversion be hardware accelerated?

We have an application that reads a GigE YUV video stream and displays it on the screen. By profiling, we have learned that the function converting each frame from YUV (UYVY) to RGB24 is taking at least an order of magnitude more time and CPU than any other piece of our camera-to-screen pipeline.

The conversion function we are using is provided by the GigE software vendor (Pleora) and is slightly faster than our own 'naive' (non-optimized) implementation. We are using DirectShow for the rest of our pipeline. 'Task-manager benchmarking' shows for our 1080p 30fps stream, a cpu usage of 4-5% when we skip the conversion (and get garbled image of course), and 15-19% CPU usage when we call the conversion function.

The questions we have are:

  1. Is there a DirectShow filter that will do this conversion for us, hopefully in a more performant manner, rather than relying on a 3rd party SDK or our own (CPU-based, serial) conversion function ?
  2. Must this conversion be done on the CPU, or is it somehow able to be offloaded to the GPU for parallel processing?

Thanks! Eric.

like image 778
user1757226 Avatar asked Oct 18 '12 18:10

user1757226


People also ask

How do you convert YUV to RGB?

The function [R, G, B] = Y′UV444toRGB888(Y′, U, V) converts Y′UV format to simple RGB format.

Why do we convert RGB to YUV?

YUV color-spaces are a more efficient coding and reduce the bandwidth more than RGB capture can. Most video cards, therefore, render directly using YUV or luminance/chrominance images. The most important component for YUV capture is always the luminance, or Y component.


1 Answers

The conversion is perhaps a good candidate for GPU processing, however what are you going to do with the converted data? If you need it for further processing in software, then reading back from video adapter might ruin all the gain you might have obtained by offloading processing to GPU. If you need it for presentation purposes only, then you don't need to convert, you can deliver YUV image right to video adapter and let it present it this way (which is the ideal configuration of the pipeline, since you don't have any conversion at all).

Talking about software conversion, I am not sure about the quality of the conversions you are using right now, however there are highly optimized (SIMD-enabled) conversions available:

  1. Standard Windows Vista+ DMO
  2. FFmpeg's libswscale
  3. Intel IPP Primitives

All three are more or less easily pluggable into DirectShow pipeline. Additionally high resolution images are good candidates for parallel software processing too.

like image 65
Roman R. Avatar answered Sep 19 '22 23:09

Roman R.