[FFmpeg-devel] Indeo3 replacement, take 3

Maxim max_pole
Tue Nov 3 14:52:55 CET 2009


Vitor Sessak schrieb:
> Maxim wrote:
>
[...]
>
>> The problem resides
>> in the function "put_pixels16_altivec()" from dsputils_ppc.c and is
>> caused actually by the wrong alignment
>
> Please send a patch adding a doxy documentation explaining the
> alignment requirements of dsp.put_no_rnd_pixels_tab. It might save a
> few days of GDB work of the next person who has the same problem ;)

In order to do it I need to know which alignment the other subroutines
require. This must be figured out first... Maybe I'll do it later...

>
>>     /* setup output and reference pointers */
>>     offset  = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2);
>>     dst     = plane->pixels[ctx->buf_sel] + offset;
>>     mv_y    = cell->mv_ptr[0];
>>     mv_x    = cell->mv_ptr[1];
>>     offset += mv_y * plane->pitch + mv_x;
>>     src     = plane->pixels[ctx->buf_sel ^ 1] + offset;
>>
>>     h = cell->height << 2;
>>
>>     if (HAVE_ALTIVEC && ((int)dst & 15)) {
>>         ctx->dsp.put_no_rnd_pixels_tab[1][0](dst, src, plane->pitch, h);
>>         src += 8;
>>         dst += 8;
>>     }
>
> This code goes a little against the dsputils philosophy. From what I
> understand, it is supposed to "just work", no matter what CPU, if the
> right alignment requirements are fulfilled. The problem with your
> approach is that it can fail when one implements
> dsp.put_no_rnd_pixels_tab[0][0] in NEON/SS4/AVR32/etc requiring
> 16-byte alignment. Also casting the integer to pointer is not very
> pretty. What I suggest is
>
> int offset_dst  = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2);
>
> [...]
>
>     if (offset_dst & 15) {
>         ctx->dsp.put_no_rnd_pixels_tab[1][0](dst, src, plane->pitch, h);
>         src += 8;
>         dst += 8;
>     }
>
> but for this to work you have to do "pitch = FFALIGN(width, 16)"
> instead of "pitch = FFALIGN(width, 8)" so plane->pixels[ctx->buf_sel]
> is 16-byte aligned.
>

Thank you! I forgot to change the alignment of the buffers in the patch.
A new version (now working with AltiVec) attached...

Regards
Maxim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: indeo3.c
Type: text/x-csrc
Size: 49544 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091103/7a3bde01/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: indeo3data.h
Type: text/x-chdr
Size: 38594 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091103/7a3bde01/attachment.h>



More information about the ffmpeg-devel mailing list