Lines Matching defs:avctx

65     AVCodecContext *avctx = priv;
66 SliceThreadContext *c = avctx->internal->thread_ctx;
67 c->mainfunc(avctx);
72 AVCodecContext *avctx = priv;
73 SliceThreadContext *c = avctx->internal->thread_ctx;
76 ret = c->func ? c->func(avctx, (char *)c->args + c->job_size * jobnr)
77 : c->func2(avctx, c->args, jobnr, threadnr);
82 void ff_slice_thread_free(AVCodecContext *avctx)
84 SliceThreadContext *c = avctx->internal->thread_ctx;
97 av_freep(&avctx->internal->thread_ctx);
100 static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
102 SliceThreadContext *c = avctx->internal->thread_ctx;
104 if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1)
105 return avcodec_default_execute(avctx, func, arg, ret, job_count, job_size);
119 static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
121 SliceThreadContext *c = avctx->internal->thread_ctx;
123 return thread_execute(avctx, NULL, arg, ret, job_count, 0);
126 int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2* func2, main_func *mainfunc, void *arg, int *ret, int job_count)
128 SliceThreadContext *c = avctx->internal->thread_ctx;
131 return thread_execute(avctx, NULL, arg, ret, job_count, 0);
134 int ff_slice_thread_init(AVCodecContext *avctx)
137 int thread_count = avctx->thread_count;
141 if (av_codec_is_encoder(avctx->codec) &&
142 avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO &&
143 avctx->height > 2800)
144 thread_count = avctx->thread_count = 1;
148 if (avctx->height)
149 nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16);
152 thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
154 thread_count = avctx->thread_count = 1;
158 avctx->active_thread_type = 0;
162 avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c));
163 mainfunc = ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL;
164 if (!c || (thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, mainfunc, thread_count)) <= 1) {
167 av_freep(&avctx->internal->thread_ctx);
168 avctx->thread_count = 1;
169 avctx->active_thread_type = 0;
172 avctx->thread_count = thread_count;
174 avctx->execute = thread_execute;
175 avctx->execute2 = thread_execute2;
179 int av_cold ff_slice_thread_init_progress(AVCodecContext *avctx)
181 SliceThreadContext *const p = avctx->internal->thread_ctx;
182 int err, i = 0, thread_count = avctx->thread_count;
210 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
212 SliceThreadContext *p = avctx->internal->thread_ctx;
222 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
224 SliceThreadContext *p = avctx->internal->thread_ctx;
240 int ff_alloc_entries(AVCodecContext *avctx, int count)
242 if (avctx->active_thread_type & FF_THREAD_SLICE) {
243 SliceThreadContext *p = avctx->internal->thread_ctx;
260 void ff_reset_entries(AVCodecContext *avctx)
262 SliceThreadContext *p = avctx->internal->thread_ctx;