From patchwork Mon Feb 22 07: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: 25884 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 A82CF448857 for ; Mon, 22 Feb 2021 09:41:21 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7820A68A7FF; Mon, 22 Feb 2021 09:41:21 +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 A9A436880D3 for ; Mon, 22 Feb 2021 09:41:14 +0200 (EET) IronPort-SDR: +GaAZSweL2Ktgr+VqXjoOQK8RztAlePCe9QKk0DcXrvGKdU8CcrFtCzpDfJQFJeKGHdTlx1p1c CMpWMoqcuC3Q== X-IronPort-AV: E=McAfee;i="6000,8403,9902"; a="269295432" X-IronPort-AV: E=Sophos;i="5.81,196,1610438400"; d="scan'208";a="269295432" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2021 23:41:11 -0800 IronPort-SDR: rpKswCYklDrvp9bc5S8EYiluavj1sSoPEXnSgc27IGC8LVIUhJdQEMUroM3oWyvelfYyZsYmqt Kek/C3o/uofA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,196,1610438400"; d="scan'208";a="441300967" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by orsmga001.jf.intel.com with ESMTP; 21 Feb 2021 23:41:08 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Feb 2021 15:30:43 +0800 Message-Id: <20210222073045.16070-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH V3 1/3] 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;