Message ID | 1545908736-23413-1-git-send-email-yejun.guo@intel.com |
---|---|
State | Superseded |
Headers | show |
On 27/12/2018 11:05, Guo, Yejun wrote: > enum AVActiveFormatDescription { > @@ -200,6 +206,19 @@ typedef struct AVFrameSideData { > AVBufferRef *buf; > } AVFrameSideData; > > +typedef struct AVROI { > + /* coordinates at frame pixel level. > + * It will be extended internally if the codec requires an alignment. > + * If the regions overlap, the last value in the list will be used. > + */ Should probaly be doxygen above the typedef, and mention the offset, too. > + size_t top; > + size_t bottom; > + size_t left; > + size_t right; > + // quant offset is encoder dependent > + int qoffset; > +} AVROI; Nit: Technically it could be a float, but I do't feel strongly about it one way or another. Cheers, - Derek
> -----Original Message----- > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf > Of Derek Buitenhuis > Sent: Friday, December 28, 2018 12:42 AM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH V3 1/3] avutil: add ROI data struct and > bump version > > On 27/12/2018 11:05, Guo, Yejun wrote: > > enum AVActiveFormatDescription { > > @@ -200,6 +206,19 @@ typedef struct AVFrameSideData { > > AVBufferRef *buf; > > } AVFrameSideData; > > > > +typedef struct AVROI { > > + /* coordinates at frame pixel level. > > + * It will be extended internally if the codec requires an alignment. > > + * If the regions overlap, the last value in the list will be used. > > + */ > > Should probaly be doxygen above the typedef, and mention the offset, too. > thanks, will fix it, together with the comment for qoffset. > > + size_t top; > > + size_t bottom; > > + size_t left; > > + size_t right; > > + // quant offset is encoder dependent > > + int qoffset; > > +} AVROI; > > Nit: Technically it could be a float, but I do't feel strongly about it one way or > another. int is from an early comment, I'm open to both, so just keep it if no more objects. > > Cheers, > - Derek > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff --git a/libavutil/frame.c b/libavutil/frame.c index 34a6210..bebc50e 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -841,6 +841,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) case AV_FRAME_DATA_QP_TABLE_DATA: return "QP table data"; #endif case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)"; + case AV_FRAME_DATA_ROIS: return "Regions Of Interest"; } return NULL; } diff --git a/libavutil/frame.h b/libavutil/frame.h index 582ac47..f9e154c 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -173,6 +173,12 @@ enum AVFrameSideDataType { * volume transform - application 4 of SMPTE 2094-40:2016 standard. */ AV_FRAME_DATA_DYNAMIC_HDR_PLUS, + + /** + * Regions Of Interest, the data is an array of AVROI type, the array size + * is implied by AVFrameSideData::size / sizeof(AVROI). + */ + AV_FRAME_DATA_ROIS, }; enum AVActiveFormatDescription { @@ -200,6 +206,19 @@ typedef struct AVFrameSideData { AVBufferRef *buf; } AVFrameSideData; +typedef struct AVROI { + /* coordinates at frame pixel level. + * It will be extended internally if the codec requires an alignment. + * If the regions overlap, the last value in the list will be used. + */ + size_t top; + size_t bottom; + size_t left; + size_t right; + // quant offset is encoder dependent + int qoffset; +} AVROI; + /** * This structure describes decoded (raw) audio or video data. * diff --git a/libavutil/version.h b/libavutil/version.h index f997615..1fcdea9 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 25 +#define LIBAVUTIL_VERSION_MINOR 26 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
The encoders such as libx264 support different QPs offset for different MBs, it makes possible for ROI-based encoding. It makes sense to add support within ffmpeg to generate/accept ROI infos and pass into encoders. Typical usage: After AVFrame is decoded, a ffmpeg filter or user's code generates ROI info for that frame, and the encoder finally does the ROI-based encoding. The ROI info is maintained as side data of AVFrame. Signed-off-by: Guo, Yejun <yejun.guo@intel.com> --- libavutil/frame.c | 1 + libavutil/frame.h | 19 +++++++++++++++++++ libavutil/version.h | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-)