@ -1790,36 +1790,27 @@ static void vp9_decode_flush(AVCodecContext *avctx)
ff_thread_release_buffer ( avctx , & s - > s . refs [ i ] ) ;
ff_thread_release_buffer ( avctx , & s - > s . refs [ i ] ) ;
}
}
static int init_frames ( AVCodecContext * avctx )
static av_cold int vp9_decode_ init( AVCodecContext * avctx )
{
{
VP9Context * s = avctx - > priv_data ;
VP9Context * s = avctx - > priv_data ;
int i ;
for ( i = 0 ; i < 3 ; i + + ) {
s - > last_bpp = 0 ;
s - > s . h . filter . sharpness = - 1 ;
for ( int i = 0 ; i < 3 ; i + + ) {
s - > s . frames [ i ] . tf . f = av_frame_alloc ( ) ;
s - > s . frames [ i ] . tf . f = av_frame_alloc ( ) ;
if ( ! s - > s . frames [ i ] . tf . f )
if ( ! s - > s . frames [ i ] . tf . f )
return AVERROR ( ENOMEM ) ;
return AVERROR ( ENOMEM ) ;
}
}
for ( i = 0 ; i < 8 ; i + + ) {
for ( int i = 0 ; i < 8 ; i + + ) {
s - > s . refs [ i ] . f = av_frame_alloc ( ) ;
s - > s . refs [ i ] . f = av_frame_alloc ( ) ;
s - > next_refs [ i ] . f = av_frame_alloc ( ) ;
s - > next_refs [ i ] . f = av_frame_alloc ( ) ;
if ( ! s - > s . refs [ i ] . f | | ! s - > next_refs [ i ] . f )
if ( ! s - > s . refs [ i ] . f | | ! s - > next_refs [ i ] . f )
return AVERROR ( ENOMEM ) ;
return AVERROR ( ENOMEM ) ;
}
}
return 0 ;
return 0 ;
}
}
static av_cold int vp9_decode_init ( AVCodecContext * avctx )
{
VP9Context * s = avctx - > priv_data ;
s - > last_bpp = 0 ;
s - > s . h . filter . sharpness = - 1 ;
return init_frames ( avctx ) ;
}
# if HAVE_THREADS
# if HAVE_THREADS
static int vp9_decode_update_thread_context ( AVCodecContext * dst , const AVCodecContext * src )
static int vp9_decode_update_thread_context ( AVCodecContext * dst , const AVCodecContext * src )
{
{