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
c1e7c9f2
Commit
c1e7c9f2
authored
Feb 06, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for non native float32, and for float64 (BE/LE) in format.c
parent
420e58de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
modules/audio_filter/converter/format.c
modules/audio_filter/converter/format.c
+33
-0
No files found.
modules/audio_filter/converter/format.c
View file @
c1e7c9f2
...
...
@@ -345,6 +345,25 @@ static block_t *Fl32toS16(filter_t *filter, block_t *b)
b
->
i_buffer
/=
2
;
return
b
;
}
static
block_t
*
Fl64toS16
(
filter_t
*
filter
,
block_t
*
b
)
{
VLC_UNUSED
(
filter
);
double
*
src
=
(
double
*
)
b
->
p_buffer
;
int16_t
*
dst
=
(
int16_t
*
)
src
;
for
(
int
i
=
b
->
i_buffer
/
8
;
i
--
;)
{
const
double
v
=
*
src
++
;
/* Slow version. */
if
(
v
>=
1
.
0
)
*
dst
++
=
32767
;
else
if
(
v
<
-
1
.
0
)
*
dst
++
=
-
32768
;
else
*
dst
++
=
v
*
32768
.
0
;
}
b
->
i_buffer
/=
4
;
return
b
;
}
static
block_t
*
S32toFl32
(
filter_t
*
filter
,
block_t
*
b
)
{
VLC_UNUSED
(
filter
);
...
...
@@ -464,6 +483,17 @@ static void S24toFl32(block_t *bdst, const block_t *bsrc)
/* */
#define XCHG(type, a, b) \
do { type _tmp = a; a = b; b = _tmp; } while(0)
static
void
Swap64
(
block_t
*
b
)
{
uint8_t
*
data
=
(
uint8_t
*
)
b
->
p_buffer
;
for
(
size_t
i
=
0
;
i
<
b
->
i_buffer
/
8
;
i
++
)
{
XCHG
(
uint8_t
,
data
[
0
],
data
[
7
]);
XCHG
(
uint8_t
,
data
[
1
],
data
[
6
]);
XCHG
(
uint8_t
,
data
[
2
],
data
[
5
]);
XCHG
(
uint8_t
,
data
[
3
],
data
[
4
]);
data
+=
8
;
}
}
static
void
Swap32
(
block_t
*
b
)
{
uint8_t
*
data
=
(
uint8_t
*
)
b
->
p_buffer
;
...
...
@@ -496,6 +526,7 @@ static const struct {
vlc_fourcc_t
dst
;
cvt_direct_t
convert
;
}
cvt_directs
[]
=
{
{
VLC_CODEC_FL64
,
VLC_CODEC_S16N
,
Fl64toS16
},
{
VLC_CODEC_FI32
,
VLC_CODEC_FL32
,
Fi32toFl32
},
{
VLC_CODEC_FI32
,
VLC_CODEC_S16N
,
Fi32toS16
},
{
VLC_CODEC_S32N
,
VLC_CODEC_FL32
,
S32toFl32
},
...
...
@@ -540,6 +571,8 @@ static const struct {
vlc_fourcc_t
b
;
cvt_swap_t
convert
;
}
cvt_swaps
[]
=
{
{
VLC_CODEC_F64L
,
VLC_CODEC_F64B
,
Swap64
},
{
VLC_CODEC_F32L
,
VLC_CODEC_F32B
,
Swap32
},
{
VLC_CODEC_S32L
,
VLC_CODEC_S32B
,
Swap32
},
{
VLC_CODEC_U32L
,
VLC_CODEC_U32B
,
Swap32
},
{
VLC_CODEC_S24L
,
VLC_CODEC_S24B
,
Swap24
},
...
...
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