[theora] png2theora.c + QImage

Ralph Giles giles at thaumas.net
Wed Apr 18 09:01:34 PDT 2012


On 12-04-17 7:15 PM, Gustav González wrote:

> http://www.maefloresta.com/tmp/example.cpp
> 
> The point where I am stuck starts at this comment:
> // LOOK HERE (line 313)

This file is only 304 lines long.

> And here is the issue: QImage supports RGB images, so my first task is
> to transform
> the content of the QImage variable from RGB to YUV.

You did see there's already (more accurate) code to do this in
png2theora.c? See rgb_to_yuv in
https://svn.xiph.org/trunk/theora/examples/png2theora.c if you don't
have the latest version.

In particular, decimation isn't the best way to do chroma subsampling. :)

> As you already noticed it, I have to deal with a conflict of types. I
> was trying to cast the yuv variable from
> "uint8_t" to "unsigned char" and vice versa with no luck. The ogv file
> exported is always corrupted.

I didn't try compiling your code, but those types should be equivalent
under Qt. Perhaps the corruption is coming from the elsewhere in the
conversion code.

 -r


More information about the theora mailing list