diff mbox

[FFmpeg-devel] avcodec/cbs_h264: add support for Alternative Transfer Characteristics SEI message

Message ID 20190526184035.134-1-jamrial@gmail.com
State Accepted
Commit ff2a638c83161b2b5d15acca494436922b389d51
Headers show

Commit Message

James Almer May 26, 2019, 6:40 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_h264.h                 |  6 ++++++
 libavcodec/cbs_h2645.c                |  1 +
 libavcodec/cbs_h264_syntax_template.c | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)

Comments

Mark Thompson June 2, 2019, 4:38 p.m. UTC | #1
On 26/05/2019 19:40, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/cbs_h264.h                 |  6 ++++++
>  libavcodec/cbs_h2645.c                |  1 +
>  libavcodec/cbs_h264_syntax_template.c | 17 +++++++++++++++++
>  3 files changed, 24 insertions(+)
> 
> diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
> index cc46eeb3b0..a31be298ba 100644
> --- a/libavcodec/cbs_h264.h
> +++ b/libavcodec/cbs_h264.h
> @@ -314,6 +314,10 @@ typedef struct H264RawSEIMasteringDisplayColourVolume {
>      uint32_t min_display_mastering_luminance;
>  } H264RawSEIMasteringDisplayColourVolume;
>  
> +typedef struct H264RawSEIAlternativeTransferCharacteristics {
> +    uint8_t preferred_transfer_characteristics;
> +} H264RawSEIAlternativeTransferCharacteristics;
> +
>  typedef struct H264RawSEIPayload {
>      uint32_t payload_type;
>      uint32_t payload_size;
> @@ -327,6 +331,8 @@ typedef struct H264RawSEIPayload {
>          H264RawSEIRecoveryPoint recovery_point;
>          H264RawSEIDisplayOrientation display_orientation;
>          H264RawSEIMasteringDisplayColourVolume mastering_display_colour_volume;
> +        H264RawSEIAlternativeTransferCharacteristics
> +            alternative_transfer_characteristics;
>          struct {
>              uint8_t *data;
>              size_t data_length;
> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> index 319202fc48..0456937710 100644
> --- a/libavcodec/cbs_h2645.c
> +++ b/libavcodec/cbs_h2645.c
> @@ -458,6 +458,7 @@ static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
>      case H264_SEI_TYPE_RECOVERY_POINT:
>      case H264_SEI_TYPE_DISPLAY_ORIENTATION:
>      case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
> +    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
>          break;
>      case H264_SEI_TYPE_USER_DATA_REGISTERED:
>          av_buffer_unref(&payload->payload.user_data_registered.data_ref);
> diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
> index 95fc6d7194..cdacd79fc4 100644
> --- a/libavcodec/cbs_h264_syntax_template.c
> +++ b/libavcodec/cbs_h264_syntax_template.c
> @@ -815,6 +815,19 @@ static int FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx,
>      return 0;
>  }
>  
> +static int FUNC(sei_alternative_transfer_characteristics)(CodedBitstreamContext *ctx,
> +                                                          RWContext *rw,
> +                                                          H264RawSEIAlternativeTransferCharacteristics *current)
> +{
> +    int err;
> +
> +    HEADER("Alternative Transfer Characteristics");
> +
> +    ub(8, preferred_transfer_characteristics);
> +
> +    return 0;
> +}
> +
>  static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
>                               H264RawSEIPayload *current)
>  {
> @@ -866,6 +879,10 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
>          CHECK(FUNC(sei_mastering_display_colour_volume)
>                (ctx, rw, &current->payload.mastering_display_colour_volume));
>          break;
> +    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
> +        CHECK(FUNC(sei_alternative_transfer_characteristics)
> +              (ctx, rw, &current->payload.alternative_transfer_characteristics));
> +        break;
>      default:
>          {
>  #ifdef READ
> 

LGTM.

Thanks,

- Mark
James Almer June 3, 2019, 10:23 p.m. UTC | #2
On 6/2/2019 1:38 PM, Mark Thompson wrote:
> On 26/05/2019 19:40, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/cbs_h264.h                 |  6 ++++++
>>  libavcodec/cbs_h2645.c                |  1 +
>>  libavcodec/cbs_h264_syntax_template.c | 17 +++++++++++++++++
>>  3 files changed, 24 insertions(+)
>>
>> diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
>> index cc46eeb3b0..a31be298ba 100644
>> --- a/libavcodec/cbs_h264.h
>> +++ b/libavcodec/cbs_h264.h
>> @@ -314,6 +314,10 @@ typedef struct H264RawSEIMasteringDisplayColourVolume {
>>      uint32_t min_display_mastering_luminance;
>>  } H264RawSEIMasteringDisplayColourVolume;
>>  
>> +typedef struct H264RawSEIAlternativeTransferCharacteristics {
>> +    uint8_t preferred_transfer_characteristics;
>> +} H264RawSEIAlternativeTransferCharacteristics;
>> +
>>  typedef struct H264RawSEIPayload {
>>      uint32_t payload_type;
>>      uint32_t payload_size;
>> @@ -327,6 +331,8 @@ typedef struct H264RawSEIPayload {
>>          H264RawSEIRecoveryPoint recovery_point;
>>          H264RawSEIDisplayOrientation display_orientation;
>>          H264RawSEIMasteringDisplayColourVolume mastering_display_colour_volume;
>> +        H264RawSEIAlternativeTransferCharacteristics
>> +            alternative_transfer_characteristics;
>>          struct {
>>              uint8_t *data;
>>              size_t data_length;
>> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
>> index 319202fc48..0456937710 100644
>> --- a/libavcodec/cbs_h2645.c
>> +++ b/libavcodec/cbs_h2645.c
>> @@ -458,6 +458,7 @@ static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
>>      case H264_SEI_TYPE_RECOVERY_POINT:
>>      case H264_SEI_TYPE_DISPLAY_ORIENTATION:
>>      case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
>> +    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
>>          break;
>>      case H264_SEI_TYPE_USER_DATA_REGISTERED:
>>          av_buffer_unref(&payload->payload.user_data_registered.data_ref);
>> diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
>> index 95fc6d7194..cdacd79fc4 100644
>> --- a/libavcodec/cbs_h264_syntax_template.c
>> +++ b/libavcodec/cbs_h264_syntax_template.c
>> @@ -815,6 +815,19 @@ static int FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx,
>>      return 0;
>>  }
>>  
>> +static int FUNC(sei_alternative_transfer_characteristics)(CodedBitstreamContext *ctx,
>> +                                                          RWContext *rw,
>> +                                                          H264RawSEIAlternativeTransferCharacteristics *current)
>> +{
>> +    int err;
>> +
>> +    HEADER("Alternative Transfer Characteristics");
>> +
>> +    ub(8, preferred_transfer_characteristics);
>> +
>> +    return 0;
>> +}
>> +
>>  static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
>>                               H264RawSEIPayload *current)
>>  {
>> @@ -866,6 +879,10 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
>>          CHECK(FUNC(sei_mastering_display_colour_volume)
>>                (ctx, rw, &current->payload.mastering_display_colour_volume));
>>          break;
>> +    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
>> +        CHECK(FUNC(sei_alternative_transfer_characteristics)
>> +              (ctx, rw, &current->payload.alternative_transfer_characteristics));
>> +        break;
>>      default:
>>          {
>>  #ifdef READ
>>
> 
> LGTM.
> 
> Thanks,
> 
> - Mark

Pushed, thanks!
diff mbox

Patch

diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
index cc46eeb3b0..a31be298ba 100644
--- a/libavcodec/cbs_h264.h
+++ b/libavcodec/cbs_h264.h
@@ -314,6 +314,10 @@  typedef struct H264RawSEIMasteringDisplayColourVolume {
     uint32_t min_display_mastering_luminance;
 } H264RawSEIMasteringDisplayColourVolume;
 
+typedef struct H264RawSEIAlternativeTransferCharacteristics {
+    uint8_t preferred_transfer_characteristics;
+} H264RawSEIAlternativeTransferCharacteristics;
+
 typedef struct H264RawSEIPayload {
     uint32_t payload_type;
     uint32_t payload_size;
@@ -327,6 +331,8 @@  typedef struct H264RawSEIPayload {
         H264RawSEIRecoveryPoint recovery_point;
         H264RawSEIDisplayOrientation display_orientation;
         H264RawSEIMasteringDisplayColourVolume mastering_display_colour_volume;
+        H264RawSEIAlternativeTransferCharacteristics
+            alternative_transfer_characteristics;
         struct {
             uint8_t *data;
             size_t data_length;
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 319202fc48..0456937710 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -458,6 +458,7 @@  static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
     case H264_SEI_TYPE_RECOVERY_POINT:
     case H264_SEI_TYPE_DISPLAY_ORIENTATION:
     case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
+    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
         break;
     case H264_SEI_TYPE_USER_DATA_REGISTERED:
         av_buffer_unref(&payload->payload.user_data_registered.data_ref);
diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 95fc6d7194..cdacd79fc4 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -815,6 +815,19 @@  static int FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx,
     return 0;
 }
 
+static int FUNC(sei_alternative_transfer_characteristics)(CodedBitstreamContext *ctx,
+                                                          RWContext *rw,
+                                                          H264RawSEIAlternativeTransferCharacteristics *current)
+{
+    int err;
+
+    HEADER("Alternative Transfer Characteristics");
+
+    ub(8, preferred_transfer_characteristics);
+
+    return 0;
+}
+
 static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
                              H264RawSEIPayload *current)
 {
@@ -866,6 +879,10 @@  static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
         CHECK(FUNC(sei_mastering_display_colour_volume)
               (ctx, rw, &current->payload.mastering_display_colour_volume));
         break;
+    case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
+        CHECK(FUNC(sei_alternative_transfer_characteristics)
+              (ctx, rw, &current->payload.alternative_transfer_characteristics));
+        break;
     default:
         {
 #ifdef READ