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
e0e1f0fc
Commit
e0e1f0fc
authored
Aug 19, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust: stick to single precision
The VLC object variables are stored in single precision anyway.
parent
829ae6f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
31 deletions
+24
-31
modules/video_filter/adjust.c
modules/video_filter/adjust.c
+24
-31
No files found.
modules/video_filter/adjust.c
View file @
e0e1f0fc
...
...
@@ -119,16 +119,16 @@ static const char *const ppsz_filter_options[] = {
struct
filter_sys_t
{
vlc_mutex_t
lock
;
double
f_contrast
;
double
f_brightness
;
float
f_hue
;
double
f_saturation
;
double
f_gamma
;
bool
b_brightness_threshold
;
int
(
*
pf_process_sat_hue
)(
picture_t
*
,
picture_t
*
,
int
,
int
,
int
,
int
,
int
);
int
(
*
pf_process_sat_hue_clip
)(
picture_t
*
,
picture_t
*
,
int
,
int
,
int
,
int
,
int
);
float
f_contrast
;
float
f_brightness
;
float
f_hue
;
float
f_saturation
;
float
f_gamma
;
bool
b_brightness_threshold
;
int
(
*
pf_process_sat_hue
)(
picture_t
*
,
picture_t
*
,
int
,
int
,
int
,
int
,
int
);
int
(
*
pf_process_sat_hue_clip
)(
picture_t
*
,
picture_t
*
,
int
,
int
,
int
,
int
,
int
);
};
/*****************************************************************************
...
...
@@ -232,13 +232,6 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
uint8_t
*
p_in
,
*
p_in_end
,
*
p_line_end
;
uint8_t
*
p_out
;
bool
b_thres
;
double
f_hue
;
double
f_gamma
;
int32_t
i_cont
,
i_lum
;
int
i_sat
,
i_sin
,
i_cos
,
i_x
,
i_y
;
int
i
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
if
(
!
p_pic
)
return
NULL
;
...
...
@@ -252,12 +245,12 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
/* 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
=
p_sys
->
f_hue
*
(
float
)(
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
;
i
nt32_t
i_cont
=
lroundf
(
p_sys
->
f_contrast
*
255
.
f
);
i
nt32_t
i_lum
=
lroundf
(
(
p_sys
->
f_brightness
-
1
.
f
)
*
255
.
f
);
f
loat
f
_hue
=
p_sys
->
f_hue
*
(
float
)(
M_PI
/
180
.);
i
nt
i_sat
=
(
int
)(
p_sys
->
f_saturation
*
256
.
f
);
f
loat
f_gamma
=
1
.
f
/
p_sys
->
f_gamma
;
b
ool
b
_thres
=
p_sys
->
b_brightness_threshold
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
/*
...
...
@@ -271,13 +264,13 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
i_lum
+=
128
-
i_cont
/
2
;
/* Fill the gamma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
256
;
i
++
)
{
pi_gamma
[
i
]
=
clip_uint8_vlc
(
pow
(
i
/
255
.
0
,
f_gamma
)
*
255
.
0
);
pi_gamma
[
i
]
=
clip_uint8_vlc
(
pow
f
(
i
/
255
.
f
,
f_gamma
)
*
255
.
f
);
}
/* Fill the luma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
256
;
i
++
)
{
pi_luma
[
i
]
=
pi_gamma
[
clip_uint8_vlc
(
i_lum
+
i_cont
*
i
/
256
)];
}
...
...
@@ -288,7 +281,7 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
* We get luma as threshold value: the higher it is, the darker is
* the image. Should I reverse this?
*/
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
256
;
i
++
)
{
pi_luma
[
i
]
=
(
i
<
i_lum
)
?
0
:
255
;
}
...
...
@@ -339,11 +332,11 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
* Do the U and V planes
*/
i
_sin
=
sin
(
f_hue
)
*
256
;
i
_cos
=
cos
(
f_hue
)
*
256
;
i
nt
i_sin
=
sinf
(
f_hue
)
*
256
.
f
;
i
nt
i_cos
=
cosf
(
f_hue
)
*
256
.
f
;
i
_x
=
(
cos
(
f_hue
)
+
sin
(
f_hue
)
)
*
32768
;
i
_y
=
(
cos
(
f_hue
)
-
sin
(
f_hue
)
)
*
32768
;
i
nt
i_x
=
(
cosf
(
f_hue
)
+
sinf
(
f_hue
)
)
*
32768
.
f
;
i
nt
i_y
=
(
cosf
(
f_hue
)
-
sinf
(
f_hue
)
)
*
32768
.
f
;
if
(
i_sat
>
256
)
{
...
...
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