Re: [FFmpeg-devel] [PATCH] libopus: Add channel mapping 2 support in libopusdec

2017-10-24 Thread Michael Niedermayer
On Tue, Mar 28, 2017 at 12:35:29AM +, Felicia Lim wrote:
> Hi all,
> 
> Here is another patch to decode Opus ambisonics files using channel mapping
> 2 [1], this time in libopusdec.c.
> 
> Please let me know if there are any concerns.
> 
> Thanks,
> Felicia
> 
> [1] 
> *https://trac.tools.ietf.org/html/draft-ietf-codec-ambisonics-02#section-3.1
> *

>  libopusdec.c |   39 +--
>  1 file changed, 29 insertions(+), 10 deletions(-)
> b84e04c55997e5edfceff91fa7e57f85dd0f1141  
> 0001-libopus-Add-channel-mapping-2-support-in-libopusdec.patch
> From 6607c6f8cff64771cdf34faa6e318271f5a48ac2 Mon Sep 17 00:00:00 2001
> From: Felicia Lim 
> Date: Mon, 27 Mar 2017 16:21:20 -0700
> Subject: [PATCH] libopus: Add channel mapping 2 support in libopusdec
> 
> Enables demuxing of Ambisonics content coded with channel mapping 2
> ---
>  libavcodec/libopusdec.c | 39 +--
>  1 file changed, 29 insertions(+), 10 deletions(-)

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libopus: Add channel mapping 2 support in libopusdec

2017-10-23 Thread Dale Curtis
Any update on this patch? We've been carrying it in Chrome for a while.

- dale

On Fri, Apr 7, 2017 at 11:14 AM, Felicia Lim 
wrote:

> Hi,
>
> Just wanted to follow up and check if there any changes I should add to
> this patch?
>
> Thanks for taking a look.
>
> Felicia
>
> On Mon, Mar 27, 2017 at 5:35 PM Felicia Lim  wrote:
>
> > Hi all,
> >
> > Here is another patch to decode Opus ambisonics files using channel
> > mapping 2 [1], this time in libopusdec.c.
> >
> > Please let me know if there are any concerns.
> >
> > Thanks,
> > Felicia
> >
> > [1] *https://trac.tools.ietf.org/html/draft-ietf-codec-
> ambisonics-02#section-3.1
> >  ambisonics-02#section-3.1>*
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libopus: Add channel mapping 2 support in libopusdec

2017-04-07 Thread Felicia Lim
Hi,

Just wanted to follow up and check if there any changes I should add to
this patch?

Thanks for taking a look.

Felicia

On Mon, Mar 27, 2017 at 5:35 PM Felicia Lim  wrote:

> Hi all,
>
> Here is another patch to decode Opus ambisonics files using channel
> mapping 2 [1], this time in libopusdec.c.
>
> Please let me know if there are any concerns.
>
> Thanks,
> Felicia
>
> [1] 
> *https://trac.tools.ietf.org/html/draft-ietf-codec-ambisonics-02#section-3.1
> *
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libopus: Add channel mapping 2 support in libopusdec

2017-03-27 Thread Felicia Lim
Hi all,

Here is another patch to decode Opus ambisonics files using channel mapping
2 [1], this time in libopusdec.c.

Please let me know if there are any concerns.

Thanks,
Felicia

[1] *https://trac.tools.ietf.org/html/draft-ietf-codec-ambisonics-02#section-3.1
*
From 6607c6f8cff64771cdf34faa6e318271f5a48ac2 Mon Sep 17 00:00:00 2001
From: Felicia Lim 
Date: Mon, 27 Mar 2017 16:21:20 -0700
Subject: [PATCH] libopus: Add channel mapping 2 support in libopusdec

Enables demuxing of Ambisonics content coded with channel mapping 2
---
 libavcodec/libopusdec.c | 39 +--
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index e6ca61a78f..9dab0fdf65 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -57,8 +57,6 @@ 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);
@@ -82,14 +80,35 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
 mapping= mapping_arr;
 }
 
-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;
+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;
 }
 
 opus->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,
-- 
2.12.2.564.g063fe858b8-goog

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel