• Home
  • Raw
  • Download

Lines Matching refs:fctx

161 static void async_lock(FrameThreadContext *fctx)  in async_lock()  argument
163 pthread_mutex_lock(&fctx->async_mutex); in async_lock()
164 while (fctx->async_lock) in async_lock()
165 pthread_cond_wait(&fctx->async_cond, &fctx->async_mutex); in async_lock()
166 fctx->async_lock = 1; in async_lock()
167 pthread_mutex_unlock(&fctx->async_mutex); in async_lock()
170 static void async_unlock(FrameThreadContext *fctx) in async_unlock() argument
172 pthread_mutex_lock(&fctx->async_mutex); in async_unlock()
173 av_assert0(fctx->async_lock); in async_unlock()
174 fctx->async_lock = 0; in async_unlock()
175 pthread_cond_broadcast(&fctx->async_cond); in async_unlock()
176 pthread_mutex_unlock(&fctx->async_mutex); in async_unlock()
398 FrameThreadContext *fctx = p->parent; in release_delayed_buffers() local
403 pthread_mutex_lock(&fctx->buffer_mutex); in release_delayed_buffers()
412 pthread_mutex_unlock(&fctx->buffer_mutex); in release_delayed_buffers()
420 FrameThreadContext *fctx = p->parent; in submit_packet() local
421 PerThreadContext *prev_thread = fctx->prev_thread; in submit_packet()
460 FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel); in submit_packet()
461 … FFSWAP(void*, p->avctx->hwaccel_context, fctx->stash_hwaccel_context); in submit_packet()
462 FFSWAP(void*, p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv); in submit_packet()
515 fctx->prev_thread = p; in submit_packet()
516 fctx->next_decoding++; in submit_packet()
525 FrameThreadContext *fctx = avctx->internal->thread_ctx; in ff_thread_decode_frame() local
526 int finished = fctx->next_finished; in ff_thread_decode_frame()
532 async_unlock(fctx); in ff_thread_decode_frame()
538 p = &fctx->threads[fctx->next_decoding]; in ff_thread_decode_frame()
547 if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1))) in ff_thread_decode_frame()
548 fctx->delaying = 0; in ff_thread_decode_frame()
550 if (fctx->delaying) { in ff_thread_decode_frame()
566 p = &fctx->threads[finished++]; in ff_thread_decode_frame()
590 } while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished); in ff_thread_decode_frame()
594 if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0; in ff_thread_decode_frame()
596 fctx->next_finished = finished; in ff_thread_decode_frame()
602 async_lock(fctx); in ff_thread_decode_frame()
688 static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count) in park_frame_worker_threads() argument
692 async_unlock(fctx); in park_frame_worker_threads()
695 PerThreadContext *p = &fctx->threads[i]; in park_frame_worker_threads()
706 async_lock(fctx); in park_frame_worker_threads()
764 FrameThreadContext *fctx = avctx->internal->thread_ctx; in ff_frame_thread_free() local
768 park_frame_worker_threads(fctx, thread_count); in ff_frame_thread_free()
770 if (fctx->prev_thread && fctx->prev_thread != fctx->threads) in ff_frame_thread_free()
771 if (update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0) < 0) { in ff_frame_thread_free()
773 fctx->prev_thread->avctx->internal->is_copy = fctx->threads->avctx->internal->is_copy; in ff_frame_thread_free()
774 fctx->threads->avctx->internal->is_copy = 1; in ff_frame_thread_free()
778 PerThreadContext *p = &fctx->threads[i]; in ff_frame_thread_free()
820 av_freep(&fctx->threads); in ff_frame_thread_free()
821 free_pthread(fctx, thread_ctx_offsets); in ff_frame_thread_free()
826 FFSWAP(const AVHWAccel*, avctx->hwaccel, fctx->stash_hwaccel); in ff_frame_thread_free()
827 FFSWAP(void*, avctx->hwaccel_context, fctx->stash_hwaccel_context); in ff_frame_thread_free()
828 FFSWAP(void*, avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv); in ff_frame_thread_free()
838 FrameThreadContext *fctx, AVCodecContext *avctx, in init_thread() argument
855 p->parent = fctx; in init_thread()
918 FrameThreadContext *fctx; in ff_frame_thread_init() local
935 avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext)); in ff_frame_thread_init()
936 if (!fctx) in ff_frame_thread_init()
939 err = init_pthread(fctx, thread_ctx_offsets); in ff_frame_thread_init()
941 free_pthread(fctx, thread_ctx_offsets); in ff_frame_thread_init()
946 fctx->async_lock = 1; in ff_frame_thread_init()
947 fctx->delaying = 1; in ff_frame_thread_init()
952 fctx->threads = av_mallocz_array(thread_count, sizeof(PerThreadContext)); in ff_frame_thread_init()
953 if (!fctx->threads) { in ff_frame_thread_init()
959 PerThreadContext *p = &fctx->threads[i]; in ff_frame_thread_init()
962 err = init_thread(p, &i, fctx, avctx, src, codec, first); in ff_frame_thread_init()
977 FrameThreadContext *fctx = avctx->internal->thread_ctx; in ff_thread_flush() local
979 if (!fctx) return; in ff_thread_flush()
981 park_frame_worker_threads(fctx, avctx->thread_count); in ff_thread_flush()
982 if (fctx->prev_thread) { in ff_thread_flush()
983 if (fctx->prev_thread != &fctx->threads[0]) in ff_thread_flush()
984 update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0); in ff_thread_flush()
987 fctx->next_decoding = fctx->next_finished = 0; in ff_thread_flush()
988 fctx->delaying = 1; in ff_thread_flush()
989 fctx->prev_thread = NULL; in ff_thread_flush()
991 PerThreadContext *p = &fctx->threads[i]; in ff_thread_flush()
1133 FrameThreadContext *fctx; in ff_thread_release_buffer() local
1159 fctx = p->parent; in ff_thread_release_buffer()
1160 pthread_mutex_lock(&fctx->buffer_mutex); in ff_thread_release_buffer()
1183 pthread_mutex_unlock(&fctx->buffer_mutex); in ff_thread_release_buffer()