diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-05 02:46:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-05 02:47:46 +0100 |
commit | 6a4cc50980783013b19bfb2edaaca14cc38d5c92 (patch) | |
tree | 44d8de6a502cb408b8ba97f8aaafabf5db4d2941 /libavcodec/lagarith.c | |
parent | 2b88cb2f4653e76ba58848ce2564a22501c9c4e9 (diff) | |
parent | 4c3e1956ee35fdcc5ffdb28782050164b4623c0b (diff) | |
download | ffmpeg-6a4cc50980783013b19bfb2edaaca14cc38d5c92.tar.gz |
Merge commit '4c3e1956ee35fdcc5ffdb28782050164b4623c0b'
* commit '4c3e1956ee35fdcc5ffdb28782050164b4623c0b':
lagarith: reallocate rgb_planes when needed
Conflicts:
libavcodec/lagarith.c
See: 9eef41b848939a0a86582afdb45235e41612d9ba
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lagarith.c')
-rw-r--r-- | libavcodec/lagarith.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 8385b7095b..69fa33704a 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -52,6 +52,7 @@ typedef struct LagarithContext { int zeros; /**< number of consecutive zero bytes encountered */ int zeros_rem; /**< number of zero bytes remaining to output */ uint8_t *rgb_planes; + int rgb_planes_allocated; int rgb_stride; } LagarithContext; @@ -611,13 +612,12 @@ static int lag_decode_frame(AVCodecContext *avctx, offs[1] = offset_gu; offs[2] = offset_ry; + l->rgb_stride = FFALIGN(avctx->width, 16); + av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated, + l->rgb_stride * avctx->height * planes + 1); if (!l->rgb_planes) { - l->rgb_stride = FFALIGN(avctx->width, 16); - l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * 4 + 16); - if (!l->rgb_planes) { - av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); - return AVERROR(ENOMEM); - } + av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); + return AVERROR(ENOMEM); } for (i = 0; i < planes; i++) srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride; |