Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2020-08-19 16:39:00 +0300
committerSergey Sharybin <sergey@blender.org>2021-02-15 14:29:14 +0300
commit5b2bfb2fed03274bd0bc2007c66118ca33c9f1ca (patch)
treecd5c7c52563943a918bbfed8cfe94565ef43b45a /source/blender/blenkernel/intern/writeffmpeg.c
parenta923a34de19cc83a9a687995de7203e64a4a5b95 (diff)
FFmpeg: Improve multi-threading settings
Allow use all system threads for frame encoding/decoding. This is very straightforward: the value of zero basically disables threading. Change threading policy to slice when decoding frames. The reason for this is because decoding happens frame-by-frame, so inter-frame threading policy will not bring any speedup. The change for threading policy to slice is less obvious and is based on benchmark of the demo files from T78986. This gives best performance so far. Rendering the following file went down from 190sec down to 160sec. https://storage.googleapis.com/institute-storage/vse_simplified_example.zip This change makes both reading and writing faster. The animation render is just easiest to get actual time metrics. Differential Revision: https://developer.blender.org/D8627
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index e6adad765c3..0991d804882 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -37,6 +37,7 @@
# endif
# include "BLI_math_base.h"
+# include "BLI_threads.h"
# include "BLI_utildefines.h"
# include "BKE_global.h"
@@ -566,8 +567,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
/* Set up the codec context */
c = st->codec;
- c->thread_count = 0;
- c->thread_type = FF_THREAD_FRAME;
+ c->thread_count = BLI_system_thread_count();
+ c->thread_type = FF_THREAD_SLICE;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -780,8 +781,8 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
st->id = 1;
c = st->codec;
- c->thread_count = 0;
- c->thread_type = FF_THREAD_FRAME;
+ c->thread_count = BLI_system_thread_count();
+ c->thread_type = FF_THREAD_SLICE;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_AUDIO;