cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
eewse
Adventurer
Adventurer
678 Views
Registered: ‎02-24-2019

How to split a file using HLS that could produce hdmi out?

 

This dummy_cp program that could produce screen output through hdmi out

 

template <typename T_in>
void dummy_cp( T_in& img_in, T_in& img_out, int rows, int cols) {

hls::Scalar<1, unsigned char> p;
L_row: for(int row = 0; row < rows; row++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=720
    L_col: for(int col = 0; col <cols/2; col++) {
    #pragma HLS LOOP_TRIPCOUNT min=1 max=1280
    #pragma HLS pipeline rewind
    img_in >> p;
    img_out << p;

    }  // L_col
    L_col2: for(int col=cols/2; col < cols; col++) {
    #pragma HLS LOOP_TRIPCOUNT min=1 max=1280
    #pragma HLS pipeline rewind
    img_in >> p;
    img_out << p;

    }  // L_col2
}   // L_row

}

 

But, the following prgram "crop_half" could not produce any output through  hdmi out

template <typename T_in, typename T_out>
void crop_half( T_in& img_in, T_out& img_out, int rows, int cols) {

hls::Scalar<1, unsigned char> p;
L_row: for(int row = 0; row < rows; row++) {
#pragma HLS LOOP_TRIPCOUNT min=1 max=720
    L_col: for(int col = 0; col <cols/2; col++) {
    #pragma HLS LOOP_TRIPCOUNT min=1 max=1280
    #pragma HLS pipeline rewind
    img_in >> p;
    img_out << p;

    }  // L_col
    L_col2: for(int col=cols/2; col < cols; col++) {
    #pragma HLS LOOP_TRIPCOUNT min=1 max=1280
    #pragma HLS pipeline rewind
    img_in >> p;
   // img_out << p;

    }  // L_col2 
}   // L_row

}

Please advise

0 Kudos
2 Replies
scampbell
Moderator
Moderator
620 Views
Registered: ‎10-04-2011

Hello @eewse ,

To me, it looks like the programs are nearly identical, except for the template. However, I did notice that the 2nd program had the following code:

    img_in >> p;
   // img_out << p;

The output stream here is commented out, so the output port would be removed in the design. Does un-commenting that code resolve the issue?

Ok, please let me know,

Scott

0 Kudos
eewse
Adventurer
Adventurer
610 Views
Registered: ‎02-24-2019

because I only need the top half of the image, the 2nd program will not add any pixels into img_out

 

Actually, I want to write something like this. But not working. :(

void merge_tb(GRAY_WK_IMAGE& wk_t_gray, GRAY_WK_IMAGE& wk_b_gray, GRAY_DST_IMAGE& dst_gray) {
static GRAY_PIXEL pixel_t_in;

mtL_row: for(int row = 0; row < half_dst_rows; row++) {
    mtL_col: for(int col = 0; col <dst_cols; col++) {
#pragma HLS LOOP_FLATTEN OFF
#pragma HLS DEPENDENCE array inter false
#pragma HLS PIPELINE
        wk_t_gray >> pixel_t_in;
        dst_gray << pixel_t_in;
    }  // mtL_col
    }   // mtL_row


static GRAY_PIXEL pixel_b_in;

mbL_row: for(int row = 0; row < half_dst_rows; row++) {
    mbL_col: for(int col = 0; col <dst_cols; col++) {
#pragma HLS LOOP_FLATTEN OFF
#pragma HLS DEPENDENCE array inter false
#pragma HLS PIPELINE
        wk_b_gray >> pixel_b_in;
        dst_gray << pixel_b_in;
    }  // mbL_col
    }   // mbL_row

}

 

0 Kudos