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
ffec9d32
Commit
ffec9d32
authored
Nov 28, 2018
by
Rostislav Pehlivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "libopus: Add channel mapping 2 support in libopusdec"
This reverts commit
c8c995bc
.
parent
cf283f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
29 deletions
+10
-29
libopusdec.c
libavcodec/libopusdec.c
+10
-29
No files found.
libavcodec/libopusdec.c
View file @
ffec9d32
...
...
@@ -63,6 +63,8 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
avc
->
sample_rate
=
48000
;
avc
->
sample_fmt
=
avc
->
request_sample_fmt
==
AV_SAMPLE_FMT_FLT
?
AV_SAMPLE_FMT_FLT
:
AV_SAMPLE_FMT_S16
;
avc
->
channel_layout
=
avc
->
channels
>
8
?
0
:
ff_vorbis_channel_layouts
[
avc
->
channels
-
1
];
if
(
avc
->
extradata_size
>=
OPUS_HEAD_SIZE
)
{
opus
->
pre_skip
=
AV_RL16
(
avc
->
extradata
+
10
);
...
...
@@ -86,35 +88,14 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
mapping
=
mapping_arr
;
}
if
(
channel_map
==
1
)
{
avc
->
channel_layout
=
avc
->
channels
>
8
?
0
:
ff_vorbis_channel_layouts
[
avc
->
channels
-
1
];
if
(
avc
->
channels
>
2
&&
avc
->
channels
<=
8
)
{
const
uint8_t
*
vorbis_offset
=
ff_vorbis_channel_layout_offsets
[
avc
->
channels
-
1
];
int
ch
;
/* Remap channels from Vorbis order to ffmpeg order */
for
(
ch
=
0
;
ch
<
avc
->
channels
;
ch
++
)
mapping_arr
[
ch
]
=
mapping
[
vorbis_offset
[
ch
]];
mapping
=
mapping_arr
;
}
}
else
if
(
channel_map
==
2
)
{
int
ambisonic_order
=
ff_sqrt
(
avc
->
channels
)
-
1
;
if
(
avc
->
channels
!=
(
ambisonic_order
+
1
)
*
(
ambisonic_order
+
1
)
&&
avc
->
channels
!=
(
ambisonic_order
+
1
)
*
(
ambisonic_order
+
1
)
+
2
)
{
av_log
(
avc
,
AV_LOG_ERROR
,
"Channel mapping 2 is only specified for channel counts"
" which can be written as (n + 1)^2 or (n + 2)^2 + 2"
" for nonnegative integer n
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
(
avc
->
channels
>
227
)
{
av_log
(
avc
,
AV_LOG_ERROR
,
"Too many channels
\n
"
);
return
AVERROR_INVALIDDATA
;
}
avc
->
channel_layout
=
0
;
}
else
{
avc
->
channel_layout
=
0
;
if
(
avc
->
channels
>
2
&&
avc
->
channels
<=
8
)
{
const
uint8_t
*
vorbis_offset
=
ff_vorbis_channel_layout_offsets
[
avc
->
channels
-
1
];
int
ch
;
/* Remap channels from Vorbis order to ffmpeg order */
for
(
ch
=
0
;
ch
<
avc
->
channels
;
ch
++
)
mapping_arr
[
ch
]
=
mapping
[
vorbis_offset
[
ch
]];
mapping
=
mapping_arr
;
}
opus
->
dec
=
opus_multistream_decoder_create
(
avc
->
sample_rate
,
avc
->
channels
,
...
...
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