summaryrefslogtreecommitdiffstats
path: root/baseline/source/cjpeg_transupp/cjpeg_transupp.c
diff options
context:
space:
mode:
Diffstat (limited to 'baseline/source/cjpeg_transupp/cjpeg_transupp.c')
-rw-r--r--baseline/source/cjpeg_transupp/cjpeg_transupp.c716
1 files changed, 0 insertions, 716 deletions
diff --git a/baseline/source/cjpeg_transupp/cjpeg_transupp.c b/baseline/source/cjpeg_transupp/cjpeg_transupp.c
deleted file mode 100644
index 112fba1..0000000
--- a/baseline/source/cjpeg_transupp/cjpeg_transupp.c
+++ /dev/null
@@ -1,716 +0,0 @@
1/*
2
3 This program is part of the TACLeBench benchmark suite.
4 Version V 2.0
5
6 Name: cjpeg_transupp
7
8 Author: Thomas G. Lane
9
10 Function: This file contains image transformation routines and other utility
11 code used by the jpegtran sample application. These are NOT part of the core
12 JPEG library. But we keep these routines separate from jpegtran.c to ease
13 the task of maintaining jpegtran-like programs that have other user
14 interfaces.
15
16 Source: MediaBench II
17 http://euler.slu.edu/~fritts/mediabench (mirror)
18
19 Original name: cjpeg
20
21 Changes: No major functional changes.
22
23 License: See the accompanying README file.
24
25*/
26
27
28/*
29 Include section
30*/
31
32#include "extra.h"
33#include "jpeglib.h"
34
35
36/*
37 Forward declaration of functions
38*/
39
40void cjpeg_transupp_initSeed( void );
41signed char cjpeg_transupp_randomInteger( void );
42void cjpeg_transupp_init( void );
43int cjpeg_transupp_return( void );
44void cjpeg_transupp_do_flip_v( j_compress_ptr );
45void cjpeg_transupp_do_rot_90( j_compress_ptr );
46void cjpeg_transupp_do_rot_180( j_compress_ptr );
47void cjpeg_transupp_do_rot_270( j_compress_ptr );
48void cjpeg_transupp_do_transverse( j_compress_ptr );
49void cjpeg_transupp_main( void );
50//int main( void );
51
52
53/*
54 Declaration of global variables
55*/
56
57volatile int cjpeg_transupp_seed;
58
59signed char cjpeg_transupp_input[ 256 ];
60signed char cjpeg_transupp_input2[ 80 ];
61signed char cjpeg_transupp_input3[ 65 ];
62signed char cjpeg_transupp_input3_2[ 65 ];
63signed char cjpeg_transupp_input4[ 64 ];
64signed char cjpeg_transupp_input5[ 65 ];
65signed char cjpeg_transupp_input5_2[ 65 ];
66
67/* Output arrays replace writing of results into a file. */
68signed char cjpeg_transupp_output_data[ 512 ];
69signed char cjpeg_transupp_output_data2[ 512 ];
70signed char cjpeg_transupp_output_data3[ 512 ];
71signed char cjpeg_transupp_output_data4[ 512 ];
72signed char cjpeg_transupp_output_data5[ 512 ];
73
74struct jpeg_compress_struct cjpeg_transupp_dstinfo;
75
76
77/*
78 Initialization- and return-value-related functions
79*/
80
81void cjpeg_transupp_initSeed( void )
82{
83 cjpeg_transupp_seed = 0;
84}
85
86
87/*
88 cjpeg_transupp_RandomInteger generates random integers between -128 and 127.
89*/
90signed char cjpeg_transupp_randomInteger( void )
91{
92 cjpeg_transupp_seed = ( ( ( cjpeg_transupp_seed * 133 ) + 81 ) % 256 ) - 128;
93 return( cjpeg_transupp_seed );
94}
95
96
97void cjpeg_transupp_init( void )
98{
99 register int i;
100
101
102 cjpeg_transupp_dstinfo.max_h_samp_factor = 2;
103 cjpeg_transupp_dstinfo.max_v_samp_factor = 2;
104 cjpeg_transupp_dstinfo.num_components = 3;
105
106 cjpeg_transupp_initSeed();
107
108 _Pragma( "loopbound min 256 max 256" )
109 for ( i = 0; i < 256; i++ )
110 cjpeg_transupp_input[ i ] = cjpeg_transupp_randomInteger();
111
112 _Pragma( "loopbound min 80 max 80" )
113 for ( i = 0; i < 80; i++ )
114 cjpeg_transupp_input2[ i ] = cjpeg_transupp_randomInteger();
115
116 _Pragma( "loopbound min 65 max 65" )
117 for ( i = 0; i < 65; i++ )
118 cjpeg_transupp_input3[ i ] = cjpeg_transupp_randomInteger();
119
120 _Pragma( "loopbound min 65 max 65" )
121 for ( i = 0; i < 65; i++ )
122 cjpeg_transupp_input3_2[ i ] = cjpeg_transupp_randomInteger();
123
124 _Pragma( "loopbound min 64 max 64" )
125 for ( i = 0; i < 64; i++ )
126 cjpeg_transupp_input4[ i ] = cjpeg_transupp_randomInteger();
127
128 _Pragma( "loopbound min 65 max 65" )
129 for ( i = 0; i < 65; i++ )
130 cjpeg_transupp_input5[ i ] = cjpeg_transupp_randomInteger();
131
132 _Pragma( "loopbound min 65 max 65" )
133 for ( i = 0; i < 65; i++ )
134 cjpeg_transupp_input5_2[ i ] = cjpeg_transupp_randomInteger();
135}
136
137
138int cjpeg_transupp_return( void )
139{
140 int checksum = 0;
141 unsigned int i;
142
143
144 _Pragma( "loopbound min 512 max 512" )
145 for ( i = 0; i < 512; i++ )
146 checksum += cjpeg_transupp_output_data[ i ];
147
148 _Pragma( "loopbound min 512 max 512" )
149 for ( i = 0; i < 512; i++ )
150 checksum += cjpeg_transupp_output_data2[ i ];
151
152 _Pragma( "loopbound min 512 max 512" )
153 for ( i = 0; i < 512; i++ )
154 checksum += cjpeg_transupp_output_data3[ i ];
155
156 _Pragma( "loopbound min 512 max 512" )
157 for ( i = 0; i < 512; i++ )
158 checksum += cjpeg_transupp_output_data4[ i ];
159
160 _Pragma( "loopbound min 512 max 512" )
161 for ( i = 0; i < 512; i++ )
162 checksum += cjpeg_transupp_output_data5[ i ];
163
164 return( checksum );
165}
166
167
168/*
169 Algorithm core functions
170*/
171
172/*
173 Vertical flip
174*/
175void cjpeg_transupp_do_flip_v( j_compress_ptr dstinfo )
176{
177 unsigned int MCU_rows, comp_height, dst_blk_x, dst_blk_y;
178 int ci, i, j, offset_y;
179 JCOEFPTR src_ptr, dst_ptr;
180
181
182 /*
183 We output into a separate array because we can't touch different rows of the
184 source virtual array simultaneously. Otherwise, this is a pretty
185 straightforward analog of horizontal flip.
186 Within a DCT block, vertical mirroring is done by changing the signs of
187 odd-numbered rows.
188 Partial iMCUs at the bottom edge are copied verbatim.
189 */
190 MCU_rows = dstinfo->image_height / ( dstinfo->max_v_samp_factor * DCTSIZE );
191
192 int compptr_v_samp_factor = 8;
193 unsigned int compptr_height_in_blocks = 19;
194 unsigned int compptr_width_in_blocks = 29;
195
196 _Pragma( "loopbound min 3 max 3" )
197 for ( ci = 0; ci < dstinfo->num_components;