move vp6 huffman table freeing code, out of common vp56 code

Originally committed as revision 22186 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2010-03-03 22:29:06 +00:00
parent 68b0fd7c68
commit ded2100e48
2 changed files with 20 additions and 15 deletions

View File

@ -26,7 +26,6 @@
#include "vp56.h" #include "vp56.h"
#include "vp56data.h" #include "vp56data.h"
#include "get_bits.h"
void vp56_init_dequant(VP56Context *s, int quantizer) void vp56_init_dequant(VP56Context *s, int quantizer)
@ -696,7 +695,6 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
av_cold int vp56_free(AVCodecContext *avctx) av_cold int vp56_free(AVCodecContext *avctx)
{ {
VP56Context *s = avctx->priv_data; VP56Context *s = avctx->priv_data;
int pt;
av_freep(&s->qscale_table); av_freep(&s->qscale_table);
av_freep(&s->above_blocks); av_freep(&s->above_blocks);
@ -708,15 +706,5 @@ av_cold int vp56_free(AVCodecContext *avctx)
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]); avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]);
if (s->framep[VP56_FRAME_PREVIOUS]->data[0]) if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]); avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
for (pt=0; pt < 2; pt++) {
int ct, cg;
free_vlc(&s->dccv_vlc[pt]);
free_vlc(&s->runv_vlc[pt]);
for (ct=0; ct<3; ct++)
for (cg = 0; cg < 6; cg++)
free_vlc(&s->ract_vlc[pt][ct][cg]);
}
return 0; return 0;
} }

View File

@ -602,6 +602,23 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
static av_cold int vp6_decode_free(AVCodecContext *avctx)
{
VP56Context *s = avctx->priv_data;
int pt, ct, cg;
vp56_free(avctx);
for (pt=0; pt<2; pt++) {
free_vlc(&s->dccv_vlc[pt]);
free_vlc(&s->runv_vlc[pt]);
for (ct=0; ct<3; ct++)
for (cg=0; cg<6; cg++)
free_vlc(&s->ract_vlc[pt][ct][cg]);
}
return 0;
}
AVCodec vp6_decoder = { AVCodec vp6_decoder = {
"vp6", "vp6",
CODEC_TYPE_VIDEO, CODEC_TYPE_VIDEO,
@ -609,7 +626,7 @@ AVCodec vp6_decoder = {
sizeof(VP56Context), sizeof(VP56Context),
vp6_decode_init, vp6_decode_init,
NULL, NULL,
vp56_free, vp6_decode_free,
vp56_decode_frame, vp56_decode_frame,
CODEC_CAP_DR1, CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP6"), .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
@ -623,7 +640,7 @@ AVCodec vp6f_decoder = {
sizeof(VP56Context), sizeof(VP56Context),
vp6_decode_init, vp6_decode_init,
NULL, NULL,
vp56_free, vp6_decode_free,
vp56_decode_frame, vp56_decode_frame,
CODEC_CAP_DR1, CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"), .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
@ -637,7 +654,7 @@ AVCodec vp6a_decoder = {
sizeof(VP56Context), sizeof(VP56Context),
vp6_decode_init, vp6_decode_init,
NULL, NULL,
vp56_free, vp6_decode_free,
vp56_decode_frame, vp56_decode_frame,
CODEC_CAP_DR1, CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"), .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),