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

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Dec 10 03:20:40 EET 2018


2018-12-09 16:15 GMT+01:00, Mark Thompson <sw at jkqxz.net>:
> On 07/12/2018 00:17, James Almer wrote:
>> 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,
>
> Yes, this.  The values are all uint8_t, so this one should be too.

Applied this variant.

Thank you, Carl Eugen


More information about the ffmpeg-devel mailing list