summaryrefslogtreecommitdiff
path: root/libavcodec/vp6.c
diff options
context:
space:
mode:
authorBen Jackson <ben@ben.com>2012-09-15 10:32:43 -0700
committerMichael Niedermayer <michaelni@gmx.at>2012-09-15 20:26:47 +0200
commit39a3894ad50f97592ca68081095c5c2bcbcad841 (patch)
treefe3f9f40b82d01ac418c41f4797f65343b6d92d8 /libavcodec/vp6.c
parent1c20fcf0b0d30b63c33e4302c3d92b66b1665b33 (diff)
lavc/vp6: Implement "slice" threading for VP6A decode
The YUV channels of VP6 are encoded in a highly linear fashion which does not have any slice-like concept to thread. The alpha channel of VP6A is fairly independent of the YUV and comprises 40% of the work. This patch uses the THREAD_SLICE capability to split the YUV and A decodes into separate threads. Two bugs are fixed by splitting YUV and alpha state: - qscale_table from VP6A decode was for alpha channel instead of YUV - alpha channel filtering settings were overwritten by YUV header parse Signed-off-by: Ben Jackson <ben@ben.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vp6.c')
-rw-r--r--libavcodec/vp6.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index c8a191799e..bafa2b4d0a 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -599,6 +599,18 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
ff_vp56_init(avctx, avctx->codec->id == AV_CODEC_ID_VP6,
avctx->codec->id == AV_CODEC_ID_VP6A);
vp6_decode_init_context(s);
+
+ if (s->has_alpha) {
+ int i;
+
+ s->alpha_context = av_mallocz(sizeof(VP56Context));
+ ff_vp56_init_context(avctx, s->alpha_context,
+ s->flip == -1, s->has_alpha);
+ vp6_decode_init_context(s->alpha_context);
+ for (i = 0; i < 6; ++i)
+ s->alpha_context->framep[i] = s->framep[i];
+ }
+
return 0;
}
@@ -622,6 +634,13 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx)
ff_vp56_free(avctx);
vp6_decode_free_context(s);
+
+ if (s->alpha_context) {
+ ff_vp56_free_context(s->alpha_context);
+ vp6_decode_free_context(s->alpha_context);
+ av_free(s->alpha_context);
+ }
+
return 0;
}
@@ -672,6 +691,6 @@ AVCodec ff_vp6a_decoder = {
.init = vp6_decode_init,
.close = vp6_decode_free,
.decode = ff_vp56_decode_frame,
- .capabilities = CODEC_CAP_DR1,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
};