aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-01 19:29:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-01 23:22:06 +0200
commitc72cca5a44d8a83e097a97a13990d421ba7a4c5d (patch)
treed579265c3c94ad72fb1665c652f585b8a1ee0cb2 /libavcodec/ffv1dec.c
parent5be7aecc80b5efcd3eb01868caeb01b72b4bfd87 (diff)
downloadffmpeg-c72cca5a44d8a83e097a97a13990d421ba7a4c5d.tar.gz
avcodec/ffv1dec: move initial_states init to init_thread_copy()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r--libavcodec/ffv1dec.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 38e0849d87..70904eaf29 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -942,13 +942,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
static int init_thread_copy(AVCodecContext *avctx)
{
FFV1Context *f = avctx->priv_data;
+ int i;
f->picture.f = NULL;
f->last_picture.f = NULL;
f->sample_buffer = NULL;
- f->quant_table_count = 0;
f->slice_count = 0;
+ for (i = 0; i < f->quant_table_count; i++) {
+ av_assert0(f->version > 1);
+ f->initial_states[i] = av_memdup(f->initial_states[i],
+ f->context_count[i] * sizeof(*f->initial_states[i]));
+ }
+
return 0;
}
@@ -962,12 +968,9 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
return 0;
if (!fdst->picture.f) {
+ FFV1Context bak = *fdst;
memcpy(fdst, fsrc, sizeof(*fdst));
-
- for (i = 0; i < fdst->quant_table_count; i++) {
- fdst->initial_states[i] = av_malloc(fdst->context_count[i] * sizeof(*fdst->initial_states[i]));
- memcpy(fdst->initial_states[i], fsrc->initial_states[i], fdst->context_count[i] * sizeof(*fdst->initial_states[i]));
- }
+ memcpy(fdst->initial_states, bak.initial_states, sizeof(fdst->initial_states));
fdst->picture.f = av_frame_alloc();
fdst->last_picture.f = av_frame_alloc();