Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
0ad141d3
Commit
0ad141d3
authored
Sep 21, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_memalign: use memalign() if posix_memalign() isn't here
Also rename confusing vlc_free()
parent
69d23756
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
14 deletions
+29
-14
configure.ac
configure.ac
+1
-1
include/vlc_common.h
include/vlc_common.h
+3
-11
modules/codec/avcodec/copy.c
modules/codec/avcodec/copy.c
+1
-1
src/extras/libc.c
src/extras/libc.c
+22
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/picture.c
src/misc/picture.c
+1
-1
No files found.
configure.ac
View file @
0ad141d3
...
...
@@ -562,7 +562,7 @@ need_libc=false
dnl Check for usual libc functions
AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp uselocale])
AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise
posix_memalign
setlocale stricmp strnicmp uselocale])
AC_REPLACE_FUNCS([asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
...
...
include/vlc_common.h
View file @
0ad141d3
...
...
@@ -886,19 +886,11 @@ static inline void SetQWLE (void *p, uint64_t qw)
VLC_API
bool
vlc_ureduce
(
unsigned
*
,
unsigned
*
,
uint64_t
,
uint64_t
,
uint64_t
);
/* Aligned memory allocator */
VLC_API
void
*
vlc_memalign
(
size_t
align
,
size_t
size
);
#ifdef WIN32
# include <malloc.h>
# define vlc_memalign(align, size) (__mingw_aligned_malloc(size, align))
# define vlc_free(base) (__mingw_aligned_free(base))
# define vlc_aligned_free(base) (__mingw_aligned_free(base))
#else
static
inline
void
*
vlc_memalign
(
size_t
align
,
size_t
size
)
{
void
*
base
;
if
(
unlikely
(
posix_memalign
(
&
base
,
align
,
size
)))
base
=
NULL
;
return
base
;
}
# define vlc_free(base) free(base)
# define vlc_aligned_free(base) free(base)
#endif
VLC_API
void
vlc_tdestroy
(
void
*
,
void
(
*
)(
void
*
)
);
...
...
modules/codec/avcodec/copy.c
View file @
0ad141d3
...
...
@@ -300,7 +300,7 @@ int CopyInitCache(copy_cache_t *cache, unsigned width)
}
void
CopyCleanCache
(
copy_cache_t
*
cache
)
{
vlc_free
(
cache
->
buffer
);
vlc_
aligned_
free
(
cache
->
buffer
);
cache
->
buffer
=
NULL
;
cache
->
size
=
0
;
}
...
...
src/extras/libc.c
View file @
0ad141d3
...
...
@@ -32,6 +32,12 @@
#include <vlc_common.h>
#include <vlc_charset.h>
#if defined(HAVE_POSIX_MEMALIGN)
# include <stdlib.h>
#elif defined(HAVE_MEMALIGN) || defined(HAVE_WIN32)
# include <malloc.h>
#endif
#include <errno.h>
#undef iconv_t
...
...
@@ -419,3 +425,19 @@ bool vlc_ureduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
return
b_exact
;
}
void
*
vlc_memalign
(
size_t
align
,
size_t
size
)
{
void
*
base
;
#if defined(HAVE_POSIX_MEMALIGN)
if
(
unlikely
(
posix_memalign
(
&
base
,
align
,
size
)))
base
=
NULL
;
#elif defined(HAVE_MEMALIGN)
base
=
memalign
(
align
,
size
);
#elif defined(HAVE_WIN32)
base
=
__mingw_aligned_malloc
(
size
,
align
);
#else
# error Unimplemented!
#endif
return
base
;
}
src/libvlccore.sym
View file @
0ad141d3
...
...
@@ -675,4 +675,5 @@ xml_ReaderCreate
xml_ReaderDelete
xml_ReaderReset
vlc_keycode2str
vlc_memalign
vlc_str2keycode
src/misc/picture.c
View file @
0ad141d3
...
...
@@ -268,7 +268,7 @@ void picture_Delete( picture_t *p_picture )
assert
(
p_picture
->
p_release_sys
==
NULL
);
free
(
p_picture
->
p_q
);
vlc_free
(
p_picture
->
p_data_orig
);
vlc_
aligned_
free
(
p_picture
->
p_data_orig
);
free
(
p_picture
->
p_sys
);
free
(
p_picture
);
}
...
...
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