summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1dec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2017-01-09 18:04:42 +0100
committerAnton Khirnov <anton@khirnov.net>2020-04-10 15:24:54 +0200
commit1f4cf92cfbd3accbae582ac63126ed5570ddfd37 (patch)
tree0d08c281a748689d53350a929fb0df022dc6ef2c /libavcodec/ffv1dec.c
parent665e5b0fba41a8bae2269d9ce8929a24002e5907 (diff)
pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r--libavcodec/ffv1dec.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 2ffd3ef991..c704373cfe 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -977,34 +977,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
return buf_size;
}
-#if HAVE_THREADS
-static int init_thread_copy(AVCodecContext *avctx)
-{
- FFV1Context *f = avctx->priv_data;
- int i, ret;
-
- f->picture.f = NULL;
- f->last_picture.f = NULL;
- f->sample_buffer = NULL;
- f->max_slice_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]));
- }
-
- f->picture.f = av_frame_alloc();
- f->last_picture.f = av_frame_alloc();
-
- if ((ret = ff_ffv1_init_slice_contexts(f)) < 0)
- return ret;
-
- return 0;
-}
-#endif
-
static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
{
fsdst->version = fsrc->version;
@@ -1088,7 +1060,6 @@ AVCodec ff_ffv1_decoder = {
.init = decode_init,
.close = ff_ffv1_close,
.decode = decode_frame,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
.capabilities = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/ |
AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS,