Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
0c851e46
Commit
0c851e46
authored
Jun 14, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
threads: make get_logical_cpus() available outside pthread.c
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
094c5e6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
internal.h
libavcodec/internal.h
+2
-0
pthread.c
libavcodec/pthread.c
+3
-3
No files found.
libavcodec/internal.h
View file @
0c851e46
...
...
@@ -167,4 +167,6 @@ static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx,
int
ff_thread_can_start_frame
(
AVCodecContext
*
avctx
);
int
ff_get_logical_cpus
(
AVCodecContext
*
avctx
);
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/pthread.c
View file @
0c851e46
...
...
@@ -160,7 +160,7 @@ typedef struct FrameThreadContext {
* limit the number of threads to 16 for automatic detection */
#define MAX_AUTO_THREADS 16
static
int
get_logical_cpus
(
AVCodecContext
*
avctx
)
int
ff_
get_logical_cpus
(
AVCodecContext
*
avctx
)
{
int
ret
,
nb_cpus
=
1
;
#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
...
...
@@ -303,7 +303,7 @@ static int thread_init(AVCodecContext *avctx)
int
thread_count
=
avctx
->
thread_count
;
if
(
!
thread_count
)
{
int
nb_cpus
=
get_logical_cpus
(
avctx
);
int
nb_cpus
=
ff_
get_logical_cpus
(
avctx
);
// use number of cores + 1 as thread count if there is more than one
if
(
nb_cpus
>
1
)
thread_count
=
avctx
->
thread_count
=
FFMIN
(
nb_cpus
+
1
,
MAX_AUTO_THREADS
);
...
...
@@ -799,7 +799,7 @@ static int frame_thread_init(AVCodecContext *avctx)
int
i
,
err
=
0
;
if
(
!
thread_count
)
{
int
nb_cpus
=
get_logical_cpus
(
avctx
);
int
nb_cpus
=
ff_
get_logical_cpus
(
avctx
);
if
((
avctx
->
debug
&
(
FF_DEBUG_VIS_QP
|
FF_DEBUG_VIS_MB_TYPE
))
||
avctx
->
debug_mv
)
nb_cpus
=
1
;
// use number of cores + 1 as thread count if there is more than one
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment