Revision 0b178e56
libavcodec/cscd.c | ||
---|---|---|
158 | 158 |
switch ((buf[0] >> 1) & 7) { |
159 | 159 |
case 0: { // lzo compression |
160 | 160 |
int outlen = c->decomp_size, inlen = buf_size - 2; |
161 |
if (lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) |
|
161 |
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
|
|
162 | 162 |
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); |
163 | 163 |
break; |
164 | 164 |
} |
... | ... | |
232 | 232 |
c->linelen = avctx->width * avctx->bits_per_coded_sample / 8; |
233 | 233 |
c->height = avctx->height; |
234 | 234 |
c->decomp_size = c->height * c->linelen; |
235 |
c->decomp_buf = av_malloc(c->decomp_size + LZO_OUTPUT_PADDING); |
|
235 |
c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING);
|
|
236 | 236 |
if (!c->decomp_buf) { |
237 | 237 |
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); |
238 | 238 |
return 1; |
libavcodec/nuv.c | ||
---|---|---|
116 | 116 |
avctx->width = c->width = width; |
117 | 117 |
avctx->height = c->height = height; |
118 | 118 |
c->decomp_size = c->height * c->width * 3 / 2; |
119 |
c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + LZO_OUTPUT_PADDING); |
|
119 |
c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);
|
|
120 | 120 |
if (!c->decomp_buf) { |
121 | 121 |
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); |
122 | 122 |
return 0; |
... | ... | |
175 | 175 |
buf_size -= 12; |
176 | 176 |
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) { |
177 | 177 |
int outlen = c->decomp_size, inlen = buf_size; |
178 |
if (lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen)) |
|
178 |
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
|
|
179 | 179 |
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); |
180 | 180 |
buf = c->decomp_buf; |
181 | 181 |
buf_size = c->decomp_size; |
libavformat/matroskadec.c | ||
---|---|---|
872 | 872 |
do { |
873 | 873 |
olen = pkt_size *= 3; |
874 | 874 |
pkt_data = av_realloc(pkt_data, |
875 |
pkt_size+LZO_OUTPUT_PADDING); |
|
876 |
result = lzo1x_decode(pkt_data, &olen, data, &isize); |
|
877 |
} while (result==LZO_OUTPUT_FULL && pkt_size<10000000); |
|
875 |
pkt_size+AV_LZO_OUTPUT_PADDING);
|
|
876 |
result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
|
|
877 |
} while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
|
|
878 | 878 |
if (result) |
879 | 879 |
goto failed; |
880 | 880 |
pkt_size -= olen; |
libavutil/lzo.c | ||
---|---|---|
41 | 41 |
static inline int get_byte(LZOContext *c) { |
42 | 42 |
if (c->in < c->in_end) |
43 | 43 |
return *c->in++; |
44 |
c->error |= LZO_INPUT_DEPLETED; |
|
44 |
c->error |= AV_LZO_INPUT_DEPLETED;
|
|
45 | 45 |
return 1; |
46 | 46 |
} |
47 | 47 |
|
... | ... | |
88 | 88 |
register uint8_t *dst = c->out; |
89 | 89 |
if (cnt > c->in_end - src) { |
90 | 90 |
cnt = FFMAX(c->in_end - src, 0); |
91 |
c->error |= LZO_INPUT_DEPLETED; |
|
91 |
c->error |= AV_LZO_INPUT_DEPLETED;
|
|
92 | 92 |
} |
93 | 93 |
if (cnt > c->out_end - dst) { |
94 | 94 |
cnt = FFMAX(c->out_end - dst, 0); |
95 |
c->error |= LZO_OUTPUT_FULL; |
|
95 |
c->error |= AV_LZO_OUTPUT_FULL;
|
|
96 | 96 |
} |
97 | 97 |
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) |
98 | 98 |
COPY4(dst, src); |
... | ... | |
120 | 120 |
register const uint8_t *src = &c->out[-back]; |
121 | 121 |
register uint8_t *dst = c->out; |
122 | 122 |
if (src < c->out_start || src > dst) { |
123 |
c->error |= LZO_INVALID_BACKPTR; |
|
123 |
c->error |= AV_LZO_INVALID_BACKPTR;
|
|
124 | 124 |
return; |
125 | 125 |
} |
126 | 126 |
if (cnt > c->out_end - dst) { |
127 | 127 |
cnt = FFMAX(c->out_end - dst, 0); |
128 |
c->error |= LZO_OUTPUT_FULL; |
|
128 |
c->error |= AV_LZO_OUTPUT_FULL;
|
|
129 | 129 |
} |
130 | 130 |
memcpy_backptr(dst, back, cnt); |
131 | 131 |
c->out = dst + cnt; |
... | ... | |
187 | 187 |
* \return 0 on success, otherwise error flags, see lzo.h |
188 | 188 |
* |
189 | 189 |
* Make sure all buffers are appropriately padded, in must provide |
190 |
* LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes.
|
|
190 |
* AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
|
|
191 | 191 |
*/ |
192 |
int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) { |
|
192 |
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
|
|
193 | 193 |
int state= 0; |
194 | 194 |
int x; |
195 | 195 |
LZOContext c; |
... | ... | |
202 | 202 |
if (x > 17) { |
203 | 203 |
copy(&c, x - 17); |
204 | 204 |
x = GETB(c); |
205 |
if (x < 16) c.error |= LZO_ERROR; |
|
205 |
if (x < 16) c.error |= AV_LZO_ERROR;
|
|
206 | 206 |
} |
207 | 207 |
if (c.in > c.in_end) |
208 |
c.error |= LZO_INPUT_DEPLETED; |
|
208 |
c.error |= AV_LZO_INPUT_DEPLETED;
|
|
209 | 209 |
while (!c.error) { |
210 | 210 |
int cnt, back; |
211 | 211 |
if (x > 15) { |
... | ... | |
223 | 223 |
back += (GETB(c) << 6) + (x >> 2); |
224 | 224 |
if (back == (1 << 14)) { |
225 | 225 |
if (cnt != 1) |
226 |
c.error |= LZO_ERROR; |
|
226 |
c.error |= AV_LZO_ERROR;
|
|
227 | 227 |
break; |
228 | 228 |
} |
229 | 229 |
} |
... | ... | |
252 | 252 |
return c.error; |
253 | 253 |
} |
254 | 254 |
|
255 |
#if LIBAVUTIL_VERSION_MAJOR < 50 |
|
256 |
int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) { |
|
257 |
return av_lzo1x_decode(out, outlen, in, inlen); |
|
258 |
} |
|
259 |
#endif |
|
260 |
|
|
255 | 261 |
#ifdef TEST |
256 | 262 |
#include <stdio.h> |
257 | 263 |
#include <lzo/lzo1x.h> |
... | ... | |
277 | 283 |
#elif defined(LIBLZO_UNSAFE) |
278 | 284 |
if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL)) |
279 | 285 |
#else |
280 |
if (lzo1x_decode(decomp, &outlen, comp, &inlen)) |
|
286 |
if (av_lzo1x_decode(decomp, &outlen, comp, &inlen))
|
|
281 | 287 |
#endif |
282 | 288 |
av_log(NULL, AV_LOG_ERROR, "decompression error\n"); |
283 | 289 |
STOP_TIMER("lzod") |
libavutil/lzo.h | ||
---|---|---|
24 | 24 |
|
25 | 25 |
#include <stdint.h> |
26 | 26 |
|
27 |
#define LZO_INPUT_DEPLETED 1 |
|
28 |
#define LZO_OUTPUT_FULL 2 |
|
29 |
#define LZO_INVALID_BACKPTR 4 |
|
30 |
#define LZO_ERROR 8 |
|
27 |
#define AV_LZO_INPUT_DEPLETED 1
|
|
28 |
#define AV_LZO_OUTPUT_FULL 2
|
|
29 |
#define AV_LZO_INVALID_BACKPTR 4
|
|
30 |
#define AV_LZO_ERROR 8
|
|
31 | 31 |
|
32 |
#define LZO_INPUT_PADDING 8 |
|
33 |
#define LZO_OUTPUT_PADDING 12 |
|
32 |
#define AV_LZO_INPUT_PADDING 8
|
|
33 |
#define AV_LZO_OUTPUT_PADDING 12
|
|
34 | 34 |
|
35 |
int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); |
|
35 |
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
|
|
36 | 36 |
|
37 | 37 |
void av_memcpy_backptr(uint8_t *dst, int back, int cnt); |
38 | 38 |
|
Also available in: Unified diff