Mercurial > libavcodec.hg
comparison truemotion2.c @ 4364:05e932ddaaa9 libavcodec
rename BE/LE_8/16/32 to AV_RL/B_8/16/32
author | alex |
---|---|
date | Fri, 19 Jan 2007 22:12:59 +0000 |
parents | c8c591fe26f8 |
children | a96d905dcbaa |
comparison
equal
deleted
inserted
replaced
4363:9b7662fa4905 | 4364:05e932ddaaa9 |
---|---|
206 uint8_t *obuf; | 206 uint8_t *obuf; |
207 int length; | 207 int length; |
208 | 208 |
209 obuf = buf; | 209 obuf = buf; |
210 | 210 |
211 magic = LE_32(buf); | 211 magic = AV_RL32(buf); |
212 buf += 4; | 212 buf += 4; |
213 | 213 |
214 if(magic == 0x00000100) { /* old header */ | 214 if(magic == 0x00000100) { /* old header */ |
215 /* av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */ | 215 /* av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */ |
216 return 40; | 216 return 40; |
217 } else if(magic == 0x00000101) { /* new header */ | 217 } else if(magic == 0x00000101) { /* new header */ |
218 int w, h, size, flags, xr, yr; | 218 int w, h, size, flags, xr, yr; |
219 | 219 |
220 length = LE_32(buf); | 220 length = AV_RL32(buf); |
221 buf += 4; | 221 buf += 4; |
222 | 222 |
223 init_get_bits(&ctx->gb, buf, 32 * 8); | 223 init_get_bits(&ctx->gb, buf, 32 * 8); |
224 size = get_bits_long(&ctx->gb, 31); | 224 size = get_bits_long(&ctx->gb, 31); |
225 h = get_bits(&ctx->gb, 15); | 225 h = get_bits(&ctx->gb, 15); |
268 int skip = 0; | 268 int skip = 0; |
269 int len, toks; | 269 int len, toks; |
270 TM2Codes codes; | 270 TM2Codes codes; |
271 | 271 |
272 /* get stream length in dwords */ | 272 /* get stream length in dwords */ |
273 len = BE_32(buf); buf += 4; cur += 4; | 273 len = AV_RB32(buf); buf += 4; cur += 4; |
274 skip = len * 4 + 4; | 274 skip = len * 4 + 4; |
275 | 275 |
276 if(len == 0) | 276 if(len == 0) |
277 return 4; | 277 return 4; |
278 | 278 |
279 toks = BE_32(buf); buf += 4; cur += 4; | 279 toks = AV_RB32(buf); buf += 4; cur += 4; |
280 if(toks & 1) { | 280 if(toks & 1) { |
281 len = BE_32(buf); buf += 4; cur += 4; | 281 len = AV_RB32(buf); buf += 4; cur += 4; |
282 if(len == TM2_ESCAPE) { | 282 if(len == TM2_ESCAPE) { |
283 len = BE_32(buf); buf += 4; cur += 4; | 283 len = AV_RB32(buf); buf += 4; cur += 4; |
284 } | 284 } |
285 if(len > 0) { | 285 if(len > 0) { |
286 init_get_bits(&ctx->gb, buf, (skip - cur) * 8); | 286 init_get_bits(&ctx->gb, buf, (skip - cur) * 8); |
287 if(tm2_read_deltas(ctx, stream_id) == -1) | 287 if(tm2_read_deltas(ctx, stream_id) == -1) |
288 return -1; | 288 return -1; |
289 buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; | 289 buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; |
290 cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; | 290 cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; |
291 } | 291 } |
292 } | 292 } |
293 /* skip unused fields */ | 293 /* skip unused fields */ |
294 if(BE_32(buf) == TM2_ESCAPE) { | 294 if(AV_RB32(buf) == TM2_ESCAPE) { |
295 buf += 4; cur += 4; /* some unknown length - could be escaped too */ | 295 buf += 4; cur += 4; /* some unknown length - could be escaped too */ |
296 } | 296 } |
297 buf += 4; cur += 4; | 297 buf += 4; cur += 4; |
298 buf += 4; cur += 4; /* unused by decoder */ | 298 buf += 4; cur += 4; /* unused by decoder */ |
299 | 299 |
310 tm2_free_codes(&codes); | 310 tm2_free_codes(&codes); |
311 return -1; | 311 return -1; |
312 } | 312 } |
313 ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); | 313 ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); |
314 ctx->tok_lens[stream_id] = toks; | 314 ctx->tok_lens[stream_id] = toks; |
315 len = BE_32(buf); buf += 4; cur += 4; | 315 len = AV_RB32(buf); buf += 4; cur += 4; |
316 if(len > 0) { | 316 if(len > 0) { |
317 init_get_bits(&ctx->gb, buf, (skip - cur) * 8); | 317 init_get_bits(&ctx->gb, buf, (skip - cur) * 8); |
318 for(i = 0; i < toks; i++) | 318 for(i = 0; i < toks; i++) |
319 ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes); | 319 ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes); |
320 } else { | 320 } else { |