h264_sei: Add namespace prefix to all SEI values

This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.
pull/272/head
Mark Thompson 8 years ago
parent 4d56f7ab8f
commit 6ea220cbee
  1. 26
      libavcodec/h264_parser.c
  2. 16
      libavcodec/h264_sei.c
  3. 39
      libavcodec/h264_sei.h
  4. 24
      libavcodec/h264_slice.c
  5. 6
      libavcodec/vaapi_encode_h264.c

@ -404,23 +404,23 @@ static inline int parse_nal_units(AVCodecParserContext *s,
if (sps->pic_struct_present_flag && p->sei.picture_timing.present) { if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
switch (p->sei.picture_timing.pic_struct) { switch (p->sei.picture_timing.pic_struct) {
case SEI_PIC_STRUCT_TOP_FIELD: case H264_SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_BOTTOM_FIELD: case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
s->repeat_pict = 0; s->repeat_pict = 0;
break; break;
case SEI_PIC_STRUCT_FRAME: case H264_SEI_PIC_STRUCT_FRAME:
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
s->repeat_pict = 1; s->repeat_pict = 1;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
s->repeat_pict = 2; s->repeat_pict = 2;
break; break;
case SEI_PIC_STRUCT_FRAME_DOUBLING: case H264_SEI_PIC_STRUCT_FRAME_DOUBLING:
s->repeat_pict = 3; s->repeat_pict = 3;
break; break;
case SEI_PIC_STRUCT_FRAME_TRIPLING: case H264_SEI_PIC_STRUCT_FRAME_TRIPLING:
s->repeat_pict = 5; s->repeat_pict = 5;
break; break;
default: default:
@ -435,12 +435,12 @@ static inline int parse_nal_units(AVCodecParserContext *s,
s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
if (sps->pic_struct_present_flag && p->sei.picture_timing.present) { if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
switch (p->sei.picture_timing.pic_struct) { switch (p->sei.picture_timing.pic_struct) {
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
s->field_order = AV_FIELD_TT; s->field_order = AV_FIELD_TT;
break; break;
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
s->field_order = AV_FIELD_BB; s->field_order = AV_FIELD_BB;
break; break;
default: default:

@ -71,7 +71,7 @@ static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
h->pic_struct = get_bits(gb, 4); h->pic_struct = get_bits(gb, 4);
h->ct_type = 0; h->ct_type = 0;
if (h->pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) if (h->pic_struct > H264_SEI_PIC_STRUCT_FRAME_TRIPLING)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
num_clock_ts = sei_num_clock_ts_table[h->pic_struct]; num_clock_ts = sei_num_clock_ts_table[h->pic_struct];
@ -375,25 +375,25 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
} }
switch (type) { switch (type) {
case SEI_TYPE_PIC_TIMING: // Picture timing SEI case H264_SEI_TYPE_PIC_TIMING: // Picture timing SEI
ret = decode_picture_timing(&h->picture_timing, gb, ps->sps, logctx); ret = decode_picture_timing(&h->picture_timing, gb, ps->sps, logctx);
break; break;
case SEI_TYPE_USER_DATA_REGISTERED: case H264_SEI_TYPE_USER_DATA_REGISTERED:
ret = decode_registered_user_data(h, gb, logctx, size); ret = decode_registered_user_data(h, gb, logctx, size);
break; break;
case SEI_TYPE_USER_DATA_UNREGISTERED: case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size); ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size);
break; break;
case SEI_TYPE_RECOVERY_POINT: case H264_SEI_TYPE_RECOVERY_POINT:
ret = decode_recovery_point(&h->recovery_point, gb); ret = decode_recovery_point(&h->recovery_point, gb);
break; break;
case SEI_TYPE_BUFFERING_PERIOD: case H264_SEI_TYPE_BUFFERING_PERIOD:
ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx); ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx);
break; break;
case SEI_TYPE_FRAME_PACKING: case H264_SEI_TYPE_FRAME_PACKING:
ret = decode_frame_packing_arrangement(&h->frame_packing, gb); ret = decode_frame_packing_arrangement(&h->frame_packing, gb);
break; break;
case SEI_TYPE_DISPLAY_ORIENTATION: case H264_SEI_TYPE_DISPLAY_ORIENTATION:
ret = decode_display_orientation(&h->display_orientation, gb); ret = decode_display_orientation(&h->display_orientation, gb);
break; break;
default: default:

@ -25,33 +25,34 @@
* SEI message types * SEI message types
*/ */
typedef enum { typedef enum {
SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) H264_SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
SEI_TYPE_PIC_TIMING = 1, ///< picture timing H264_SEI_TYPE_PIC_TIMING = 1, ///< picture timing
SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35 H264_SEI_TYPE_FILLER_PAYLOAD = 3, ///< filler data
SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data H264_SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync) H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement H264_SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation H264_SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
} SEI_Type; H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
} H264_SEI_Type;
/** /**
* pic_struct in picture timing SEI message * pic_struct in picture timing SEI message
*/ */
typedef enum { typedef enum {
SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame H264_SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field H264_SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
} SEI_PicStructType; } H264_SEI_PicStructType;
typedef struct H264SEIPictureTiming { typedef struct H264SEIPictureTiming {
int present; int present;
SEI_PicStructType pic_struct; H264_SEI_PicStructType pic_struct;
/** /**
* Bit set of clock types for fields/frames in picture timing SEI message. * Bit set of clock types for fields/frames in picture timing SEI message.

@ -1007,37 +1007,37 @@ static int h264_export_frame_props(H264Context *h)
if (sps->pic_struct_present_flag && h->sei.picture_timing.present) { if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
H264SEIPictureTiming *pt = &h->sei.picture_timing; H264SEIPictureTiming *pt = &h->sei.picture_timing;
switch (pt->pic_struct) { switch (pt->pic_struct) {
case SEI_PIC_STRUCT_FRAME: case H264_SEI_PIC_STRUCT_FRAME:
break; break;
case SEI_PIC_STRUCT_TOP_FIELD: case H264_SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_BOTTOM_FIELD: case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
cur->f->interlaced_frame = 1; cur->f->interlaced_frame = 1;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
if (FIELD_OR_MBAFF_PICTURE(h)) if (FIELD_OR_MBAFF_PICTURE(h))
cur->f->interlaced_frame = 1; cur->f->interlaced_frame = 1;
else else
// try to flag soft telecine progressive // try to flag soft telecine progressive
cur->f->interlaced_frame = h->prev_interlaced_frame; cur->f->interlaced_frame = h->prev_interlaced_frame;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
/* Signal the possibility of telecined film externally /* Signal the possibility of telecined film externally
* (pic_struct 5,6). From these hints, let the applications * (pic_struct 5,6). From these hints, let the applications
* decide if they apply deinterlacing. */ * decide if they apply deinterlacing. */
cur->f->repeat_pict = 1; cur->f->repeat_pict = 1;
break; break;
case SEI_PIC_STRUCT_FRAME_DOUBLING: case H264_SEI_PIC_STRUCT_FRAME_DOUBLING:
cur->f->repeat_pict = 2; cur->f->repeat_pict = 2;
break; break;
case SEI_PIC_STRUCT_FRAME_TRIPLING: case H264_SEI_PIC_STRUCT_FRAME_TRIPLING:
cur->f->repeat_pict = 4; cur->f->repeat_pict = 4;
break; break;
} }
if ((pt->ct_type & 3) && if ((pt->ct_type & 3) &&
pt->pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP) pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP)
cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0; cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0;
} else { } else {
/* Derive interlacing flag from used decoding process. */ /* Derive interlacing flag from used decoding process. */
@ -1053,8 +1053,8 @@ static int h264_export_frame_props(H264Context *h)
(sps->pic_struct_present_flag && h->sei.picture_timing.present)) { (sps->pic_struct_present_flag && h->sei.picture_timing.present)) {
/* Use picture timing SEI information. Even if it is a /* Use picture timing SEI information. Even if it is a
* information of a past frame, better than nothing. */ * information of a past frame, better than nothing. */
if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM || if (h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP) h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->f->top_field_first = 1; cur->f->top_field_first = 1;
else else
cur->f->top_field_first = 0; cur->f->top_field_first = 0;

@ -650,18 +650,18 @@ static void vaapi_encode_h264_write_sei(PutBitContext *pbc,
for (payload_type = 0; payload_type < 64; payload_type++) { for (payload_type = 0; payload_type < 64; payload_type++) {
switch (payload_type) { switch (payload_type) {
case SEI_TYPE_BUFFERING_PERIOD: case H264_SEI_TYPE_BUFFERING_PERIOD:
if (!priv->send_timing_sei || if (!priv->send_timing_sei ||
pic->type != PICTURE_TYPE_IDR) pic->type != PICTURE_TYPE_IDR)
continue; continue;
write_payload = &vaapi_encode_h264_write_buffering_period; write_payload = &vaapi_encode_h264_write_buffering_period;
break; break;
case SEI_TYPE_PIC_TIMING: case H264_SEI_TYPE_PIC_TIMING:
if (!priv->send_timing_sei) if (!priv->send_timing_sei)
continue; continue;
write_payload = &vaapi_encode_h264_write_pic_timing; write_payload = &vaapi_encode_h264_write_pic_timing;
break; break;
case SEI_TYPE_USER_DATA_UNREGISTERED: case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
if (pic->encode_order != 0) if (pic->encode_order != 0)
continue; continue;
write_payload = &vaapi_encode_h264_write_identifier; write_payload = &vaapi_encode_h264_write_identifier;

Loading…
Cancel
Save