Message ID | 1688161135-11774-4-git-send-email-dheitmueller@ltnglobal.com |
---|---|
State | New |
Headers | show |
Series | Misc AFD improvements and support for Bar Data | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Quoting Devin Heitmueller (2023-06-30 23:38:51) > Add new side data types for both AVPacket and AVFrame to support > "bar data" as defined in SMPTE 2016-1, ATSC A/53, and SCTE 128-1. > > Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> > --- > libavcodec/decode.c | 1 + > libavcodec/defs.h | 12 ++++++++++++ > libavcodec/packet.h | 6 ++++++ > libavutil/frame.h | 6 ++++++ > 4 files changed, 25 insertions(+) > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index 6ee2c85..5aafce7 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -1332,6 +1332,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, > { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, > { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC }, > { AV_PKT_DATA_AFD, AV_FRAME_DATA_AFD }, > + { AV_PKT_DATA_BARDATA, AV_FRAME_DATA_BARDATA }, > { AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE }, > { AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE }, > { AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, > diff --git a/libavcodec/defs.h b/libavcodec/defs.h > index fbe3254..deadfe7 100644 > --- a/libavcodec/defs.h > +++ b/libavcodec/defs.h > @@ -119,6 +119,18 @@ typedef struct AVPanScan { > } AVPanScan; > > /** > + * Bar data - used by side data for avcodec and avframe. Defines the location > + * of horizontal or vertical black bars (i.e. letterbox/pillar bars) > + */ > +typedef struct AVBarData { > + int top_bottom; /* 0=top/bottom 1=left/right */ > + int top; > + int left; > + int bottom; > + int right; Am I understanding correctly that half of these are never used for a given AVBarData instance? Seems wasteful. Could make it a generic bound0, bound1 or a union instead.
On Sat, Jul 1, 2023 at 4:11 AM Anton Khirnov <anton@khirnov.net> wrote: > > /** > > + * Bar data - used by side data for avcodec and avframe. Defines the location > > + * of horizontal or vertical black bars (i.e. letterbox/pillar bars) > > + */ > > +typedef struct AVBarData { > > + int top_bottom; /* 0=top/bottom 1=left/right */ > > + int top; > > + int left; > > + int bottom; > > + int right; > > Am I understanding correctly that half of these are never used for a > given AVBarData instance? Seems wasteful. Could make it a generic > bound0, bound1 or a union instead. It was only an extra eight bytes per video frame, so I wasn't particularly worried about the size. That said, perhaps a union would make it more clear that you can't set both simultaneously. Devin
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6ee2c85..5aafce7 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1332,6 +1332,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC }, { AV_PKT_DATA_AFD, AV_FRAME_DATA_AFD }, + { AV_PKT_DATA_BARDATA, AV_FRAME_DATA_BARDATA }, { AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE }, { AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE }, { AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, diff --git a/libavcodec/defs.h b/libavcodec/defs.h index fbe3254..deadfe7 100644 --- a/libavcodec/defs.h +++ b/libavcodec/defs.h @@ -119,6 +119,18 @@ typedef struct AVPanScan { } AVPanScan; /** + * Bar data - used by side data for avcodec and avframe. Defines the location + * of horizontal or vertical black bars (i.e. letterbox/pillar bars) + */ +typedef struct AVBarData { + int top_bottom; /* 0=top/bottom 1=left/right */ + int top; + int left; + int bottom; + int right; +} AVBarData; + +/** * This structure describes the bitrate properties of an encoded bitstream. It * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD * parameters for H.264/HEVC. diff --git a/libavcodec/packet.h b/libavcodec/packet.h index f28e7e7..bdad21e 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -300,6 +300,12 @@ enum AVPacketSideDataType { AV_PKT_DATA_DYNAMIC_HDR10_PLUS, /** + * Bar data. See SMPTE ST2016-1, ATSC A/53, SCTE 128-1 + * Format for this data can be found in the AVBarData struct + */ + AV_PKT_DATA_BARDATA, + + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may * change when new side data types are added. diff --git a/libavutil/frame.h b/libavutil/frame.h index a491315..317b663 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -214,6 +214,12 @@ enum AVFrameSideDataType { * Ambient viewing environment metadata, as defined by H.274. */ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, + /** + * SMPTE ST 2016-1 Bar data + * The data is the AVBarData struct defined in libavcodec. + * Note: See SMPTE ST 2016-1:2009 Section 8 for the interaction between AFD and Bar Data + */ + AV_FRAME_DATA_BARDATA, }; enum AVActiveFormatDescription {
Add new side data types for both AVPacket and AVFrame to support "bar data" as defined in SMPTE 2016-1, ATSC A/53, and SCTE 128-1. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> --- libavcodec/decode.c | 1 + libavcodec/defs.h | 12 ++++++++++++ libavcodec/packet.h | 6 ++++++ libavutil/frame.h | 6 ++++++ 4 files changed, 25 insertions(+)