[FFmpeg-devel] [PATCH V2] libavfilter/dnn: add batch mode for async execution

Fu, Ting ting.fu at intel.com
Thu Jan 14 16:45:21 EET 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Guo,
> Yejun
> Sent: Sunday, January 10, 2021 09:16 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Guo, Yejun <yejun.guo at intel.com>
> Subject: [FFmpeg-devel] [PATCH V2] libavfilter/dnn: add batch mode for async
> execution
> 
> the default number of batch_size is 1
> 
> Signed-off-by: Xie, Lin <lin.xie at intel.com>
> Signed-off-by: Wu Zhiwen <zhiwen.wu at intel.com>
> Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
> ---
>  libavfilter/dnn/dnn_backend_openvino.c | 187 ++++++++++++++++++++-----
>  libavfilter/dnn/dnn_backend_openvino.h |   1 +
>  libavfilter/dnn/dnn_interface.c        |   1 +
>  libavfilter/dnn_interface.h            |   2 +
>  libavfilter/vf_dnn_processing.c        |  36 ++++-
>  5 files changed, 194 insertions(+), 33 deletions(-)
> 
[...]
>      if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
>          if (status == AVERROR_EOF) {
> -            ff_outlink_set_status(outlink, status, pts);
> +            int64_t out_pts = pts;
> +            ret = flush_frame(outlink, pts, &out_pts);
> +            ff_outlink_set_status(outlink, status, out_pts);
>              return ret;
>          }
>      }
> --
> 2.17.1

Hi Yejun,
This patch works well for me.
Testing was carried on my machine, which CPU is i7-8700K 3.7Ghz and iGPU is UHD630.
The patch was tested by using espcn super resolution model (950*540 video as input), with async on and off. The fps increased from 11fps to 13fps (~18% up) on CPU, from 8fps to 11fps (~37% up) on iGPU.

On CPU with async off:
./ffmpeg -i input_video.mp4 -vf dnn_processing=dnn_backend=openvino:model=espcn1080p.xml:input=x:output=espcn/prediction:async=0:options=device=CPU\&batch_size=1 -y output_video.mp4
On CPU with async on:
./ffmpeg -i input_video.mp4 -vf dnn_processing=dnn_backend=openvino:model=espcn1080p.xml:input=x:output=espcn/prediction:async=1:options=device=CPU\&batch_size=2 -y output_video.mp4

On GPU with async off:
./ffmpeg -i input_video.mp4 -vf dnn_processing=dnn_backend=openvino:model=espcn1080p.xml:input=x:output=espcn/prediction:async=0:options=device=GPU\&batch_size=1 -y output_video.mp4
On GPU with async on:
./ffmpeg -i input_video.mp4 -vf dnn_processing=dnn_backend=openvino:model=espcn1080p.xml:input=x:output=espcn/prediction:async=1:options=device=GPU\&batch_size=2 -y output_video.mp4

> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request at ffmpeg.org
> with subject "unsubscribe".


More information about the ffmpeg-devel mailing list