Skip to content

Commit c1de6e8

Browse files
committed
Fix allocation of image in memory
1 parent 50004ae commit c1de6e8

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

modules/router/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ ifdef DISABLE_ROUTER_DEBUG
7474
LFLAGS += -DDISABLE_ROUTER_DEBUG
7575
endif # DISABLE_ROUTER_DEBUG
7676

77+
ifdef DISABLE_VGA_DEBUG
78+
CFLAGS += -DDISABLE_VGA_DEBUG
79+
LFLAGS += -DDISABLE_VGA_DEBUG
80+
endif # DISABLE_VGA_DEBUG
81+
7782
ifdef DISABLE_FILTER_DEBUG
7883
CFLAGS += -DDISABLE_FILTER_DEBUG
7984
LFLAGS += -DDISABLE_FILTER_DEBUG

modules/router/src/tb_edge_detector_tlm.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -330,22 +330,13 @@ SC_MODULE(Tb_top)
330330
Mat detectedImageAfterMemY(IMAG_ROWS, IMAG_COLS, CV_8UC1);
331331
Mat detectedImageAfterMem(IMAG_ROWS, IMAG_COLS, CV_8UC1);
332332

333-
dbgprint("Starting VGA to receive image");
333+
dbgprint("Starting receiving of the image through VGA");
334334

335335
unsigned char *vga_start = new unsigned char;
336336
unsigned char *vga_done;
337337
*vga_start = 1;
338338
tb_initiator->write(vga_start, IMG_INPUT_START_ADDRESS_LO, sizeof(char));
339339

340-
// for (int i = 0; i < IPS_TOTAL_VERTICAL; ++i)
341-
// {
342-
// for (int j = 0; j < IPS_TOTAL_HORIZONTAL; ++j)
343-
// {
344-
// // this->vga_DUT->run();
345-
// // Wait 40ns for conversions
346-
347-
// }
348-
// }
349340
tb_initiator->read(vga_done, IMG_INPUT_DONE_ADDRESS_LO, sizeof(char));
350341
while (*vga_done == 0)
351342
{
@@ -355,7 +346,7 @@ SC_MODULE(Tb_top)
355346
}
356347
delete[] vga_done;
357348

358-
dbgprint("Ending VGA");
349+
dbgprint("Finished receiving of the image through VGA");
359350

360351
tb_initiator->read(local_results, IMG_INPUT_ADDRESS_LO, IMAG_ROWS * IMAG_COLS * 3);
361352

@@ -370,8 +361,6 @@ SC_MODULE(Tb_top)
370361
}
371362
}
372363

373-
/*
374-
375364
total_number_of_pixels = IMAG_ROWS * IMAG_COLS;
376365

377366
dbgprint("Starting gray scale conversion");
@@ -844,10 +833,10 @@ SC_MODULE(Tb_top)
844833
}
845834

846835
dbgprint("Finished with the transmision of the image");
847-
*/
836+
848837

849838
imwrite("originalImageAfterMem.jpg", originalImageAfterMem);
850-
/*
839+
851840
imwrite("grayImagePrevMem.jpg", grayImagePrevMem);
852841
imwrite("grayImageAfterMem.jpg", grayImageAfterMem);
853842
imwrite("filteredImagePrevMem.jpg", filteredImagePrevMem);
@@ -857,7 +846,7 @@ SC_MODULE(Tb_top)
857846
imwrite("detectedImagePrevMemY.jpg", detectedImagePrevMemY);
858847
imwrite("detectedImageAfterMemY.jpg", detectedImageAfterMemY);
859848
imwrite("detectedImagePrevMem.jpg", detectedImagePrevMem);
860-
imwrite("detectedImageAfterMem.jpg", detectedImageAfterMem);*/
849+
imwrite("detectedImageAfterMem.jpg", detectedImageAfterMem);
861850

862851
sc_stop();
863852
}

modules/vga/include/vga.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ SC_MODULE(vga)
179179

180180
if (!((IMG_ROW < 0) || (IMG_COL < 0) || (IMG_ROW >= V_ACTIVE) || (IMG_COL >= H_ACTIVE)))
181181
{
182-
const unsigned int INDEX = IMG_ROW * (3 * V_ACTIVE) + 3 * IMG_COL;
182+
const unsigned int INDEX = IMG_ROW * (3 * H_ACTIVE) + 3 * IMG_COL;
183183

184184
this->tmp_img[INDEX] = this->red.read();
185185
this->tmp_img[INDEX + 1] = this->green.read();

0 commit comments

Comments
 (0)