mirror of https://git.ffmpeg.org/ffmpeg.git
hevc: Use common SEI types
This commit is contained in:
parent
64b3aac8d0
commit
773857df59
|
@ -1445,23 +1445,23 @@ static const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[] = {
|
|||
static void cbs_h265_free_sei_payload(H265RawSEIPayload *payload)
|
||||
{
|
||||
switch (payload->payload_type) {
|
||||
case HEVC_SEI_TYPE_BUFFERING_PERIOD:
|
||||
case HEVC_SEI_TYPE_PICTURE_TIMING:
|
||||
case HEVC_SEI_TYPE_PAN_SCAN_RECT:
|
||||
case HEVC_SEI_TYPE_RECOVERY_POINT:
|
||||
case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
|
||||
case HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS:
|
||||
case HEVC_SEI_TYPE_DECODED_PICTURE_HASH:
|
||||
case HEVC_SEI_TYPE_TIME_CODE:
|
||||
case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
|
||||
case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
|
||||
case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
|
||||
case HEVC_SEI_TYPE_ALPHA_CHANNEL_INFO:
|
||||
case SEI_TYPE_BUFFERING_PERIOD:
|
||||
case SEI_TYPE_PIC_TIMING:
|
||||
case SEI_TYPE_PAN_SCAN_RECT:
|
||||
case SEI_TYPE_RECOVERY_POINT:
|
||||
case SEI_TYPE_DISPLAY_ORIENTATION:
|
||||
case SEI_TYPE_ACTIVE_PARAMETER_SETS:
|
||||
case SEI_TYPE_DECODED_PICTURE_HASH:
|
||||
case SEI_TYPE_TIME_CODE:
|
||||
case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
|
||||
case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
|
||||
case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
|
||||
case SEI_TYPE_ALPHA_CHANNEL_INFO:
|
||||
break;
|
||||
case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
|
||||
case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
|
||||
av_buffer_unref(&payload->payload.user_data_registered.data_ref);
|
||||
break;
|
||||
case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
|
||||
case SEI_TYPE_USER_DATA_UNREGISTERED:
|
||||
av_buffer_unref(&payload->payload.user_data_unregistered.data_ref);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -2049,18 +2049,18 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
|
|||
} \
|
||||
} while (0)
|
||||
#define SEI_TYPE_N(type, prefix_valid, suffix_valid, name) \
|
||||
case HEVC_SEI_TYPE_ ## type: \
|
||||
case SEI_TYPE_ ## type: \
|
||||
SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
|
||||
CHECK(FUNC(sei_ ## name)(ctx, rw, ¤t->payload.name)); \
|
||||
break
|
||||
#define SEI_TYPE_S(type, prefix_valid, suffix_valid, name) \
|
||||
case HEVC_SEI_TYPE_ ## type: \
|
||||
case SEI_TYPE_ ## type: \
|
||||
SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
|
||||
CHECK(FUNC(sei_ ## name)(ctx, rw, ¤t->payload.name, \
|
||||
¤t->payload_size)); \
|
||||
break
|
||||
#define SEI_TYPE_E(type, prefix_valid, suffix_valid, name) \
|
||||
case HEVC_SEI_TYPE_ ## type: \
|
||||
case SEI_TYPE_ ## type: \
|
||||
SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
|
||||
CHECK(FUNC(sei_ ## name)(ctx, rw, ¤t->payload.name, \
|
||||
¤t->payload_size, \
|
||||
|
@ -2068,19 +2068,19 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
|
|||
break
|
||||
|
||||
#define SEI_TYPE_N2(type, prefix_valid, suffix_valid, name) \
|
||||
case HEVC_SEI_TYPE_ ## type: \
|
||||
case SEI_TYPE_ ## type: \
|
||||
SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
|
||||
CHECK(FUNC_SEI(sei_ ## name)(ctx, rw, ¤t->payload.name)); \
|
||||
break
|
||||
#define SEI_TYPE_S2(type, prefix_valid, suffix_valid, name) \
|
||||
case HEVC_SEI_TYPE_ ## type: \
|
||||
case SEI_TYPE_ ## type: \
|
||||
SEI_TYPE_CHECK_VALID(name, prefix_valid, suffix_valid); \
|
||||
CHECK(FUNC_SEI(sei_ ## name)(ctx, rw, ¤t->payload.name, \
|
||||
¤t->payload_size)); \
|
||||
break
|
||||
|
||||
SEI_TYPE_E(BUFFERING_PERIOD, 1, 0, buffering_period);
|
||||
SEI_TYPE_N(PICTURE_TIMING, 1, 0, pic_timing);
|
||||
SEI_TYPE_N(PIC_TIMING, 1, 0, pic_timing);
|
||||
SEI_TYPE_N(PAN_SCAN_RECT, 1, 0, pan_scan_rect);
|
||||
SEI_TYPE_S2(USER_DATA_REGISTERED_ITU_T_T35,
|
||||
1, 1, user_data_registered);
|
||||
|
@ -2090,7 +2090,8 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
|
|||
SEI_TYPE_N(ACTIVE_PARAMETER_SETS, 1, 0, active_parameter_sets);
|
||||
SEI_TYPE_N(DECODED_PICTURE_HASH, 0, 1, decoded_picture_hash);
|
||||
SEI_TYPE_N(TIME_CODE, 1, 0, time_code);
|
||||
SEI_TYPE_N2(MASTERING_DISPLAY_INFO, 1, 0, mastering_display_colour_volume);
|
||||
SEI_TYPE_N2(MASTERING_DISPLAY_COLOUR_VOLUME,
|
||||
1, 0, mastering_display_colour_volume);
|
||||
SEI_TYPE_N2(CONTENT_LIGHT_LEVEL_INFO,1, 0, content_light_level);
|
||||
SEI_TYPE_N2(ALTERNATIVE_TRANSFER_CHARACTERISTICS,
|
||||
1, 0, alternative_transfer_characteristics);
|
||||
|
|
|
@ -402,25 +402,25 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s,
|
|||
switch (type) {
|
||||
case 256: // Mismatched value from HM 8.1
|
||||
return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
|
||||
case HEVC_SEI_TYPE_FRAME_PACKING:
|
||||
case SEI_TYPE_FRAME_PACKING_ARRANGEMENT:
|
||||
return decode_nal_sei_frame_packing_arrangement(&s->frame_packing, gb);
|
||||
case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
|
||||
case SEI_TYPE_DISPLAY_ORIENTATION:
|
||||
return decode_nal_sei_display_orientation(&s->display_orientation, gb);
|
||||
case HEVC_SEI_TYPE_PICTURE_TIMING:
|
||||
case SEI_TYPE_PIC_TIMING:
|
||||
return decode_nal_sei_pic_timing(s, gb, ps, logctx, size);
|
||||
case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
|
||||
case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
|
||||
return decode_nal_sei_mastering_display_info(&s->mastering_display, gb);
|
||||
case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
|
||||
case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
|
||||
return decode_nal_sei_content_light_info(&s->content_light, gb);
|
||||
case HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS:
|
||||
case SEI_TYPE_ACTIVE_PARAMETER_SETS:
|
||||
return decode_nal_sei_active_parameter_sets(s, gb, logctx);
|
||||
case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
|
||||
case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
|
||||
return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, logctx, size);
|
||||
case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
|
||||
case SEI_TYPE_USER_DATA_UNREGISTERED:
|
||||
return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, size);
|
||||
case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
|
||||
case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
|
||||
return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb);
|
||||
case HEVC_SEI_TYPE_TIME_CODE:
|
||||
case SEI_TYPE_TIME_CODE:
|
||||
return decode_nal_sei_timecode(&s->timecode, gb);
|
||||
default:
|
||||
av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
|
||||
|
@ -433,7 +433,7 @@ static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEI *s,
|
|||
int type, int size)
|
||||
{
|
||||
switch (type) {
|
||||
case HEVC_SEI_TYPE_DECODED_PICTURE_HASH:
|
||||
case SEI_TYPE_DECODED_PICTURE_HASH:
|
||||
return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
|
||||
default:
|
||||
av_log(logctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
|
||||
|
|
|
@ -24,40 +24,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "get_bits.h"
|
||||
#include "sei.h"
|
||||
|
||||
/**
|
||||
* SEI message types
|
||||
*/
|
||||
typedef enum {
|
||||
HEVC_SEI_TYPE_BUFFERING_PERIOD = 0,
|
||||
HEVC_SEI_TYPE_PICTURE_TIMING = 1,
|
||||
HEVC_SEI_TYPE_PAN_SCAN_RECT = 2,
|
||||
HEVC_SEI_TYPE_FILLER_PAYLOAD = 3,
|
||||
HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35 = 4,
|
||||
HEVC_SEI_TYPE_USER_DATA_UNREGISTERED = 5,
|
||||
HEVC_SEI_TYPE_RECOVERY_POINT = 6,
|
||||
HEVC_SEI_TYPE_SCENE_INFO = 9,
|
||||
HEVC_SEI_TYPE_FULL_FRAME_SNAPSHOT = 15,
|
||||
HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
|
||||
HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17,
|
||||
HEVC_SEI_TYPE_FILM_GRAIN_CHARACTERISTICS = 19,
|
||||
HEVC_SEI_TYPE_POST_FILTER_HINT = 22,
|
||||
HEVC_SEI_TYPE_TONE_MAPPING_INFO = 23,
|
||||
HEVC_SEI_TYPE_FRAME_PACKING = 45,
|
||||
HEVC_SEI_TYPE_DISPLAY_ORIENTATION = 47,
|
||||
HEVC_SEI_TYPE_SOP_DESCRIPTION = 128,
|
||||
HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS = 129,
|
||||
HEVC_SEI_TYPE_DECODING_UNIT_INFO = 130,
|
||||
HEVC_SEI_TYPE_TEMPORAL_LEVEL0_INDEX = 131,
|
||||
HEVC_SEI_TYPE_DECODED_PICTURE_HASH = 132,
|
||||
HEVC_SEI_TYPE_SCALABLE_NESTING = 133,
|
||||
HEVC_SEI_TYPE_REGION_REFRESH_INFO = 134,
|
||||
HEVC_SEI_TYPE_TIME_CODE = 136,
|
||||
HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO = 137,
|
||||
HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,
|
||||
HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147,
|
||||
HEVC_SEI_TYPE_ALPHA_CHANNEL_INFO = 165,
|
||||
} HEVC_SEI_Type;
|
||||
|
||||
typedef enum {
|
||||
HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
|
||||
|
|
|
@ -2247,7 +2247,7 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
|||
|
||||
if (tc_data) {
|
||||
sei_data[sei_count].payloadSize = (uint32_t)tc_size;
|
||||
sei_data[sei_count].payloadType = HEVC_SEI_TYPE_TIME_CODE;
|
||||
sei_data[sei_count].payloadType = SEI_TYPE_TIME_CODE;
|
||||
sei_data[sei_count].payload = (uint8_t*)tc_data;
|
||||
sei_count ++;
|
||||
}
|
||||
|
|
|
@ -218,14 +218,14 @@ static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
|
|||
i = 0;
|
||||
|
||||
if (priv->sei_needed & SEI_MASTERING_DISPLAY) {
|
||||
sei->payload[i].payload_type = HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO;
|
||||
sei->payload[i].payload_type = SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME;
|
||||
sei->payload[i].payload.mastering_display_colour_volume =
|
||||
priv->sei_mastering_display;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (priv->sei_needed & SEI_CONTENT_LIGHT_LEVEL) {
|
||||
sei->payload[i].payload_type = HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO;
|
||||
sei->payload[i].payload_type = SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO;
|
||||
sei->payload[i].payload.content_light_level = priv->sei_content_light_level;
|
||||
++i;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue