OpenShot Library | libopenshot
0.2.2
include
OpenMPUtilities.h
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief Header file for OpenMPUtilities (set some common macros)
4
* @author Jonathan Thomas <jonathan@openshot.org>
5
*
6
* @section LICENSE
7
*
8
* Copyright (c) 2008-2014 OpenShot Studios, LLC
9
* <http://www.openshotstudios.com/>. This file is part of
10
* OpenShot Library (libopenshot), an open-source project dedicated to
11
* delivering high quality video editing and animation solutions to the
12
* world. For more information visit <http://www.openshot.org/>.
13
*
14
* OpenShot Library (libopenshot) is free software: you can redistribute it
15
* and/or modify it under the terms of the GNU Lesser General Public License
16
* as published by the Free Software Foundation, either version 3 of the
17
* License, or (at your option) any later version.
18
*
19
* OpenShot Library (libopenshot) is distributed in the hope that it will be
20
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU Lesser General Public License for more details.
23
*
24
* You should have received a copy of the GNU Lesser General Public License
25
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26
*/
27
28
#ifndef OPENSHOT_OPENMP_UTILITIES_H
29
#define OPENSHOT_OPENMP_UTILITIES_H
30
31
#include <omp.h>
32
#include <stdlib.h>
33
#include <string.h>
34
35
// Calculate the # of OpenMP and FFmpeg Threads to allow. We are limiting both
36
// of these based on our own performance tests (more is not always better).
37
#define OPEN_MP_NUM_PROCESSORS (min(omp_get_num_procs(), 6))
38
#define FF_NUM_PROCESSORS (min(omp_get_num_procs(), 12))
39
40
using namespace
std;
41
42
namespace
openshot
{
43
44
// Check if OS2_OMP_THREADS environment variable is present, and return
45
// if multiple threads should be used with OMP
46
static
bool
IsOMPEnabled() {
47
char
* OS2_OMP_THREADS = getenv(
"OS2_OMP_THREADS"
);
48
if
(OS2_OMP_THREADS != NULL && strcmp(OS2_OMP_THREADS,
"0"
) == 0)
49
return
false
;
50
else
51
return
true
;
52
}
53
54
}
55
56
#endif
openshot
This namespace is the default namespace for all code in the openshot library.
Definition:
AudioBufferSource.h:45
Generated on Wed Mar 25 2020 17:42:00 for OpenShot Library | libopenshot by
1.8.17