Mercurial > libavcodec.hg
comparison vp8.c @ 12247:50a96623366b libavcodec
VP8: use AV_RL24 instead of defining a new RL24.
author | darkshikari |
---|---|
date | Fri, 23 Jul 2010 21:17:18 +0000 |
parents | 3c841933cf78 |
children | 121272849def |
comparison
equal
deleted
inserted
replaced
12246:3c841933cf78 | 12247:50a96623366b |
---|---|
196 uint8_t token[4][8][3][NUM_DCT_TOKENS-1]; | 196 uint8_t token[4][8][3][NUM_DCT_TOKENS-1]; |
197 uint8_t mvc[2][19]; | 197 uint8_t mvc[2][19]; |
198 } prob[2]; | 198 } prob[2]; |
199 } VP8Context; | 199 } VP8Context; |
200 | 200 |
201 #define RL24(p) (AV_RL16(p) + ((p)[2] << 16)) | |
202 | |
203 static void vp8_decode_flush(AVCodecContext *avctx) | 201 static void vp8_decode_flush(AVCodecContext *avctx) |
204 { | 202 { |
205 VP8Context *s = avctx->priv_data; | 203 VP8Context *s = avctx->priv_data; |
206 int i; | 204 int i; |
207 | 205 |
305 buf_size -= 3*(s->num_coeff_partitions-1); | 303 buf_size -= 3*(s->num_coeff_partitions-1); |
306 if (buf_size < 0) | 304 if (buf_size < 0) |
307 return -1; | 305 return -1; |
308 | 306 |
309 for (i = 0; i < s->num_coeff_partitions-1; i++) { | 307 for (i = 0; i < s->num_coeff_partitions-1; i++) { |
310 int size = RL24(sizes + 3*i); | 308 int size = AV_RL24(sizes + 3*i); |
311 if (buf_size - size < 0) | 309 if (buf_size - size < 0) |
312 return -1; | 310 return -1; |
313 | 311 |
314 vp56_init_range_decoder(&s->coeff_partition[i], buf, size); | 312 vp56_init_range_decoder(&s->coeff_partition[i], buf, size); |
315 buf += size; | 313 buf += size; |
400 int height = s->avctx->height; | 398 int height = s->avctx->height; |
401 | 399 |
402 s->keyframe = !(buf[0] & 1); | 400 s->keyframe = !(buf[0] & 1); |
403 s->profile = (buf[0]>>1) & 7; | 401 s->profile = (buf[0]>>1) & 7; |
404 s->invisible = !(buf[0] & 0x10); | 402 s->invisible = !(buf[0] & 0x10); |
405 header_size = RL24(buf) >> 5; | 403 header_size = AV_RL24(buf) >> 5; |
406 buf += 3; | 404 buf += 3; |
407 buf_size -= 3; | 405 buf_size -= 3; |
408 | 406 |
409 if (s->profile > 3) | 407 if (s->profile > 3) |
410 av_log(s->avctx, AV_LOG_WARNING, "Unknown profile %d\n", s->profile); | 408 av_log(s->avctx, AV_LOG_WARNING, "Unknown profile %d\n", s->profile); |
418 av_log(s->avctx, AV_LOG_ERROR, "Header size larger than data provided\n"); | 416 av_log(s->avctx, AV_LOG_ERROR, "Header size larger than data provided\n"); |
419 return AVERROR_INVALIDDATA; | 417 return AVERROR_INVALIDDATA; |
420 } | 418 } |
421 | 419 |
422 if (s->keyframe) { | 420 if (s->keyframe) { |
423 if (RL24(buf) != 0x2a019d) { | 421 if (AV_RL24(buf) != 0x2a019d) { |
424 av_log(s->avctx, AV_LOG_ERROR, "Invalid start code 0x%x\n", RL24(buf)); | 422 av_log(s->avctx, AV_LOG_ERROR, "Invalid start code 0x%x\n", AV_RL24(buf)); |
425 return AVERROR_INVALIDDATA; | 423 return AVERROR_INVALIDDATA; |
426 } | 424 } |
427 width = AV_RL16(buf+3) & 0x3fff; | 425 width = AV_RL16(buf+3) & 0x3fff; |
428 height = AV_RL16(buf+5) & 0x3fff; | 426 height = AV_RL16(buf+5) & 0x3fff; |
429 hscale = buf[4] >> 6; | 427 hscale = buf[4] >> 6; |