[x264-devel] Re: [PATCH] Altivec optimizations for quant4x4, quant4x4dc, quant8x8, sub8x8_dct8, sub16x16_dct8, pixel_sa8d_8x8

Guillaume POIRIER gpoirier at mplayerhq.hu
Wed Aug 30 10:00:55 CEST 2006


Hi,

Loren Merritt a écrit :
> On Tue, 29 Aug 2006, Guillaume POIRIER wrote:
> 
>> So I imagine the problem lies in the abs+accumulation code, which seems
>> quite straightforward, and doesn't look like it could be that
>> error-prone... but it's late here, and so I guess I'll just sleep on 
> it...
>>
>> If anyone has an idea, please speak-up! :)
> 
>> /* accumulation of all elements of the resulting bloc */
>> vec_s16_t abs0v = vec_abs(sa8d0v);
>> vec_s16_t abs1v = vec_abs(sa8d1v);
>> vec_s16_t sum01v = vec_add(abs0v, abs1v);
>> vec_s16_t abs2v = vec_abs(sa8d2v);
>> vec_s16_t abs3v = vec_abs(sa8d3v);
>> vec_s16_t sum23v = vec_add(abs2v, abs3v);
>> vec_s32_t sum0123v = vec_sum4s(sum01v, sum23v);
>>
>> vec_s16_t abs4v = vec_abs(sa8d4v);
>> vec_s16_t abs5v = vec_abs(sa8d5v);
>> vec_s16_t sum45v = vec_add(abs4v, abs5v);
>> vec_s16_t abs6v = vec_abs(sa8d6v);
>> vec_s16_t abs7v = vec_abs(sa8d7v);
>> vec_s16_t sum67v = vec_add(abs6v, abs7v);
>> vec_s16_t sum4567v = vec_sum4s(sum45v, sum67v);
>>
>> vec_s32_t sumblocv = vec_sums( sum0123v, sum4567v );
>> sumblocv = vec_splat(sumblocv, 3);
> 
> I'm not fluent in altivec, but the manual says:
> vec_sum4s can't take two vec_s16_t, one of the inputs has to be 32bit.
> vec_sums only horizontally sums one of the inputs.

Yes, you are right. I noticed that yesterday when I went over the 
accumulation code once again.
The way horizontal accumulation is made is Altivec is quite clever in 
fact, as it allows to easily do the accumulation of vectors in a loop.

I wonder how it's done in SSE4. Intel hasn't released any doc about them 
yet. I wonder why: are they not ready, or do they have smth to hide? or... ?


> so:
> 
> sa8d0v = vec_abs(sa8d0v);
> sa8d1v = vec_abs(sa8d1v);
> sa8d2v = vec_abs(sa8d2v);
> sa8d3v = vec_abs(sa8d3v);
> sa8d4v = vec_abs(sa8d4v);
> sa8d5v = vec_abs(sa8d5v);
> sa8d6v = vec_abs(sa8d6v);
> sa8d7v = vec_abs(sa8d7v);
> sa8d0v = vec_add(sa8d0v, sa8d4v);
> sa8d1v = vec_add(sa8d1v, sa8d5v);
> sa8d2v = vec_add(sa8d2v, sa8d6v);
> sa8d3v = vec_add(sa8d3v, sa8d7v);
> sa8d0v = vec_add(sa8d0v, sa8d2v);
> sa8d1v = vec_add(sa8d1v, sa8d3v);
> sa8d0v = vec_add(sa8d0v, sa8d1v);
> vec_s32_t sumblocv = vec_sums(vec_sum4s(sa8d0v, zero), zero)
> sumblocv = vec_splat(sumblocv, 3);

I wrote it in a different way (with 2 sum4s), but yeah, that's pretty 
much how it should be done.

Guillaume

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list