Lines Matching refs:avctx
46 * @param avctx The context.
48 static void validate_thread_parameters(AVCodecContext *avctx)
50 int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
52 && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)
54 && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
55 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
56 if (avctx->thread_count == 1) {
57 avctx->active_thread_type = 0;
58 } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
59 avctx->active_thread_type = FF_THREAD_FRAME;
60 } else if (avctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS &&
61 avctx->thread_type & FF_THREAD_SLICE) {
62 avctx->active_thread_type = FF_THREAD_SLICE;
63 } else if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_AUTO_THREADS)) {
64 avctx->thread_count = 1;
65 avctx->active_thread_type = 0;
68 if (avctx->thread_count > MAX_AUTO_THREADS)
69 av_log(avctx, AV_LOG_WARNING,
71 avctx->thread_count, MAX_AUTO_THREADS);
74 int ff_thread_init(AVCodecContext *avctx)
76 validate_thread_parameters(avctx);
78 if (avctx->active_thread_type&FF_THREAD_SLICE)
79 return ff_slice_thread_init(avctx);
80 else if (avctx->active_thread_type&FF_THREAD_FRAME)
81 return ff_frame_thread_init(avctx);
86 void ff_thread_free(AVCodecContext *avctx)
88 if (avctx->active_thread_type&FF_THREAD_FRAME)
89 ff_frame_thread_free(avctx, avctx->thread_count);
91 ff_slice_thread_free(avctx);