diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-01-03 17:19:01 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-01-29 07:31:43 +0100 |
commit | aec50f79e7460340a148a3096fe212d67edc2c64 (patch) | |
tree | 8f338cd3d2a7aed4b7fc054c348c05ca2de81ade /libavcodec/rawdec.c | |
parent | e6da5d215b1f2267bfdbb83028f2c1b63434edad (diff) | |
download | ffmpeg-aec50f79e7460340a148a3096fe212d67edc2c64.tar.gz |
rawdec: use AVPALETTE_SIZE instead of magic constants.
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r-- | libavcodec/rawdec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 2751f34974..ab93d49e07 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -138,14 +138,15 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, frame->reordered_opaque = avctx->reordered_opaque; frame->pkt_pts = avctx->pkt->pts; - if (buf_size < context->length - (avctx->pix_fmt == AV_PIX_FMT_PAL8 ? 256 * 4 : 0)) + if (buf_size < context->length - (avctx->pix_fmt == AV_PIX_FMT_PAL8 ? + AVPALETTE_SIZE : 0)) return -1; //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) if (context->buffer) { int i; uint8_t *dst = context->buffer; - buf_size = context->length - 256 * 4; + buf_size = context->length - AVPALETTE_SIZE; if (avctx->bits_per_coded_sample == 4) { for (i = 0; 2 * i + 1 < buf_size; i++) { dst[2 * i + 0] = buf[i] >> 4; |