diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-10 23:43:52 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-29 19:46:52 +0200 |
commit | cf06dee58d6ea0870dcdf5463fcf2aef97f0daa7 (patch) | |
tree | 539f7e47ce53ecf4eddd82e0ea2da33740c5e635 /libavcodec/snow.c | |
parent | 1cefdc397ed04dd1e0ff5dd1f09e126f13b5aa06 (diff) | |
download | ffmpeg-cf06dee58d6ea0870dcdf5463fcf2aef97f0daa7.tar.gz |
libavcodec/snow: change AVFrame to pointers to AVFrame for ABI stability
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r-- | libavcodec/snow.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index c4df4b68ea..1c27ae2cf9 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -337,7 +337,7 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, } } }else{ - uint8_t *src= s->last_picture[block->ref].data[plane_index]; + uint8_t *src= s->last_picture[block->ref]->data[plane_index]; const int scale= plane_index ? (2*s->mv_scale)>>s->chroma_h_shift : 2*s->mv_scale; int mx= block->mx*scale; int my= block->my*scale; @@ -461,11 +461,11 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ 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); - avcodec_get_frame_defaults(&s->last_picture[i]); + s->last_picture[i] = av_frame_alloc(); } - avcodec_get_frame_defaults(&s->mconly_picture); - avcodec_get_frame_defaults(&s->current_picture); + s->mconly_picture = av_frame_alloc(); + s->current_picture = av_frame_alloc(); return 0; fail: @@ -478,15 +478,15 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { int ret, emu_buf_size; if(!s->scratchbuf) { - if ((ret = ff_get_buffer(s->avctx, &s->mconly_picture, + if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - FF_ALLOCZ_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_ALLOCZ_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(s->mconly_picture.format != avctx->pix_fmt) { + if(s->mconly_picture->format != avctx->pix_fmt) { av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); return AVERROR_INVALIDDATA; } @@ -596,51 +596,51 @@ void ff_snow_release_buffer(AVCodecContext *avctx) SnowContext *s = avctx->priv_data; int i; - if(s->last_picture[s->max_ref_frames-1].data[0]){ - av_frame_unref(&s->last_picture[s->max_ref_frames-1]); + if(s->last_picture[s->max_ref_frames-1]->data[0]){ + av_frame_unref(s->last_picture[s->max_ref_frames-1]); for(i=0; i<9; i++) if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3]) - av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture.linesize[i%3])); + av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture->linesize[i%3])); } } int ff_snow_frame_start(SnowContext *s){ - AVFrame tmp; + AVFrame *tmp; int i, ret; int w= s->avctx->width; //FIXME round up to x16 ? int h= s->avctx->height; - if (s->current_picture.data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) { - s->dsp.draw_edges(s->current_picture.data[0], - s->current_picture.linesize[0], w , h , + if (s->current_picture->data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) { + s->dsp.draw_edges(s->current_picture->data[0], + s->current_picture->linesize[0], w , h , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(s->current_picture.data[1], - s->current_picture.linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift, + s->dsp.draw_edges(s->current_picture->data[1], + s->current_picture->linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(s->current_picture.data[2], - s->current_picture.linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift, + s->dsp.draw_edges(s->current_picture->data[2], + s->current_picture->linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); } ff_snow_release_buffer(s->avctx); - av_frame_move_ref(&tmp, &s->last_picture[s->max_ref_frames-1]); + tmp= s->last_picture[s->max_ref_frames-1]; for(i=s->max_ref_frames-1; i>0; i--) - av_frame_move_ref(&s->last_picture[i], &s->last_picture[i-1]); + s->last_picture[i] = s->last_picture[i-1]; memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4); - if(USE_HALFPEL_PLANE && s->current_picture.data[0]) { - if((ret = halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture)) < 0) + if(USE_HALFPEL_PLANE && s->current_picture->data[0]) { + if((ret = halfpel_interpol(s, s->halfpel_plane[0], s->current_picture)) < 0) return ret; } - av_frame_move_ref(&s->last_picture[0], &s->current_picture); - av_frame_move_ref(&s->current_picture, &tmp); + s->last_picture[0] = s->current_picture; + s->current_picture = tmp; if(s->keyframe){ s->ref_frames= 0; }else{ int i; - for(i=0; i<s->max_ref_frames && s->last_picture[i].data[0]; i++) - if(i && s->last_picture[i-1].key_frame) + for(i=0; i<s->max_ref_frames && s->last_picture[i]->data[0]; i++) + if(i && s->last_picture[i-1]->key_frame) break; s->ref_frames= i; if(s->ref_frames==0){ @@ -649,10 +649,10 @@ int ff_snow_frame_start(SnowContext *s){ } } - if ((ret = ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) + if ((ret = ff_get_buffer(s->avctx, s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - s->current_picture.key_frame= s->keyframe; + s->current_picture->key_frame= s->keyframe; return 0; } @@ -680,10 +680,10 @@ av_cold void ff_snow_common_end(SnowContext *s) for(i=0; i<MAX_REF_FRAMES; i++){ av_freep(&s->ref_mvs[i]); av_freep(&s->ref_scores[i]); - if(s->last_picture[i].data[0]) { - av_assert0(s->last_picture[i].data[0] != s->current_picture.data[0]); - av_frame_unref(&s->last_picture[i]); + if(s->last_picture[i]->data[0]) { + av_assert0(s->last_picture[i]->data[0] != s->current_picture->data[0]); } + av_frame_free(&s->last_picture[i]); } for(plane_index=0; plane_index<3; plane_index++){ @@ -695,6 +695,6 @@ av_cold void ff_snow_common_end(SnowContext *s) } } } - av_frame_unref(&s->mconly_picture); - av_frame_unref(&s->current_picture); + av_frame_free(&s->mconly_picture); + av_frame_free(&s->current_picture); } |