avcodec/cbs_{h2645,sei}: add support for Ambient Viewing Environment SEI

Defined by H.274, this SEI message is utilized by iPhones to save
the nominal ambient viewing environment for the display of recorded
HDR content.
pull/388/head
Jan Ekström 2 years ago
parent d3538dd293
commit f4bebc0c34
  1. 6
      libavcodec/cbs_h2645.c
  2. 6
      libavcodec/cbs_sei.h
  3. 17
      libavcodec/cbs_sei_syntax_template.c

@ -1500,6 +1500,12 @@ static const SEIMessageTypeDescriptor cbs_sei_common_types[] = {
sizeof(SEIRawAlternativeTransferCharacteristics),
SEI_MESSAGE_RW(sei, alternative_transfer_characteristics),
},
{
SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT,
1, 0,
sizeof(SEIRawAmbientViewingEnvironment),
SEI_MESSAGE_RW(sei, ambient_viewing_environment),
},
SEI_MESSAGE_TYPE_END,
};

@ -65,6 +65,12 @@ typedef struct SEIRawAlternativeTransferCharacteristics {
uint8_t preferred_transfer_characteristics;
} SEIRawAlternativeTransferCharacteristics;
typedef struct SEIRawAmbientViewingEnvironment {
uint32_t ambient_illuminance;
uint16_t ambient_light_x;
uint16_t ambient_light_y;
} SEIRawAmbientViewingEnvironment;
typedef struct SEIRawMessage {
uint32_t payload_type;
uint32_t payload_size;

@ -144,6 +144,23 @@ static int FUNC(alternative_transfer_characteristics)
return 0;
}
static int FUNC(ambient_viewing_environment)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawAmbientViewingEnvironment *current,
SEIMessageState *state)
{
static const uint16_t max_ambient_light_value = 50000;
int err;
HEADER("Ambient Viewing Environment");
u(32, ambient_illuminance, 1, MAX_UINT_BITS(32));
u(16, ambient_light_x, 0, max_ambient_light_value);
u(16, ambient_light_y, 0, max_ambient_light_value);
return 0;
}
static int FUNC(message)(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawMessage *current)
{

Loading…
Cancel
Save