Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2db07444
Commit
2db07444
authored
Nov 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
posterize: use atomic variable instead of lock
parent
62daf8e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
24 deletions
+14
-24
modules/video_filter/posterize.c
modules/video_filter/posterize.c
+14
-24
No files found.
modules/video_filter/posterize.c
View file @
2db07444
...
...
@@ -29,10 +29,11 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <assert.h>
#include <vlc_atomic.h>
#include <vlc_filter.h>
#include "filter_picture.h"
...
...
@@ -86,8 +87,7 @@ static int FilterCallback( vlc_object_t *, char const *,
*****************************************************************************/
struct
filter_sys_t
{
int
i_level
;
vlc_mutex_t
lock
;
atomic_int
i_level
;
};
/*****************************************************************************
...
...
@@ -129,11 +129,10 @@ static int Create( vlc_object_t *p_this )
config_ChainParse
(
p_filter
,
CFG_PREFIX
,
ppsz_filter_options
,
p_filter
->
p_cfg
);
p_sys
->
i_level
=
var_CreateGetIntegerCommand
(
p_filter
,
CFG_PREFIX
"level"
);
vlc_mutex_init
(
&
p_sys
->
lock
);
atomic_init
(
&
p_sys
->
i_level
,
var_CreateGetIntegerCommand
(
p_filter
,
CFG_PREFIX
"level"
)
);
var_AddCallback
(
p_filter
,
CFG_PREFIX
"level"
,
FilterCallback
,
NULL
);
var_AddCallback
(
p_filter
,
CFG_PREFIX
"level"
,
FilterCallback
,
p_sys
);
p_filter
->
pf_video_filter
=
Filter
;
...
...
@@ -148,11 +147,10 @@ static int Create( vlc_object_t *p_this )
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
var_DelCallback
(
p_filter
,
CFG_PREFIX
"level"
,
FilterCallback
,
NULL
);
vlc_mutex_destroy
(
&
p_filter
->
p_sys
->
lock
);
free
(
p_filter
->
p_sys
);
var_DelCallback
(
p_filter
,
CFG_PREFIX
"level"
,
FilterCallback
,
p_sys
);
free
(
p_sys
);
}
/*****************************************************************************
...
...
@@ -165,14 +163,11 @@ static void Destroy( vlc_object_t *p_this )
static
picture_t
*
Filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
picture_t
*
p_outpic
;
int
level
;
if
(
!
p_pic
)
return
NULL
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
level
=
p_sys
->
i_level
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
int
level
=
atomic_load
(
&
p_sys
->
i_level
);
p_outpic
=
filter_NewPicture
(
p_filter
);
if
(
!
p_outpic
)
...
...
@@ -442,16 +437,11 @@ static void YuvPosterization( uint8_t* posterized_y1, uint8_t* posterized_y2,
static
int
FilterCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
(
void
)
oldval
;
(
void
)
p_data
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
(
void
)
p_this
;
(
void
)
oldval
;
filter_sys_t
*
p_sys
=
p_data
;
if
(
!
strcmp
(
psz_var
,
CFG_PREFIX
"level"
)
)
{
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
i_level
=
newval
.
i_int
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
atomic_store
(
&
p_sys
->
i_level
,
newval
.
i_int
);
return
VLC_SUCCESS
;
}
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