[FFmpeg-devel] [PATCH 1/2] libavfi/dnn: refine enum DNNColorOrder
Ting Fu
ting.fu at intel.com
Mon May 23 12:29:17 EEST 2022
Change the DCO_RGB and DCO_BGR color order in DNNColorOrder to
DCO_RGB_PACKED and DCO_GBR_PACKED for following RGB planar support.
Signed-off-by: Ting Fu <ting.fu at intel.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 2 +-
libavfilter/dnn/dnn_backend_tf.c | 2 +-
libavfilter/dnn/dnn_io_proc.c | 4 ++--
libavfilter/dnn_interface.h | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index cf012aca4c..92e180a0eb 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -156,7 +156,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request)
input.dt = precision_to_datatype(precision);
// all models in openvino open model zoo use BGR as input,
// change to be an option when necessary.
- input.order = DCO_BGR;
+ input.order = DCO_BGR_PACKED;
for (int i = 0; i < ctx->options.batch_size; ++i) {
lltask = ff_queue_pop_front(ov_model->lltask_queue);
diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index 3b5084b67b..e639b3cecd 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -294,7 +294,7 @@ static int get_input_tf(void *model, DNNData *input, const char *input_name)
tf_output.index = 0;
input->dt = TF_OperationOutputType(tf_output);
- input->order = DCO_RGB;
+ input->order = DCO_RGB_PACKED;
status = TF_NewStatus();
TF_GraphGetTensorShape(tf_model->graph, tf_output, dims, 4, status);
diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index 7961bf6b95..532b089002 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -176,9 +176,9 @@ static enum AVPixelFormat get_pixel_format(DNNData *data)
{
if (data->dt == DNN_UINT8) {
switch (data->order) {
- case DCO_BGR:
+ case DCO_BGR_PACKED:
return AV_PIX_FMT_BGR24;
- case DCO_RGB:
+ case DCO_RGB_PACKED:
return AV_PIX_FMT_RGB24;
default:
av_assert0(!"unsupported data pixel format.\n");
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h
index ef8d7ae66f..d94baa90c4 100644
--- a/libavfilter/dnn_interface.h
+++ b/libavfilter/dnn_interface.h
@@ -38,8 +38,8 @@ typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
typedef enum {
DCO_NONE,
- DCO_BGR,
- DCO_RGB,
+ DCO_BGR_PACKED,
+ DCO_RGB_PACKED,
} DNNColorOrder;
typedef enum {
--
2.17.1
More information about the ffmpeg-devel
mailing list