diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-04 00:32:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-04 00:32:31 +0200 |
commit | 86e107a7d468666189506d3edd4f4b5ca14cd59e (patch) | |
tree | 7270750bbe78c241461a844d7c1c8de3696e3765 /libavcodec/snow.c | |
parent | af392efe51d5cc3536cb3c75bce8954179222d18 (diff) | |
parent | 1a068bfefd5da09f596e5079b39b418933bad0ea (diff) | |
download | ffmpeg-86e107a7d468666189506d3edd4f4b5ca14cd59e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
cosmetics: Consistently use C-style comments with multiple inclusion guards
anm: fix a few Doxygen comments
misc typo and wording fixes
attributes: add av_noreturn
attributes: drop pointless define guards
configure: do not disable av_always_inline with --enable-small
flvdec: initial stream switch support
avplay: fix write on freed memory for rawvideo
snow: remove a VLA used for edge emulation
x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
snow: remove the runs[] VLA.
snow: Check mallocs at init
flacdec: remove redundant setting of avctx->sample_fmt
Conflicts:
ffplay.c
libavcodec/h264.c
libavcodec/snow.c
libavcodec/snow.h
libavcodec/snowdec.c
libavcodec/snowenc.c
libavformat/flvdec.c
libavutil/attributes.h
tools/patcheck
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r-- | libavcodec/snow.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 309e1bf040..04072501ad 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -394,7 +394,8 @@ mca( 8, 8,8) av_cold int ff_snow_common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; - int i, j; + int i, j, ret; + int emu_buf_size; s->avctx= avctx; s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe @@ -447,19 +448,27 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ width= s->avctx->width; height= s->avctx->height; - s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM)); - s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here - s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM)); - s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM)); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here + FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); + FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); for(i=0; i<MAX_REF_FRAMES; i++) for(j=0; j<MAX_REF_FRAMES; j++) ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1); - s->avctx->get_buffer(s->avctx, &s->mconly_picture); - s->scratchbuf = av_mallocz(s->mconly_picture.linesize[0]*7*MB_SIZE); + if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) { +// av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); +// return ret; + } + FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture.linesize[0], 2*width+256)*7*MB_SIZE, fail); + emu_buf_size = FFMAX(s->mconly_picture.linesize[0], 2*width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); + FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); return 0; +fail: + return AVERROR(ENOMEM); } int ff_snow_common_init_after_header(AVCodecContext *avctx) { @@ -632,6 +641,7 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->temp_dwt_buffer); av_freep(&s->spatial_idwt_buffer); av_freep(&s->temp_idwt_buffer); + av_freep(&s->run_buffer); s->m.me.temp= NULL; av_freep(&s->m.me.scratchpad); @@ -641,6 +651,7 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->block); av_freep(&s->scratchbuf); + av_freep(&s->emu_edge_buffer); for(i=0; i<MAX_REF_FRAMES; i++){ av_freep(&s->ref_mvs[i]); |