diff mbox

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

Message ID CAB0OVGp6_7QxKitZ+vrgkFMRBYGbscyH-_iEuv6-XUqL1kEx+g@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Dec. 6, 2018, 11:29 p.m. UTC
Hi!

Attached patch silences an ugly clang warning.

Please comment, Carl Eugen

Comments

James Almer Dec. 7, 2018, 12:17 a.m. UTC | #1
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@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@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Mark Thompson Dec. 9, 2018, 3:15 p.m. UTC | #2
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@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.

Thanks,

- Mark
Carl Eugen Hoyos Dec. 10, 2018, 1:20 a.m. UTC | #3
2018-12-09 16:15 GMT+01:00, Mark Thompson <sw@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@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
diff mbox

Patch

From 20a643259b8e382bdfd759af78c36c3442c0affc Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@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; \
         current->name = prob; \
     } while (0)
 
-- 
1.7.10.4