@@ -141,17 +141,15 @@ struct rjpeg
141141
142142typedef struct
143143{
144- uint32_t img_x ;
145- uint32_t img_y ;
144+ uint8_t * img_buffer ;
145+ uint8_t * img_buffer_end ;
146+ uint8_t * img_buffer_original ;
146147 int img_n ;
147148 int img_out_n ;
148-
149149 int buflen ;
150+ uint32_t img_x ;
151+ uint32_t img_y ;
150152 uint8_t buffer_start [128 ];
151-
152- uint8_t * img_buffer ;
153- uint8_t * img_buffer_end ;
154- uint8_t * img_buffer_original ;
155153} rjpeg_context ;
156154
157155static INLINE uint8_t rjpeg_get8 (rjpeg_context * s )
@@ -171,67 +169,64 @@ static INLINE uint8_t rjpeg_get8(rjpeg_context *s)
171169
172170typedef struct
173171{
174- uint8_t fast [1 << FAST_BITS ];
172+ unsigned int maxcode [18 ];
173+ int delta [17 ]; /* old 'firstsymbol' - old 'firstcode' */
175174 /* weirdly, repacking this into AoS is a 10% speed loss, instead of a win */
176175 uint16_t code [256 ];
176+ uint8_t fast [1 << FAST_BITS ];
177177 uint8_t values [256 ];
178178 uint8_t size [257 ];
179- unsigned int maxcode [18 ];
180- int delta [17 ]; /* old 'firstsymbol' - old 'firstcode' */
181179} rjpeg_huffman ;
182180
183181typedef struct
184182{
185183 rjpeg_context * s ;
186- rjpeg_huffman huff_dc [4 ];
187- rjpeg_huffman huff_ac [4 ];
188- uint8_t dequant [4 ][64 ];
189- int16_t fast_ac [4 ][1 << FAST_BITS ];
190-
191- /* sizes for components, interleaved MCUs */
192- int img_h_max , img_v_max ;
193- int img_mcu_x , img_mcu_y ;
194- int img_mcu_w , img_mcu_h ;
184+ /* kernels */
185+ void (* idct_block_kernel )(uint8_t * out , int out_stride , short data [64 ]);
186+ void (* YCbCr_to_RGB_kernel )(uint8_t * out , const uint8_t * y , const uint8_t * pcb ,
187+ const uint8_t * pcr , int count , int step );
188+ uint8_t * (* resample_row_hv_2_kernel )(uint8_t * out , uint8_t * in_near ,
189+ uint8_t * in_far , int w , int hs );
195190
196191 /* definition of jpeg image component */
197192 struct
198193 {
194+ uint8_t * data ;
195+ void * raw_data , * raw_coeff ;
196+ uint8_t * linebuf ;
197+ short * coeff ; /* progressive only */
199198 int id ;
200199 int h ,v ;
201200 int tq ;
202201 int hd ,ha ;
203202 int dc_pred ;
204203
205204 int x ,y ,w2 ,h2 ;
206- uint8_t * data ;
207- void * raw_data , * raw_coeff ;
208- uint8_t * linebuf ;
209- short * coeff ; /* progressive only */
210205 int coeff_w ; /* number of 8x8 coefficient blocks */
211206 int coeff_h ; /* number of 8x8 coefficient blocks */
212207 } img_comp [4 ];
213208
214- uint32_t code_buffer ; /* jpeg entropy-coded buffer */
209+ /* sizes for components, interleaved MCUs */
210+ int img_h_max , img_v_max ;
211+ int img_mcu_x , img_mcu_y ;
212+ int img_mcu_w , img_mcu_h ;
213+
215214 int code_bits ; /* number of valid bits */
216- unsigned char marker ; /* marker seen while filling entropy buffer */
217215 int nomore ; /* flag if we saw a marker so must stop */
218-
219216 int progressive ;
220217 int spec_start ;
221218 int spec_end ;
222219 int succ_high ;
223220 int succ_low ;
224221 int eob_run ;
225-
226222 int scan_n , order [4 ];
227223 int restart_interval , todo ;
228-
229- /* kernels */
230- void (* idct_block_kernel )(uint8_t * out , int out_stride , short data [64 ]);
231- void (* YCbCr_to_RGB_kernel )(uint8_t * out , const uint8_t * y , const uint8_t * pcb ,
232- const uint8_t * pcr , int count , int step );
233- uint8_t * (* resample_row_hv_2_kernel )(uint8_t * out , uint8_t * in_near ,
234- uint8_t * in_far , int w , int hs );
224+ uint32_t code_buffer ; /* jpeg entropy-coded buffer */
225+ rjpeg_huffman huff_dc [4 ]; /* unsigned int alignment */
226+ rjpeg_huffman huff_ac [4 ]; /* unsigned int alignment */
227+ int16_t fast_ac [4 ][1 << FAST_BITS ];
228+ unsigned char marker ; /* marker seen while filling entropy buffer */
229+ uint8_t dequant [4 ][64 ];
235230} rjpeg_jpeg ;
236231
237232#define RJPEG_F2F (x ) ((int) (((x) * 4096 + 0.5)))
0 commit comments