Skip to content

Commit 576f657

Browse files
committed
limiting the size
1 parent 04b0d11 commit 576f657

File tree

9 files changed

+51
-51
lines changed

9 files changed

+51
-51
lines changed

modules/compression/include/ips_jpg_at_model.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ SC_MODULE (jpg_output) {
128128
void compression_operation() {
129129
while(true) {
130130
wait(compression_event);
131-
int output_size;
131+
int output_size = 0;
132132
//Level shift
133133
for(int i=0; i<(image_rows*image_cols);i++){
134134
image[i]=image[i]-128;
135135
}
136136
wait(100, SC_NS);
137137
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
138-
int block_output[Number_of_blocks][Block_rows*Block_cols];
139-
int block_output_size[Number_of_blocks];
138+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
139+
int block_output_size[Number_of_blocks] = {0};
140140
int block_counter = 0;
141141
output_size = 0;
142142
for(int row=0; row<image_rows; row+=Block_rows) {

modules/compression/include/ips_jpg_lt_model.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ SC_MODULE (jpg_output) {
2020
//const int Block_rows = 8;
2121
//const int Block_cols = 8;
2222
double* image;
23-
int image_rows;
24-
int image_cols;
23+
int image_rows = 480;
24+
int image_cols = 640;
2525
signed char EOB = 127; // end of block
2626

2727
//input variables
28-
int PixelValue;
29-
int row;
30-
int col;
28+
int PixelValue = 0;
29+
int row = 0;
30+
int col = 0;
3131

3232
//output variables
3333
signed char *Element;
34-
int index;
34+
int index = 0;
3535

3636
//compression variables
37-
int *output_size;
37+
int *output_size = 0;
3838

3939
int quantificator[8][8] = { // quantization table
4040
{16,11,10,16,24,40,51,61},
@@ -124,8 +124,8 @@ SC_MODULE (jpg_output) {
124124
image[i]=image[i]-128;
125125
}
126126
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
127-
int block_output[Number_of_blocks][Block_rows*Block_cols];
128-
int block_output_size[Number_of_blocks];
127+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
128+
int block_output_size[Number_of_blocks] = {0};
129129
int block_counter = 0;
130130
*output_size = 0;
131131
for(int row=0; row<image_rows; row+=Block_rows) {
@@ -159,7 +159,7 @@ SC_MODULE (jpg_output) {
159159
cos_table[row][col] = cos((((2*row)+1)*col*PI)/16);
160160
}
161161
}
162-
double temp;
162+
double temp = 0.0;
163163
for(int row=row_offset; row<row_offset+Block_rows; row++)
164164
{
165165
double* i_row = &image[row * image_cols];

modules/compression/include/ips_jpg_pv_model.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ SC_MODULE (jpg_output) {
2020
//const int Block_rows = 8;
2121
//const int Block_cols = 8;
2222
double* image;
23-
int image_rows;
24-
int image_cols;
23+
int image_rows = 480;
24+
int image_cols = 640;
2525
signed char EOB = 127; // end of block
2626

2727
int quantificator[8][8] = { // quantization table
@@ -81,8 +81,8 @@ SC_MODULE (jpg_output) {
8181
image[i]=image[i]-128;
8282
}
8383
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
84-
int block_output[Number_of_blocks][Block_rows*Block_cols];
85-
int block_output_size[Number_of_blocks];
84+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
85+
int block_output_size[Number_of_blocks] = {0};
8686
int block_counter = 0;
8787
*output_size = 0;
8888
for(int row=0; row<image_rows; row+=Block_rows) {
@@ -115,7 +115,7 @@ SC_MODULE (jpg_output) {
115115
cos_table[row][col] = cos((((2*row)+1)*col*PI)/16);
116116
}
117117
}
118-
double temp;
118+
double temp = 0.0;
119119
for(int row=row_offset; row<row_offset+Block_rows; row++)
120120
{
121121
double* i_row = &image[row * image_cols];
@@ -159,7 +159,7 @@ SC_MODULE (jpg_output) {
159159
double* i_row = &image[row * image_cols];
160160
for(int col=col_offset; col<col_offset+Block_cols; col++) {
161161
int temp_index = zigzag_index[(row-row_offset)*8+(col-col_offset)];
162-
block_output[temp_index]=i_row[col];
162+
block_output[temp_index] = i_row[col];
163163
if(i_row[col] !=0 && temp_index>index_last_non_zero_value) {index_last_non_zero_value = temp_index+1;}
164164
}
165165
}

modules/compression/src/ips_jpg_at_model.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ SC_MODULE (jpg_output) {
128128
void compression_operation() {
129129
while(true) {
130130
wait(compression_event);
131-
int output_size;
131+
int output_size = 0;
132132
//Level shift
133133
for(int i=0; i<(image_rows*image_cols);i++){
134134
image[i]=image[i]-128;
135135
}
136136
wait(100, SC_NS);
137137
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
138-
int block_output[Number_of_blocks][Block_rows*Block_cols];
139-
int block_output_size[Number_of_blocks];
138+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
139+
int block_output_size[Number_of_blocks] = {0};
140140
int block_counter = 0;
141141
output_size = 0;
142142
for(int row=0; row<image_rows; row+=Block_rows) {

modules/compression/src/ips_jpg_at_testbench.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
#include "ips_jpg_at_model.cpp"
1313

14-
const int Nrows = 16;
15-
const int Ncols = 24;
14+
const int Nrows = 208;
15+
const int Ncols = 288;
1616

1717
struct Image {
1818
int matrix[Nrows][Ncols];
@@ -107,9 +107,9 @@ int sc_main (int argc, char* argv[]) {
107107
//}
108108
//printMatrix(output_image, image_rows, image_cols);
109109

110-
int output_size;
110+
int output_size = 0;
111111
jpg_comp.JPEG_compression();
112-
sc_start(10000,SC_NS);
112+
sc_start(700000,SC_NS);
113113
output_size = Array_size.read();
114114

115115
signed char output_array[output_size];

modules/compression/src/ips_jpg_lt_model.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ SC_MODULE (jpg_output) {
2020
//const int Block_rows = 8;
2121
//const int Block_cols = 8;
2222
double* image;
23-
int image_rows;
24-
int image_cols;
23+
int image_rows = 480;
24+
int image_cols = 640;
2525
signed char EOB = 127; // end of block
2626

2727
//input variables
28-
int PixelValue;
29-
int row;
30-
int col;
28+
int PixelValue = 0;
29+
int row = 0;
30+
int col = 0;
3131

3232
//output variables
3333
signed char *Element;
34-
int index;
34+
int index = 0;
3535

3636
//compression variables
37-
int *output_size;
37+
int *output_size = 0;
3838

3939
int quantificator[8][8] = { // quantization table
4040
{16,11,10,16,24,40,51,61},
@@ -124,8 +124,8 @@ SC_MODULE (jpg_output) {
124124
image[i]=image[i]-128;
125125
}
126126
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
127-
int block_output[Number_of_blocks][Block_rows*Block_cols];
128-
int block_output_size[Number_of_blocks];
127+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
128+
int block_output_size[Number_of_blocks] = {0};
129129
int block_counter = 0;
130130
*output_size = 0;
131131
for(int row=0; row<image_rows; row+=Block_rows) {
@@ -159,7 +159,7 @@ SC_MODULE (jpg_output) {
159159
cos_table[row][col] = cos((((2*row)+1)*col*PI)/16);
160160
}
161161
}
162-
double temp;
162+
double temp = 0.0;
163163
for(int row=row_offset; row<row_offset+Block_rows; row++)
164164
{
165165
double* i_row = &image[row * image_cols];

modules/compression/src/ips_jpg_lt_testbench.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
#include "ips_jpg_lt_model.cpp"
1313

14-
const int Nrows = 16;
15-
const int Ncols = 24;
14+
const int Nrows = 208;
15+
const int Ncols = 288;
1616

1717
struct Image {
18-
int matrix[Nrows][Ncols];
18+
int matrix[Nrows][Ncols] = {0};
1919
};
2020

2121
Image dummy_img(int i_rows, int i_cols)
@@ -86,9 +86,9 @@ int sc_main (int argc, char* argv[]) {
8686
//}
8787
//printMatrix(output_image, image_rows, image_cols);
8888

89-
int output_size;
89+
int output_size = 0;
9090
jpg_comp.JPEG_compression(&output_size);
91-
sc_start(10000,SC_NS);
91+
sc_start(700000,SC_NS);
9292

9393
signed char output_array[output_size];
9494
sc_trace(wf, output_array, "output_array");

modules/compression/src/ips_jpg_pv_model.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ SC_MODULE (jpg_output) {
2020
//const int Block_rows = 8;
2121
//const int Block_cols = 8;
2222
double* image;
23-
int image_rows;
24-
int image_cols;
23+
int image_rows = 480;
24+
int image_cols = 640;
2525
signed char EOB = 127; // end of block
2626

2727
int quantificator[8][8] = { // quantization table
@@ -81,8 +81,8 @@ SC_MODULE (jpg_output) {
8181
image[i]=image[i]-128;
8282
}
8383
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
84-
int block_output[Number_of_blocks][Block_rows*Block_cols];
85-
int block_output_size[Number_of_blocks];
84+
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
85+
int block_output_size[Number_of_blocks] = {0};
8686
int block_counter = 0;
8787
*output_size = 0;
8888
for(int row=0; row<image_rows; row+=Block_rows) {
@@ -115,7 +115,7 @@ SC_MODULE (jpg_output) {
115115
cos_table[row][col] = cos((((2*row)+1)*col*PI)/16);
116116
}
117117
}
118-
double temp;
118+
double temp = 0.0;
119119
for(int row=row_offset; row<row_offset+Block_rows; row++)
120120
{
121121
double* i_row = &image[row * image_cols];
@@ -159,7 +159,7 @@ SC_MODULE (jpg_output) {
159159
double* i_row = &image[row * image_cols];
160160
for(int col=col_offset; col<col_offset+Block_cols; col++) {
161161
int temp_index = zigzag_index[(row-row_offset)*8+(col-col_offset)];
162-
block_output[temp_index]=i_row[col];
162+
block_output[temp_index] = i_row[col];
163163
if(i_row[col] !=0 && temp_index>index_last_non_zero_value) {index_last_non_zero_value = temp_index+1;}
164164
}
165165
}

modules/compression/src/ips_jpg_pv_testbench.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
#include "ips_jpg_pv_model.cpp"
1313

14-
const int Nrows = 16;
15-
const int Ncols = 24;
14+
const int Nrows = 452;
15+
const int Ncols = 640;
1616

1717
struct Image {
18-
int matrix[Nrows][Ncols];
18+
int matrix[Nrows][Ncols] = {0};
1919
};
2020

2121
Image dummy_img(int i_rows, int i_cols)
@@ -85,7 +85,7 @@ int sc_main (int argc, char* argv[]) {
8585
//}
8686
//printMatrix(output_image, image_rows, image_cols);
8787

88-
int output_size;
88+
int output_size = 0;
8989
jpg_comp.JPEG_compression(&output_size);
9090

9191
signed char output_array[output_size];

0 commit comments

Comments
 (0)