Skip to content

Commit eb669c1

Browse files
committed
chaing typing to snake_style
1 parent 7e88c2b commit eb669c1

File tree

9 files changed

+157
-157
lines changed

9 files changed

+157
-157
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ echo 'Compiling *.c *cpp files'
33
rm -rf ips_jpg.o
44
export SYSTEMC_HOME=/usr/local/systemc-2.3.3/
55
export OPENCV_H_DIR=/usr/local/include/opencv4/
6-
export OPENCV_L_DIR=/usr/local/lib/
6+
export OPENCV_SO_DIR=/usr/local/lib/
77
export LD_LIBRARY_PATH=$SYSTEMC_HOME/lib-linux64
8-
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_L_DIR ips_jpg_at_testbench.cpp ips_jpg_at_model.cpp -lsystemc -lm -o ips_jpg.o
8+
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -Iinclude/ -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_SO_DIR src/ips_jpg_at_testbench.hpp include/ips_jpg_at_model.cpp -lsystemc -lm -o ips_jpg.o
99
echo 'Simulation Started'
1010
./ips_jpg.o
1111
echo 'Simulation Ended'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ echo 'Compiling *.c *cpp files'
33
rm -rf ips_jpg.o
44
export SYSTEMC_HOME=/usr/local/systemc-2.3.3/
55
export OPENCV_H_DIR=/usr/local/include/opencv4/
6-
export OPENCV_L_DIR=/usr/local/lib/
6+
export OPENCV_SO_DIR=/usr/local/lib/
77
export LD_LIBRARY_PATH=$SYSTEMC_HOME/lib-linux64
8-
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_L_DIR ips_jpg_lt_testbench.cpp ips_jpg_lt_model.cpp -lsystemc -lm -o ips_jpg.o
8+
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -Iinclude/ -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_SO_DIR src/ips_jpg_lt_testbench.cpp include/ips_jpg_lt_model.hpp -lsystemc -lm -o ips_jpg.o
99
echo 'Simulation Started'
1010
./ips_jpg.o
1111
echo 'Simulation Ended'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ echo 'Compiling *.c *cpp files'
33
rm -rf ips_jpg.o
44
export SYSTEMC_HOME=/usr/local/systemc-2.3.3/
55
export OPENCV_H_DIR=/usr/local/include/opencv4/
6-
export OPENCV_L_DIR=/usr/local/lib/
6+
export OPENCV_SO_DIR=/usr/local/lib/
77
export LD_LIBRARY_PATH=$SYSTEMC_HOME/lib-linux64
8-
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_L_DIR ips_jpg_pv_testbench.cpp ips_jpg_pv_model.cpp -lsystemc -lm -o ips_jpg.o
8+
g++ -I$SYSTEMC_HOME/include -I$OPENCV_H_DIR -Iinclude/ -L$SYSTEMC_HOME/lib-linux64 -L$OPENCV_SO_DIR src/ips_jpg_pv_testbench.cpp include/ips_jpg_pv_model.hpp -lsystemc -lm -o ips_jpg.o
99
echo 'Simulation Started'
1010
./ips_jpg.o
1111
echo 'Simulation Ended'

modules/compression/include/ips_jpg_at_model.hpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
* *5. Entropy compression by variable length encoding (huffman). Used to maximize compression. Not implemented here.
1212
*/
1313
#define PI 3.1415926535897932384626433832795
14-
#define Block_rows 8
15-
#define Block_cols 8
14+
#define BLOCK_ROWS 8
15+
#define BLOCK_COLS 8
1616

1717
SC_MODULE (jpg_output) {
1818

1919
//input signals
20-
sc_in<sc_int<32> > PixelValue_signal;
20+
sc_in<sc_int<32> > pixel_value_signal;
2121
sc_in<sc_int<32> > row_signal;
2222
sc_in<sc_int<32> > col_signal;
2323

2424
//output signals
25-
sc_out<sc_int<8> > Element_signal;
25+
sc_out<sc_int<8> > element_signal;
2626
sc_in<sc_int<32> > index_signal;
2727

2828
//compression signals
@@ -34,7 +34,7 @@ SC_MODULE (jpg_output) {
3434
double* image;
3535
int image_rows = 480;
3636
int image_cols = 640;
37-
signed char EOB = 127; // end of block
37+
signed char eob = 127; // end of block
3838

3939
int quantificator[8][8] = { // quantization table
4040
{16,11,10,16,24,40,51,61},
@@ -84,24 +84,24 @@ SC_MODULE (jpg_output) {
8484
while(true) {
8585
wait(starter_event);
8686
int im_rows = row_signal.read();
87-
if(im_rows%Block_rows==0) {image_rows=im_rows;}
88-
else {image_rows=(im_rows/Block_rows+1)*Block_rows;}
87+
if(im_rows%BLOCK_ROWS==0) {image_rows=im_rows;}
88+
else {image_rows=(im_rows/BLOCK_ROWS+1)*BLOCK_ROWS;}
8989
wait(4, SC_NS);
9090
int im_cols = col_signal.read();
91-
if(im_cols%Block_cols==0) {image_cols=im_cols;}
92-
else {image_cols=(im_cols/Block_cols+1)*Block_cols;}
91+
if(im_cols%BLOCK_COLS==0) {image_cols=im_cols;}
92+
else {image_cols=(im_cols/BLOCK_COLS+1)*BLOCK_COLS;}
9393
}
9494
}
9595

96-
void InputPixel() {
96+
void input_pixel() {
9797
input_event.notify(8, SC_NS);
9898
}
9999

100100
void input_operation(){
101101
while(true) {
102102
wait(input_event);
103103
double* i_row = &image[row_signal.read() * image_cols];
104-
i_row[col_signal.read()] = double(PixelValue_signal.read());
104+
i_row[col_signal.read()] = double(pixel_value_signal.read());
105105
}
106106
}
107107

@@ -110,18 +110,18 @@ SC_MODULE (jpg_output) {
110110
// *Pixel = int(i_row[col]);
111111
//}
112112

113-
void OutputByte() {
113+
void output_byte() {
114114
output_event.notify(8, SC_NS);
115115
}
116116

117117
void output_operation(){
118118
while(true) {
119119
wait(output_event);
120-
Element_signal = image[index_signal.read()];
120+
element_signal = image[index_signal.read()];
121121
}
122122
}
123123

124-
void JPEG_compression() {
124+
void jpeg_compression() {
125125
compression_event.notify(100, SC_NS);
126126
}
127127

@@ -134,48 +134,48 @@ SC_MODULE (jpg_output) {
134134
image[i]=image[i]-128;
135135
}
136136
wait(100, SC_NS);
137-
int Number_of_blocks = image_rows*image_cols/(Block_rows*Block_cols);
138-
int block_output[Number_of_blocks][Block_rows*Block_cols] = {0};
139-
int block_output_size[Number_of_blocks] = {0};
137+
int number_of_blocks = image_rows*image_cols/(BLOCK_ROWS*BLOCK_COLS);
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;
142-
for(int row=0; row<image_rows; row+=Block_rows) {
142+
for(int row=0; row<image_rows; row+=BLOCK_ROWS) {
143143
double* i_row = &image[row * image_cols];
144-
for(int col=0; col<image_cols; col+=Block_cols) { //Divided the image in 8×8 blocks
145-
DCT(row,col);
146-
Quantization(row,col);
147-
ZigZag(row,col,&block_output_size[block_counter],block_output[block_counter]);
144+
for(int col=0; col<image_cols; col+=BLOCK_COLS) { //Divided the image in 8×8 blocks
145+
dct(row,col);
146+
quantization(row,col);
147+
zigzag(row,col,&block_output_size[block_counter],block_output[block_counter]);
148148
output_size += block_output_size[block_counter]+1;
149149
block_counter++;
150150
}
151151
}
152152
int output_counter = 0;
153-
for(int block_index=0;block_index<Number_of_blocks;block_index++){
153+
for(int block_index=0;block_index<number_of_blocks;block_index++){
154154
for(int out_index=0; out_index<block_output_size[block_index];out_index++){
155155
image[output_counter]=block_output[block_index][out_index];
156156
output_counter++;
157157
}
158-
image[output_counter]=EOB;
158+
image[output_counter]=eob;
159159
output_counter++;
160160
}
161161
output_size_signal = output_size;
162162
}
163163
}
164164

165-
void DCT(int row_offset, int col_offset) {
165+
void dct(int row_offset, int col_offset) {
166166
wait(400, SC_NS);
167-
double cos_table[Block_rows][Block_cols];
168-
for (int row = 0; row < Block_rows; row++) //make the cosine table
167+
double cos_table[BLOCK_ROWS][BLOCK_COLS];
168+
for (int row = 0; row < BLOCK_ROWS; row++) //make the cosine table
169169
{
170-
for (int col = 0; col < Block_cols; col++) {
170+
for (int col = 0; col < BLOCK_COLS; col++) {
171171
cos_table[row][col] = cos((((2*row)+1)*col*PI)/16);
172172
}
173173
}
174174
double temp;
175-
for(int row=row_offset; row<row_offset+Block_rows; row++)
175+
for(int row=row_offset; row<row_offset+BLOCK_ROWS; row++)
176176
{
177177
double* i_row = &image[row * image_cols];
178-
for(int col=col_offset; col<col_offset+Block_cols; col++) {
178+
for(int col=col_offset; col<col_offset+BLOCK_COLS; col++) {
179179
//i_row[col] = cos_table[row-row_offset][col-col_offset];
180180
temp = 0.0;
181181
for (int x = 0; x < 8; x++){
@@ -198,24 +198,24 @@ SC_MODULE (jpg_output) {
198198
}
199199
}
200200

201-
void Quantization(int row_offset, int col_offset) {
201+
void quantization(int row_offset, int col_offset) {
202202
wait(100, SC_NS);
203-
for(int row=row_offset; row<row_offset+Block_rows; row++)
203+
for(int row=row_offset; row<row_offset+BLOCK_ROWS; row++)
204204
{
205205
double* i_row = &image[row * image_cols];
206-
for(int col=col_offset; col<col_offset+Block_cols; col++) {
206+
for(int col=col_offset; col<col_offset+BLOCK_COLS; col++) {
207207
i_row[col] = round(i_row[col]/quantificator[row-row_offset][col-col_offset]);
208208
}
209209
}
210210
}
211211

212-
void ZigZag(int row_offset, int col_offset, int *block_output_size, int *block_output) {
212+
void zigzag(int row_offset, int col_offset, int *block_output_size, int *block_output) {
213213
wait(200, SC_NS);
214214
int index_last_non_zero_value = 0; // index to last non-zero in a block zigzag array
215-
for(int row=row_offset; row<row_offset+Block_rows; row++)
215+
for(int row=row_offset; row<row_offset+BLOCK_ROWS; row++)
216216
{
217217
double* i_row = &image[row * image_cols];
218-
for(int col=col_offset; col<col_offset+Block_cols; col++) {
218+
for(int col=col_offset; col<col_offset+BLOCK_COLS; col++) {
219219
int temp_index = zigzag_index[(row-row_offset)*8+(col-col_offset)];
220220
block_output[temp_index]=i_row[col];
221221
if(i_row[col] !=0 && temp_index>index_last_non_zero_value) {index_last_non_zero_value = temp_index+1;}

0 commit comments

Comments
 (0)