[Development] [Interest] Fastest Way to convert a QVideoFrame to an QImage?

Allan Sandfeld Jensen kde at carewolf.com
Fri Feb 14 16:42:42 CET 2014


On Wednesday 12 February 2014, Thiago Macieira wrote:
> Em qua 12 fev 2014, às 09:55:09, Jason H escreveu:
> > Well Qt does NOT support grayscale. None of the QImage::Formats are gray.
> > It's either mono, indexed color or color bits. Which is why I'm a but
> > unsure of what is faster. I would assume setting a pixel on Indexed 8,
> > would take a RGB or index and produce a color index lookup, even when the
> > index is the lookup.
> 
> qimage.h:
> 
> #if 0
>         // reserved for future use
>         Format_RGB15,
>         Format_Grayscale16,
>         Format_Grayscale8,
>         Format_Grayscale4,
>         Format_Grayscale4LSB,
>         Format_Grayscale2,
>         Format_Grayscale2LSB
> #endif
> 
> You may want to contribute some of those formats :-)

I added rgba formats last summer. You need to touch a lot of code to get the 
basics of a new format set up, so I wouldn't recommend it for everyone. I did 
the basic setup though for grayscale8, so if anyone want to add more tests and 
manually check it works. Feel free to start at https://codereview.qt-project.org/#change,78250

Most importantly though, the qt needs to be combed for places where depth ==8 
bit is assumed to be indexed. It also appears we implement grayscale a few 
places by using indexed8 and setting a colortable of grayscales. 

`Allan



More information about the Development mailing list