[x264-devel] Re: x264_t.dct.block.luma4x4 & residual_ac

Loren Merritt lorenm at u.washington.edu
Thu Dec 2 23:15:37 CET 2004


On Wed, 1 Dec 2004, [iso-8859-1] Måns Rullgård wrote:

> "GC Wen" <gcmoon at mimow.com> writes:
>
>> Hi,
>>
>> I put x264_t->dct->block->residual_ac and
>> x264_t->dct->block->luma4x4 into a UNION.
>> and it seems works.
>> maybe it can save a little memory?
>
> It would save (16+8) * 16 * sizeof(int) = 1536 bytes, if your ints are
> 32 bits.  If you are that tight on memory you probably have more of a
> problem holding the frame data in memory.
>
> I'm not quite sure how these are used, but if only one of them will
> ever be in use, making them a union could have the advantage of making
> this more clear in the declaration.

Some macroblock types (I16x16, I4x4 chroma) use a second DCT of the 
first's DC coeffs, and the remaining AC coeffs are stored in residual_ac.
In the other types, each 4x4 block is encoded separately, and they 
use luma4x4.
So yes, a union makes it more clear that they are just slightly different 
versions of the same data.

--Loren Merritt


More information about the x264-devel mailing list