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

zhaoxiu.zeng zhaoxiu.zeng at gmail.com
Sat Feb 14 10:20:32 CET 2015


在 2015/2/14 16:47, Reimar Döffinger 写道:
> 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 just move the definition from back.
We have a FFSIGN definition in avutil, but it is "((a) > 0 ? 1 : -1)".

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list