[Ffmpeg-devel] alignment in H264 with altivec optimizations

Mauricio Alvarez alvarez
Fri Apr 21 12:59:17 CEST 2006

Loren Merritt wrote:
> On Thu, 20 Apr 2006, Mauricio Alvarez wrote:
>> with respect to the alignment of the pointers in some kernels:
> None of the h264 dsp functions should ever need a misaligned store (up
> to the width of the block, of course: a 4x4 function only guarantees 4
> byte alignment).

That means that the dsp pointers in the h264 dsp kernels (luma and
chroma and interpolation and idct) are always aligned to the data type
of the block?

If that's true it means that I can assume that the misalignment for the
stores with respect to the 128-bit aligment of Altivec ( (unsigned long)
dst & 0xF) is:

for 16x16 blocks: always 0.
for 8x8 blocks  : 0, 8
for 4x4 blocks  : 0,4,8,12

In my environment: PPC970, Mac OS-X, gcc-3.3.3 (and gcc-4.0.2), using
h264 HD videos coded with JM and x264 encoders in raw h264 format the
previous conditions are always meet. But I don't know if that's true for
other environments.

> Stride alignment depends on architecture, but for ppc64 it should always
> be divisible by 16.

 ... for Altivec code in the PPC architecture. because the PPC970
processor (and may be other recent PPC processors ) have hardware
support for scalar unaligned accesses.

Thanks for your comments

Mauricio Alvarez

More information about the ffmpeg-devel mailing list