diff mbox series

[FFmpeg-devel,22/35] avcodec/proresenc_anatoliy: remove IS_NEGATIVE() macro

Message ID 20231211014429.1841681-23-u@pkh.me
State Accepted
Commit d269f841995b9ecc5d169090841c7541c18a9bb4
Headers show
Series [FFmpeg-devel,01/35] avcodec/proresenc_kostya: remove an unnecessary parenthesis level in MAKE_CODE() macro | expand

Commit Message

Clément Bœsch Dec. 11, 2023, 1:35 a.m. UTC
This makes the function closer to encode_acs() in proresenc_kostya.
---
 libavcodec/proresenc_anatoliy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefano Sabatini Dec. 18, 2023, 10:29 p.m. UTC | #1
On date Monday 2023-12-11 02:35:23 +0100, Clément Bœsch wrote:
> This makes the function closer to encode_acs() in proresenc_kostya.
> ---
>  libavcodec/proresenc_anatoliy.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
> index 4ea3d89126..43dee7f79b 100644
> --- a/libavcodec/proresenc_anatoliy.c
> +++ b/libavcodec/proresenc_anatoliy.c
> @@ -257,7 +257,6 @@ static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
>  
>  #define GET_SIGN(x)  ((x) >> 31)
>  #define TO_GOLOMB(val) (((val) * 2) ^ GET_SIGN(val))
> -#define IS_NEGATIVE(val) ((GET_SIGN(val) ^ -1) + 1)
>  #define TO_GOLOMB2(val,sign) ((val)==0 ? 0 : ((val) << 1) + (sign))
>  
>  static av_always_inline int get_level(int val)
> @@ -318,7 +317,7 @@ static void encode_ac_coeffs(PutBitContext *pb,
>  
>                  prev_level = level;
>  
> -                put_bits(pb, 1, IS_NEGATIVE(val));
> +                put_sbits(pb, 1, GET_SIGN(val));

Should be good.
diff mbox series

Patch

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 4ea3d89126..43dee7f79b 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -257,7 +257,6 @@  static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
 
 #define GET_SIGN(x)  ((x) >> 31)
 #define TO_GOLOMB(val) (((val) * 2) ^ GET_SIGN(val))
-#define IS_NEGATIVE(val) ((GET_SIGN(val) ^ -1) + 1)
 #define TO_GOLOMB2(val,sign) ((val)==0 ? 0 : ((val) << 1) + (sign))
 
 static av_always_inline int get_level(int val)
@@ -318,7 +317,7 @@  static void encode_ac_coeffs(PutBitContext *pb,
 
                 prev_level = level;
 
-                put_bits(pb, 1, IS_NEGATIVE(val));
+                put_sbits(pb, 1, GET_SIGN(val));
             } else {
                 ++run;
             }