Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
451
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
b1355543
Commit
b1355543
authored
3 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
cpu: semi-generic helper for hooking SIMD functions
parent
b15b63e7
No related branches found
No related tags found
1 merge request
!1429
cpu: helper to probe DSP functions
Pipeline
#193991
passed with stage
in 22 minutes and 48 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/vlc_cpu.h
+42
-0
42 additions, 0 deletions
include/vlc_cpu.h
src/libvlccore.sym
+1
-0
1 addition, 0 deletions
src/libvlccore.sym
src/misc/cpu.c
+15
-0
15 additions, 0 deletions
src/misc/cpu.c
with
58 additions
and
0 deletions
include/vlc_cpu.h
+
42
−
0
View file @
b1355543
...
...
@@ -219,4 +219,46 @@ unsigned vlc_CPU_raw(void);
# endif
/**
* Initialises DSP functions.
*
* This helper looks for accelerated Digital Signal Processing functions
* identified by the supplied type name. Those functions ares typically
* implemented using architecture-specific assembler code with
* Single Instruction Multiple Data (SIMD) opcodes for faster processing.
*
* The exact purposes and semantics of the DSP functions is uniquely identified
* by a nul-terminated string.
*
* \note This function should not be used directly. It is recommended to use
* the convenience wrapper vlc_CPU_functions_init_once() instead.
*
* \param name nul-terminated type identifier (cannot be NULL)
* \param [inout] funcs type-specific data structure to be initialised
*/
VLC_API
void
vlc_CPU_functions_init
(
const
char
*
name
,
void
*
restrict
funcs
);
# ifndef __cplusplus
/**
* Initialises DSP functions once.
*
* This is a convenience wrapper for vlc_CPU_functions_init().
* It only initialises the functions the first time it is evaluated.
*/
static
inline
void
vlc_CPU_functions_init_once
(
const
char
*
name
,
void
*
restrict
funcs
)
{
static
vlc_once_t
once
=
VLC_STATIC_ONCE
;
if
(
!
vlc_once_begin
(
&
once
))
{
vlc_CPU_functions_init
(
name
,
funcs
);
vlc_once_complete
(
&
once
);
}
}
# endif
#define set_cpu_funcs(name, activate, priority) \
set_callback(VLC_CHECKED_TYPE(void (*)(void *), activate)) \
set_capability(name, priority)
#endif
/* !VLC_CPU_H */
This diff is collapsed.
Click to expand it.
src/libvlccore.sym
+
1
−
0
View file @
b1355543
...
...
@@ -553,6 +553,7 @@ vlc_sem_trywait
vlc_control_cancel
vlc_GetCPUCount
vlc_CPU
vlc_CPU_functions_init
vlc_event_attach
vlc_event_detach
vlc_filenamecmp
...
...
This diff is collapsed.
Click to expand it.
src/misc/cpu.c
+
15
−
0
View file @
b1355543
...
...
@@ -34,6 +34,7 @@
#include
<vlc_common.h>
#include
<vlc_cpu.h>
#include
<vlc_memstream.h>
#include
<vlc_modules.h>
#include
"libvlc.h"
#include
<assert.h>
...
...
@@ -305,3 +306,17 @@ void vlc_CPU_dump (vlc_object_t *obj)
free
(
stream
.
ptr
);
}
}
void
vlc_CPU_functions_init
(
const
char
*
capability
,
void
*
restrict
funcs
)
{
module_t
**
mods
;
ssize_t
n
=
vlc_module_match
(
capability
,
NULL
,
false
,
&
mods
,
NULL
);
for
(
ssize_t
i
=
0
;
i
<
n
;
i
++
)
{
void
(
*
init
)(
void
*
)
=
vlc_module_map
(
NULL
,
mods
[
i
]);
if
(
likely
(
init
!=
NULL
))
init
(
funcs
);
}
free
(
mods
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment