[FFmpeg-devel] [PATCH 2/5] avcodec/cbs_h2645: add helper macros for signed values

Mark Thompson sw at jkqxz.net
Wed Apr 17 02:24:09 EEST 2019


On 17/04/2019 00:01, James Almer wrote:
> On 4/16/2019 7:57 PM, Mark Thompson wrote:
>> On 15/04/2019 22:17, James Almer wrote:
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>>  libavcodec/cbs_h2645.c | 20 ++++++++++++++++++++
>>>  1 file changed, 20 insertions(+)
>>>
>>> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
>>> index e74f8dce81..a205293b3c 100644
>>> --- a/libavcodec/cbs_h2645.c
>>> +++ b/libavcodec/cbs_h2645.c
>>> @@ -255,6 +255,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
>>>  #define flag(name) u(1, name, 0, 1)
>>>  #define ue(name, range_min, range_max) \
>>>          xue(name, current->name, range_min, range_max, 0)
>>> +#define i(width, name, range_min, range_max) \
>>> +        xi(width, name, current->name, range_min, range_max, 0)
>>
>> I know it's right, but defining "i" as a macro feels like a pretty terrible idea in C :P
> 
> Eh, i guess :p. It at least didn't blow up here.
> 
> What would be best? s? su like in cbs_av1? Something else?

To clarify, I do think it's correct to call it i() here to match the H.26[45] standards.

Any other option would probably be more confusing.  And, as you note, it actually doesn't blow up because none of the many uses of i are followed by (.

- Mark


More information about the ffmpeg-devel mailing list