[FFmpeg-devel] [PATCH 0/5] Integer scalar product DSP functions
Michael Niedermayer
michaelni at gmx.at
Wed May 8 18:29:51 CEST 2013
On Wed, May 08, 2013 at 04:53:49PM +0200, Christophe Gisquet wrote:
> 2013/5/8 Christophe Gisquet <christophe.gisquet at gmail.com>:
> > Those functions generally work in batch of 16 elements, but some cases
> > need batches of 8. The first 2 patches only matter for ra144, and alternate
> > patch ra144-pad-buffer-and-use-scalarproduct_int16.patch is probably a better
> > idea.
>
> Here it is.
>
> Btw, fate-ra-144 and fate-lossless-wma do pass here.
> ra144.c | 12 +++++-------
> ra144.h | 4 +++-
> 2 files changed, 8 insertions(+), 8 deletions(-)
> c15a9d6d52cfe700ac99d4a4df6a7213b177e02d ra144-pad-buffer-and-use-scalarproduct_int16.patch
> diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
> index fe9a5bc..2874b78 100644
> --- a/libavcodec/ra144.c
> +++ b/libavcodec/ra144.c
> @@ -1681,12 +1681,9 @@ unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy)
> }
>
> /** inverse root mean square */
> -int ff_irms(const int16_t *data)
> +int ff_irms(DSPContext *dsp, const int16_t *data)
> {
> - unsigned int i, sum = 0;
> -
> - for (i=0; i < BLOCKSIZE; i++)
> - sum += data[i] * data[i];
> + unsigned int sum = dsp->scalarproduct_int16(data, data, BLOCKSIZE);
>
> if (sum == 0)
> return 0; /* OOPS - division by zero */
> @@ -1698,14 +1695,15 @@ void ff_subblock_synthesis(RA144Context *ractx, const int16_t *lpc_coefs,
> int cba_idx, int cb1_idx, int cb2_idx,
> int gval, int gain)
> {
> - int16_t buffer_a[BLOCKSIZE];
> + LOCAL_ALIGNED(16, int16_t, buffer_a, [FFALIGN(BLOCKSIZE,16)]);
> int16_t *block;
> int m[3];
>
> + AV_ZERO128(buffer_a+BLOCKSIZE);
if buffer_a is moved to the context then this could be avoided
also it would avoid the need for LOCAL_ALIGNED()
also trying to build the code with the patch results in:
libavcodec/ra144enc.c: In function ‘ra144_encode_subblock’:
libavcodec/ra144enc.c:377:9: warning: passing argument 1 of ‘ff_irms’ from incompatible pointer type [enabled by default]
libavcodec/ra144.h:73:5: note: expected ‘struct DSPContext *’ but argument is of type ‘int16_t *’
libavcodec/ra144enc.c:377:9: error: too few arguments to function ‘ff_irms’
libavcodec/ra144.h:73:5: note: declared here
[...]
thanks
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130508/86440db8/attachment.asc>
More information about the ffmpeg-devel
mailing list