[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_h2645: rename macros to read and write fields with custom range of values

James Almer jamrial at gmail.com
Mon Apr 29 02:35:31 EEST 2019


On 4/28/2019 8:19 PM, Mark Thompson wrote:
> On 17/04/2019 03:56, James Almer wrote:
>> These are more in line with the new ones introduced in the previous commit.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> No more i() macro :p
>>
>> Figured I'd leave all the byte and checksum fields using the custom range
>> macro, to have the explicit hex values visible. That's why they were not
>> changed in the first patch.
>>
>>  libavcodec/cbs_h2645.c                |   8 +-
>>  libavcodec/cbs_h264_syntax_template.c |  52 ++++++-------
>>  libavcodec/cbs_h265_syntax_template.c | 106 +++++++++++++-------------
>>  3 files changed, 83 insertions(+), 83 deletions(-)
>>
>> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
>> index 319202fc48..5623fa705e 100644
>> --- a/libavcodec/cbs_h2645.c
>> +++ b/libavcodec/cbs_h2645.c
>> @@ -250,21 +250,21 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
>>  
>>  #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
>>  
>> -#define u(width, name, range_min, range_max) \
>> +#define uc(width, name, range_min, range_max) \
>>          xu(width, name, current->name, range_min, range_max, 0)
>>  #define ub(width, name) \
>>          xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0)
>>  #define flag(name) ub(1, name)
>>  #define ue(name, range_min, range_max) \
>>          xue(name, current->name, range_min, range_max, 0)
>> -#define i(width, name, range_min, range_max) \
>> +#define ic(width, name, range_min, range_max) \
>>          xi(width, name, current->name, range_min, range_max, 0)
>>  #define ib(width, name) \
>>          xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0)
>>  #define se(name, range_min, range_max) \
>>          xse(name, current->name, range_min, range_max, 0)
>>  
>> -#define us(width, name, range_min, range_max, subs, ...) \
>> +#define ucs(width, name, range_min, range_max, subs, ...) \
>>          xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
>>  #define ubs(width, name, subs, ...) \
>>          xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
>> @@ -272,7 +272,7 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
>>          xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)
>>  #define ues(name, range_min, range_max, subs, ...) \
>>          xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)
>> -#define is(width, name, range_min, range_max, subs, ...) \
>> +#define ics(width, name, range_min, range_max, subs, ...) \
>>          xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
>>  #define ibs(width, name, subs, ...) \
>>          xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__)
> 
> Not sure I'm convinced by this one - the existing flag/u/ue/se set is really very nice in matching the standard.  If anything, it makes me think of going the other way in the AV1 code, though there are fewer limited values there so the bare f() case is not so common.
> 
> Thanks,
> 
> - Mark

I don't mind dropping this patch. You're right that as is it matches the
standard.


More information about the ffmpeg-devel mailing list