mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 02:20:07 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user