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

Måns Rullgård mans
Thu Apr 2 23:36:13 CEST 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Thu, Apr 02, 2009 at 05:09:49PM -0300, Ramiro Polla wrote:
>> Hi,
>> 
>> 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

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.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list