[FFmpeg-cvslog] lavc/vp6: Refactor vp6_decode_init into vp6_decode_init/ vp6_decode_init_context

Ben Jackson git at videolan.org
Sat Sep 15 20:52:14 CEST 2012


ffmpeg | branch: master | Ben Jackson <ben at ben.com> | Sat Sep 15 10:32:40 2012 -0700| [6e86d6af6bd914fb076d1263cbb240c888a1284e] | committer: Michael Niedermayer

lavc/vp6: Refactor vp6_decode_init into vp6_decode_init/vp6_decode_init_context

Pave the way for per-thread context initialization.

Signed-off-by: Ben Jackson <ben at ben.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e86d6af6bd914fb076d1263cbb240c888a1284e
---

 libavcodec/vp6.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 2002a1e..a895386 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -590,12 +590,20 @@ static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src,
     }
 }
 
+static av_cold void vp6_decode_init_context(VP56Context *s);
+
 static av_cold int vp6_decode_init(AVCodecContext *avctx)
 {
     VP56Context *s = avctx->priv_data;
 
     ff_vp56_init(avctx, avctx->codec->id == AV_CODEC_ID_VP6,
                         avctx->codec->id == AV_CODEC_ID_VP6A);
+    vp6_decode_init_context(s);
+    return 0;
+}
+
+static av_cold void vp6_decode_init_context(VP56Context *s)
+{
     s->deblock_filtering = 0;
     s->vp56_coord_div = vp6_coord_div;
     s->parse_vector_adjustment = vp6_parse_vector_adjustment;
@@ -604,16 +612,22 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
     s->parse_vector_models = vp6_parse_vector_models;
     s->parse_coeff_models = vp6_parse_coeff_models;
     s->parse_header = vp6_parse_header;
-
-    return 0;
 }
 
+static av_cold void vp6_decode_free_context(VP56Context *s);
+
 static av_cold int vp6_decode_free(AVCodecContext *avctx)
 {
     VP56Context *s = avctx->priv_data;
-    int pt, ct, cg;
 
     ff_vp56_free(avctx);
+    vp6_decode_free_context(s);
+    return 0;
+}
+
+static av_cold void vp6_decode_free_context(VP56Context *s)
+{
+    int pt, ct, cg;
 
     for (pt=0; pt<2; pt++) {
         ff_free_vlc(&s->dccv_vlc[pt]);
@@ -622,7 +636,6 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx)
             for (cg=0; cg<6; cg++)
                 ff_free_vlc(&s->ract_vlc[pt][ct][cg]);
     }
-    return 0;
 }
 
 AVCodec ff_vp6_decoder = {



More information about the ffmpeg-cvslog mailing list