X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fwnv1.c;h=9a5a77fe78e8b92a6c0ee0660072a8b83b84827a;hb=b07781b6e4f6267f20aec4e7f1d390ddb223af46;hp=fa3a308dc06bd6b31ede29f8dee1ededc67fc78d;hpb=7a00bbad2100367481240e62876b941b5c4befdc;p=ffmpeg diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index fa3a308dc06..9a5a77fe78e 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -25,7 +25,7 @@ */ #include "avcodec.h" -#include "bitstream.h" +#include "get_bits.h" typedef struct WNV1Context{ @@ -129,15 +129,26 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx){ WNV1Context * const l = avctx->priv_data; + static VLC_TYPE code_table[1 << CODE_VLC_BITS][2]; l->avctx = avctx; avctx->pix_fmt = PIX_FMT_YUV422P; - if(!code_vlc.table){ - init_vlc(&code_vlc, CODE_VLC_BITS, 16, - &code_tab[0][1], 4, 2, - &code_tab[0][0], 4, 2, 1); - } + code_vlc.table = code_table; + code_vlc.table_allocated = 1 << CODE_VLC_BITS; + init_vlc(&code_vlc, CODE_VLC_BITS, 16, + &code_tab[0][1], 4, 2, + &code_tab[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC); + + return 0; +} + +static av_cold int decode_end(AVCodecContext *avctx){ + WNV1Context * const l = avctx->priv_data; + AVFrame *pic = &l->pic; + + if (pic->data[0]) + avctx->release_buffer(avctx, pic); return 0; } @@ -149,7 +160,7 @@ AVCodec wnv1_decoder = { sizeof(WNV1Context), decode_init, NULL, - NULL, + decode_end, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),