summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: remove FF_API_FLAG_TRUNCATEDJames Almer2023-02-091-3/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: deprecate AV_CODEC_(FLAG|CAP)_TRUNCATEDAnton Khirnov2021-09-201-0/+2
| | | | | | | | | | It is supported only by a few decoders (h263, h263p, mpeg(1|2|)video and mpeg4) and is entirely redundant with parsers. Furthermore, using it leads to missing frames, as flushing the decoder at the end does not work properly. Co-authored-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_frame: Move (init|free)_pthread() to pthread.cAndreas Rheinhardt2021-09-041-0/+38
| | | | | | | | We have more mutexes/condition variables whose initialization is unchecked. Also use a proper namespace for these functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal capAnton Khirnov2021-03-161-1/+1
| | | | | | | | | | | | | | | | AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9a to mark codecs that spawn threads internally and are able to select an optimal threads count by themselves (all such codecs are wrappers around external libraries). It is used by lavc generic code to check whether it should handle thread_count=0 itself or pass the zero directly to the codec implementation. Within this meaning, it is clearly supposed to be an internal cap rather than a public one, since from the viewpoint of a libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens in the generic code or within the codec internals is not a meaningful difference for the caller. External aspects of this flag will be dealt with in the following commit.
* Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-271-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'def97856de6021965db86c25a732d78689bd6bb0': lavc: AV-prefix all codec capabilities Conflicts: cmdutils.c ffmpeg.c ffplay.c libavcodec/8svx.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/adpcm.c libavcodec/alac.c libavcodec/atrac3plusdec.c libavcodec/bink.c libavcodec/dnxhddec.c libavcodec/dvdec.c libavcodec/dvenc.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/fic.c libavcodec/flacdec.c libavcodec/flacenc.c libavcodec/flvdec.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/gifdec.c libavcodec/h261dec.c libavcodec/hevc.c libavcodec/iff.c libavcodec/imc.c libavcodec/libopenjpegdec.c libavcodec/libvo-aacenc.c libavcodec/libvorbisenc.c libavcodec/libvpxdec.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec_float.c libavcodec/msmpeg4dec.c libavcodec/mxpegdec.c libavcodec/nvenc_h264.c libavcodec/nvenc_hevc.c libavcodec/pngdec.c libavcodec/qpeg.c libavcodec/ra288.c libavcodec/rv10.c libavcodec/s302m.c libavcodec/sp5xdec.c libavcodec/takdec.c libavcodec/tiff.c libavcodec/tta.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/vp6.c libavcodec/vp9.c libavcodec/wavpack.c libavcodec/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-271-3/+3
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-271-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615': lavc: AV-prefix all codec flags Conflicts: doc/examples/muxing.c ffmpeg.c ffmpeg_opt.c ffplay.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/ac3enc_float.c libavcodec/atrac1.c libavcodec/atrac3.c libavcodec/atrac3plusdec.c libavcodec/dcadec.c libavcodec/ffv1enc.c libavcodec/h264.c libavcodec/h264_loopfilter.c libavcodec/h264_mb.c libavcodec/imc.c libavcodec/libmp3lame.c libavcodec/libtheoraenc.c libavcodec/libtwolame.c libavcodec/libvpxenc.c libavcodec/libxavs.c libavcodec/libxvid.c libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegaudiodec_template.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/nellymoserdec.c libavcodec/nellymoserenc.c libavcodec/nvenc.c libavcodec/on2avc.c libavcodec/options_table.h libavcodec/opus_celt.c libavcodec/pngenc.c libavcodec/ra288.c libavcodec/ratecontrol.c libavcodec/twinvq.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c libavcodec/vorbisdec.c libavcodec/vp3.c libavcodec/wma.c libavcodec/wmaprodec.c libavcodec/x86/hpeldsp_init.c libavcodec/x86/me_cmp_init.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec flagsVittorio Giovara2015-07-271-3/+3
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'cc14ee03a7b91c69343f8d60c9e089a1950eeadb'Michael Niedermayer2013-11-041-1110/+5
|\ \ | |/ | | | | | | | | | | | | | | | | | | * commit 'cc14ee03a7b91c69343f8d60c9e089a1950eeadb': lavc: split slice and frame threading functions into separate files Conflicts: libavcodec/Makefile libavcodec/pthread.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: split slice and frame threading functions into separate filesAnton Khirnov2013-11-041-947/+5
| |
* | Merge commit '5cd6513f5be14b9744783d3d9e853d3f11065e93'Michael Niedermayer2013-11-041-8/+8
|\ \ | |/ | | | | | | | | | | * commit '5cd6513f5be14b9744783d3d9e853d3f11065e93': pthread: drop avcodec_ prefixes from static functions Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pthread: drop avcodec_ prefixes from static functionsAnton Khirnov2013-11-041-8/+8
| |
| * lavc: deprecate AVCodecContext.debug_mvAnton Khirnov2013-10-311-1/+0
| | | | | | | | It has been unused since 37045e422903695e610cca6ecb753df643ab9380.
* | avcodec/pthread: add wpp apiMickaël Raulet2013-10-221-0/+65
| | | | | | | | | | | | | | | | | | | | | | cherry picked from commit c7765f3295fe7dc0653161c6a3d3e1778b76ee67 cherry picked from commit 0008c4979fc1d1bc24d4d2c791715f6dd017563c Conflicts: libavcodec/utils.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '5152196b2b47d446d9a509b9bfb318daa26a1f2b'Michael Niedermayer2013-10-211-2/+2
|\ \ | |/ | | | | | | | | | | | | * commit '5152196b2b47d446d9a509b9bfb318daa26a1f2b': pthread: Avoid spurious wakeups See: e3329474a366de066b25e86f35f5abf9c5a4b7b2 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pthread: Avoid spurious wakeupsBen Jackson2013-10-211-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pthread_wait_cond can wake up unexpectedly (Wikipedia: Spurious_wakeup). The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or allow the caller of avctx->execute to return before all jobs were complete. Test both cases to ensure the wakeup is real. Signed-off-by: Ben Jackson <ben@ben.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * pthread: Fix deadlock during thread initializationDerek Buitenhuis2013-10-131-1/+2
| | | | | | | | | | | | | | | | | | | | Sometimes, if pthread_create() failed, then pthread_cond_wait() could accidentally be called in the worker threads after the uninit function had already called pthread_cond_broadcast(), leading to a deadlock. Don't call pthread_cond_wait() if c->done is set. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit '7950e519bb094897f957b9a9531cc60ba46cbc91'Michael Niedermayer2013-08-031-0/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7950e519bb094897f957b9a9531cc60ba46cbc91': Disable deprecation warnings for cases where a replacement is available Conflicts: libavcodec/avpacket.c libavcodec/pthread.c libavcodec/utils.c libavdevice/v4l2.c libavfilter/avfiltergraph.c libavfilter/buffersrc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Disable deprecation warnings for cases where a replacement is availableDiego Biurrun2013-08-021-0/+9
| |
* | Merge commit '50612484e058e8b241f0528584d64d9d2ccebf12'Michael Niedermayer2013-07-171-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '50612484e058e8b241f0528584d64d9d2ccebf12': pthread: Rename thread_init to avoid symbol collision Conflicts: libavcodec/pthread.c libavfilter/pthread.c See: 674d8a9629609a17fd6916164556cb012d6e6a1c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pthread: Rename thread_init to avoid symbol collisionSean McGovern2013-07-171-2/+2
| | | | | | | | | | | | The AIX threads library exposes a function with the same name. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Rename thread_init() in libavcodec and libavfilter as library_thread_init().Carl Eugen Hoyos2013-06-301-2/+2
| | | | | | | | The aix header sys/thread.h contains a definition for thread_init().
* | audio frame multi-threaded decodingPaul B Mahol2013-06-051-1/+7
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | os2threads: move from lavc to compat/Dave Yeo2013-05-281-1/+1
| | | | | | | | | | | | | | For useage in other places besides lavc. Needed after commit 90f9a5830b5d332de7ebb1ab45589f1870cbd65d Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_cpu_count: factorize "detected %d logical cores" messageMichael Niedermayer2013-05-261-1/+0
| | | | | | | | | | | | Also print the message just once Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec: remove ff_get_logical_cpus()Michael Niedermayer2013-05-241-10/+3
| | | | | | | | | | | | This simplifies the code Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '2a6eaeaa85d17b27ee0dd449183ec197c35c9675'Michael Niedermayer2013-05-241-52/+4
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | * commit '2a6eaeaa85d17b27ee0dd449183ec197c35c9675': Move get_logical_cpus() from lavc/pthread to lavu/cpu. Conflicts: doc/APIchanges libavcodec/pthread.c libavutil/cpu.c libavutil/cpu.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Move get_logical_cpus() from lavc/pthread to lavu/cpu.Anton Khirnov2013-05-241-54/+5
| | | | | | | | | | It will be useful in lavfi, and could conceivably be useful to the user applications as well.
* | Merge commit '90f9a5830b5d332de7ebb1ab45589f1870cbd65d'Michael Niedermayer2013-05-241-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '90f9a5830b5d332de7ebb1ab45589f1870cbd65d': w32pthreads: move from lavc to compat/ Conflicts: libavcodec/Makefile libavcodec/pthread.c libavcodec/vp8.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * w32pthreads: move from lavc to compat/Anton Khirnov2013-05-241-1/+1
| | | | | | | | It will be used in other places than lavc.
* | Merge commit 'db8e336e5fc18c41cb4e9bab1960349e9800d546'Michael Niedermayer2013-05-171-5/+5
|\ \ | |/ | | | | | | | | | | * commit 'db8e336e5fc18c41cb4e9bab1960349e9800d546': pthread: reindent Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pthread: reindentAnton Khirnov2013-05-171-5/+5
| |
* | Merge commit '30e256430eb88c6d4c382581b89bca171d79fbc0'Michael Niedermayer2013-05-171-7/+0
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '30e256430eb88c6d4c382581b89bca171d79fbc0': lavc/pthread: remove obsolete checks Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc/pthread: remove obsolete checksAnton Khirnov2013-05-171-7/+0
| | | | | | | | | | | | Those were useful when avcodec_thread_init() was a public functions. It was deprecated and removed some time ago, so those checks are not needed anymore.
* | avcodec/pthread: fix ffv1 with 2 threadsMichael Niedermayer2013-05-171-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | ffv1dec: Support frame threading with gop > 1Michael Niedermayer2013-05-111-1/+1
| | | | | | | | | | | | This is about 20-30% faster than slice threading Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/pthread: use THREAD_SAFE_CALLBACKS() to simplifx more codeMichael Niedermayer2013-04-251-10/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/pthread: Make sure ff_thread_finish_setup() conditions matchMichael Niedermayer2013-04-251-6/+5
| | | | | | | | | | | | Prevents warning from being shown due to multiple calls. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '94660c35249e11c53b9a9f0c2f85c4335b21eda7'Michael Niedermayer2013-04-231-2/+2
|\ \ | |/ | | | | | | | | | | * commit '94660c35249e11c53b9a9f0c2f85c4335b21eda7': threads: always call thread_finish_setup for intra codecs Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * threads: always call thread_finish_setup for intra codecsJanne Grunau2013-04-221-2/+2
| | | | | | | | | | | | | | Intra codecs do not need an update_thread_context() function and never call ff_thread_finish_setup(). They rely on ff_thread_get_buffer() calling it. So call it even if the get_buffer2 function pointer is avcodec_default_get_buffer2 and it has not been called before.
* | Add thread-safe wrapper for get_format().Reimar Döffinger2013-04-151-1/+46
| | | | | | | | | | | | | | Just like get_buffer, get_format should not be called from a different thread if thread_safe_callbacks is not set. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-03-271-0/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | * qatar/master: hwaccel: fix use with frame based multithreading Conflicts: libavcodec/h263dec.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hwaccel: fix use with frame based multithreadingJanne Grunau2013-03-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Allows use of AVHWAccel based decoders with frame based multithreading. The decoders will be forced into an non-concurrent mode by delaying ff_thread_finish_setup() calls after decoding of the current frame is finished. This wastes memory by unnecessarily using multiple threads and thus copies of the decoder context but allows seamless switching between hardware accelerated and frame threaded software decoding when the hardware decoder does not support the stream.
* | Merge commit 'c71c80f53b6a63fd6360d9de5a262f9e7c85681f'Michael Niedermayer2013-03-201-0/+1
|\ \ | |/ | | | | | | | | | | * commit 'c71c80f53b6a63fd6360d9de5a262f9e7c85681f': pthread: unref already decoded frames when flushing the decoder Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pthread: unref already decoded frames when flushing the decoderHendrik Leppkes2013-03-191-0/+1
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | pthread: update all get_buffer checks for get_buffer2Hendrik Leppkes2013-03-191-5/+15
| | | | | | | | | | | | | | This restores the performance of simple frame-threaded codecs back to their pre-merge levels. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavc: factorize ff_{thread_,re,}get_buffer error messages.Clément Bœsch2013-03-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coccinelle profile used: @@ expression r, ctx, f, loglevel, str, flags; @@ -if ((r = ff_get_buffer(ctx, f, flags)) < 0) { - av_log(ctx, loglevel, str); - return r; -} +if ((r = ff_get_buffer(ctx, f, flags)) < 0) + return r; @@ expression r, ctx, f, loglevel, str; @@ -if ((r = ff_reget_buffer(ctx, f)) < 0) { - av_log(ctx, loglevel, str); - return r; -} +if ((r = ff_reget_buffer(ctx, f)) < 0) + return r; @@ expression r, ctx, f, loglevel, str, flags; @@ -if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) { - av_log(ctx, loglevel, str); - return r; -} +if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) + return r; ...along with some manual patches for the remaining ones.
* | Merge commit 'fce68c93554803801c32c1b20509bfa8d496b02a'Michael Niedermayer2013-03-131-0/+1
|\ \ | |/ | | | | | | | | | | * commit 'fce68c93554803801c32c1b20509bfa8d496b02a': pthread: unref the decoded but not returned frames on close. Merged-by: Michael Niedermayer <michaelni@gmx.at>