当前位置:网站首页>Media data processing V2 Version (VPC) image zoom content analysis
Media data processing V2 Version (VPC) image zoom content analysis
2022-06-28 16:13:00 【Hua Weiyun】
Ascend710, Introduction to exclusive media data processing interface
1. What is? Ascend710?
Ascend710 It is a product developed by Huawei for AI Computing chip , That's what people say NPU, Through dedicated AI The operation acceleration unit can realize low-power and high-efficiency processing of a large number of AI Calculation task .
2. Why use a dedicated media data interface ,opencv Isn't it more general ?
opencv Very common indeed , stay CPU,GPU You can call the corresponding API Interface for some image data processing , however Ascend710 A special media data processing structure is integrated on the , It can complete the task more energy-saving and efficient than traditional media data processing , This is of great significance in some embedded scenarios , and opencv Although it can be , But considering that the traditional software decoding is mostly arranged in CPU Upper operation , It not only brings a very high amount of computation to occupy other application computing resources, but also is not efficient , and opencv You cannot call the corresponding Asend Chip capabilities . So we should have a set of special interfaces .
First, post links to official documents , Please check the official documents if you don't understand .
Official document link
Although media data processing v2 The version of the interface is currently in the process of experiencing , No large-scale publicity , But from the pictures on the official website, it has been well supported
flow chart

From the figure, we can see that although the interface has become the second version , But in fact, the overall thinking is still unchanged :
System initialization ==》 Create the corresponding media processing function channel ==》 Application memory ==》 Call the processing interface ==》 Call the get result interface ==》 Memory free ==》 System logoff
Focus on several important API Interface
- establish vpc Image processing channel interface
// Prototype hi_s32 hi_mpi_vpc_create_chn(hi_vpc_chn chn, const hi_vpc_chn_attr *attr)// Parameters hi_vpc_chn chn: This parameter indicates that the value range of image processing channel number is [0,256)hi_vpc_chn_attr *attrtypedef struct { hi_s32 attr; // Task queue depth , Value range :[0,350], Indicates the number of tasks distributed by a channel . Memory consumption varies linearly with capacity . hi_u32 pic_width; // The maximum image width supported by the channel , It has no practical effect at present , The official recommendation is set to zero , Prevent compatibility problems with later versions . hi_u32 pic_height; // The maximum image height supported by the channel , It has no practical effect at present , The official recommendation is set to zero , Prevent compatibility problems with later versions .} hi_vpc_chn_attr;
- Scaling interface
// Prototype hi_s32 hi_mpi_vpc_resize (hi_vpc_chn chn, const hi_vpc_pic_info *source_pic, hi_vpc_pic_info *dest_pic, hi_double fx, hi_double fy, hi_u32 interpolation, hi_u32 *task_id, hi_s32 milli_sec)// Parameters hi_vpc_chn chn: Image processing channel number , Value range :[0, 256)hi_vpc_pic_info *source_pic Input structure pointer of image information hi_vpc_pic_info *dest_pic Structure pointer for outputting image information typedef struct { hi_void* picture_address; // Storing picture data Device Address . hi_u32 picture_buffer_size; // Buffer size for storing picture data .( Note that this size is the width height to the following size , Not necessarily the original size of the picture ) hi_u32 picture_width; // The picture is really wide . hi_u32 picture_height; // The picture is really high hi_u32 picture_width_stride; // Picture width stride hi_u32 picture_height_stride; // The picture is high stride hi_pixel_format picture_format; // Format of target picture } hi_vpc_pic_info;hi_double fx: Wide scaling hi_double fy: High zoom hi_u32 interpolation: Image zoom 0: Industry wide Bilinear Algorithm 1: Industry wide Nearest neighbor Algorithm hi_s32 milli_sec: How to time out -1: Blocking mode 0: Non blocking mode >0: Timeout mode , Configure the specific timeout . The general deviation is within a time slice of the operating system .hi_u32 *task_id: Mission ID To distinguish between different tasks
- Receive zoom ( Cutout ) Interface for the results of
// Prototype hi_s32 hi_mpi_vpc_get_process_result(hi_vpc_chn chn, hi_u32 task_id, hi_s32 milli_sec) This interface can be in the same thread as the task sending interface , You can also call speed up in another thread .// Parameters hi_vpc_chn chn: Image processing channel number , Value range :[0, 256)hi_u32 task_id: Mission ID To distinguish between different tasks hi_s32 milli_sec: How to time out -1: Blocking mode 0: Non blocking mode >0: Timeout mode , Configure the specific timeout . The general deviation is within a time slice of the operating system
- Matting task sending interface
// Prototype hi_s32 hi_mpi_vpc_crop(hi_vpc_chn chn, const hi_vpc_pic_info *source_pic, hi_vpc_crop_region_info crop_info[], hi_u32 count, hi_u32 *task_id, hi_s32 milli_sec)// Parameters hi_vpc_chn chn: Image processing channel number , Value range :[0, 256)hi_vpc_pic_info *source_pic The explanation is the same as above hi_u32 count: Number of matting areas , Value range [1,256]hi_vpc_crop_region_info crop_info[]: Matting picture information array , The array length is the same as count The parameter values are consistent typedef struct { hi_vpc_pic_info dest_pic_info; hi_vpc_crop_region crop_region;} hi_vpc_crop_region_info;typedef struct { hi_u32 top_offset; // Top left corner of matting ( Abscissa ) hi_u32 left_offset; // Top left corner of matting ( Ordinate ) hi_u32 crop_width; // The matting area is wide hi_u32 crop_height; // The matting area is high } hi_vpc_crop_region;
Open source learning
边栏推荐
- 简单介绍一下tensorflow与pytorch的相互转换(主要是tensorflow转pytorch)
- Slim GAIN(SGAIN)介绍及代码实现——基于生成对抗网络的缺失数据填补
- Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
- [recommendation system] esmm model of multi task learning (updating)
- A 24-year-old bald programmer teaches you how to continuously integrate and deliver microservice delivery. You can't learn how to cut me off
- Mysql自连接查询「建议收藏」
- REDIS00_ Explain redis Conf configuration file
- 10:00面试,10:02就出来了 ,问的实在是太...
- 机器学习之卷积神经网络Lenet5训练模型
- 征文投稿丨使用轻量应用服务器搭建博客环境
猜你喜欢
leetcode:22. bracket-generating
The world has embraced Web3.0 one after another, and many countries have clearly begun to seize the initiative
Among US private server setup
Visual studio 2019 software installation package and installation tutorial
榜单首发——线控制动「新周期」,本土供应商市场竞争力TOP10
征文投稿丨使用轻量应用服务器搭建博客环境
逆向调试入门-PE结构详解02/07
What are the most powerful small and medium-sized companies in Beijing?
Focus on the 35 year old Kan: fear is because you don't have the ability to match your age
Knowing these commands allows you to master shell's own tools
随机推荐
同创伟业合伙人童子平:“元宇宙”究竟该投什么
What are the most powerful small and medium-sized companies in Beijing?
3. Caller 服务调用 - dapr
MySQL self connection query "suggestions collection"
VC2010 编绎Qt5.6.3 提示 CVTRES : fatal error CVT1107:
10年测试经验,在35岁的生理年龄面前,一文不值
among us私服搭建
【MySQL】官网文档学习之查询语句sql注意事项
Application of mongodb in Tencent retail premium code
Gartner发布当前至2024年的五大隐私趋势
Visual Studio 2019软件安装包和安装教程
机器学习之卷积神经网络使用cifar10数据集和alexnet网络模型训练分类模型,安装labelimg,以及报错ERROR
Naacl 2022 | distillation of machinetranslation SOTA model
Redmibook Pro 14 enhanced version cannot open delta software drastudio_ v1.00.07.52
Analysis of PostgreSQL storage structure
[high concurrency foundation] hidden dangers and solutions of MySQL concurrency under different transaction isolation levels
零钱兑换(动态规划)
Big God explains open source buff gain strategy live lecture
Etcd可视化工具:Kstone简介(一)
Knowing these commands allows you to master shell's own tools