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
953f3b12
Commit
953f3b12
authored
Aug 13, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
glspectrum: use single precision
parent
07d3ca8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
modules/visualization/glspectrum.c
modules/visualization/glspectrum.c
+37
-37
No files found.
modules/visualization/glspectrum.c
View file @
953f3b12
...
...
@@ -104,10 +104,10 @@ struct filter_sys_t
static
block_t
*
DoWork
(
filter_t
*
,
block_t
*
);
static
void
*
Thread
(
void
*
);
#define SPECTRUM_WIDTH 4.
0
#define SPECTRUM_WIDTH 4.
f
#define NB_BANDS 20
#define ROTATION_INCREMENT
0.1
#define BAR_DECREMENT
0.075
#define ROTATION_INCREMENT
.1f
#define BAR_DECREMENT
.075f
#define ROTATION_MAX 20
const
GLfloat
lightZeroColor
[]
=
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
...
...
@@ -249,40 +249,40 @@ static void initOpenGLScene(void)
*/
static
void
drawBar
(
void
)
{
const
float
w
=
SPECTRUM_WIDTH
/
NB_BANDS
-
0
.
05
;
const
float
w
=
SPECTRUM_WIDTH
/
NB_BANDS
-
0
.
05
f
;
const
GLfloat
vertexCoords
[]
=
{
0
.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
/* Test the ranges. */
r
=
r
>
1
.
0
?
1
.
0
:
r
;
b
=
b
>
1
.
0
?
1
.
0
:
b
;
r
=
r
>
1
.
f
?
1
.
f
:
r
;
b
=
b
>
1
.
f
?
1
.
f
:
b
;
r
=
r
<
0
.
0
?
0
.
0
:
r
;
b
=
b
<
0
.
0
?
0
.
0
:
b
;
r
=
r
<
0
.
f
?
0
.
f
:
r
;
b
=
b
<
0
.
f
?
0
.
f
:
b
;
/* Set the bar color. */
glColor4f
(
r
,
0
.
0
,
b
,
1
.
0
);
glColor4f
(
r
,
0
.
f
,
b
,
1
.
f
);
}
...
...
@@ -323,7 +323,7 @@ static void setBarColor(float f_height)
static
void
drawBars
(
float
heights
[])
{
glPushMatrix
();
glTranslatef
(
-
2
.
0
,
0
.
0
,
0
.
0
);
glTranslatef
(
-
2
.
f
,
0
.
f
,
0
.
f
);
glEnableClientState
(
GL_VERTEX_ARRAY
);
glEnableClientState
(
GL_NORMAL_ARRAY
);
...
...
@@ -332,12 +332,12 @@ static void drawBars(float heights[])
for
(
unsigned
i
=
0
;
i
<
NB_BANDS
;
++
i
)
{
glPushMatrix
();
glScalef
(
1
.
0
,
heights
[
i
],
1
.
0
);
glScalef
(
1
.
f
,
heights
[
i
],
1
.
f
);
setBarColor
(
heights
[
i
]);
drawBar
();
glPopMatrix
();
glTranslatef
(
w
,
0
.
0
,
0
.
0
);
glTranslatef
(
w
,
0
.
f
,
0
.
f
);
}
glDisableClientState
(
GL_VERTEX_ARRAY
);
...
...
@@ -471,7 +471,7 @@ static void *Thread( void *p_data )
{
union
{
float
f
;
int32_t
i
;}
u
;
u
.
f
=
*
p_buffl
+
384
.
0
;
u
.
f
=
*
p_buffl
+
384
.
f
;
if
(
u
.
i
>
0x43c07fff
)
*
p_buffs
=
32767
;
else
if
(
u
.
i
<
0x43bf8000
)
...
...
@@ -525,7 +525,7 @@ static void *Thread( void *p_data )
y
=
p_dest
[
j
];
}
/* Calculate the height of the bar */
float
new_height
=
y
!=
0
?
log
(
y
)
*
0
.
4
:
0
;
float
new_height
=
y
!=
0
?
log
f
(
y
)
*
0
.
4
f
:
0
;
height
[
i
]
=
new_height
>
height
[
i
]
?
new_height
:
height
[
i
];
}
...
...
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