On date Monday 2023-12-11 02:35:30 +0100, Clément Bœsch wrote:
> This matches the code from proresenc_kostya.
> ---
>  libavcodec/proresenc_anatoliy.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
> index 0318379461..88c6d47ab7 100644
> --- a/libavcodec/proresenc_anatoliy.c
> +++ b/libavcodec/proresenc_anatoliy.c
> @@ -258,13 +258,6 @@ static void encode_vlc_codeword(PutBitContext *pb, 
> unsigned codebook, int val)
>  #define GET_SIGN(x)  ((x) >> 31)
>  #define MAKE_CODE(x) (((x) * 2) ^ GET_SIGN(x))
>  
> -static av_always_inline int get_level(int val)
> -{
> -    int sign = (val >> 31);
> -    return (val ^ sign) - sign;
> -}
> -
> -
>  static void encode_dcs(PutBitContext *pb, int16_t *blocks,
>                         int blocks_per_slice, int scale)
>  {
> @@ -305,7 +298,7 @@ static void encode_ac_coeffs(PutBitContext *pb,
>  
>                  prev_run   = run;
>                  run        = 0;
> -                level      = get_level(val);
> +                level      = FFABS(val);
>                  code       = level - 1;

LGTM, given that (for sign = 1):
val ^ sign = val + 1
val + 1 - 1 = val + 1 + 2**N -1 = val + 2**N = ABS(val) 
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to