diff mbox

[FFmpeg-devel] libopus: decode ambisonics with non-diegetic sources

Message ID CAJ0LFHXwYojeiS+r6w5nDgO_u0y4q3Lo73TLmF+1ai3-sCRJ3A@mail.gmail.com
State Accepted
Headers show

Commit Message

Felicia Lim Feb. 10, 2017, 6:42 p.m. UTC
Hi all,

The attached patch allows libavcodec/opus to decode ambisonics with
non-diegetic stereo stream in an ogg/opus container, as is being added in
this IETF standards draft [1].

Please let me know if there are any concerns.

Thanks,
Felicia

[1] https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1

Comments

Felicia Lim Feb. 16, 2017, 7:28 p.m. UTC | #1
Hi all,

Just wanted to follow up this patch which allows decoding opus ambisonics
with an additional stereo stream at the end. Please let me know if there
are any changes I should make to it?

Thanks,
Felicia

On Fri, Feb 10, 2017 at 10:42 AM Felicia Lim <flim@google.com> wrote:

> Hi all,
>
> The attached patch allows libavcodec/opus to decode ambisonics with
> non-diegetic stereo stream in an ogg/opus container, as is being added in
> this IETF standards draft [1].
>
> Please let me know if there are any concerns.
>
> Thanks,
> Felicia
>
> [1] https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1
>
>
Michael Niedermayer Feb. 17, 2017, 10:16 a.m. UTC | #2
On Fri, Feb 10, 2017 at 06:42:55PM +0000, Felicia Lim wrote:
> Hi all,
> 
> The attached patch allows libavcodec/opus to decode ambisonics with
> non-diegetic stereo stream in an ogg/opus container, as is being added in
> this IETF standards draft [1].
> 
> Please let me know if there are any concerns.
> 
> Thanks,
> Felicia
> 
> [1] https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1

>  opus.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 118751c3eaf7bf909eda8abe6aa9737fd36286b7  0001-libopus-decode-ambisonics-with-non-diegetic-sources.patch
> From 0798655323605d44d4f75e48fbfc940be0ba7423 Mon Sep 17 00:00:00 2001
> From: Felicia <flim@google.com>
> Date: Mon, 6 Feb 2017 15:49:36 -0800
> Subject: [PATCH] libopus: decode ambisonics with non-diegetic sources
> 
> Channel mapping 2 additionally supports a non-diegetic stereo track
> appended to the end of a full-order ambisonics signal, such that the
> total channel count is either
>   (n + 1) ^ 2, or
>   (n + 1) ^ 2 + 2
> where n is the ambisonics order

applied

thx

[...]
diff mbox

Patch

From 0798655323605d44d4f75e48fbfc940be0ba7423 Mon Sep 17 00:00:00 2001
From: Felicia <flim@google.com>
Date: Mon, 6 Feb 2017 15:49:36 -0800
Subject: [PATCH] libopus: decode ambisonics with non-diegetic sources

Channel mapping 2 additionally supports a non-diegetic stereo track
appended to the end of a full-order ambisonics signal, such that the
total channel count is either
  (n + 1) ^ 2, or
  (n + 1) ^ 2 + 2
where n is the ambisonics order
---
 libavcodec/opus.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 1eeb92c5bd..07e70fd7a4 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -373,10 +373,12 @@  av_cold int ff_opus_parse_extradata(AVCodecContext *avctx,
             channel_reorder = channel_reorder_vorbis;
         } else if (map_type == 2) {
             int ambisonic_order = ff_sqrt(channels) - 1;
-            if (channels != (ambisonic_order + 1) * (ambisonic_order + 1)) {
+            if (channels != ((ambisonic_order + 1) * (ambisonic_order + 1)) &&
+                channels != ((ambisonic_order + 1) * (ambisonic_order + 1) + 2)) {
                 av_log(avctx, AV_LOG_ERROR,
                        "Channel mapping 2 is only specified for channel counts"
-                       " which can be written as (n + 1)^2 for nonnegative integer n\n");
+                       " which can be written as (n + 1)^2 or (n + 1)^2 + 2"
+                       " for nonnegative integer n\n");
                 return AVERROR_INVALIDDATA;
             }
             layout = 0;
-- 
2.11.0.483.g087da7b7c-goog