Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1a30bf60
Commit
1a30bf60
authored
Jun 09, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add sofa2wavs
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
d4d1fc82
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
0 deletions
+81
-0
Makefile
Makefile
+1
-0
Makefile
tools/Makefile
+1
-0
sofa2wavs.c
tools/sofa2wavs.c
+79
-0
No files found.
Makefile
View file @
1a30bf60
...
...
@@ -82,6 +82,7 @@ target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
$(LD)
$(LDFLAGS)
$(LDEXEFLAGS)
$(LD_O)
$^
$(ELIBS)
$(FF_EXTRALIBS)
$(LIBFUZZER_PATH)
tools/cws2fws$(EXESUF)
:
ELIBS = $(ZLIB)
tools/sofa2wavs$(EXESUF)
:
ELIBS = $(FF_EXTRALIBS)
tools/uncoded_frame$(EXESUF)
:
$(FF_DEP_LIBS)
tools/uncoded_frame$(EXESUF)
:
ELIBS = $(FF_EXTRALIBS)
tools/target_dec_%_fuzzer$(EXESUF)
:
$(FF_DEP_LIBS)
...
...
tools/Makefile
View file @
1a30bf60
TOOLS
=
qt-faststart trasher uncoded_frame
TOOLS-$(CONFIG_LIBMYSOFA)
+=
sofa2wavs
TOOLS-$(CONFIG_ZLIB)
+=
cws2fws
tools/target_dec_%_fuzzer.o
:
tools/target_dec_fuzzer.c
...
...
tools/sofa2wavs.c
0 → 100644
View file @
1a30bf60
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <mysofa.h>
int
main
(
int
argc
,
char
**
argv
)
{
struct
MYSOFA_HRTF
*
hrtf
;
int
sample_rate
;
int
err
,
i
,
j
;
if
(
argc
<
3
)
{
printf
(
"usage: %s input_SOFA_file output_directory
\n
"
,
argv
[
0
]);
return
1
;
}
hrtf
=
mysofa_load
(
argv
[
1
],
&
err
);
if
(
!
hrtf
||
err
)
{
printf
(
"invalid input SOFA file: %s
\n
"
,
argv
[
1
]);
return
1
;
}
if
(
hrtf
->
DataSamplingRate
.
elements
!=
1
)
goto
fail
;
sample_rate
=
hrtf
->
DataSamplingRate
.
values
[
0
];
err
=
mkdir
(
argv
[
2
],
0744
);
if
(
err
)
goto
fail
;
err
=
chdir
(
argv
[
2
]);
if
(
err
)
goto
fail
;
for
(
i
=
0
;
i
<
hrtf
->
M
;
i
++
)
{
FILE
*
file
;
int
bps
=
32
;
int
blkalign
=
8
;
int
bytespersec
=
blkalign
*
sample_rate
;
char
filename
[
1024
];
int
azi
=
hrtf
->
SourcePosition
.
values
[
i
*
3
];
int
ele
=
hrtf
->
SourcePosition
.
values
[
i
*
3
+
1
];
int
dis
=
hrtf
->
SourcePosition
.
values
[
i
*
3
+
2
];
int
size
=
8
*
hrtf
->
N
;
int
offset
=
i
*
2
*
hrtf
->
N
;
snprintf
(
filename
,
sizeof
(
filename
),
"azi_%d_ele_%d_dis_%d.wav"
,
azi
,
ele
,
dis
);
file
=
fopen
(
filename
,
"w+"
);
fwrite
(
"RIFF"
,
4
,
1
,
file
);
fwrite
(
"
\xFF\xFF\xFF\xFF
"
,
4
,
1
,
file
);
fwrite
(
"WAVE"
,
4
,
1
,
file
);
fwrite
(
"fmt "
,
4
,
1
,
file
);
fwrite
(
"
\x10\x00\00\00
"
,
4
,
1
,
file
);
fwrite
(
"
\x03\x00
"
,
2
,
1
,
file
);
fwrite
(
"
\x02\x00
"
,
2
,
1
,
file
);
fwrite
(
&
sample_rate
,
4
,
1
,
file
);
fwrite
(
&
bytespersec
,
4
,
1
,
file
);
fwrite
(
&
blkalign
,
2
,
1
,
file
);
fwrite
(
&
bps
,
2
,
1
,
file
);
fwrite
(
"data"
,
4
,
1
,
file
);
fwrite
(
&
size
,
4
,
1
,
file
);
for
(
j
=
0
;
j
<
hrtf
->
N
;
j
++
)
{
float
l
,
r
;
l
=
hrtf
->
DataIR
.
values
[
offset
+
j
];
r
=
hrtf
->
DataIR
.
values
[
offset
+
j
+
hrtf
->
N
];
fwrite
(
&
l
,
4
,
1
,
file
);
fwrite
(
&
r
,
4
,
1
,
file
);
}
fclose
(
file
);
}
fail:
mysofa_free
(
hrtf
);
return
0
;
}
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