[x264-devel] Lossless H.264 encoding

Jason Garrett-Glaser darkshikari at gmail.com
Tue Dec 23 11:05:24 CET 2008


2008/12/23 Ram prasad <ramprasad85 at gmail.com>:
> Hi all
> My source data is raw 24 bit RGB VGA video. I want to encode it into a h.264
> video. my requirement is that this should be a lossless compression. Looking
> at the code i think x264 does not support any other format other than YUV
> 420. I am planning to modify the code to make it work on high quality YUV
> 444 or if possible on the RGB data itself.
> Before i embark on this task i would like to know whether it is feasible or
> not. if it is yes, how much effort would it require.

RGB support is probably not feasible; I don't even know if the spec
supports it, and even if it does, I know of no decoders that do--you'd
have to modify a decoder to support it to, and you'd probably end up
having to use the Separate Chroma Plane coding feature, where each
chroma plane is its own image.

YUV444 is definitely feasible.  It would require the following changes:

1.  In all cases where chroma planes are handled, instead of >>1 to
get the size of chroma, or chroma stride, or whatever, a variable
would have to be used.  This is probably the most time consuming step
by far--going through all the code, finding all places where 420 is
assumed, and fix it.
2.  AFAIK, a different Hadamard transform is used for chroma coding
for 422/444.  This isn't important in lossless mode, but it would have
to be implemented for the feature to be accepted (since lossy is also
useful...).  It probably wouldn't be much work though.  In fact, if
I'm right, you might be able to just use the luma transform for chroma
in 444, as I think they might be the same.
3.  Deblock would have to be called on more chroma edges accordingly.
Not important in lossless, but would be needed for lossy.
4.  Increase the size of the necessary dct blocks in x264_t to add
enough room for all the chroma DCTs and adjust CABAC/CAVLC coding as
necessary.

Dark Shikari


More information about the x264-devel mailing list