diff mbox series

[FFmpeg-devel,V5,2/5] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox

Message ID 20210308050522.9396-2-yejun.guo@intel.com
State New
Headers show
Series [FFmpeg-devel,V5,1/5] libavfilter/dnn: add ff_dnn_set_proc to set pre/post proc
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Guo, Yejun March 8, 2021, 5:05 a.m. UTC
They will be used for filters such as detect and classify.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
---
 libavfilter/bbox.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/bbox.h b/libavfilter/bbox.h
index 116158d59e..3ba8ce5b47 100644
--- a/libavfilter/bbox.h
+++ b/libavfilter/bbox.h
@@ -22,6 +22,57 @@ 
 #define AVFILTER_BBOX_H
 
 #include <stdint.h>
+#include "libavutil/rational.h"
+
+typedef struct BoundingBox {
+    /**
+     * Distance in pixels from the top edge of the frame to top
+     * and bottom, and from the left edge of the frame to left and
+     * right, defining the bounding box.
+     */
+    int top;
+    int left;
+    int bottom;
+    int right;
+
+#define BBOX_LABEL_NAME_MAX_SIZE 32
+
+    /**
+     * Detect result with confidence
+     */
+    char detect_label[BBOX_LABEL_NAME_MAX_SIZE];
+    AVRational detect_confidence;
+
+    /**
+     * At most 4 classifications based on the detected bounding box.
+     * For example, we can get max 4 different attributes with 4 different
+     * DNN models on one bounding box.
+     * classify_count is zero if no classification.
+     */
+#define AV_NUM_BBOX_CLASSIFY 4
+    uint32_t classify_count;
+    char classify_labels[AV_NUM_BBOX_CLASSIFY][BBOX_LABEL_NAME_MAX_SIZE];
+    AVRational classify_confidences[AV_NUM_BBOX_CLASSIFY];
+} BoundingBox;
+
+typedef struct BoundingBoxHeader {
+    /**
+     * Information about how the bounding box is generated.
+     * for example, the DNN model name.
+     */
+    char source[128];
+
+    /**
+     * Must be set to the size of BoundingBox (that is,
+     * sizeof(BoundingBox)).
+     */
+    uint32_t bbox_size;
+
+    /**
+     * Pointer to the array of BoundingBox.
+     */
+    BoundingBox bboxes[];
+} BoundingBoxHeader;
 
 typedef struct FFBoundingBox {
     int x1, x2, y1, y2;