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
da293d9e
Commit
da293d9e
authored
May 19, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust: thread-safety
parent
5d854b36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
modules/video_filter/adjust.c
modules/video_filter/adjust.c
+12
-4
No files found.
modules/video_filter/adjust.c
View file @
da293d9e
...
...
@@ -113,6 +113,7 @@ static const char *const ppsz_filter_options[] = {
*****************************************************************************/
struct
filter_sys_t
{
vlc_mutex_t
lock
;
double
f_contrast
;
double
f_brightness
;
int
i_hue
;
...
...
@@ -172,6 +173,7 @@ static int Create( vlc_object_t *p_this )
p_sys
->
b_brightness_threshold
=
var_CreateGetBoolCommand
(
p_filter
,
"brightness-threshold"
);
vlc_mutex_init
(
&
p_sys
->
lock
);
var_AddCallback
(
p_filter
,
"contrast"
,
AdjustCallback
,
p_sys
);
var_AddCallback
(
p_filter
,
"brightness"
,
AdjustCallback
,
p_sys
);
var_AddCallback
(
p_filter
,
"hue"
,
AdjustCallback
,
p_sys
);
...
...
@@ -199,6 +201,7 @@ static void Destroy( vlc_object_t *p_this )
var_DelCallback
(
p_filter
,
"brightness-threshold"
,
AdjustCallback
,
p_sys
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
);
}
...
...
@@ -232,13 +235,15 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
}
/* Getvariables */
/* Get variables */
vlc_mutex_lock
(
&
p_sys
->
lock
);
i_cont
=
(
int
)(
p_sys
->
f_contrast
*
255
);
i_lum
=
(
int
)(
(
p_sys
->
f_brightness
-
1
.
0
)
*
255
);
f_hue
=
(
float
)(
p_sys
->
i_hue
*
M_PI
/
180
);
i_sat
=
(
int
)(
p_sys
->
f_saturation
*
256
);
f_gamma
=
1
.
0
/
p_sys
->
f_gamma
;
b_thres
=
p_sys
->
b_brightness_threshold
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
/*
* Threshold mode drops out everything about luma, contrast and gamma.
...
...
@@ -469,13 +474,15 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
}
/* Getvariables */
/* Get variables */
vlc_mutex_lock
(
&
p_sys
->
lock
);
i_cont
=
(
int
)(
p_sys
->
f_contrast
*
255
);
i_lum
=
(
int
)(
(
p_sys
->
f_brightness
-
1
.
0
)
*
255
);
f_hue
=
(
float
)(
p_sys
->
i_hue
*
M_PI
/
180
);
i_sat
=
(
int
)(
p_sys
->
f_saturation
*
256
);
f_gamma
=
1
.
0
/
p_sys
->
f_gamma
;
b_thres
=
p_sys
->
b_brightness_threshold
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
/*
* Threshold mode drops out everything about luma, contrast and gamma.
...
...
@@ -659,6 +666,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
oldval
);
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
!
strcmp
(
psz_var
,
"contrast"
)
)
p_sys
->
f_contrast
=
newval
.
f_float
;
else
if
(
!
strcmp
(
psz_var
,
"brightness"
)
)
...
...
@@ -671,7 +679,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
p_sys
->
f_gamma
=
newval
.
f_float
;
else
if
(
!
strcmp
(
psz_var
,
"brightness-threshold"
)
)
p_sys
->
b_brightness_threshold
=
newval
.
b_bool
;
else
return
VLC_EGENERIC
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
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