当前位置:网站首页>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
边栏推荐
- Visual studio 2019 software installation package and installation tutorial
- 机器学习之卷积神经网络使用cifar10数据集和alexnet网络模型训练分类模型,安装labelimg,以及报错ERROR
- among us私服搭建
- Gartner发布当前至2024年的五大隐私趋势
- 大神详解开源 BUFF 增益攻略丨直播讲座
- 【Hot100】4. 寻找两个正序数组的中位数
- 超自动化与网络安全的未来
- Etcd可视化工具:Kstone简介(一)
- Coding Devops helps Sinochem information to build a new generation of research efficiency platform and drive the new future of "online Sinochem"
- CODING DevOps 助力中化信息打造新一代研效平台,驱动“线上中化”新未来
猜你喜欢

Today's sleep quality record is 80 points

5 minutes to make a bouncing ball game

Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(上)

What is the maximum number of concurrent TCP connections for a server? 65535?

北京有哪些牛逼的中小型公司?

3. Caller 服务调用 - dapr

Naacl 2022 | distillation of machinetranslation SOTA model

Soliciting articles and contributions - building a blog environment with a lightweight application server

Etcd可视化工具:Kstone简介(一)

Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
随机推荐
Jenkins的安装及使用
Android和eclipse和MySQL上传图片并获取
机器学习之卷积神经网络--CNN介绍
wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
Basic grammar of C language
Classic model transformer
【推荐系统】多任务学习之ESMM模型(更新ing)
What are the most powerful small and medium-sized companies in Beijing?
Cross cluster deployment of helm applications using karmada
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
Today's sleep quality record is 80 points
数字藏品热潮之下,你必须知道的那些事儿
[Spock] process non ASCII characters in an identifier
昨日元宇宙| 沃尔玛成立探索元宇宙和Web3的创新部门,Dior发布元宇宙展览
机器学习之卷积神经网络Lenet5训练模型
Among US private server setup
同创伟业合伙人童子平:“元宇宙”究竟该投什么
今天睡眠质量记录80分
PostgreSQL enables grouping statistics by year, month, day, week, hour, minute and second
REDIS00_ Explain redis Conf configuration file
