mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-21 23:10:13 +00:00
avcodec/h2645_sei: Also support Active Format Descriptor for HEVC
It is valid for HEVC; in fact, the ATSC-HEVC spec [1] simply refers to the relevant H.264 spec. It is also trivial to implement now: Just move applying AFD to ff_h2645_sei_to_frame() and stop ignoring AFD when parsing a HEVC SEI containing it. A FATE-test for this has been added. [1]: https://www.atsc.org/atsc-documents/a3412017-video-hevc/ Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
01e775f4b7
commit
a5bba606a0
@ -95,7 +95,7 @@ static int decode_registered_user_data_dynamic_hdr_vivid(HEVCSEIDynamicHDRVivid
|
||||
}
|
||||
#endif
|
||||
|
||||
static int decode_registered_user_data_afd(H264SEIAFD *h, GetByteContext *gb)
|
||||
static int decode_registered_user_data_afd(H2645SEIAFD *h, GetByteContext *gb)
|
||||
{
|
||||
int flag;
|
||||
|
||||
@ -157,13 +157,10 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
|
||||
user_identifier = bytestream2_get_be32u(gb);
|
||||
switch (user_identifier) {
|
||||
case MKBETAG('D', 'T', 'G', '1'): // afd_data
|
||||
if (!IS_H264(codec_id))
|
||||
goto unsupported;
|
||||
return decode_registered_user_data_afd(&h->afd, gb);
|
||||
case MKBETAG('G', 'A', '9', '4'): // closed captions
|
||||
return decode_registered_user_data_closed_caption(&h->a53_caption, gb);
|
||||
default:
|
||||
unsupported:
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
|
||||
user_identifier);
|
||||
@ -537,6 +534,16 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
|
||||
}
|
||||
sei->unregistered.nb_buf_ref = 0;
|
||||
|
||||
if (sei->afd.present) {
|
||||
AVFrameSideData *sd = av_frame_new_side_data(frame, AV_FRAME_DATA_AFD,
|
||||
sizeof(uint8_t));
|
||||
|
||||
if (sd) {
|
||||
*sd->data = sei->afd.active_format_description;
|
||||
sei->afd.present = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@ typedef struct H2645SEIA53Caption {
|
||||
AVBufferRef *buf_ref;
|
||||
} H2645SEIA53Caption;
|
||||
|
||||
typedef struct H264SEIAFD {
|
||||
typedef struct H2645SEIAFD {
|
||||
int present;
|
||||
uint8_t active_format_description;
|
||||
} H264SEIAFD;
|
||||
} H2645SEIAFD;
|
||||
|
||||
typedef struct HEVCSEIDynamicHDRPlus {
|
||||
AVBufferRef *info;
|
||||
@ -99,7 +99,7 @@ typedef struct H2645SEIFilmGrainCharacteristics {
|
||||
|
||||
typedef struct H2645SEI {
|
||||
H2645SEIA53Caption a53_caption;
|
||||
H264SEIAFD afd; //< H.264 only
|
||||
H2645SEIAFD afd;
|
||||
HEVCSEIDynamicHDRPlus dynamic_hdr_plus; //< HEVC only
|
||||
HEVCSEIDynamicHDRVivid dynamic_hdr_vivid; //< HEVC only
|
||||
H2645SEIUnregistered unregistered;
|
||||
|
@ -1226,16 +1226,6 @@ static int h264_export_frame_props(H264Context *h)
|
||||
}
|
||||
}
|
||||
|
||||
if (h->sei.common.afd.present) {
|
||||
AVFrameSideData *sd = av_frame_new_side_data(out, AV_FRAME_DATA_AFD,
|
||||
sizeof(uint8_t));
|
||||
|
||||
if (sd) {
|
||||
*sd->data = h->sei.common.afd.active_format_description;
|
||||
h->sei.common.afd.present = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ff_h2645_sei_to_frame(out, &h->sei.common, AV_CODEC_ID_H264, h->avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -237,6 +237,9 @@ FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-paired-fields
|
||||
fate-hevc-monochrome-crop: CMD = probeframes -show_entries frame=width,height:stream=width,height $(TARGET_SAMPLES)/hevc/hevc-monochrome.hevc
|
||||
FATE_HEVC_FFPROBE-$(call PARSERDEMDEC, HEVC, HEVC, HEVC) += fate-hevc-monochrome-crop
|
||||
|
||||
fate-hevc-afd-tc-sei: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -bitexact -show_entries frame_side_data_list -select_streams v $(TARGET_SAMPLES)/mpegts/loewe.ts
|
||||
FATE_HEVC_FFPROBE-$(call PARSERDEMDEC, HEVC, HEVC, HEVC) += fate-hevc-afd-tc-sei
|
||||
|
||||
fate-hevc-hdr10-plus-metadata: CMD = probeframes -show_entries frame=side_data_list $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc
|
||||
FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-hdr10-plus-metadata
|
||||
|
||||
|
204
tests/ref/fate/hevc-afd-tc-sei
Normal file
204
tests/ref/fate/hevc-afd-tc-sei
Normal file
@ -0,0 +1,204 @@
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
||||
[FRAME]
|
||||
[SIDE_DATA]
|
||||
side_data_type=Active format description
|
||||
active_format=8
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
side_data_type=SMPTE 12-1 timecode
|
||||
[TIMECODE]
|
||||
value=00:00:00:00
|
||||
[/TIMECODE]
|
||||
[/SIDE_DATA]
|
||||
[/FRAME]
|
Loading…
Reference in New Issue
Block a user