[FFmpeg-devel] Patch to parse H264 SEI Green Metadata

Vittorio Giovara vittorio.giovara at gmail.com
Fri Jun 26 02:56:17 CEST 2015


On Thu, Jun 25, 2015 at 5:30 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Thu, Jun 25, 2015 at 11:13:53AM +0000, Nicolas Derouineau wrote:
>> Hello,
>> Please find here enclosed a patch enabling h264 Green Metada SEI parsing for FFMPEG. You'll be able to find reference bitstreams containing the metadata at the following adress:
>>
>> ftp-public-greenvideo.insa-rennes.fr
>>
>>
>> The Nal SEI syntax is the same as the one used in the last JM release (19.0).
>>
>>
>> Best Regards,
>>
>>
>>
>> Nicolas DEROUINEAU
>> Research Engineer
>> VITEC
>>
>> T.  +33 1 46 73 06 06
>> E.  nicolas.derouineau at vitec.com<mailto:nicolas.derouineau at vitec.com>
>> W. www.vitec.com<http://www.vitec.com/>
>
>>  h264.h     |   20 ++++++++++++++++++
>>  h264_sei.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 87 insertions(+)
>> feb39a55dd6afbaf341df765eafc02266c00a588  0002-Enabling-GreenMetadata-SEI-parsing-for-H264-decoder.patch
>> From 60903bff6429182c84dc5daef0d26695d3f71861 Mon Sep 17 00:00:00 2001
>> From: Nicolas DEROUINEAU <nicolas.derouineau at vitec.com>
>> Date: Thu, 25 Jun 2015 13:02:39 +0200
>> Subject: [PATCH 2/2] Enabling GreenMetadata SEI parsing for H264 decoder
>>
>> ---
>>  libavcodec/h264.h     | 20 +++++++++++++++
>>  libavcodec/h264_sei.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 87 insertions(+)
>>
>> diff --git a/libavcodec/h264.h b/libavcodec/h264.h
>> index 548510d..0324dc1 100644
>> --- a/libavcodec/h264.h
>> +++ b/libavcodec/h264.h
>> @@ -137,6 +137,7 @@ typedef enum {
>>      SEI_TYPE_RECOVERY_POINT         = 6,   ///< recovery point (frame # to decoder sync)
>>      SEI_TYPE_FRAME_PACKING          = 45,  ///< frame packing arrangement
>>      SEI_TYPE_DISPLAY_ORIENTATION    = 47,  ///< display orientation
>> +    SEI_TYPE_GREEN_METADATA  = 56  ///< GreenMPEG information
>>  } SEI_Type;
>>
>>  /**
>> @@ -268,6 +269,22 @@ typedef struct FPA {
>>  } FPA;
>>
>>  /**
>> + * Green MetaData Information Type
>> + */
>> +typedef struct GreenMetaData {
>> +    unsigned char  green_metadata_type;
>> +    unsigned char  period_type;
>> +    unsigned short num_seconds;
>> +    unsigned short num_pictures;

uint16_t and uint8_t would probably be more appropriate here

>> +    unsigned char percent_non_zero_macroblocks;
>> +    unsigned char percent_intra_coded_macroblocks;
>> +    unsigned char percent_six_tap_filtering;
>> +    unsigned char percent_alpha_point_deblocking_instance;
>> +    unsigned char xsd_metric_type;
>> +    unsigned short xsd_metric_value;
>> +} GreenMetaData;
>> +
>> +/**
>>   * Memory management control operation opcode.
>>   */
>>  typedef enum MMCOOpcode {
>> @@ -804,6 +821,9 @@ typedef struct H264Context {
>>      /* Motion Estimation */
>>      qpel_mc_func (*qpel_put)[16];
>>      qpel_mc_func (*qpel_avg)[16];
>> +
>> +    /*Green Metadata */
>> +    GreenMetaData sei_GreenMetaData;

This is mostly a nit, but could you maybe avoid using CamelCase naming
in function and variable names?
eg GreenMetaData sei_green_metadata would reflect more the rest of the code.

thanks
-- 
Vittorio


More information about the ffmpeg-devel mailing list