[XviD-devel] Encoding grayscale images.

Sun Apr 24 19:19:43 CEST 2005

I'm trying to encode grayscale images.

I couldn't find an option to just encode grayscale.

Looking at the xvid_encraw examples direcotry, I see that the greyscale 
image is split into a smaller YUV image and sends it to the encoder.
The xvid_decraw gets back a YUV image and reassembles the greyscale image.

I would think that setting all values of the U and the V plane as 0
and sending the greyscale image as the Y plane would be a better.
Here are my reasons,
 1. If split the image into YUV, the motion vector for the UV will be
    arbitrary since it uses the same motion vector specified for the Y.
    Generaly this would lead to large difference values resulting in more
 2. If you set all the values in the U and V plane to 0 you do not need
    to encode the U and V plane. So only the extra bits need is in the
    macroblock header where you specify which blocks are encoded.
 3. By spliting the image into smaller YUV image you do have less macro
    blocks to encode which could save you bits. However if you look think
    of it in block level you have the same number of blocks encoded since 
    no blocks in the U,V plane needs to be encoded. Which means you save 
    bits in the macroblock header and the motion vectors. However as I
    mentioned in 1 I do not think this is a win, since the motion vectors
    for the blocks in U and V are arbitray.

Am I missing something?

I'd appreciate any insigts.

More information about the XviD-devel mailing list