cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
531 Views
Registered: ‎12-12-2019

Video processing in vivado hls

Hi, I am using the code to convert RGB to GRAY of an input video which is describe below,--

---------------top.cpp--------------

#include "top.h"
void top(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM, int rows, int cols)
{
#pragma HLS INTERFACE axis port=INPUT_STREAM
#pragma HLS INTERFACE axis port=OUTPUT_STREAM
RGB_IMAGE img_0(rows, cols);
GRAY_IMAGE img_1(rows, cols);
RGB_IMAGE img_2(rows, cols);
#pragma HLS dataflow
while(1)
{
hls::AXIvideo2Mat(INPUT_STREAM, img_0);
hls::CvtColor<HLS_BGR2GRAY>(img_0, img_1);
hls::CvtColor<HLS_GRAY2RGB>(img_1, img_2);
hls::Mat2AXIvideo(img_2, OUTPUT_STREAM);
}
}

--------------------top.h--------------------

#include "hls_video.h"
#include <ap_fixed.h>
#define MAX_WIDTH 2000
#define MAX_HEIGHT 2000
typedef hls::stream<ap_axiu<32,1,1,1> > AXI_STREAM;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> RGB_IMAGE;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> GRAY_IMAGE;
void top(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM, int rows, int cols);

-------------------------test.cpp-------------------

#include <hls_opencv.h>
#include "test.h"
#include <iostream>
using namespace std;
int main (int argc, char** argv) {
IplImage* src;
IplImage* dst;
AXI_STREAM src_axi, dst_axi;
src=cvLoadImage("outcpp1.avi");
dst = cvCreateImage(cvGetSize(src), src->depth, src->nChannels);
IplImage2AXIvideo(src, src_axi);
top(src_axi, dst_axi,src->height,src->width);
AXIvideo2IplImage(dst_axi, dst);
cvSaveImage("op.avi", dst);
cvReleaseImage(&src);
cvReleaseImage(&dst);
}

--------------------------test.h--------------

#include "hls_video.h"
#include <ap_fixed.h>
#define MAX_WIDTH 2000
#define MAX_HEIGHT 2000
typedef hls::stream<ap_axiu<32,1,1,1> > AXI_STREAM;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> RGB_IMAGE;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> GRAY_IMAGE;
void top(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM, int rows, int cols);

---------------------------------------------

 

I am getting this error

*************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
make: 'csim.exe' is up to date.
@E Simulation failed: SIGSEGV.
ERROR: [SIM 211-100] CSim failed with error

0 Kudos
1 Reply
wenchen
Moderator
Moderator
484 Views
Registered: ‎05-27-2018

Hi paulsujoy68@gmail.com ,

     This error means your c simulation has an issue. Technically it has nothing to do with HLS. You should be able to run your c-sim project without any HLS involvement and it should compile and run properly by itself.

    The solution is to debug your testbench under a debugger and see why it's crashing. SIGSEGV means segment violation signal which almost always means that you have accessed memory which doesn't exist or accessed address 0 (both of which are possible outcomes of uninitialized pointer dereferencing)

     Probably, I guess you haven't include your outcpp1.avi file correctly. cvLoadImage function cannot load the .avi file.

      CvCapture *capture =cvCaptureFromAVI("1.avi");

     Try to use an image as an input file first and set the input file path in the project settings->c-sim.

 

Thanks,

Wen

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos