From patchwork Fri Feb 19 13:30:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25807 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 07C9D447915 for ; Fri, 19 Feb 2021 15:41:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D44FE68A2C6; Fri, 19 Feb 2021 15:41:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1EE6468A247 for ; Fri, 19 Feb 2021 15:41:16 +0200 (EET) IronPort-SDR: xU+aJdPR/9qwlOGIqnUY6Ew6jCxorRnlGtwmfZwpdgXKjVnwpdM7f3rzoztzmLMhRGuw4XnVER a0c1QJxTA2MQ== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="268695575" X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="268695575" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 05:41:14 -0800 IronPort-SDR: gmUHJnKI4/DYxd2O+gtQLvqfKcoQ3Ug5/vpq9BXWnWlNUzvhNLsiOqI9FQ9EzsQDxOBcsPtmuC 0bggR8nSFjwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="401032413" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by orsmga008.jf.intel.com with ESMTP; 19 Feb 2021 05:41:03 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Feb 2021 21:30:43 +0800 Message-Id: <20210219133046.14740-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH V2 1/4] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" They will be used for filters such as detect and classify. Signed-off-by: Guo, Yejun --- libavfilter/bbox.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/libavfilter/bbox.h b/libavfilter/bbox.h index 116158d59e..7c63dfa727 100644 --- a/libavfilter/bbox.h +++ b/libavfilter/bbox.h @@ -22,6 +22,51 @@ #define AVFILTER_BBOX_H #include +#include "libavutil/rational.h" + +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; +} BoundingBoxHeader; + +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_LENGTH 32 + + /** + * Detect result with confidence + */ + char detect_label[BBOX_LABEL_NAME_MAX_LENGTH+1]; + 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_LENGTH+1]; + AVRational classify_confidences[AV_NUM_BBOX_CLASSIFY]; +} BoundingBox; typedef struct FFBoundingBox { int x1, x2, y1, y2;