summaryrefslogtreecommitdiff
path: root/libavutil/frame.h
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2019-01-10 16:53:30 +0800
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2019-01-17 21:47:11 +0000
commit1ef4828276e4c568a13b4c57c08aa75470adec9f (patch)
tree6e7c005b9dff5869ceeb285395b36efd57e77c56 /libavutil/frame.h
parentaf05070ddf8e748132047b265cebd7f893fb37f9 (diff)
downloadffmpeg-1ef4828276e4c568a13b4c57c08aa75470adec9f.tar.gz
avutil: add ROI (Region Of Interest) data struct and bump version
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> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavutil/frame.h')
-rw-r--r--libavutil/frame.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 582ac470b2..8d0dfedebb 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 AVRegionOfInterest type, the number of
+ * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
+ */
+ AV_FRAME_DATA_REGIONS_OF_INTEREST,
};
enum AVActiveFormatDescription {
@@ -201,6 +207,35 @@ typedef struct AVFrameSideData {
} AVFrameSideData;
/**
+ * Structure to hold Region Of Interest.
+ *
+ * self_size specifies the size of this data structure. This value
+ * should be set to sizeof(AVRegionOfInterest). EINVAL is returned if self_size is zero.
+ *
+ * Number of pixels to discard from the top/bottom/left/right border of
+ * the frame to obtain the region of interest of the frame.
+ * They are encoder dependent and will be extended internally
+ * if the codec requires an alignment.
+ * If the regions overlap, the last value in the list will be used.
+ *
+ * qoffset is quant offset, and base rule here:
+ * returns EINVAL if AVRational.den is zero.
+ * the value (num/den) range is [-1.0, 1.0], clamp to +-1.0 if out of range.
+ * 0 means no picture quality change,
+ * negtive offset asks for better quality (and the best with value -1.0),
+ * positive offset asks for worse quality (and the worst with value 1.0).
+ * How to explain/implement the different quilaity requirement is encoder dependent.
+ */
+typedef struct AVRegionOfInterest {
+ uint32_t self_size;
+ int top;
+ int bottom;
+ int left;
+ int right;
+ AVRational qoffset;
+} AVRegionOfInterest;
+
+/**
* This structure describes decoded (raw) audio or video data.
*
* AVFrame must be allocated using av_frame_alloc(). Note that this only