Mercurial > libavcodec.hg
comparison faxcompr.c @ 8478:2f7c09bb6bfb libavcodec
Factorize "avctx->width + 2" out to avoid someone mistakenly changing
some but not all.
| author | michael |
|---|---|
| date | Fri, 26 Dec 2008 16:38:55 +0000 |
| parents | 5f85d21a70b2 |
| children | f456c3aebe1c |
comparison
equal
deleted
inserted
replaced
| 8477:5f85d21a70b2 | 8478:2f7c09bb6bfb |
|---|---|
| 278 { | 278 { |
| 279 int j; | 279 int j; |
| 280 GetBitContext gb; | 280 GetBitContext gb; |
| 281 int *runs, *ref, *runend; | 281 int *runs, *ref, *runend; |
| 282 int ret; | 282 int ret; |
| 283 | 283 int runsize= avctx->width + 2; |
| 284 runs = av_malloc((avctx->width + 2) * sizeof(runs[0])); | 284 |
| 285 ref = av_malloc((avctx->width + 2) * sizeof(ref[0])); | 285 runs = av_malloc(runsize * sizeof(runs[0])); |
| 286 ref = av_malloc(runsize * sizeof(ref[0])); | |
| 286 ref[0] = avctx->width; | 287 ref[0] = avctx->width; |
| 287 ref[1] = 0; | 288 ref[1] = 0; |
| 288 ref[2] = 0; | 289 ref[2] = 0; |
| 289 init_get_bits(&gb, src, srcsize*8); | 290 init_get_bits(&gb, src, srcsize*8); |
| 290 for(j = 0; j < height; j++){ | 291 for(j = 0; j < height; j++){ |
| 291 runend = runs + avctx->width + 2; | 292 runend = runs + runsize; |
| 292 if(compr == TIFF_G4){ | 293 if(compr == TIFF_G4){ |
| 293 ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); | 294 ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); |
| 294 if(ret < 0){ | 295 if(ret < 0){ |
| 295 av_free(runs); | 296 av_free(runs); |
| 296 av_free(ref); | 297 av_free(ref); |
