[FFmpeg-devel] [PATCH] lavfi/dnn: Add OpenVINO API 2.0 support

Anton Khirnov anton at khirnov.net
Fri Mar 24 15:09:35 EET 2023


Quoting Ting Fu (2023-03-21 07:21:40)
> OpenVINO API 2.0 was released in March 2022, which introduced new features.
> This commit implement current OpenVINO features with new 2.0 APIs. And will
> adding other features in API 2.0.
> The OpenVINO runtime wil be installed in /usr/local/, please add path
> /usr/local/runtime/lib/intel64/pkgconfig/ to PKG_CONFIG_PATH mannually
> for new OpenVINO libs config.

Installation paths are up to the system administrator and are detected
with pkg-config as per your patch, so this does not belong in the commit
message.

> +
> +#include "dnn_backend_openvino2.h"
> +#include "dnn_io_proc.h"
> +#include "libavutil/avassert.h"
> +#include "libavutil/avstring.h"
> +#include "libavutil/detection_bbox.h"
> +#include "libavutil/cpu.h"
> +#include "libavutil/opt.h"
> +#include "dnn_backend_common.h"
> +#include "../internal.h"
> +#include "safe_queue.h"

Headers should be grouped according to some principle, typically
per-library and alphabetically ordered.

> +#include "openvino/c/openvino.h"

This is a system header, it needs to use <>

> +static DNNDataType port_datatype_to_dnn_datatype(ov_element_type_e port_datatype)
> +{
> +    switch (port_datatype)
> +    {
> +    case F32:
> +        return DNN_FLOAT;
> +    case U8:
> +        return DNN_UINT8;
> +    default:
> +        av_assert0(!"Not supported yet.");

asserts express internal code constraints, you must never assert on
outside data.

> +int ff_dnn_execute_model_ov2(const DNNModel *model, DNNExecBaseParams *exec_params) {

This file is schizophrenic about opening brace placement. It should
always be on its own line.

> +static int get_datatype_size(DNNDataType dt)
> +{
> +    switch (dt)
> +    {
> +    case DNN_FLOAT:
> +        return sizeof(float);
> +    case DNN_UINT8:
> +        return sizeof(uint8_t);
> +    default:
> +        av_assert0(!"not supported yet.");

Same as above.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list