取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
dwj909727985
Adventurer
Adventurer
303 次查看
注册日期: ‎05-04-2018

Vivado HLS工程移植Vitis HLS过程中类型转换

跳至解决方案

 

定义类型

typedef hls::stream<xf::cv::ap_axiu<PIXEL_IN_WIDTH,1,1,1> > AXI_STREAM_IN;
typedef hls::stream<xf::cv::ap_axiu<PIXEL_OUT_WIDTH,1,1,1> > AXI_STREAM_OUT_12BIT;
typedef hls::stream<xf::cv::ap_axiu<32,1,1,1> > AXI_STREAM_OUT_20BIT;

typedef xf::cv::Mat<XF_32SC1, IMG_HEIGHT_MAX, IMG_WIDTH_MAX, XF_NPPC1> IMAGE_IN;
typedef xf::cv::Mat<XF_12UC1, IMG_HEIGHT_MAX, IMG_WIDTH_MAX, XF_NPPC1> IMAGE_OUT_12BIT;
typedef xf::cv::Mat<XF_32SC1, IMG_HEIGHT_MAX, IMG_WIDTH_MAX, XF_NPPC1> IMAGE_OUT_20BIT;

typedef xf::cv::Scalar<1, ap_uint<PIXEL_IN_WIDTH> > PIXEL;
typedef xf::cv::Scalar<1, ap_uint<PIXEL_OUT_WIDTH> > PIXEL_OUT_12BIT;
typedef xf::cv::Scalar<1, ap_uint<32> > PIXEL_OUT_20BIT;

IMAGE_IN img_in(inputPort.IMG_H, inputPort.IMG_W);
IMAGE_OUT_12BIT img_out_12bit(inputPort.IMG_H, inputPort.IMG_W);
IMAGE_OUT_20BIT img_out_20bit(inputPort.IMG_H, inputPort.IMG_W);

xf::cv::AXIvideo2xfMat(input, img_in); // stream to matrix stream

PIXEL pixelIn; // pixel in
PIXEL_OUT_12BIT pixelOut_12Bit; // pixel out
PIXEL_OUT_20BIT pixelOut_20Bit; // pixel out
LINEBUF lbuf; // line buffer
WINDOW window; // window buffer

img_in >> pixelIn;//报错的位置

img_out_12bit << pixelOut_12Bit;//报错的位置
img_out_20bit << pixelOut_20Bit;//报错的位置

输入图像数据时,我把Stream类型的数据转换为Scalar类型的进行图像处理,处理完后再将Scalar类型的数据转换为Stream类型(Vivado HLS中是这样处理的),到Vitis HLS中之后就出现以下错误,Vitis HLS中应该怎么表示这两个类型数据之间的转换?

ERROR: [HLS 207-3719] invalid operands to binary expression ('IMAGE_IN' (aka 'Mat<XF_32SC1, 1080, 1920, XF_NPPC1>') and 'PIXEL' (aka 'Scalar<1, ap_uint<32> >')): HLS_TM_CORE/TM_CORE.cpp:175:12

ERROR: [HLS 207-3719] invalid operands to binary expression ('IMAGE_OUT_12BIT' (aka 'Mat<XF_12UC1, 1080, 1920, XF_NPPC1>') and 'PIXEL_OUT_12BIT' (aka 'Scalar<1, ap_uint<12> >')): HLS_TM_CORE/TM_CORE.cpp:438:19

ERROR: [HLS 207-3719] invalid operands to binary expression ('IMAGE_OUT_20BIT' (aka 'Mat<XF_32SC1, 1080, 1920, XF_NPPC1>') and 'PIXEL_OUT_20BIT' (aka 'Scalar<1, ap_uint<32> >')): HLS_TM_CORE/TM_CORE.cpp:439:19

0 项奖励
回复
1 解答

已接受的解答
wenchen
Moderator
Moderator
248 次查看
注册日期: ‎05-27-2018

Hi @dwj909727985 

看一下以下表格,了解一下xf::cv::Mat 格式的更新,报错位置的<< 符号已经在Vitis vision 中不支持了

https://xilinx.github.io/Vitis_Libraries/vision/2020.1/migrating-hls-video-library-to-vitis-vision.html?highlight=scalar

Table : Infrastructure Functions and Classes
Member Function hls::Mat (HLS Video lib) xf::cv::Mat (Vitis vision lib)
channels() Returns the number of channels Returns the number of channels
type() Returns the enum value of pixel type Returns the enum value of pixel type
depth() Returns the enum value of pixel type Returns the depth of pixel including channels
read() Readout a value and return it as a scalar from stream Readout a value from a given location and return it as a packed (for multi-pixel/clock) value.
operator >> Similar to read() Not available in Vitis vision
operator << Similar to write() Not available in Vitis vision
Write() Write a scalar value into the stream Writes a packed (for multi-pixel/clock) value into the given location.
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
2 回复数
wenchen
Moderator
Moderator
249 次查看
注册日期: ‎05-27-2018

Hi @dwj909727985 

看一下以下表格,了解一下xf::cv::Mat 格式的更新,报错位置的<< 符号已经在Vitis vision 中不支持了

https://xilinx.github.io/Vitis_Libraries/vision/2020.1/migrating-hls-video-library-to-vitis-vision.html?highlight=scalar

Table : Infrastructure Functions and Classes
Member Function hls::Mat (HLS Video lib) xf::cv::Mat (Vitis vision lib)
channels() Returns the number of channels Returns the number of channels
type() Returns the enum value of pixel type Returns the enum value of pixel type
depth() Returns the enum value of pixel type Returns the depth of pixel including channels
read() Readout a value and return it as a scalar from stream Readout a value from a given location and return it as a packed (for multi-pixel/clock) value.
operator >> Similar to read() Not available in Vitis vision
operator << Similar to write() Not available in Vitis vision
Write() Write a scalar value into the stream Writes a packed (for multi-pixel/clock) value into the given location.
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
dwj909727985
Adventurer
Adventurer
235 次查看
注册日期: ‎05-04-2018
0 项奖励
回复