[FFmpeg-devel,2/3] avcodec/cbs_h2645: use the fixed() macro for forbidden_zero_bit

Submitted by James Almer on April 17, 2019, 2:56 a.m.

Details

Message ID 20190417025635.9700-2-jamrial@gmail.com
State Accepted
Commit 45048ece81d395431d5604cf30596aaa62692da3
Headers show

Commit Message

James Almer April 17, 2019, 2:56 a.m.
This follows the spec definition, and removes a field from the relevant
structs.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_h264.h                 | 1 -
 libavcodec/cbs_h264_syntax_template.c | 2 +-
 libavcodec/cbs_h265.h                 | 1 -
 libavcodec/cbs_h265_syntax_template.c | 2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)

Comments

Mark Thompson April 28, 2019, 11 p.m.
On 17/04/2019 03:56, James Almer wrote:
> This follows the spec definition, and removes a field from the relevant
> structs.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/cbs_h264.h                 | 1 -
>  libavcodec/cbs_h264_syntax_template.c | 2 +-
>  libavcodec/cbs_h265.h                 | 1 -
>  libavcodec/cbs_h265_syntax_template.c | 2 +-
>  4 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
> index b5eee7c370..cc46eeb3b0 100644
> --- a/libavcodec/cbs_h264.h
> +++ b/libavcodec/cbs_h264.h
> @@ -38,7 +38,6 @@ enum {
>  
>  
>  typedef struct H264RawNALUnitHeader {
> -    uint8_t forbidden_zero_bit;
>      uint8_t nal_ref_idc;
>      uint8_t nal_unit_type;
>  
> diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
> index cc9bd07590..95fc6d7194 100644
> --- a/libavcodec/cbs_h264_syntax_template.c
> +++ b/libavcodec/cbs_h264_syntax_template.c
> @@ -33,7 +33,7 @@ static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
>  {
>      int err;
>  
> -    u(1, forbidden_zero_bit, 0, 0);
> +    fixed(1, forbidden_zero_bit, 0);
>      ub(2, nal_ref_idc);
>      ub(5, nal_unit_type);
>  
> diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
> index 0c0e4f84b0..c9bc90187b 100644
> --- a/libavcodec/cbs_h265.h
> +++ b/libavcodec/cbs_h265.h
> @@ -35,7 +35,6 @@ enum {
>  };
>  
>  typedef struct H265RawNALUnitHeader {
> -    uint8_t forbidden_zero_bit;
>      uint8_t nal_unit_type;
>      uint8_t nuh_layer_id;
>      uint8_t nuh_temporal_id_plus1;
> diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
> index 87d1332f48..9000bbc307 100644
> --- a/libavcodec/cbs_h265_syntax_template.c
> +++ b/libavcodec/cbs_h265_syntax_template.c
> @@ -33,7 +33,7 @@ static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
>  {
>      int err;
>  
> -    u(1, forbidden_zero_bit, 0, 0);
> +    fixed(1, forbidden_zero_bit, 0);
>  
>      if (expected_nal_unit_type >= 0)
>          u(6, nal_unit_type, expected_nal_unit_type,
> 

Yep, LGTM.

Thanks,

- Mark
James Almer April 28, 2019, 11:34 p.m.
On 4/28/2019 8:00 PM, Mark Thompson wrote:
> On 17/04/2019 03:56, James Almer wrote:
>> This follows the spec definition, and removes a field from the relevant
>> structs.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/cbs_h264.h                 | 1 -
>>  libavcodec/cbs_h264_syntax_template.c | 2 +-
>>  libavcodec/cbs_h265.h                 | 1 -
>>  libavcodec/cbs_h265_syntax_template.c | 2 +-
>>  4 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
>> index b5eee7c370..cc46eeb3b0 100644
>> --- a/libavcodec/cbs_h264.h
>> +++ b/libavcodec/cbs_h264.h
>> @@ -38,7 +38,6 @@ enum {
>>  
>>  
>>  typedef struct H264RawNALUnitHeader {
>> -    uint8_t forbidden_zero_bit;
>>      uint8_t nal_ref_idc;
>>      uint8_t nal_unit_type;
>>  
>> diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
>> index cc9bd07590..95fc6d7194 100644
>> --- a/libavcodec/cbs_h264_syntax_template.c
>> +++ b/libavcodec/cbs_h264_syntax_template.c
>> @@ -33,7 +33,7 @@ static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
>>  {
>>      int err;
>>  
>> -    u(1, forbidden_zero_bit, 0, 0);
>> +    fixed(1, forbidden_zero_bit, 0);
>>      ub(2, nal_ref_idc);
>>      ub(5, nal_unit_type);
>>  
>> diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
>> index 0c0e4f84b0..c9bc90187b 100644
>> --- a/libavcodec/cbs_h265.h
>> +++ b/libavcodec/cbs_h265.h
>> @@ -35,7 +35,6 @@ enum {
>>  };
>>  
>>  typedef struct H265RawNALUnitHeader {
>> -    uint8_t forbidden_zero_bit;
>>      uint8_t nal_unit_type;
>>      uint8_t nuh_layer_id;
>>      uint8_t nuh_temporal_id_plus1;
>> diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
>> index 87d1332f48..9000bbc307 100644
>> --- a/libavcodec/cbs_h265_syntax_template.c
>> +++ b/libavcodec/cbs_h265_syntax_template.c
>> @@ -33,7 +33,7 @@ static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
>>  {
>>      int err;
>>  
>> -    u(1, forbidden_zero_bit, 0, 0);
>> +    fixed(1, forbidden_zero_bit, 0);
>>  
>>      if (expected_nal_unit_type >= 0)
>>          u(6, nal_unit_type, expected_nal_unit_type,
>>
> 
> Yep, LGTM.
> 
> Thanks,
> 
> - Mark

Pushed.

Patch hide | download patch | download mbox

diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
index b5eee7c370..cc46eeb3b0 100644
--- a/libavcodec/cbs_h264.h
+++ b/libavcodec/cbs_h264.h
@@ -38,7 +38,6 @@  enum {
 
 
 typedef struct H264RawNALUnitHeader {
-    uint8_t forbidden_zero_bit;
     uint8_t nal_ref_idc;
     uint8_t nal_unit_type;
 
diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index cc9bd07590..95fc6d7194 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -33,7 +33,7 @@  static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
 {
     int err;
 
-    u(1, forbidden_zero_bit, 0, 0);
+    fixed(1, forbidden_zero_bit, 0);
     ub(2, nal_ref_idc);
     ub(5, nal_unit_type);
 
diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 0c0e4f84b0..c9bc90187b 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -35,7 +35,6 @@  enum {
 };
 
 typedef struct H265RawNALUnitHeader {
-    uint8_t forbidden_zero_bit;
     uint8_t nal_unit_type;
     uint8_t nuh_layer_id;
     uint8_t nuh_temporal_id_plus1;
diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 87d1332f48..9000bbc307 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -33,7 +33,7 @@  static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw,
 {
     int err;
 
-    u(1, forbidden_zero_bit, 0, 0);
+    fixed(1, forbidden_zero_bit, 0);
 
     if (expected_nal_unit_type >= 0)
         u(6, nal_unit_type, expected_nal_unit_type,