You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Enabled multi-threading decoding and encoding with libavcodec, setting the thread_count property. This make a huge improvement in CPU performance, for codecs that support this property.
This commit is contained in:
@@ -90,6 +90,9 @@ void FFmpegReader::Open()
|
||||
pStream = pFormatCtx->streams[videoStream];
|
||||
pCodecCtx = pFormatCtx->streams[videoStream]->codec;
|
||||
|
||||
// Set number of threads equal to number of processors + 1
|
||||
pCodecCtx->thread_count = omp_get_num_procs() + 1;
|
||||
|
||||
// Find the decoder for the video stream
|
||||
AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
|
||||
if (pCodec == NULL) {
|
||||
@@ -113,6 +116,9 @@ void FFmpegReader::Open()
|
||||
aStream = pFormatCtx->streams[audioStream];
|
||||
aCodecCtx = pFormatCtx->streams[audioStream]->codec;
|
||||
|
||||
// Set number of threads equal to number of processors + 1
|
||||
aCodecCtx->thread_count = omp_get_num_procs() + 1;
|
||||
|
||||
// Find the decoder for the audio stream
|
||||
AVCodec *aCodec = avcodec_find_decoder(aCodecCtx->codec_id);
|
||||
if (aCodec == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user