summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
Commit message (Collapse)AuthorAge
* lavc: add a wrapper for AVCodecContext.get_buffer().Anton Khirnov2012-12-04
| | | | It will be useful in the upcoming transition to refcounted AVFrames.
* pthread: make sure AVFrame.extended_data is set properly.Anton Khirnov2012-09-25
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* pthread: add const to AVCodec pointersMans Rullgard2012-08-18
| | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* Don't include common.h from avutil.hMartin Storsjö2012-08-15
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* Avoid C99 variable declarations within for statements.Diego Biurrun2012-06-14
| | | | | We generally do not declare variables within for statements and there are compilers that choke on such constructs.
* pthread: warn on high thread countsSean McGovern2012-05-07
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* avcodec: remove AVCodecContext.dsp_maskMans Rullgard2012-04-21
| | | | | | | | This removes all references to AVCodecContext.dsp_mask and marks it for eviction at the next version bump. It has been superseded by av_set_cpu_flag_mask() which, unlike this field, works everywhere. Signed-off-by: Mans Rullgard <mans@mansr.com>
* pthread: Fix crash due to fctx->delaying not being cleared.Dale Curtis2012-04-12
| | | | | | | | | | | Reproducible with test case and ffplay -threads 2. Stack trace: http://pastebin.com/PexZ4Uc0 Test case: http://commondatastorage.googleapis.com/dalecurtis-shared/crash.ogm Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: Immediately release all frames in ff_thread_flush()Alexander Strange2012-03-24
| | | | | | | | Before this, they were only added to the delayed release queue and not freed until later. This could lead to unnecessary memory use or buffer exhaustion. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: free progress if buffer allocation failed.Ronald S. Bultje2012-03-24
| | | | | | | Else we run out of progress variables after a few failed buffer allocations. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/avconv: support changing frame sizes in codecs with frame mt.Ronald S. Bultje2012-03-24
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* threads: fix old frames returned after avcodec_flush_buffers()Uoti Urpala2012-03-16
| | | | | | | | | | Calling avcodec_flush_buffers() and then avcodec_decode_video2() with a 0-sized packet (to get remaining buffered frames) could incorrectly return an old frame from before the avcodec_flush_buffers() call. Add a loop in ff_thread_flush() to zero the got_frame field of each thread to ensure the old frames will not be returned. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavc: deprecate AVCodecContext.sub_id.Anton Khirnov2012-03-04
| | | | | | | In most places where it's used, it's as a pointless write-only field. Only rv10 decoder actually reads from it, but it stores some internal version info in it. There is no reason for it to be in a public field.
* lavc: reorder AVCodecContext fields.Anton Khirnov2012-02-27
| | | | | Put related fields together, move the important ones closer to the beginning, try to eliminate holes.
* threads: update slice_count and slice_offset from user contextJanne Grunau2012-01-21
| | | | | They are used to signal the number of slices and offsets of each slice out of band to the decoder.
* cosmetics: drop some pointless parenthesesDiego Biurrun2012-01-07
|
* win32: detect number of CPUs using affinityDaniel Verkamp2012-01-03
| | | | Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* threads: limit the number of automatic threads to MAX_AUTO_THREADSJanne Grunau2012-01-01
| | | | | | The extra thread added in {frame_}*thread_init was not taken into account. Explicitly sets thread_count to 1 if only one CPU core was detected. Also fixes two typos in comments.
* threads: introduce CODEC_CAP_AUTO_THREADS and add it to libx264Janne Grunau2012-01-01
| | | | | | Some external codecs have their own code to determine the best number of threads. This number is not necessary the number of cpu cores. Thread_count will be only 0 if the codec has CODEC_CAP_AUTO_THREADS.
* threads: add sysconf based number of CPUs detectionJanne Grunau2011-12-31
| | | | Can act as fallback and should work on a couple of Unix systems.
* threads: always include necessary headers for number of CPUs detectionJanne Grunau2011-12-31
| | | | | | Since the conditions for the actual usage are more specific a less preferred method can be used. This would cause compilation errors because necessary headers are not included.
* threads: test for sys/param.h and include it for sysctl on OpenBSDJanne Grunau2011-12-27
|
* lavc: add format field to AVFrameStefano Sabatini2011-12-25
| | | | | | The format is a per-frame property, having it in AVFrame simplify the operation of extraction of that information, since avoids the need to access the codec/stream context.
* lavc: add width and height fields to AVFrameStefano Sabatini2011-12-25
| | | | | | width and height are per-frame properties, setting these values in AVFrame simplify the operation of extraction of that information, since avoids the need to check the codec/stream context.
* lavc: add a sample_aspect_ratio field to AVFrameStefano Sabatini2011-12-25
| | | | | | | The sample aspect ratio is a per-frame property, so it makes sense to define it in AVFrame rather than in the codec/stream context. Simplify application-level sample aspect ratio information extraction, and allow further simplifications.
* threads: check defines before using them in automatic thread detectionJanne Grunau2011-12-23
|
* pthread: include sys/types.h before sys/sysctl.hJanne Grunau2011-12-23
| | | | Fixes compilation on FreeBSD with clang 3.
* bsd: use number of logical CPUs as automatic thread countJanne Grunau2011-12-22
|
* windows: use number of CPUs as automatic thread countJanne Grunau2011-12-22
|
* linux: use number of CPUs as automatic thread countJanne Grunau2011-12-22
| | | | | | Use sched_getaffinity to determine the number of logical CPUs. Limits the number of threads to 16 since slice threading of H.264 seems to be buggy with more than 16 threads.
* pthreads: reset active_thread_type when slice thread_init returrns earlyJanne Grunau2011-12-22
|
* avcodec: deprecate AVFrame.ageMans Rullgard2011-12-18
| | | | | | | | This was intended as an optimisation for skipped blocks in MPEG2 P-frames and never used elsewhere. Removing this "optimisation" speeds up MPEG2 decoding by 1-2% (ARM Cortex-A9). Signed-off-by: Mans Rullgard <mans@mansr.com>
* doxygen: misc consistency, spelling and wording fixesDiego Biurrun2011-12-12
|
* pthread: don't increment index on zero-sized packets.Aaron Colwell2011-11-28
| | | | | | | | The next call to decode() will update from an invalid index, which will either lead to a memcpy() where dest==src (2 threads), or lead to a crash (>2 threads). Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: track thread existence in a separate variable.Cheng Sun2011-11-26
| | | | | | | | This fixes a compile error on mingw32 when using p->thread directly (as if it were a pointer) to track thread existence, because the type is opaque and may be a non-pointer. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* [PATCH] Fix crash when initializing multi-threaded decoding for corrupted file.Cheng Sun2011-11-26
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* frame-mt: return consumed packet size in ff_thread_decode_frameJanne Grunau2011-11-25
| | | | | This is required to fulfill avcodec_decode_video2() promise to return the number of consumed bytes on success.
* pthread: do not touch has_b_framesJanne Grunau2011-11-22
| | | | | | | | | | | | | | | | | | Adding the thread count in frame level multithreading to has_b_frames as an additional delay causes more problems than it solves. For example inconsistent behaviour during timestamp calculation in libavformat. Thread count and frame level multithreading are both set by the user. If the additional delay caused by frame level multithreading needs to be considered in the calling code it has all information to take it into account. Should it become necessary to calculate a maximum delay inside libavcodec it should be exported as its own field and not reusing an existing field. Based on a patch by Michael Niedermayer. Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* pthread: add some malloc failure checksJustin Ruggles2011-11-21
|
* avcodec: move some AVCodecContext fields to an internal struct.Justin Ruggles2011-11-19
| | | | | | | | A new field, AVCodecContext.internal is used to hold a new struct AVCodecInternal, which has private fields that are not codec-specific and are used by general libavcodec functions. Moved internal_buffer, internal_buffer_count, and is_copy.
* threads: restore has_b_frames in frame_thread_freeJanne Grunau2011-10-26
| | | | | | Otherwise the delay expressed in has_b_frames increases with every avcodec_close/avcodec_open. Fixes fate-ea-dct with more than 1 thread.
* w32threads: support for frame multithreadingSteven Walters2011-10-16
| | | | | | | | Replace our incomplete w32threads implementation with x264's pthreads w32threads wrapper. Relicensed to LGPL with kind permission by Pegasys Inc. Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* pthread: prevent updating AVCodecContext from itself in frame_thread_freeRonald S. Bultje2011-10-15
| | | | Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* pthread: copy coded frame dimensions in update_context_from_threadRonald S. Bultje2011-10-15
| | | | Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* vp8/mt: flush worker thread, not application thread context, on seek.Ronald S. Bultje2011-07-10
| | | | This prevents a crash when seeking.
* mt: proper locking around release_buffer calls.Ronald S. Bultje2011-07-10
| | | | | This fixes a crash when seeking in some webm files with many threads (e.g. 8).
* H264/MPEG frame-level multi-threading.Alexander Strange2011-06-02
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavc: remove FF_API_HURRY_UP cruftAnton Khirnov2011-04-26
|
* Introduce slice threads flag.Ronald S. Bultje2011-04-21
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: validate_thread_parameters() ignored slice-threading being ↵Alexander Strange2011-04-09
| | | | | | | | | | | | intentionally off The thread_type API allows you to request only FF_THREAD_FRAME (instead of FRAME | SLICE), but it was being ignored. We don't implement both of them at the same time, so there isn't an effect on current codecs, except that you can request no kinds of threading now (a bit useless). Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>