comparison faxcompr.c @ 8468:75328d3e788e libavcodec

Factorize mode switching in put_line().
author michael
date Fri, 26 Dec 2008 13:48:09 +0000
parents 3700af1c1f4f
children 5b63a9da46f4
comparison
equal deleted inserted replaced
8467:3700af1c1f4f 8468:75328d3e788e
230 } 230 }
231 231
232 static void put_line(uint8_t *dst, int size, int width, const int *runs) 232 static void put_line(uint8_t *dst, int size, int width, const int *runs)
233 { 233 {
234 PutBitContext pb; 234 PutBitContext pb;
235 int run, mode = 0, pix_left = width, run_idx = 0; 235 int run, mode = 1, pix_left = width, run_idx = 0;
236 236
237 init_put_bits(&pb, dst, size*8); 237 init_put_bits(&pb, dst, size*8);
238 while(pix_left > 0){ 238 while(pix_left > 0){
239 run = runs[run_idx++]; 239 run = runs[run_idx++];
240 mode = !mode;
240 if(!run){ 241 if(!run){
241 mode = !mode;
242 continue; 242 continue;
243 } 243 }
244 pix_left -= run; 244 pix_left -= run;
245 for(; run > 16; run -= 16) 245 for(; run > 16; run -= 16)
246 put_sbits(&pb, 16, -mode); 246 put_sbits(&pb, 16, -mode);
247 put_sbits(&pb, run, -mode); 247 put_sbits(&pb, run, -mode);
248 mode = !mode;
249 } 248 }
250 } 249 }
251 250
252 static int find_group3_syncmarker(GetBitContext *gb, int srcsize) 251 static int find_group3_syncmarker(GetBitContext *gb, int srcsize)
253 { 252 {