[FFmpeg-devel] [PATCH] dot_product() static non-inline in a header
Mon Dec 15 00:37:20 CET 2008
Aurelien Jacobs <aurel at gnuage.org> writes:
> On Sun, 14 Dec 2008 01:47:50 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Sun, Dec 14, 2008 at 01:45:16AM +0100, Aurelien Jacobs wrote:
>> > Hi,
>> > dot_product() is declared as static non-inline in celp_math.h, which
>> > generates some warning: 'dot_product' defined but not used.
>> > I'm not sure about the original intention, so here are two different
>> > patches (pick one of them):
>> > - simply mark this function inline
>> > - move this function in acelp_pitch_delay.c which is the only
>> > file using it.
>> is there a speed gain from having it in te header inline?
> I have no idea, and I'm not really interested in testing this.
> I hope someone more involved in celp will do it.
>> if not iam in favor of ff_dot_product() in the .c file
> That's another possiblity... Patch attached.
> Index: libavcodec/celp_math.c
> --- libavcodec/celp_math.c (revision 16115)
> +++ libavcodec/celp_math.c (working copy)
> @@ -196,6 +196,17 @@
> return (power_int << 15) + value;
> +int ff_dot_product(const int16_t* a, const int16_t* b, int length, int shift)
> + int sum = 0;
> + int i;
> + for(i=0; i<length; i++)
> + sum += (a[i] * b[i]) >> shift;
> + return sum;
This looks generic enough that it should probably be moved to
something like dsputils. It is also trivially simdable.
mans at mansr.com
More information about the ffmpeg-devel