[FFmpeg-devel] [PATCH 2/3] avcodec/wmalosslessdec: optimize sign operation

Clément Bœsch u at pkh.me
Sat Feb 14 21:43:39 CET 2015


On Sat, Feb 14, 2015 at 09:47:34AM +0100, Reimar Döffinger wrote:
> On 13.02.2015, at 17:51, "zhaoxiu.zeng" <zhaoxiu.zeng at gmail.com> wrote:
> > From b08b4a38c87000fe5549de96f65de6ba77740b30 Mon Sep 17 00:00:00 2001
> > From: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
> > Date: Fri, 13 Feb 2015 23:52:29 +0800
> > Subject: [PATCH 2/3] avcodec/wmalosslessdec: optimize sign operation
> > 
> > Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
> > ---
> > libavcodec/wmalosslessdec.c | 34 ++++++++--------------------------
> > 1 file changed, 8 insertions(+), 26 deletions(-)
> > 
> > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
> > index 9bd5e7b..1916594 100644
> > --- a/libavcodec/wmalosslessdec.c
> > +++ b/libavcodec/wmalosslessdec.c
> > @@ -175,6 +175,8 @@ typedef struct WmallDecodeCtx {
> >     int channel_coeffs[WMALL_MAX_CHANNELS][WMALL_BLOCK_MAX_SIZE];
> > } WmallDecodeCtx;
> > 
> > +/** Get sign of integer (1 for positive, -1 for negative and 0 for zero) */
> > +#define WMASIGN(x) ((x > 0) - (x < 0))
> 
> Don't we already have a helper function for this operation in avutil?
> I haven't checked, but I think I remember one.

I see only this one:
libavcodec/diracdec.c:#define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150214/42808564/attachment.asc>


More information about the ffmpeg-devel mailing list