1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

dnn: add DCO_RGB color order to enum DNNColorOrder

Adding DCO_RGB color order to DNNColorOrder, since tensorflow model
needs this kind of color oder as input.

Signed-off-by: Ting Fu <ting.fu@intel.com>
This commit is contained in:
Ting Fu 2021-05-06 16:46:07 +08:00 committed by Guo, Yejun
parent 7fac6efa97
commit f02928eb5a
3 changed files with 13 additions and 3 deletions

View File

@ -143,6 +143,7 @@ static DNNReturnType get_input_tf(void *model, DNNData *input, const char *input
tf_output.index = 0;
input->dt = TF_OperationOutputType(tf_output);
input->order = DCO_RGB;
status = TF_NewStatus();
TF_GraphGetTensorShape(tf_model->graph, tf_output, dims, 4, status);

View File

@ -168,11 +168,19 @@ static DNNReturnType proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND
static enum AVPixelFormat get_pixel_format(DNNData *data)
{
if (data->dt == DNN_UINT8 && data->order == DCO_BGR) {
return AV_PIX_FMT_BGR24;
if (data->dt == DNN_UINT8) {
switch (data->order) {
case DCO_BGR:
return AV_PIX_FMT_BGR24;
case DCO_RGB:
return AV_PIX_FMT_RGB24;
default:
av_assert0(!"unsupported data pixel format.\n");
return AV_PIX_FMT_BGR24;
}
}
av_assert0(!"not supported yet.\n");
av_assert0(!"unsupported data type.\n");
return AV_PIX_FMT_BGR24;
}

View File

@ -39,6 +39,7 @@ typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
typedef enum {
DCO_NONE,
DCO_BGR,
DCO_RGB,
} DNNColorOrder;
typedef enum {