Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
5288c382
Commit
5288c382
authored
Aug 04, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for MMX at build-time if possible
parent
83a11816
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
30 additions
and
35 deletions
+30
-35
include/vlc_cpu.h
include/vlc_cpu.h
+8
-4
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.c
+1
-1
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+1
-1
modules/codec/libmpeg2.c
modules/codec/libmpeg2.c
+1
-1
modules/codec/x264.c
modules/codec/x264.c
+1
-1
modules/stream_out/switcher.c
modules/stream_out/switcher.c
+2
-2
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb.c
+4
-6
modules/video_chroma/i420_yuy2.c
modules/video_chroma/i420_yuy2.c
+2
-2
modules/video_chroma/i422_yuy2.c
modules/video_chroma/i422_yuy2.c
+4
-6
modules/video_filter/deinterlace/algo_yadif.c
modules/video_filter/deinterlace/algo_yadif.c
+1
-1
modules/video_filter/postproc.c
modules/video_filter/postproc.c
+1
-1
modules/video_filter/swscale.c
modules/video_filter/swscale.c
+1
-1
src/misc/cpu.c
src/misc/cpu.c
+2
-2
src/posix/linux_cpu.c
src/posix/linux_cpu.c
+1
-6
No files found.
include/vlc_cpu.h
View file @
5288c382
...
...
@@ -30,7 +30,7 @@ VLC_API unsigned vlc_CPU(void);
# if defined (__i386__) || defined (__x86_64__)
# define HAVE_FPU 1
# define
CPU_CAPABILITY_MMX (1<<3)
# define
VLC_CPU_MMX 8
# define CPU_CAPABILITY_3DNOW (1<<4)
# define CPU_CAPABILITY_MMXEXT (1<<5)
# define CPU_CAPABILITY_SSE (1<<6)
...
...
@@ -42,11 +42,15 @@ VLC_API unsigned vlc_CPU(void);
# define CPU_CAPABILITY_SSE4A (1<<12)
# if defined (__MMX__)
# define vlc_CPU_MMX() (1)
# define VLC_MMX
# elif VLC_GCC_VERSION(4, 4)
# define VLC_MMX __attribute__ ((__target__ ("mmx")))
# else
# define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler
# define vlc_CPU_MMX() ((vlc_CPU() & VLC_CPU_MMX) != 0)
# if VLC_GCC_VERSION(4, 4)
# define VLC_MMX __attribute__ ((__target__ ("mmx")))
# else
# define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler
# endif
# endif
# if defined (__SSE__)
...
...
modules/codec/avcodec/avcodec.c
View file @
5288c382
...
...
@@ -332,7 +332,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_context
->
dsp_mask
=
0
;
#if defined (__i386__) || defined (__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMX
)
)
if
(
!
vlc_CPU_MMX
(
)
)
p_context
->
dsp_mask
|=
AV_CPU_FLAG_MMX
;
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
)
p_context
->
dsp_mask
|=
AV_CPU_FLAG_MMX2
;
...
...
modules/codec/avcodec/encoder.c
View file @
5288c382
...
...
@@ -326,7 +326,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_context
->
dsp_mask
=
0
;
#if defined (__i386__) || defined (__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMX
)
)
if
(
!
vlc_CPU_MMX
(
)
)
p_context
->
dsp_mask
|=
AV_CPU_FLAG_MMX
;
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
)
p_context
->
dsp_mask
|=
AV_CPU_FLAG_MMX2
;
...
...
modules/codec/libmpeg2.c
View file @
5288c382
...
...
@@ -193,7 +193,7 @@ static int OpenDecoder( vlc_object_t *p_this )
#if defined( __i386__ ) || defined( __x86_64__ )
unsigned
cpu
=
vlc_CPU
();
if
(
cpu
&
CPU_CAPABILITY_MMX
)
if
(
vlc_CPU_MMX
()
)
i_accel
|=
MPEG2_ACCEL_X86_MMX
;
if
(
cpu
&
CPU_CAPABILITY_3DNOW
)
i_accel
|=
MPEG2_ACCEL_X86_3DNOW
;
...
...
modules/codec/x264.c
View file @
5288c382
...
...
@@ -1261,7 +1261,7 @@ static int Open ( vlc_object_t *p_this )
#if defined (__i386__) || defined (__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMX
)
)
if
(
!
vlc_CPU_MMX
(
)
)
p_sys
->
param
.
cpu
&=
~
X264_CPU_MMX
;
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
)
p_sys
->
param
.
cpu
&=
~
X264_CPU_MMXEXT
;
...
...
modules/stream_out/switcher.c
View file @
5288c382
...
...
@@ -381,7 +381,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id
->
ff_enc_c
->
dsp_mask
=
0
;
#if defined (__i386__) || defined (__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMX
)
)
if
(
!
vlc_CPU_MMX
(
)
)
id
->
ff_enc_c
->
dsp_mask
|=
AV_CPU_FLAG_MMX
;
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
)
id
->
ff_enc_c
->
dsp_mask
|=
AV_CPU_FLAG_MMX2
;
...
...
@@ -802,7 +802,7 @@ static mtime_t VideoCommand( sout_stream_t *p_stream, sout_stream_id_t *id )
id
->
ff_enc_c
->
dsp_mask
=
0
;
#if defined (__i386__) || defined (__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMX
)
)
if
(
!
vlc_CPU_MMX
(
)
)
id
->
ff_enc_c
->
dsp_mask
|=
AV_CPU_FLAG_MMX
;
if
(
!
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
)
id
->
ff_enc_c
->
dsp_mask
|=
AV_CPU_FLAG_MMX2
;
...
...
modules/video_chroma/i420_rgb.c
View file @
5288c382
...
...
@@ -84,17 +84,17 @@ vlc_module_begin ()
set_description
(
N_
(
"I420,IYUV,YV12 to "
"RGB2,RV15,RV16,RV24,RV32 conversions"
)
)
set_capability
(
"video filter2"
,
80
)
# define
CPU_CAPABILITY 0
# define
vlc_CPU_capable() (true)
#elif defined (MODULE_NAME_IS_i420_rgb_mmx)
set_description
(
N_
(
"MMX I420,IYUV,YV12 to "
"RV15,RV16,RV24,RV32 conversions"
)
)
set_capability
(
"video filter2"
,
100
)
# define
CPU_CAPABILITY CPU_CAPABILITY_MMX
# define
vlc_CPU_capable() vlc_CPU_MMX()
#elif defined (MODULE_NAME_IS_i420_rgb_sse2)
set_description
(
N_
(
"SSE2 I420,IYUV,YV12 to "
"RV15,RV16,RV24,RV32 conversions"
)
)
set_capability
(
"video filter2"
,
120
)
# define
CPU_CAPABILITY CPU_CAPABILITY_SSE2
# define
vlc_CPU_capable() ((vlc_CPU() & CPU_CAPABILITY_SSE2) != 0)
#endif
set_callbacks
(
Activate
,
Deactivate
)
vlc_module_end
()
...
...
@@ -111,10 +111,8 @@ static int Activate( vlc_object_t *p_this )
size_t
i_tables_size
;
#endif
#if CPU_CAPABILITY
if
(
!
(
vlc_CPU
()
&
CPU_CAPABILITY
)
)
if
(
!
vlc_CPU_capable
()
)
return
VLC_EGENERIC
;
#endif
if
(
p_filter
->
fmt_out
.
video
.
i_width
&
1
||
p_filter
->
fmt_out
.
video
.
i_height
&
1
)
{
...
...
modules/video_chroma/i420_yuy2.c
View file @
5288c382
...
...
@@ -88,11 +88,11 @@ vlc_module_begin ()
#if defined (MODULE_NAME_IS_i420_yuy2)
set_description
(
N_
(
"Conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
80
)
# define vlc_CPU_capable() (
1
)
# define vlc_CPU_capable() (
true
)
#elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
set_description
(
N_
(
"MMX conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
160
)
# define vlc_CPU_capable()
(vlc_CPU() & CPU_CAPABILITY_MMX
)
# define vlc_CPU_capable()
vlc_CPU_MMX(
)
#elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
set_description
(
N_
(
"SSE2 conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
250
)
...
...
modules/video_chroma/i422_yuy2.c
View file @
5288c382
...
...
@@ -71,17 +71,17 @@ vlc_module_begin ()
#if defined (MODULE_NAME_IS_i422_yuy2)
set_description
(
N_
(
"Conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
80
)
# define
CPU_CAPABILITY 0
# define
vlc_CPU_capable() (true)
# define VLC_TARGET
#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
set_description
(
N_
(
"MMX conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
100
)
# define
CPU_CAPABILITY CPU_CAPABILITY_MMX
# define
vlc_CPU_capable() vlc_CPU_MMX()
# define VLC_TARGET VLC_MMX
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
set_description
(
N_
(
"SSE2 conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
)
set_capability
(
"video filter2"
,
120
)
# define
CPU_CAPABILITY CPU_CAPABILITY_SSE2
# define
vlc_CPU_capable() ((vlc_CPU() & CPU_CAPABILITY_SSE2) != 0)
# define VLC_TARGET VLC_SSE
#endif
set_callbacks
(
Activate
,
NULL
)
...
...
@@ -96,10 +96,8 @@ static int Activate( vlc_object_t *p_this )
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
#if CPU_CAPABILITY
if
(
!
(
vlc_CPU
()
&
CPU_CAPABILITY
)
)
if
(
!
vlc_CPU_capable
()
)
return
VLC_EGENERIC
;
#endif
if
(
p_filter
->
fmt_in
.
video
.
i_width
&
1
||
p_filter
->
fmt_in
.
video
.
i_height
&
1
)
{
...
...
modules/video_filter/deinterlace/algo_yadif.c
View file @
5288c382
...
...
@@ -110,7 +110,7 @@ int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src,
filter
=
yadif_filter_line_c
;
#if defined(HAVE_YADIF_MMX)
if
(
vlc_CPU
()
&
CPU_CAPABILITY_MMX
)
if
(
vlc_CPU
_MMX
()
)
filter
=
yadif_filter_line_mmx
;
#endif
#if defined(HAVE_YADIF_SSE2)
...
...
modules/video_filter/postproc.c
View file @
5288c382
...
...
@@ -135,7 +135,7 @@ static int OpenPostproc( vlc_object_t *p_this )
/* Set CPU capabilities */
#if defined(__i386__) || defined(__x86_64__)
unsigned
i_cpu
=
vlc_CPU
();
if
(
i_cpu
&
CPU_CAPABILITY_MMX
)
if
(
vlc_CPU_MMX
()
)
i_flags
|=
PP_CPU_CAPS_MMX
;
if
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
i_flags
|=
PP_CPU_CAPS_MMX2
;
...
...
modules/video_filter/swscale.c
View file @
5288c382
...
...
@@ -233,7 +233,7 @@ static int GetSwsCpuMask(void)
#if defined(__i386__) || defined(__x86_64__)
const
unsigned
int
i_cpu
=
vlc_CPU
();
if
(
i_cpu
&
CPU_CAPABILITY_MMX
)
if
(
vlc_CPU_MMX
()
)
i_sws_cpu
|=
SWS_CPU_CAPS_MMX
;
#if (LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0))
if
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
...
...
src/misc/cpu.c
View file @
5288c382
...
...
@@ -221,7 +221,7 @@ void vlc_CPU_init (void)
if
(
!
(
i_edx
&
0x00800000
)
)
goto
out
;
# endif
i_capabilities
|=
CPU_CAPABILITY
_MMX
;
i_capabilities
|=
VLC_CPU
_MMX
;
# if defined (__SSE__)
i_capabilities
|=
CPU_CAPABILITY_MMXEXT
|
CPU_CAPABILITY_SSE
;
...
...
@@ -352,7 +352,7 @@ void vlc_CPU_dump (vlc_object_t *obj)
if (flags & (capability)) \
p += sprintf (p, "%s ", (string) )
PRINT_CAPABILITY
(
CPU_CAPABILITY_MMX
,
"MMX
"
);
if
(
vlc_CPU_MMX
())
p
+=
sprintf
(
p
,
"MMX
"
);
PRINT_CAPABILITY
(
CPU_CAPABILITY_3DNOW
,
"3DNow!"
);
PRINT_CAPABILITY
(
CPU_CAPABILITY_MMXEXT
,
"MMXEXT"
);
PRINT_CAPABILITY
(
CPU_CAPABILITY_SSE
,
"SSE"
);
...
...
src/posix/linux_cpu.c
View file @
5288c382
...
...
@@ -67,10 +67,8 @@ static void vlc_CPU_init (void)
core_caps
|=
VLC_CPU_ARM_NEON
;
#elif defined (__i386__) || defined (__x86_64__)
# ifndef __MMX__
if
(
!
strcmp
(
cap
,
"mmx"
))
core_caps
|=
CPU_CAPABILITY_MMX
;
# endif
core_caps
|=
VLC_CPU_MMX
;
# ifndef __SSE__
if
(
!
strcmp
(
cap
,
"sse"
))
core_caps
|=
CPU_CAPABILITY_SSE
|
CPU_CAPABILITY_MMXEXT
;
...
...
@@ -121,9 +119,6 @@ static void vlc_CPU_init (void)
/* Always enable capabilities that were forced during compilation */
#if defined (__i386__) || defined (__x86_64__)
# ifdef __MMX__
all_caps
|=
CPU_CAPABILITY_MMX
;
# endif
# ifdef __SSE__
all_caps
|=
CPU_CAPABILITY_SSE
|
CPU_CAPABILITY_MMXEXT
;
# endif
...
...
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