[FFmpeg-devel] [PATCH]lavc/cbs_vp9: Avoid an implicit conversion from 255 to -1

James Almer jamrial at gmail.com
Fri Dec 7 02:17:30 EET 2018


On 12/6/2018 8:29 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch silences an ugly clang warning.
> 
> Please comment, Carl Eugen
> 
> 
> 0001-lavc-cbs_vp9-Avoid-an-implicit-conversion-from-255-t.patch
> 
> From 20a643259b8e382bdfd759af78c36c3442c0affc Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Fri, 7 Dec 2018 00:26:40 +0100
> Subject: [PATCH] lavc/cbs_vp9: Avoid an implicit conversion from 255 to -1.
> 
> Silences a warning with clang:
> libavcodec/cbs_vp9_syntax_template.c:220:17: warning: implicit conversion from 'int' to 'int8_t' (aka 'signed char')
>       changes value from 255 to -1
> ---
>  libavcodec/cbs_vp9.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
> index c03ce98..95d147d 100644
> --- a/libavcodec/cbs_vp9.c
> +++ b/libavcodec/cbs_vp9.c
> @@ -310,7 +310,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
>          if (prob_coded) \
>              xf(8, name.prob, prob, subs, __VA_ARGS__); \
>          else \
> -            prob = 255; \
> +            prob = -1; \

I think it may be better to make prob uint8_t instead, but Mark knows
best, so wait for him to comment.

>          current->name = prob; \
>      } while (0)
>  
> -- 1.7.10.4
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list