Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 14/11/2017 à 11:14 PM, Carl Eugen Hoyos a écrit : 2017-11-14 21:01 GMT+01:00 pkv.stream: Le 14/11/2017 à 1:20 AM, Carl Eugen Hoyos a écrit : 2017-11-09 9:01 GMT+01:00 pkv.stream : 1) there are changes to make to the list of channel layouts not requiring PCE ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous is 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) see patch in attachment (can't be applied directly due to rebasing issues from your initial patch) Did you test what effect this patch has on ffmpeg (the command line interface) when encoding five- or six-channel aac from back and side source? yes I did check, this patch reverts aac encoder to previous behaviour with 5.0 and 5.1 (when there was no PCE) more accurately: 5.0 5.1 back is reverted to previous behaviour , but 5.0 5.1 side is not because it uses now PCE, which agrees with spec (no weird channel rematrixing though); sorry for the inaccuracy. Thank you for the explanation! Carl Eugen ___ 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] aacenc: WIP support for PCEs
2017-11-14 21:01 GMT+01:00 pkv.stream: > Le 14/11/2017 à 1:20 AM, Carl Eugen Hoyos a écrit : >> >> 2017-11-09 9:01 GMT+01:00 pkv.stream : >> >>> 1) there are changes to make to the list of channel layouts not requiring >>> PCE >>> >>> ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK >>> since the previous is >>> 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 >>> ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) >>> >>> see patch in attachment (can't be applied directly due to rebasing issues >>> from your initial patch) >> >> Did you test what effect this patch has on ffmpeg (the command line >> interface) >> when encoding five- or six-channel aac from back and side source? > > yes I did check, this patch reverts aac encoder to previous behaviour with > 5.0 and 5.1 (when there was no PCE) Thank you for the explanation! Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 14/11/2017 à 1:20 AM, Carl Eugen Hoyos a écrit : 2017-11-09 9:01 GMT+01:00 pkv.stream: 1) there are changes to make to the list of channel layouts not requiring PCE ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous is 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) see patch in attachment (can't be applied directly due to rebasing issues from your initial patch) Did you test what effect this patch has on ffmpeg (the command line interface) when encoding five- or six-channel aac from back and side source? yes I did check, this patch reverts aac encoder to previous behaviour with 5.0 and 5.1 (when there was no PCE) If something weird happens (like resampling), a Changelog entry may be a good idea. Thank you, Carl Eugen ___ 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] aacenc: WIP support for PCEs
2017-11-09 9:01 GMT+01:00 pkv.stream: > 1) there are changes to make to the list of channel layouts not requiring > PCE > > ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous is > 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 > ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) > > see patch in attachment (can't be applied directly due to rebasing issues > from your initial patch) Did you test what effect this patch has on ffmpeg (the command line interface) when encoding five- or six-channel aac from back and side source? If something weird happens (like resampling), a Changelog entry may be a good idea. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
> Hi atomnuker, > > that's wonderful; > > there are two things also: > > 1) there are changes to make to the list of channel layouts not requiring > PCE > > ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous > is 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 > ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) > > see patch in attachment (can't be applied directly due to rebasing issues > from your initial patch) > > Checked the spec, you're right, fixed. Great, you're right also about side being better than back in the commit message. > 2) for everything to work I had to also apply the patch from here: > > http://ffmpeg.org/pipermail/ffmpeg-devel/2017-October/217357.html > > If you ffmpeg -loglevel debug , you will see that on non-default channel > layouts, there is an auto insertion of a resampler filter : the > channel_layout option is not passed correctly in the chain. > > for instance: ffmpeg -channel_layout octagonal -i input.wav -c:a aac > -channel_layout octagonal out.mkv will matrix the input from octagonal to > 7.1 before the encoding. > > Check ticket 6706 for details of the issue. > > I am not knowledgeable enough to be sure my fix is correct; it's working > for sure, but I've had very few feedback (only Michael and Moritz about > styling issues). > Pining Michael to take a look at it. Discussing this with Michael. My patch fails when there is down or upmixing. I think there are at least two bugs hiding one behind another within the filter chain. It's a pity because this cripples your PCE implementation to ffmpeg default channel layouts only (2.1 4.0 5.0 5.1 6.1 7.1 hexadecagonal), where 4.0 5.0 5.1 7.1 do not require PCE anyway. I'll try to find a solution but senior dev help might be needed because this is quite convoluted. Best ___ 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] aacenc: WIP support for PCEs
On 9 November 2017 at 08:01, pkv.streamwrote: > Le 09/11/2017 à 4:43 AM, Rostislav Pehlivanov a écrit : > >> On 18 October 2017 at 11:05, pkv.stream wrote: >> >> Le 02/10/2017 à 8:39 PM, Rostislav Pehlivanov a écrit : >>> >>> On 2 October 2017 at 18:43, pkv.stream wrote: Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : > On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: > >> Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : >> >>> 2017-10-02 0:40 GMT+02:00 pkv.stream : >>> Hi atomnuker, > got your PCE working; > > the patch you attached contains tabs, they cannot be committed > to the FFmpeg repository, please remove them. (Or one tab.) thanks for pointing out. >>> Removed the offending tab. >>> >>> Thank you, Carl Eugen >>> >>> ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel aacenc.h | 239 ++ >>> +++-- >>> 1 file changed, 233 insertions(+), 6 deletions(-) >>> 929275fe34af4d0048bac2be928957288cb75ddd >>> 0001-avcodec-aacenc-PCE-for-al >>> l-ffmpeg-usual-layouts.patch >>>From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 >>> 2001 >>> From: pkviet >>> Date: Sun, 24 Sep 2017 16:11:17 +0200 >>> Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts >>> >>> this seems not to apply cleanly here, did i miss something ? >>> >> Hi Michael >> > this needs to be applied after the initial patch by atomnuker which he > did > not apply since this required work. > What i submitted was not aimed at being pushed since there is probably > still work to do. > Depending on what he wants to do with his patch, I'll resubmit a > working > patch later, properly rebased. > Sorry about the mess. > regards > > > Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts > >> error: sha1 information is lacking or useless (libavcodec/aacenc.h). >> error: could not build fake ancestor >> Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts >> The copy of the patch that failed is found in: .git/rebase-apply/patch >> >> >> [...] >> >> >> >> ___ >> 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 > > > Give me a few hours and I'll test it and submit a v2 of my patch with your improvements. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi >>> >>> any updates ? >>> >>> regards >>> >>> >>> ___ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> >> Hi, >> Very sorry it took me this long but I finally got motivated and got around >> to checking your patch >> >> I have to say I'm impressed, everything works perfectly, decodes fine and >> the mappings were all fine. This is a big feature which many people have >> requested and complained the encoder lacks support for. >> >> I've done some minor changes to the code on the encoder side (an INFO >> print >> instead of a warning), to the comments (just alignment) and for the >> ambisonic layouts (made them use the defines) and I've pushed it. >> >> Thanks a lot >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > Hi atomnuker, > > that's wonderful; > > there are two things also: > > 1) there are changes to make to the list of channel layouts not requiring > PCE > > ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous > is 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 > ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) > > see patch in attachment (can't be applied directly due to rebasing issues > from your initial patch) > > Checked the spec, you're right, fixed. > 2) for everything to work I had to also apply the patch from here: > > http://ffmpeg.org/pipermail/ffmpeg-devel/2017-October/217357.html > > If you ffmpeg -loglevel debug , you will see that on non-default channel >
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 09/11/2017 à 4:43 AM, Rostislav Pehlivanov a écrit : On 18 October 2017 at 11:05, pkv.streamwrote: Le 02/10/2017 à 8:39 PM, Rostislav Pehlivanov a écrit : On 2 October 2017 at 18:43, pkv.stream wrote: Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : 2017-10-02 0:40 GMT+02:00 pkv.stream : Hi atomnuker, got your PCE working; the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) thanks for pointing out. Removed the offending tab. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel aacenc.h | 239 ++ +++-- 1 file changed, 233 insertions(+), 6 deletions(-) 929275fe34af4d0048bac2be928957288cb75ddd 0001-avcodec-aacenc-PCE-for-al l-ffmpeg-usual-layouts.patch From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 From: pkviet Date: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts this seems not to apply cleanly here, did i miss something ? Hi Michael this needs to be applied after the initial patch by atomnuker which he did not apply since this required work. What i submitted was not aimed at being pushed since there is probably still work to do. Depending on what he wants to do with his patch, I'll resubmit a working patch later, properly rebased. Sorry about the mess. regards Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts error: sha1 information is lacking or useless (libavcodec/aacenc.h). error: could not build fake ancestor Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts The copy of the patch that failed is found in: .git/rebase-apply/patch [...] ___ 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 Give me a few hours and I'll test it and submit a v2 of my patch with your improvements. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi any updates ? regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi, Very sorry it took me this long but I finally got motivated and got around to checking your patch I have to say I'm impressed, everything works perfectly, decodes fine and the mappings were all fine. This is a big feature which many people have requested and complained the encoder lacks support for. I've done some minor changes to the code on the encoder side (an INFO print instead of a warning), to the comments (just alignment) and for the ambisonic layouts (made them use the defines) and I've pushed it. Thanks a lot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi atomnuker, that's wonderful; there are two things also: 1) there are changes to make to the list of channel layouts not requiring PCE ==> AV_CH_LAYOUT_5POINT0 to AV_CH_LAYOUT_5POINT0_BACK since the previous is 5.0(side) while the latter is 5.0 which is what is in spec (table 1.19 ISO/IEC 14496-3:200X(E) or table 42 ISO/IEC 13818-7:2004(E) ) see patch in attachment (can't be applied directly due to rebasing issues from your initial patch) 2) for everything to work I had to also apply the patch from here: http://ffmpeg.org/pipermail/ffmpeg-devel/2017-October/217357.html If you ffmpeg -loglevel debug , you will see that on non-default channel layouts, there is an auto insertion of a resampler filter : the channel_layout option is not passed correctly in the chain. for instance: ffmpeg -channel_layout octagonal -i input.wav -c:a aac -channel_layout octagonal out.mkv will matrix the input from octagonal to 7.1 before the encoding. Check ticket 6706 for details of the issue. I am not knowledgeable enough to be sure my fix is correct; it's working for sure, but I've had very few feedback (only Michael and Moritz about styling issues). Maybe you could have a look. Regards pkv From 847334071ff13a00d54b9f55ccf29c7553ab83f1 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 6 Nov 2017 10:03:47 +0100 Subject: [PATCH] avcodec/aacenc: fix default channels Fix default channels not requiring PCE. Replaces 5.0 and 5.1 definitions; 7.1 should be AV_CH_LAYOUT_7POINT1_WIDE_BACK
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
On 18 October 2017 at 11:05, pkv.streamwrote: > Le 02/10/2017 à 8:39 PM, Rostislav Pehlivanov a écrit : > >> On 2 October 2017 at 18:43, pkv.stream wrote: >> >> Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : >>> >>> On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : > > 2017-10-02 0:40 GMT+02:00 pkv.stream : >> >> Hi atomnuker, >>> >>> got your PCE working; >>> >>> the patch you attached contains tabs, they cannot be committed >> to the FFmpeg repository, please remove them. >> (Or one tab.) >> >> thanks for pointing out. > Removed the offending tab. > > Thank you, Carl Eugen > >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >>aacenc.h | 239 ++ > +++-- >1 file changed, 233 insertions(+), 6 deletions(-) > 929275fe34af4d0048bac2be928957288cb75ddd > 0001-avcodec-aacenc-PCE-for-al > l-ffmpeg-usual-layouts.patch > From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 > 2001 > From: pkviet > Date: Sun, 24 Sep 2017 16:11:17 +0200 > Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts > > this seems not to apply cleanly here, did i miss something ? Hi Michael >>> this needs to be applied after the initial patch by atomnuker which he >>> did >>> not apply since this required work. >>> What i submitted was not aimed at being pushed since there is probably >>> still work to do. >>> Depending on what he wants to do with his patch, I'll resubmit a working >>> patch later, properly rebased. >>> Sorry about the mess. >>> regards >>> >>> >>> Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts error: sha1 information is lacking or useless (libavcodec/aacenc.h). error: could not build fake ancestor Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts The copy of the patch that failed is found in: .git/rebase-apply/patch [...] ___ 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 >>> >>> >> Give me a few hours and I'll test it and submit a v2 of my patch with your >> improvements. >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > Hi > > any updates ? > > regards > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > Hi, Very sorry it took me this long but I finally got motivated and got around to checking your patch I have to say I'm impressed, everything works perfectly, decodes fine and the mappings were all fine. This is a big feature which many people have requested and complained the encoder lacks support for. I've done some minor changes to the code on the encoder side (an INFO print instead of a warning), to the comments (just alignment) and for the ambisonic layouts (made them use the defines) and I've pushed it. Thanks a lot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 02/10/2017 à 8:39 PM, Rostislav Pehlivanov a écrit : On 2 October 2017 at 18:43, pkv.streamwrote: Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : 2017-10-02 0:40 GMT+02:00 pkv.stream : Hi atomnuker, got your PCE working; the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) thanks for pointing out. Removed the offending tab. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel aacenc.h | 239 ++ +++-- 1 file changed, 233 insertions(+), 6 deletions(-) 929275fe34af4d0048bac2be928957288cb75ddd 0001-avcodec-aacenc-PCE-for-al l-ffmpeg-usual-layouts.patch From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 From: pkviet Date: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts this seems not to apply cleanly here, did i miss something ? Hi Michael this needs to be applied after the initial patch by atomnuker which he did not apply since this required work. What i submitted was not aimed at being pushed since there is probably still work to do. Depending on what he wants to do with his patch, I'll resubmit a working patch later, properly rebased. Sorry about the mess. regards Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts error: sha1 information is lacking or useless (libavcodec/aacenc.h). error: could not build fake ancestor Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts The copy of the patch that failed is found in: .git/rebase-apply/patch [...] ___ 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 Give me a few hours and I'll test it and submit a v2 of my patch with your improvements. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi any updates ? regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
On 2 October 2017 at 18:43, pkv.streamwrote: > Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : > >> On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: >> >>> Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : >>> 2017-10-02 0:40 GMT+02:00 pkv.stream : > Hi atomnuker, > > got your PCE working; > the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) >>> thanks for pointing out. >>> Removed the offending tab. >>> >>> Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> aacenc.h | 239 ++ >>> +++-- >>> 1 file changed, 233 insertions(+), 6 deletions(-) >>> 929275fe34af4d0048bac2be928957288cb75ddd 0001-avcodec-aacenc-PCE-for-al >>> l-ffmpeg-usual-layouts.patch >>> From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 >>> From: pkviet >>> Date: Sun, 24 Sep 2017 16:11:17 +0200 >>> Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts >>> >> this seems not to apply cleanly here, did i miss something ? >> > > Hi Michael > this needs to be applied after the initial patch by atomnuker which he did > not apply since this required work. > What i submitted was not aimed at being pushed since there is probably > still work to do. > Depending on what he wants to do with his patch, I'll resubmit a working > patch later, properly rebased. > Sorry about the mess. > regards > > >> Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts >> error: sha1 information is lacking or useless (libavcodec/aacenc.h). >> error: could not build fake ancestor >> Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts >> The copy of the patch that failed is found in: .git/rebase-apply/patch >> >> >> [...] >> >> >> >> ___ >> 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 > Give me a few hours and I'll test it and submit a v2 of my patch with your improvements. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 02/10/2017 à 7:23 PM, Michael Niedermayer a écrit : On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : 2017-10-02 0:40 GMT+02:00 pkv.stream: Hi atomnuker, got your PCE working; the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) thanks for pointing out. Removed the offending tab. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel aacenc.h | 239 +-- 1 file changed, 233 insertions(+), 6 deletions(-) 929275fe34af4d0048bac2be928957288cb75ddd 0001-avcodec-aacenc-PCE-for-all-ffmpeg-usual-layouts.patch From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 From: pkviet Date: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts this seems not to apply cleanly here, did i miss something ? Hi Michael this needs to be applied after the initial patch by atomnuker which he did not apply since this required work. What i submitted was not aimed at being pushed since there is probably still work to do. Depending on what he wants to do with his patch, I'll resubmit a working patch later, properly rebased. Sorry about the mess. regards Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts error: sha1 information is lacking or useless (libavcodec/aacenc.h). error: could not build fake ancestor Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts The copy of the patch that failed is found in: .git/rebase-apply/patch [...] ___ 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] aacenc: WIP support for PCEs
On Mon, Oct 02, 2017 at 12:52:53AM +0200, pkv.stream wrote: > Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : > >2017-10-02 0:40 GMT+02:00 pkv.stream: > >>Hi atomnuker, > >> > >>got your PCE working; > >the patch you attached contains tabs, they cannot be committed > >to the FFmpeg repository, please remove them. > >(Or one tab.) > > thanks for pointing out. > Removed the offending tab. > > > > >Thank you, Carl Eugen > >___ > >ffmpeg-devel mailing list > >ffmpeg-devel@ffmpeg.org > >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > aacenc.h | 239 > +-- > 1 file changed, 233 insertions(+), 6 deletions(-) > 929275fe34af4d0048bac2be928957288cb75ddd > 0001-avcodec-aacenc-PCE-for-all-ffmpeg-usual-layouts.patch > From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 > From: pkviet > Date: Sun, 24 Sep 2017 16:11:17 +0200 > Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts this seems not to apply cleanly here, did i miss something ? Applying: avcodec/aacenc: PCE for all ffmpeg usual layouts error: sha1 information is lacking or useless (libavcodec/aacenc.h). error: could not build fake ancestor Patch failed at 0001 avcodec/aacenc: PCE for all ffmpeg usual layouts The copy of the patch that failed is found in: .git/rebase-apply/patch [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
forgot to say a few things: - only the order and the type of the element (sce, cpe or lfe) really matters for the encoding; the encoder does not use the front, side or back info; I have used that fact for instance for 7.1 and 7.1(wide) or 7.1(wide-side): same PCE config can be used and works perfectly fine . - while spec allows up to 16 elements for front, side, back, lfe groups , I found that the decoder can not deal with more than four per group; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 02/10/2017 à 12:43 AM, Carl Eugen Hoyos a écrit : 2017-10-02 0:40 GMT+02:00 pkv.stream: Hi atomnuker, got your PCE working; the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) thanks for pointing out. Removed the offending tab. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel From 647fb61708bc1279f9dc17c679052a778dce5fbb Mon Sep 17 00:00:00 2001 From: pkviet Date: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts PCE for all usual layouts listed in channel_layout_map (channel_layout.c) have been added. All encodes with PCE are decoded correctly by ffmpeg aac decoder (not checked with others). The correctness of the channel positions in the encodes have been checked by splitting the channels to independent audio tracks. Two non standard layouts have been added in the PCE for support of 9 and 10 channels, which are useful for ambisonics. For layouts with LFE, the LFE element has been replaced by a SCE because the encoder always puts the LFE as last channel, irrespective of config_map and reorder_map. This is not optimal but it enables these layouts. --- libavcodec/aacenc.h | 239 ++-- 1 file changed, 233 insertions(+), 6 deletions(-) diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 346d989..31afd04 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -99,6 +99,33 @@ typedef struct AACPCEInfo { uint8_t reorder_map[16]; ///< maps channels from lavc to aac order } AACPCEInfo; +/** + *List of PCE (Program Configuration Element) for the channel layouts listed in channel_layout.h + * + *For those wishing in the future to add other layouts: + * - num_ele: number of elements in each group of front, side, back, lfe channels; + * (an element is of type SCE (single channel) , CPE (channel pair) for the first 3 groups; + * and is LFE for LFE group). + * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group + * - index: there are three independent indices for SCE, CPE and LFE; + * they are incremented irrespective of the group to which the element belongs; + * they are not reset when going from one group to another + * + * Example: for 7.0 channel layout, + * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group) + * .index = { { 0, 0 }, { 1 }, { 2 }, }, index is 0 for the single SCE + * but goes from 0 to 2 for the CPEs . + * + * The index order impacts the channel ordering. But is otherwise arbitrary + * (the sequence could have been 2, 0, 1 instead of 0, 1, 2). + * Spec allows discontinuous indices, e.g. if one has a total of two SCE, SCE.0 SCE.15 is OK per spec; + * BUT it won't be decoded by ffmpeg aac decoder which at this time requires that indices fully cover some range starting from 0. + * (SCE.1 SCE.0 is OK but not SCE.0 SCE.15). + * + * - config_map: total number of elements and their types. Beware, the way the types are ordered impacts the final channel ordering. + * - reorder_map: reorders the channels. + * + */ static const AACPCEInfo aac_pce_configs[] = { { .layout = AV_CH_LAYOUT_MONO, @@ -117,20 +144,220 @@ static const AACPCEInfo aac_pce_configs[] = { .reorder_map = { 0, 1 }, }, { +.layout = AV_CH_LAYOUT_2POINT1, +.num_ele = { 1, 0, 0, 1 }, +.pairing = { { 1 }, }, +.index = { { 0 },{ 0 },{ 0 },{ 0 } }, +.config_map = { 2, TYPE_CPE, TYPE_LFE }, +.reorder_map = { 0, 1, 2 }, +}, +{ +.layout = AV_CH_LAYOUT_2_1, +.num_ele = { 1, 0, 1, 0 }, +.pairing = { { 1 },{ 0 },{ 0 } }, +.index = { { 0 },{ 0 },{ 0 }, }, +.config_map = { 2, TYPE_CPE, TYPE_SCE }, +.reorder_map = { 0, 1, 2 }, +}, +{ .layout = AV_CH_LAYOUT_SURROUND, .num_ele = { 2, 0, 0, 0 }, .pairing = { { 1, 0 }, }, -.index = { { 0, 1 }, }, -.config_map = { 2, TYPE_SCE, TYPE_CPE }, -.reorder_map = { 2, 0, 1 }, +.index = { { 0, 0 }, }, +.config_map = { 2, TYPE_CPE, TYPE_SCE, }, +.reorder_map = { 0, 1, 2 }, +}, +{ +.layout = AV_CH_LAYOUT_3POINT1, +.num_ele = { 2, 0, 0, 1 }, +.pairing = { { 1, 0 }, }, +.index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, }, +.config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE }, +.reorder_map = { 0, 1, 2, 3 }, }, { .layout = AV_CH_LAYOUT_4POINT0, .num_ele = { 2, 0, 1, 0 }, .pairing = { { 1, 0 }, { 0 }, { 0 }, }, -.index = { { 0, 1 }, { 0 }, { 0 } }, -.config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_SCE }, -.reorder_map = { 2, 0, 1, 3 }, +
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
2017-10-02 0:40 GMT+02:00 pkv.stream: > Hi atomnuker, > > got your PCE working; the patch you attached contains tabs, they cannot be committed to the FFmpeg repository, please remove them. (Or one tab.) Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Hi atomnuker, got your PCE working; my previous issues where index related and were the reasons ffmpeg aac decoder would issue errors. So found out: - index is not reset between groups of front, side, back; - it runs actually for each type (SCE, CPE, LFE) - for ffmpeg aac decoder to work, the list of index for a type must be continuous (and probably start with 0, although the order is arbitrary); ex: 0 1 2 or 2 0 1 are ok but not 0 4 I've corrected your PCE table accordingly. I've tested the correctness of the PCE encode for all the layouts listed in the attachment through the following systematic procedure: - pcm stream with required number of channels declared with -channel_layout identical to destination (to avoid any automatic channel matrixing) - the encoded file was decoded, channels split into mono streams in the order of the channels. This allowed me to check the channel orders are fine as well as the correctness of the aac encode itself. For channels layouts with LFE starting from 4.1, I have had issues with the order of the LFE channel. When encoding with PCE, the LFE channel is always positioned as the last one even if the PCE positions it elsewhere; the -config_map and -reorder_map options make no difference. So either these layouts with LFE should be removed from the table; or a workaround could be to replace the LFE by a SCE. This is not sub-optimal, in terms of bitrate. But maybe as a convenience to user this might be ok provisionally, until a real fix is found. I have no opinion on the matter, but have provided working PCEs for these layouts with LFE, in case. I have added two convenience layouts in the PCE table , with 9 and 10 channels. They might be of use for order 2 ambisonics or mixed ambisonics (of course this assumes the user has ordered his channels in a meaningful way for a third party software since ffmpeg does not provide ambisonics information yet). Also, during the research into this PCE, I uncovered a bug with -channel_layout option which initially is not passed correctly for non-default layouts; output filters detect the layout as the default one (for instance 4.0 instead of quad). This means there are auto-inserts of unneeded filters remapping the channels. For instance when encoding a quad pcm source to aac file with quad layout with PCE, an auto-insertion of aformat filter remaps quad source to 4.0. This completely blows up the aac PCE encode since channel matrixing occurs. I have a separate patch for that issue (see ticket 6706). regards From 507fa698974fe72d297e01c90396e602de0d42da Mon Sep 17 00:00:00 2001 From: pkvietDate: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: PCE for all ffmpeg usual layouts PCE for all usual layouts listed in channel_layout_map (channel_layout.c) have been added. All encodes with PCE are decoded correctly by ffmpeg aac decoder (not checked with others). The correctness of the channel positions in the encodes have been checked by splitting the channels to independent audio tracks. Two non standard layouts have been added in the PCE for support of 9 and 10 channels, which are useful for ambisonics. For layouts with LFE, the LFE element has been replaced by a SCE because the encoder always puts the LFE as last channel, irrespective of config_map and reorder_map. This is not optimal but it enables these layouts. --- libavcodec/aacenc.c | 2 +- libavcodec/aacenc.h | 239 ++-- 2 files changed, 234 insertions(+), 7 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 2996996..faa0684 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -565,7 +565,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return 0; } -copy_input_samples(s, frame); + copy_input_samples(s, frame); if (s->psypp) ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 346d989..31afd04 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -99,6 +99,33 @@ typedef struct AACPCEInfo { uint8_t reorder_map[16]; ///< maps channels from lavc to aac order } AACPCEInfo; +/** + *List of PCE (Program Configuration Element) for the channel layouts listed in channel_layout.h + * + *For those wishing in the future to add other layouts: + * - num_ele: number of elements in each group of front, side, back, lfe channels; + * (an element is of type SCE (single channel) , CPE (channel pair) for the first 3 groups; + * and is LFE for LFE group). + * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group + * - index: there are three independent indices for SCE, CPE and LFE; + * they are incremented irrespective of the group to which the element belongs; + * they are not reset when going from one group to another + * + * Example:
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Le 24/09/2017 à 5:06 PM, Rostislav Pehlivanov a écrit : On 24 September 2017 at 15:27, pkv.streamwrote: Hi atomnuker and others I am interested in working on this patch by atomnuker who did a great job. This could allow encoding to more channels with aac (e.g. ambisonics order three = 16 audio channels). Here's a report about additions I made to the PCE table for all the basic ffmpeg channel layouts (except mixed stereo). I have followed atomnuker assumptions for the guess work, notably regarding indexes (which seems right, I saw on spec an example with indexes running like 0 1 0 so ithe indexing seems to reset , quite probably for each group of either, front, side, back or LFE channels in the PCE). I have done some testing: encoding goes without fuss up to 16 channels. No warning, no error. But, ffmpeg aac decoder is throwing errors in aacdec_template.c : lines 3119-3124: if (elem_type < TYPE_DSE) { if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); err = AVERROR_INVALIDDATA; goto fail; error message is: channel element 0.0 is not allocated So the get_che function is failing. Of course it isn't going to work, I explicitly told you 1.) its a wip patch so no real error reporting and 2.) you need to add a new entry for whatever messed up channel layout ambisonics use and make sure the signalling indices are correct. And the latter isn't easy since nothing tells you what's correct - the spec, a decoder or anything like that. I understand. I did get though a decode of pce 4.0 or quad with vlc (downmixed to stereo by my sound card). In contrast ffmpeg aac decoder throws the error I mentioned (in ffmpeg and ffplay). So already your pce code is not doing a bad job. My point is maybe faad2 is perhaps implementing pce decode better than ffmpeg own aac decoder. Or your pce implementation might miss something that faad2 works around. I'll inquire and post if I find something useful for getting functional pce. ___ 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] aacenc: WIP support for PCEs
On 24 September 2017 at 15:27, pkv.streamwrote: > Hi atomnuker and others > > I am interested in working on this patch by atomnuker who did a great job. > > This could allow encoding to more channels with aac (e.g. ambisonics order > three = 16 audio channels). > > Here's a report about additions I made to the PCE table for all the basic > ffmpeg channel layouts (except mixed stereo). > > I have followed atomnuker assumptions for the guess work, notably > regarding indexes (which seems right, I saw on spec an example with indexes > running like 0 1 0 so ithe indexing seems to reset , quite probably for > each group of either, front, side, back or LFE channels in the PCE). > > I have done some testing: > > encoding goes without fuss up to 16 channels. No warning, no error. > > But, ffmpeg aac decoder is throwing errors in aacdec_template.c : > > lines 3119-3124: > > if (elem_type < TYPE_DSE) { > if (!(che=get_che(ac, elem_type, elem_id))) { > av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is > not allocated\n", >elem_type, elem_id); > err = AVERROR_INVALIDDATA; > goto fail; > > error message is: > > channel element 0.0 is not allocated > > So the get_che function is failing. > > Of course it isn't going to work, I explicitly told you 1.) its a wip patch so no real error reporting and 2.) you need to add a new entry for whatever messed up channel layout ambisonics use and make sure the signalling indices are correct. And the latter isn't easy since nothing tells you what's correct - the spec, a decoder or anything like that. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
link to original thread: http://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/200566.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Hi atomnuker and others I am interested in working on this patch by atomnuker who did a great job. This could allow encoding to more channels with aac (e.g. ambisonics order three = 16 audio channels). Here's a report about additions I made to the PCE table for all the basic ffmpeg channel layouts (except mixed stereo). I have followed atomnuker assumptions for the guess work, notably regarding indexes (which seems right, I saw on spec an example with indexes running like 0 1 0 so ithe indexing seems to reset , quite probably for each group of either, front, side, back or LFE channels in the PCE). I have done some testing: encoding goes without fuss up to 16 channels. No warning, no error. But, ffmpeg aac decoder is throwing errors in aacdec_template.c : lines 3119-3124: if (elem_type < TYPE_DSE) { if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); err = AVERROR_INVALIDDATA; goto fail; error message is: channel element 0.0 is not allocated So the get_che function is failing. Can't tell yet if this is an issue with the encoder or with the decoder. *atomnuker: *do you remember if could you decode with ffmpeg the files you produced with the layouts in your original patch ? I haven't tried with other decoders. Libfdk_aac decoder provides for channel =0 directing to a pce. Didn't find that in the ffmpeg aac decoder (haven't searched too much though) Best pkv From dba1cef5d1aee3d26c35a6fa429a11a6039d4844 Mon Sep 17 00:00:00 2001 From: pkvietDate: Sun, 24 Sep 2017 16:11:17 +0200 Subject: [PATCH] avcodec/aacenc: more multichannels layouts added to pce Add most ffmpeg channel layouts to the pce table by atomnuker. WIP. Encodes without errors up to 16 channels in aac but the files throw errors with ffmpeg aac decoder. Don't know yet if issue is with encoder or with decoder. --- libavcodec/aacenc.c | 2 +- libavcodec/aacenc.h | 184 2 files changed, 185 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 2996996..faa0684 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -565,7 +565,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return 0; } -copy_input_samples(s, frame); + copy_input_samples(s, frame); if (s->psypp) ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 346d989..ce2202d 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -116,6 +116,22 @@ static const AACPCEInfo aac_pce_configs[] = { .config_map = { 1, TYPE_CPE, }, .reorder_map = { 0, 1 }, }, + { + .layout = AV_CH_LAYOUT_2POINT1, + .num_ele = { 1, 0, 0, 1 }, + .pairing = { { 1 }, }, + .index = { { 0 }, { 0 }, { 0 }, { 0 } }, + .config_map = { 2, TYPE_CPE, TYPE_LFE}, + .reorder_map = { 0, 1, 2 }, + }, + { + .layout = AV_CH_LAYOUT_2_1, + .num_ele = { 1, 0, 1, 0 }, + .pairing = { { 1 }, { 0 }, { 0 } }, + .index = { { 0 }, { 0 }, { 0 }, }, + .config_map = { 2, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2 }, + }, { .layout = AV_CH_LAYOUT_SURROUND, .num_ele = { 2, 0, 0, 0 }, @@ -124,6 +140,14 @@ static const AACPCEInfo aac_pce_configs[] = { .config_map = { 2, TYPE_SCE, TYPE_CPE }, .reorder_map = { 2, 0, 1 }, }, + { + .layout = AV_CH_LAYOUT_3POINT1, + .num_ele = { 2, 0, 0, 1 }, + .pairing = { { 1, 0 }, }, + .index = { { 0, 1 }, { 0 }, { 0 }, { 0 }, }, + .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 3 }, + }, { .layout = AV_CH_LAYOUT_4POINT0, .num_ele = { 2, 0, 1, 0 }, @@ -132,6 +156,166 @@ static const AACPCEInfo aac_pce_configs[] = { .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_SCE }, .reorder_map = { 2, 0, 1, 3 }, }, + { + .layout = AV_CH_LAYOUT_4POINT1, + .num_ele = { 2, 0, 1, 1 }, + .pairing = { { 1, 0 }, { 0 }, { 0 }, }, + .index = { { 0, 1 }, { 0 }, { 0 }, { 0 } }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 3 }, + }, + { + .layout = AV_CH_LAYOUT_2_2, + .num_ele = { 1, 1, 0, 0 }, + .pairing = { { 1 }, { 1 }, }, + .index = { { 0 }, { 0 }, }, + .config_map = { 2, TYPE_CPE, TYPE_CPE }, +
Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
On Mon, Oct 3, 2016 at 3:53 PM, Rostislav Pehlivanovwrote: > Hopefully whoever wants to have support for crazy formats can help. > The table in aacenc.h (temporary position) tells the encoder what > to put in the bitstream and how to encode. Problem is, the specifications > dont specify anything. Thats because I've not been able to find any bloody > specifications and had to work with what the decoder does. And there was > plenty of guessing there because the decoder does some magic on layout_map > which I can't even figure out nor even know if its correct (it seems to be > for the formats I've tested). > Then there's the problem with the exact order that the channels have to be in. > Again a guessing game, since you essentially have no idea what the index part > of the map is supposed to be, whether it has to be incremented starting from > the first channel or reset upon every front/side/back channel groups. At > least the map to instruct the encoder's straightforward. > > Anyway, help appreciated. Will take a deeper look later, but on a shallow review, shouldn't it have some tests? (seems fairly easily testable) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs
Hopefully whoever wants to have support for crazy formats can help. The table in aacenc.h (temporary position) tells the encoder what to put in the bitstream and how to encode. Problem is, the specifications dont specify anything. Thats because I've not been able to find any bloody specifications and had to work with what the decoder does. And there was plenty of guessing there because the decoder does some magic on layout_map which I can't even figure out nor even know if its correct (it seems to be for the formats I've tested). Then there's the problem with the exact order that the channels have to be in. Again a guessing game, since you essentially have no idea what the index part of the map is supposed to be, whether it has to be incremented starting from the first channel or reset upon every front/side/back channel groups. At least the map to instruct the encoder's straightforward. Anyway, help appreciated. Applies cleanly on 543142990b6f7b8757753c13ea6dbc56275c5c7e, but should work fine with newer versions. --- libavcodec/aacenc.c| 69 +- libavcodec/aacenc.h| 50 +++- libavcodec/aacenctab.h | 13 +- 3 files changed, 124 insertions(+), 8 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 2653cef..c138699 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -50,6 +50,40 @@ static AVOnce aac_table_init = AV_ONCE_INIT; +static void put_pce(PutBitContext *pb, AVCodecContext *avctx) +{ +int i, j; +AACEncContext *s = avctx->priv_data; +AACPCEInfo *pce = >pce; + +put_bits(pb, 4, 0); + +put_bits(pb, 2, avctx->profile); +put_bits(pb, 4, s->samplerate_index); + +put_bits(pb, 4, pce->num_ele[0]); /* Front */ +put_bits(pb, 4, pce->num_ele[1]); /* Side */ +put_bits(pb, 4, pce->num_ele[2]); /* Back */ +put_bits(pb, 2, pce->num_ele[3]); /* LFE */ +put_bits(pb, 3, 0); /* Assoc data */ +put_bits(pb, 4, 0); /* CCs */ + +put_bits(pb, 1, 0); /* Stereo mixdown */ +put_bits(pb, 1, 0); /* Mono mixdown */ +put_bits(pb, 1, 0); /* Something else */ + +for (i = 0; i < 4; i++) { +for (j = 0; j < pce->num_ele[i]; j++) { +if (i < 3) +put_bits(pb, 1, pce->pairing[i][j]); +put_bits(pb, 4, pce->index[i][j]); +} +} + +avpriv_align_put_bits(pb); +put_bits(pb, 8, 0); +} + /** * Make AAC audio config object. * @see 1.6.2.1 "Syntax - AudioSpecificConfig" @@ -58,7 +92,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) { PutBitContext pb; AACEncContext *s = avctx->priv_data; -int channels = s->channels - (s->channels == 8 ? 1 : 0); +int channels = (!s->needs_pce)*(s->channels - (s->channels == 8 ? 1 : 0)); init_put_bits(, avctx->extradata, avctx->extradata_size); put_bits(, 5, s->profile+1); //profile @@ -68,6 +102,8 @@ static void put_audio_specific_config(AVCodecContext *avctx) put_bits(, 1, 0); //frame length - 1024 samples put_bits(, 1, 0); //does not depend on core coder put_bits(, 1, 0); //is not extension +if (s->needs_pce) +put_pce(, avctx); //Explicitly Mark SBR absent put_bits(, 11, 0x2b7); //sync extension @@ -488,7 +524,7 @@ static void copy_input_samples(AACEncContext *s, const AVFrame *frame) { int ch; int end = 2048 + (frame ? frame->nb_samples : 0); -const uint8_t *channel_map = aac_chan_maps[s->channels - 1]; +const uint8_t *channel_map = s->reorder_map; /* copy and remap input samples */ for (ch = 0; ch < s->channels; ch++) { @@ -923,16 +959,36 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) /* Constants */ s->last_frame_pb_count = 0; -avctx->extradata_size = 5; +avctx->extradata_size = 20; avctx->frame_size = 1024; avctx->initial_padding = 1024; s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120; /* Channel map and unspecified bitrate guessing */ s->channels = avctx->channels; -ERROR_IF(s->channels > AAC_MAX_CHANNELS || s->channels == 7, - "Unsupported number of channels: %d\n", s->channels); -s->chan_map = aac_chan_configs[s->channels-1]; + +s->needs_pce = 1; +for (i = 0; i < FF_ARRAY_ELEMS(aac_normal_chan_layouts); i++) { +if (avctx->channel_layout == aac_normal_chan_layouts[i]) { +s->needs_pce = s->options.pce; +break; +} +} + +if (s->needs_pce) { +for (i = 0; i < FF_ARRAY_ELEMS(aac_pce_configs); i++) +if (avctx->channel_layout == aac_pce_configs[i].layout) +break; +ERROR_IF(i == FF_ARRAY_ELEMS(aac_pce_configs), "Unsupported channel layout\n"); +WARN_IF(1, "Using a PCE!\n"); +s->pce = aac_pce_configs[i]; +s->reorder_map = s->pce.reorder_map; +s->chan_map = s->pce.config_map; +} else { +