[FFmpeg-cvslog] Merge commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286'
James Almer
git at videolan.org
Mon Oct 30 21:47:02 EET 2017
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Oct 30 16:40:11 2017 -0300| [8b63acaeee246a9f8c72a2dc4c2074016ed91ffb] | committer: James Almer
Merge commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286'
* commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286':
mlp: Rename the channel layout variable
Merged-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b63acaeee246a9f8c72a2dc4c2074016ed91ffb
---
libavcodec/mlpdec.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index d5585d3080..0a6b0feb97 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -66,7 +66,7 @@ typedef struct SubStream {
/// For each channel output by the matrix, the output channel to map it to
uint8_t ch_assign[MAX_CHANNELS];
/// The channel layout for this substream
- uint64_t ch_layout;
+ uint64_t mask;
/// The matrix encoding mode for this substream
enum AVMatrixEncoding matrix_encoding;
@@ -390,8 +390,8 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
return AVERROR_PATCHWELCOME;
}
if ((substr = (mh.num_substreams > 1)))
- m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
- m->substream[substr].ch_layout = mh.channel_layout_mlp;
+ m->substream[0].mask = AV_CH_LAYOUT_STEREO;
+ m->substream[substr].mask = mh.channel_layout_mlp;
} else {
if (mh.stream_type != 0xba) {
avpriv_request_sample(m->avctx,
@@ -400,15 +400,15 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
return AVERROR_PATCHWELCOME;
}
if ((substr = (mh.num_substreams > 1)))
- m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+ m->substream[0].mask = AV_CH_LAYOUT_STEREO;
if (mh.num_substreams > 2)
if (mh.channel_layout_thd_stream2)
- m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
+ m->substream[2].mask = mh.channel_layout_thd_stream2;
else
- m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
- m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
+ m->substream[2].mask = mh.channel_layout_thd_stream1;
+ m->substream[substr].mask = mh.channel_layout_thd_stream1;
- if (m->avctx->channels<=2 && m->substream[substr].ch_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
+ if (m->avctx->channels<=2 && m->substream[substr].mask == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, ignoring 2nd\n");
m->max_decoded_substream = 0;
if (m->avctx->channels==2)
@@ -533,12 +533,12 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->max_channel = max_channel;
s->max_matrix_channel = max_matrix_channel;
- if (m->avctx->request_channel_layout && (s->ch_layout & m->avctx->request_channel_layout) ==
+ if (m->avctx->request_channel_layout && (s->mask & m->avctx->request_channel_layout) ==
m->avctx->request_channel_layout && m->max_decoded_substream > substr) {
av_log(m->avctx, AV_LOG_DEBUG,
"Extracting %d-channel downmix (0x%"PRIx64") from substream %d. "
"Further substreams will be skipped.\n",
- s->max_channel + 1, s->ch_layout, substr);
+ s->max_channel + 1, s->mask, substr);
m->max_decoded_substream = substr;
}
@@ -565,9 +565,9 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
for (ch = 0; ch <= s->max_matrix_channel; ch++) {
int ch_assign = get_bits(gbp, 6);
if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) {
- uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout,
+ uint64_t channel = thd_channel_layout_extract_channel(s->mask,
ch_assign);
- ch_assign = av_get_channel_layout_channel_index(s->ch_layout,
+ ch_assign = av_get_channel_layout_channel_index(s->mask,
channel);
}
if (ch_assign < 0 || ch_assign > s->max_matrix_channel) {
@@ -609,7 +609,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
if (substr == m->max_decoded_substream) {
m->avctx->channels = s->max_matrix_channel + 1;
- m->avctx->channel_layout = s->ch_layout;
+ m->avctx->channel_layout = s->mask;
m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign,
s->output_shift,
s->max_matrix_channel,
======================================================================
diff --cc libavcodec/mlpdec.c
index d5585d3080,9ce32c832e..0a6b0feb97
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@@ -383,41 -382,20 +383,41 @@@ static int read_major_sync(MLPDecodeCon
* substream is Stereo. Subsequent substreams' layouts are indicated in the
* major sync. */
if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
+ if (mh.stream_type != 0xbb) {
+ avpriv_request_sample(m->avctx,
+ "unexpected stream_type %X in MLP",
+ mh.stream_type);
+ return AVERROR_PATCHWELCOME;
+ }
if ((substr = (mh.num_substreams > 1)))
- m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
- m->substream[substr].ch_layout = mh.channel_layout_mlp;
+ m->substream[0].mask = AV_CH_LAYOUT_STEREO;
+ m->substream[substr].mask = mh.channel_layout_mlp;
} else {
+ if (mh.stream_type != 0xba) {
+ avpriv_request_sample(m->avctx,
+ "unexpected stream_type %X in !MLP",
+ mh.stream_type);
+ return AVERROR_PATCHWELCOME;
+ }
if ((substr = (mh.num_substreams > 1)))
- m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+ m->substream[0].mask = AV_CH_LAYOUT_STEREO;
if (mh.num_substreams > 2)
if (mh.channel_layout_thd_stream2)
- m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
+ m->substream[2].mask = mh.channel_layout_thd_stream2;
else
- m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
- m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
+ m->substream[2].mask = mh.channel_layout_thd_stream1;
+ m->substream[substr].mask = mh.channel_layout_thd_stream1;
+
- if (m->avctx->channels<=2 && m->substream[substr].ch_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
++ if (m->avctx->channels<=2 && m->substream[substr].mask == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
+ av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, ignoring 2nd\n");
+ m->max_decoded_substream = 0;
+ if (m->avctx->channels==2)
+ m->avctx->channel_layout = AV_CH_LAYOUT_STEREO;
+ }
}
+ m->needs_reordering = mh.channel_arrangement >= 18 && mh.channel_arrangement <= 20;
+
/* Parse the TrueHD decoder channel modifiers and set each substream's
* AVMatrixEncoding accordingly.
*
@@@ -563,11 -541,11 +563,11 @@@ static int read_restart_header(MLPDecod
memset(s->ch_assign, 0, sizeof(s->ch_assign));
for (ch = 0; ch <= s->max_matrix_channel; ch++) {
- int ch_assign = bitstream_read(bc, 6);
+ int ch_assign = get_bits(gbp, 6);
if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) {
- uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout,
+ uint64_t channel = thd_channel_layout_extract_channel(s->mask,
ch_assign);
- ch_assign = av_get_channel_layout_channel_index(s->ch_layout,
+ ch_assign = av_get_channel_layout_channel_index(s->mask,
channel);
}
if (ch_assign < 0 || ch_assign > s->max_matrix_channel) {
More information about the ffmpeg-cvslog
mailing list