diff options
author | Wenbin Chen <wenbin.chen@intel.com> | 2024-01-17 15:21:50 +0800 |
---|---|---|
committer | Guo Yejun <yejun.guo@intel.com> | 2024-01-28 11:18:06 +0800 |
commit | 3de38b9da5c2ffddcf1c532bca78f989b0474494 (patch) | |
tree | 9454c46d15a146f877315aca2cdec97e520e40ba /libavfilter/dnn_interface.h | |
parent | c695de56b5ba8b2436e455c2284159759ca444d3 (diff) | |
download | ffmpeg-3de38b9da5c2ffddcf1c532bca78f989b0474494.tar.gz |
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>
Diffstat (limited to 'libavfilter/dnn_interface.h')
-rw-r--r-- | libavfilter/dnn_interface.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h index 183d8418b2..852d88baa8 100644 --- a/libavfilter/dnn_interface.h +++ b/libavfilter/dnn_interface.h @@ -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 |