[FFmpeg-devel] [PATCH] swscale: Use function pointers inside swScale().

Ramiro Polla ramiro.polla
Fri Apr 3 05:07:10 CEST 2009


Hi,

2009/4/2 M?ns Rullg?rd <mans at mansr.com>:
> Michael Niedermayer <michaelni at gmx.at> writes:
>> On Thu, Apr 02, 2009 at 05:09:49PM -0300, Ramiro Polla wrote:
>>> One more patch (bundled with cosmetics.diff to be applied before) in
>>> the series...
>>>
>> [...]
>>> Index: swscale_internal.h
>>> ===================================================================
>>> --- swscale_internal.h ? ? ? (revision 29130)
>>> +++ swscale_internal.h ? ? ? (working copy)
>>> @@ -214,6 +214,37 @@
>>> ? ? ?uint64_t sparc_coeffs[10] __attribute__((aligned(8)));
>>> ?#endif
>>>
>>> + ? ?/* function pointers for swScale() */
>>> + ? ?void (*yuv2nv12X ?)(struct SwsContext *, int16_t *, int16_t **, int,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?int16_t *, int16_t **, int, uint8_t *, uint8_t *, int,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?int, int);
>>> + ? ?void (*yuv2yuv1 ? )(struct SwsContext *, int16_t *, int16_t *, int16_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?uint8_t *, uint8_t *, uint8_t *, uint8_t *, long,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?long);
>>> + ? ?void (*yuv2yuvX ? )(struct SwsContext *, int16_t *, int16_t **, int,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?int16_t *, int16_t **, int, int16_t **, uint8_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?uint8_t *, uint8_t *, uint8_t *, long, long);
>>> + ? ?void (*yuv2packed1)(struct SwsContext *, uint16_t *, uint16_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?uint16_t *, uint16_t *, uint8_t *, int, int, int, int,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?int);
>>> + ? ?void (*yuv2packed2)(struct SwsContext *, uint16_t *, uint16_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?uint16_t *, uint16_t *, uint16_t *, uint16_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?uint8_t *, int, int, int, int);
>>> + ? ?void (*yuv2packedX)(struct SwsContext *c, int16_t *, int16_t **, int,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?int16_t *, int16_t **, int, int16_t **, uint8_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ?long, long);
>>> +
>>> + ? ?void (*hyscale_internal)(uint8_t *, uint8_t *, long, uint32_t *);
>>> + ? ?void (*hcscale_internal)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, long,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint32_t *);
>>> + ? ?void (*hyscale_fast)(struct SwsContext *c, int16_t *, int, uint8_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? int, int);
>>> + ? ?void (*hcscale_fast)(struct SwsContext *c, int16_t *, int, uint8_t *,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? uint8_t *, int, int);
>>> +
>>> + ? ?void (*hScale)(int16_t *, int, uint8_t *, int , int, int16_t *, int16_t *,
>>> + ? ? ? ? ? ? ? ? ? long);
>>> +
>>
>> these require a clear documentation, that is the documentation must be
>> sufficient to implement a working optimized function for each.
>> otherwise it would be yet another undocumented API that would require
>> global knowledge for any work

Yes, but that is a separate issue. There currently is no documentation
and the patch only copies the function declarations. Besides, that
would require a much closer inspection of each function and so I
suspect the original authors (eg: you =) might be better suited for
the job.

I updated the patch to take the parameters' names as well.

> The important things to know is guaranteed alignment of data and other
> restrictions like width/height always multiple of N. ?What the
> function actually does can hopefully be determined by reading the C
> code.

This also requires a closer inspection (and better understand of the
underlying asm). I don't know much about alignments.

If anyone cares to jump in and help on documenting the parameters and
the alignments, that would be really appreciated.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: func_ptrs.diff
Type: text/x-diff
Size: 22414 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090403/1d970d9c/attachment.diff>



More information about the ffmpeg-devel mailing list