Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
fc9a3b58
Commit
fc9a3b58
authored
Jan 30, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mlpdec: parse and use substream info bits
parent
00994e8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
mlp_parse.c
libavcodec/mlp_parse.c
+5
-1
mlp_parse.h
libavcodec/mlp_parse.h
+3
-0
mlpdec.c
libavcodec/mlpdec.c
+14
-1
No files found.
libavcodec/mlp_parse.c
View file @
fc9a3b58
...
...
@@ -159,7 +159,11 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
mh
->
num_substreams
=
get_bits
(
gb
,
4
);
skip_bits_long
(
gb
,
4
+
(
header_size
-
17
)
*
8
);
skip_bits
(
gb
,
2
);
mh
->
extended_substream_info
=
get_bits
(
gb
,
2
);
mh
->
substream_info
=
get_bits
(
gb
,
8
);
skip_bits_long
(
gb
,
(
header_size
-
18
)
*
8
);
return
0
;
}
libavcodec/mlp_parse.h
View file @
fc9a3b58
...
...
@@ -58,6 +58,9 @@ typedef struct MLPHeaderInfo
int
peak_bitrate
;
///< Peak bitrate for VBR, actual bitrate (==peak) for CBR
int
num_substreams
;
///< Number of substreams within stream
int
extended_substream_info
;
///< Which substream of substreams carry 16-channel presentation
int
substream_info
;
///< Which substream of substreams carry 2/6/8-channel presentation
}
MLPHeaderInfo
;
static
const
uint8_t
thd_chancount
[
13
]
=
{
...
...
libavcodec/mlpdec.c
View file @
fc9a3b58
...
...
@@ -153,6 +153,12 @@ typedef struct MLPDecodeContext {
/// Number of substreams contained within this stream.
uint8_t
num_substreams
;
/// Which substream of substreams carry 16-channel presentation
uint8_t
extended_substream_info
;
/// Which substream of substreams carry 2/6/8-channel presentation
uint8_t
substream_info
;
/// Index of the last substream to decode - further substreams are skipped.
uint8_t
max_decoded_substream
;
...
...
@@ -384,6 +390,7 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m
->
access_unit_size_pow2
=
mh
.
access_unit_size_pow2
;
m
->
num_substreams
=
mh
.
num_substreams
;
m
->
substream_info
=
mh
.
substream_info
;
/* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
m
->
max_decoded_substream
=
FFMIN
(
m
->
num_substreams
-
1
,
2
);
...
...
@@ -1286,7 +1293,13 @@ static int read_access_unit(AVCodecContext *avctx, AVFrame *frame,
if
(
!
s
->
restart_seen
)
goto
next_substr
;
if
(
substr
>
0
&&
substr
<
m
->
max_decoded_substream
&&
if
(((
avctx
->
ch_layout
.
nb_channels
==
6
&&
((
m
->
substream_info
>>
2
)
&
0x3
)
!=
0x3
)
||
(
avctx
->
ch_layout
.
nb_channels
==
8
&&
((
m
->
substream_info
>>
4
)
&
0x7
)
!=
0x7
&&
((
m
->
substream_info
>>
4
)
&
0x7
)
!=
0x6
&&
((
m
->
substream_info
>>
4
)
&
0x7
)
!=
0x3
))
&&
substr
>
0
&&
substr
<
m
->
max_decoded_substream
&&
(
s
->
min_channel
<=
m
->
substream
[
substr
-
1
].
max_channel
))
{
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Previous substream(%d) channels overlaps current substream(%d) channels, skipping.
\n
"
,
...
...
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