Skip to content

Commit b342383

Browse files
committed
Account for compression rate not multiple of 8 bytes
1 parent 2e3aaea commit b342383

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

modules/router/src/tb_edge_detector_tlm.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,23 @@ SC_MODULE(Tb_top)
569569
local_count = 0;
570570
local_group_count++;
571571
}
572+
573+
current_number_of_pixels++;
574+
if (((((float)(current_number_of_pixels)) / ((float)(total_number_of_pixels))) * 100.0) >= next_target_of_completion) {
575+
dbgprint("Image processing completed at %f", next_target_of_completion);
576+
next_target_of_completion += 10.0;
577+
}
572578
}
573579
}
574580

575581
jpg_comp_DUT->jpeg_compression(&compression_output_size);
576582

577583
local_count = 0;
578584
local_group_count = 0;
585+
current_number_of_pixels = 0;
586+
next_target_of_completion = 10.0;
579587
compression_results = new signed char[compression_output_size];
588+
total_number_of_pixels = compression_output_size;
580589
for (int i = 0; i < compression_output_size; i++)
581590
{
582591
jpg_comp_DUT->output_byte(compression_results, i);
@@ -596,6 +605,24 @@ SC_MODULE(Tb_top)
596605
local_group_count++;
597606
}
598607

608+
current_number_of_pixels++;
609+
if (((((float)(current_number_of_pixels)) / ((float)(total_number_of_pixels))) * 100.0) >= next_target_of_completion) {
610+
dbgprint("Image processing completed at %f", next_target_of_completion);
611+
next_target_of_completion += 10.0;
612+
}
613+
}
614+
615+
dbgprint("Finished with the compression algorithm of the image");
616+
617+
if (compression_output_size % 8 != 0)
618+
{
619+
local_results = reinterpret_cast<unsigned char*>(compression_results + (local_group_count * 8 * sizeof(char)));
620+
dbgmodprint(use_prints, "Before doing a write in TB");
621+
sanity_check_address(IMG_COMPRESSED + (local_group_count * 8 * sizeof(char)), IMG_COMPRESSED, IMG_COMPRESSED + IMG_COMPRESSED_SZ);
622+
tb_initiator->write(local_results, IMG_COMPRESSED + (local_group_count * 8 * sizeof(char)), (compression_output_size % 8) * sizeof(char));
623+
dbgmodprint(use_prints, "After doing a write in TB");
624+
local_count = 0;
625+
local_group_count++;
599626
}
600627

601628
dbgprint("Finished with the compression of the image");

0 commit comments

Comments
 (0)