[FFmpeg-cvslog] Use av_fast_malloc instead of av_realloc in fraps decoder.
Reimar Döffinger
git at videolan.org
Sun Apr 24 18:09:40 CEST 2011
ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sun Apr 24 14:39:07 2011 +0200| [80da2dcf05efdaa5e8f82b635da245054256a35f] | committer: Reimar Döffinger
Use av_fast_malloc instead of av_realloc in fraps decoder.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80da2dcf05efdaa5e8f82b635da245054256a35f
---
libavcodec/fraps.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index dd086d2..1bd6fc3 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -46,6 +46,7 @@ typedef struct FrapsContext{
AVCodecContext *avctx;
AVFrame frame;
uint8_t *tmpbuf;
+ int tmpbuf_size;
DSPContext dsp;
} FrapsContext;
@@ -272,7 +273,7 @@ static int decode_frame(AVCodecContext *avctx,
offs[planes] = buf_size;
for(i = 0; i < planes; i++){
is_chroma = !!i;
- s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_malloc(&s->tmpbuf, &s->tmpbuf_size, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma,
avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
@@ -314,7 +315,7 @@ static int decode_frame(AVCodecContext *avctx,
}
offs[planes] = buf_size;
for(i = 0; i < planes; i++){
- s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_malloc(&s->tmpbuf, &s->tmpbuf_size, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
More information about the ffmpeg-cvslog
mailing list