diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2020-06-01 21:49:44 +0800 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2020-06-13 06:59:19 +0800 |
commit | d5d00cb5163c5324a67c7351bd079e5258045a4d (patch) | |
tree | 772f2778a92bfffbb207f2028c356e556f6cd774 /libavcodec/snow.c | |
parent | 479c89aa2e56c4772186baa5a034b2e9862f9a76 (diff) | |
download | ffmpeg-d5d00cb5163c5324a67c7351bd079e5258045a4d.tar.gz |
avcodec/snow: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r-- | libavcodec/snow.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index a3e6afc86a..066efc5171 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -487,28 +487,27 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ width= s->avctx->width; height= s->avctx->height; - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->spatial_idwt_buffer, width, height * sizeof(IDWTELEM), fail); - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->spatial_dwt_buffer, width, height * sizeof(DWTELEM), fail); //FIXME this does not belong here - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_dwt_buffer, width, sizeof(DWTELEM), fail); - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_idwt_buffer, width, sizeof(IDWTELEM), fail); - FF_ALLOC_ARRAY_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1), ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); + if (!FF_ALLOCZ_TYPED_ARRAY(s->spatial_idwt_buffer, width * height) || + !FF_ALLOCZ_TYPED_ARRAY(s->spatial_dwt_buffer, width * height) || //FIXME this does not belong here + !FF_ALLOCZ_TYPED_ARRAY(s->temp_dwt_buffer, width) || + !FF_ALLOCZ_TYPED_ARRAY(s->temp_idwt_buffer, width) || + !FF_ALLOCZ_TYPED_ARRAY(s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1))) + return AVERROR(ENOMEM); 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->last_picture[i] = av_frame_alloc(); if (!s->last_picture[i]) - goto fail; + return AVERROR(ENOMEM); } s->mconly_picture = av_frame_alloc(); s->current_picture = av_frame_alloc(); if (!s->mconly_picture || !s->current_picture) - goto fail; + return AVERROR(ENOMEM); return 0; -fail: - return AVERROR(ENOMEM); } int ff_snow_common_init_after_header(AVCodecContext *avctx) { @@ -520,9 +519,10 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256), 7*MB_SIZE, fail); emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); - FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); + if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || + !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) + return AVERROR(ENOMEM); } if(s->mconly_picture->format != avctx->pix_fmt) { @@ -571,7 +571,7 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { av_freep(&b->x_coeff); b->x_coeff=av_mallocz_array(((b->width+1) * b->height+1), sizeof(x_and_coeff)); if (!b->x_coeff) - goto fail; + return AVERROR(ENOMEM); } w= (w+1)>>1; h= (h+1)>>1; @@ -579,8 +579,6 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { } return 0; -fail: - return AVERROR(ENOMEM); } #define USE_HALFPEL_PLANE 0 |