libavfilter/dnn_interface: use dims to represent shapes

For detect and classify output, width and height make no sence, so
change width, height to dims to represent the shape of tensor. Use
layout and dims to get width, height and channel.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
This commit is contained in:
Wenbin Chen
2024-01-17 15:21:50 +08:00
committed by Guo Yejun
parent c695de56b5
commit 3de38b9da5
7 changed files with 146 additions and 90 deletions

View File

@@ -64,7 +64,7 @@ typedef enum {
typedef struct DNNData{
void *data;
int width, height, channels;
int dims[4];
// dt and order together decide the color format
DNNDataType dt;
DNNColorOrder order;
@@ -134,4 +134,19 @@ typedef struct DNNModule{
// Initializes DNNModule depending on chosen backend.
const DNNModule *ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx);
static inline int dnn_get_width_idx_by_layout(DNNLayout layout)
{
return layout == DL_NHWC ? 2 : 3;
}
static inline int dnn_get_height_idx_by_layout(DNNLayout layout)
{
return layout == DL_NHWC ? 1 : 2;
}
static inline int dnn_get_channel_idx_by_layout(DNNLayout layout)
{
return layout == DL_NHWC ? 3 : 1;
}
#endif