Mercurial > libavcodec.hg
comparison rle.c @ 4769:79db9e9df40a libavcodec
fix indention (less work to fix it myself than to check if a indention fix patch is ok ...)
author | michael |
---|---|
date | Tue, 03 Apr 2007 01:23:37 +0000 |
parents | 542e4c4fc15a |
children | a6d1c26e8b6f |
comparison
equal
deleted
inserted
replaced
4768:542e4c4fc15a | 4769:79db9e9df40a |
---|---|
60 int count, x; | 60 int count, x; |
61 uint8_t *out; | 61 uint8_t *out; |
62 | 62 |
63 out = outbuf; | 63 out = outbuf; |
64 | 64 |
65 for(x = 0; x < w; x += count) { | |
66 /* see if we can encode the next set of pixels with RLE */ | |
67 if((count = count_pixels(ptr, w-x, bpp, 1)) > 1) { | |
68 if(out + bpp + 1 > outbuf + out_size) return -1; | |
69 *out++ = (count ^ xor) + add; | |
70 memcpy(out, ptr, bpp); | |
71 out += bpp; | |
72 } else { | |
73 /* fall back on uncompressed */ | |
74 count = count_pixels(ptr, w-x, bpp, 0); | |
75 *out++ = count - 1; | |
65 | 76 |
66 for(x = 0; x < w; x += count) { | 77 if(out + bpp*count > outbuf + out_size) return -1; |
67 /* see if we can encode the next set of pixels with RLE */ | 78 memcpy(out, ptr, bpp * count); |
68 if((count = count_pixels(ptr, w-x, bpp, 1)) > 1) { | 79 out += bpp * count; |
69 if(out + bpp + 1 > outbuf + out_size) return -1; | |
70 *out++ = (count ^ xor) + add; | |
71 memcpy(out, ptr, bpp); | |
72 out += bpp; | |
73 } else { | |
74 /* fall back on uncompressed */ | |
75 count = count_pixels(ptr, w-x, bpp, 0); | |
76 *out++ = count - 1; | |
77 | |
78 if(out + bpp*count > outbuf + out_size) return -1; | |
79 memcpy(out, ptr, bpp * count); | |
80 out += bpp * count; | |
81 } | 80 } |
82 | 81 |
83 ptr += count * bpp; | 82 ptr += count * bpp; |
84 } | 83 } |
85 | 84 |