VPC约束说明
图片分辨率约束
- 输入图片分辨率
在调用接口实现VPC功能时,各接口对分辨率的要求可能不同,请参见VPC图像处理功能下各接口的说明。其中,当输入图片格式为YUV440SP、YUV440P时,输入图片的宽最大值为4096。
- 输出图片分辨率
型号
分辨率范围
Atlas 推理系列产品 Atlas 训练系列产品 10*6~4096*4096
Atlas A3 训练系列产品 /Atlas A3 推理系列产品 Atlas A2 训练系列产品 /Atlas A2 推理系列产品 Atlas 200I/500 A2 推理产品 10*6~4096*8192
图片格式、宽高对齐、内存约束
VPC在处理图片时,需调用acldvppMalloc接口申请Device上的输入、输出内存,调用acldvppFree接口释放输入、输出内存,这部分内存的生命周期由用户自行管理。
在调用接口实现VPC功能时,图片格式的定义请参见acldvppPixelFormat,宽stride、高stride、8K等概念请参见基本概念。
图片格式、宽高对齐约束请参见表7、表8。其中,8K场景下支持的输入图片格式请参见表9。
|
输入图片格式 |
输入图片宽、高对齐要求 |
输入图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV400 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444SP 8bit YVU444SP 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV422Packed YUYV 8bit YUV422Packed UYVY 8bit YUV422Packed YVYU 8bit YUV422Packed VYUY 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽乘以2的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽乘以4的。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV440SP 8bit YVU440SP 8bit |
宽无对齐要求 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YVU420Planar YUV420Planar |
宽2对齐,高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YVU422Planar YUV422Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YVU444Planar YUV444Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YVU444Packed 8bit |
无对齐要求 |
宽stride无对齐要求,宽stride为宽乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV440Planar YVU440Planar |
宽无对齐要求,但宽≤4096 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
RGB888Planar BGR888Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV400 FP32 RGB888 FP32 BGR888 FP32 |
无对齐要求 |
宽stride无对齐要求,宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
RGB888Planar FP32 BGR888Planar FP32 |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
输出图片格式 |
输出图片宽、高对齐要求 |
输出图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV400 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽乘以4的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YVU444Packed |
无对齐要求 |
宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
RGB888Planar BGR888Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV400 FP32 RGB888 FP32 BGR888 FP32 |
无对齐要求 |
宽stride无对齐要求,宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
RGB888Planar FP32 BGR888Planar FP32 |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
输入图片格式 |
输入图片宽、高对齐要求 |
输入图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV400 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444SP 8bit YVU444SP 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV422Packed YUYV 8bit YUV422Packed UYVY 8bit YUV422Packed YVYU 8bit YUV422Packed VYUY 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽乘以2的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽乘以4的。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV440SP 8bit YVU440SP 8bit |
宽无对齐要求 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YVU420Planar YUV420Planar |
宽2对齐,高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YVU422Planar YUV422Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YVU444Planar YUV444Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YVU444Packed 8bit |
无对齐要求 |
宽stride无对齐要求,宽stride为宽乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV440Planar YVU440Planar |
宽无对齐要求,但宽≤4096 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
RGB888Planar BGR888Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
输出图片格式 |
输出图片宽、高对齐要求 |
输出图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride无对齐要求,与宽相同即可。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV400 8bit |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽乘以4的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YVU444Packed |
无对齐要求 |
宽stride为宽乘以3的值;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
RGB888Planar BGR888Planar |
无对齐要求 |
宽stride无对齐要求,与宽相同即可;高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
输入图片格式 |
输入图片宽、高对齐要求 |
输入图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV400 8bit |
无对齐要求 |
宽stride为宽16对齐后的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽16对齐后的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444SP 8bit YVU444SP 8bit |
无对齐要求 |
宽stride为宽16对齐后的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV422Packed YUYV 8bit YUV422Packed UYVY 8bit YUV422Packed YVYU 8bit YUV422Packed VYUY 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽16对齐后、再乘以2的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以4的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV440SP 8bit YVU440SP 8bit |
宽无对齐要求 高2对齐 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
输出图片格式 |
输出图片宽、高对齐要求 |
输出图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV400 8bit |
无对齐要求 |
宽stride为宽16对齐后的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽16对齐后的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以3的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以4的值。 高stride无对齐要求,与高相同即可。 内存大小(单位Byte)= 宽stride * 高stride |
|
输入图片格式 |
输入图片宽、高对齐要求 |
输入图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV400 8bit |
无对齐要求 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV420SP NV12 8bit YUV420SP NV21 8bit |
宽2对齐 高2对齐 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV422SP 8bit YVU422SP 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 2 |
|
YUV444SP 8bit YVU444SP 8bit |
无对齐要求 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3 |
|
YUV422Packed YUYV 8bit YUV422Packed UYVY 8bit YUV422Packed YVYU 8bit YUV422Packed VYUY 8bit |
宽2对齐 高无对齐要求 |
宽stride为宽16对齐后、再乘以2的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride |
|
YUV444Packed 8bit RGB888 BGR888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以3的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride |
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
无对齐要求 |
宽stride为宽16对齐后、再乘以4的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride |
|
输出图片格式 |
输出图片宽、高对齐要求 |
输出图片宽stride、高stride、内存大小要求 |
|---|---|---|
|
YUV420SP NV12 8bit |
宽2对齐 高2对齐 |
宽stride为宽16对齐后的值。 高stride为高2对齐后的值。 内存大小(单位Byte)= 宽stride * 高stride * 3/2 |
|
YUV420SP NV21 8bit |
8K场景下,各型号支持的输入图片格式不同,如下表所示:
|
型号 |
支持的输入图片格式 |
|---|---|
|
|
YUV420SP NV12 8bit和YUV420SP NV21 8bit |
|
|
|
不同产品型号中,宽stride、高stride最小值或最大值的要求不同:
- 宽stride最小10、最大16384(16384=4096*4,宽是4096的argb格式的图像,1个像素占用4个字节,一行像素就占用4096*4,即宽stride);高stride最小6、最大16384,适用于以下产品型号:
Atlas A3 训练系列产品 /Atlas A3 推理系列产品 Atlas A2 训练系列产品 /Atlas A2 推理系列产品 Atlas 200I/500 A2 推理产品 - 宽stride最小32、最大16384(16384=4096*4,宽是4096的argb格式的图像,1个像素占用4个字节,一行像素就占用4096*4,即宽stride);高stride最小6、最大16384,适用于以下产品型号:
Atlas 训练系列产品
抠图、贴图约束
|
产品版本 |
抠图、贴图约束说明 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YUV格式图像下采样约束
VPC在处理图片时,会根据输入或输出图片格式,将输入图片格式转换为YUV444或RGB用于内部处理,YUV444或RGB没有宽高奇偶数的限制,但当输出图片格式为YUV420SP或YUV422SP格式时,会进行下采样处理,由于YUV420SP或YUV422SP格式本身的数据排布导致宽高存在奇偶数限制,因此输出图片的边缘可能存在异常数据。
出现异常数据的根因在于,在计算过程中,出现输出图片位置处于奇数起始点时,此时YUV444格式的图片是正确的,但是下采样到YUV420SP格式时,由于奇数行和偶数行是共用同一个uv的,导致图片起始行的Y与上一行的UV组成新的像素,产生异常数据。