Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-22 Thread Lynne via ffmpeg-devel

On 22/05/2024 22:15, Marton Balint wrote:



On Wed, 22 May 2024, Lynne via ffmpeg-devel wrote:


On 21/05/2024 23:33, Hendrik Leppkes wrote:

 On Tue, May 21, 2024 at 9:52 PM Lynne via ffmpeg-devel
  wrote:



 It should be the case here, we shouldn't need reordering as NATIVE 
just

 lets you specify what order the elements appear in the bitstream.


 NATIVE means "the FFmpeg native ordering", not "bitstream order".
 CUSTOM lets you specify an arbitrary order but requires metadata to
 that effect, but it makes it particularly hard to map to any standard
 when playing or transcoding, so some efforts to try to unify it into a
 NATIVE format is always appreciated if possible.


Right, I forgot about that, thanks.
Amended in my git repo to use Marton's code.





ret = av_channel_layout_custom_init(&ac->oc[1].ch_layout, nb_channels);
if (ret < 0)
    return ret;

for (int i = 0; i < nb_channels; i++) {
    AVChannelCustom *cm = &ac->oc[1].ch_layout.u.map[i];
    cm->id = usac_ch_pos_to_av[get_bits(gb, 5)]; /* bsOutputChannelPos */
    if (cm->id)
    cm->id = AV_CHAN_UNKNOWN;


if (cm->id == AV_CHAN_NONE)
     cm->id = AV_CHAN_UNKNOWN;


}

ret = av_channel_layout_retype(&ac->oc[1].ch_layout,
   AV_CHANNEL_ORDER_NATIVE,
   AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);


You can simply pass 0 instead of AV_CHANNEL_ORDER_NATIVE as the order 
parameter, because AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL automatically 
uses the canonical order and ignores the order parameter.



if (ret < 0)
    return ret;

av_channel_layout_copy(&avctx->ch_layout, &ac->oc[1].ch_layout);


Missing error check.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Fixed both, thanks.
I'll keep AV_CHANNEL_ORDER_NATIVE as-is because its just more readable.


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-22 Thread Marton Balint



On Wed, 22 May 2024, Lynne via ffmpeg-devel wrote:


On 21/05/2024 23:33, Hendrik Leppkes wrote:

 On Tue, May 21, 2024 at 9:52 PM Lynne via ffmpeg-devel
  wrote:



 It should be the case here, we shouldn't need reordering as NATIVE just
 lets you specify what order the elements appear in the bitstream.


 NATIVE means "the FFmpeg native ordering", not "bitstream order".
 CUSTOM lets you specify an arbitrary order but requires metadata to
 that effect, but it makes it particularly hard to map to any standard
 when playing or transcoding, so some efforts to try to unify it into a
 NATIVE format is always appreciated if possible.


Right, I forgot about that, thanks.
Amended in my git repo to use Marton's code.





ret = av_channel_layout_custom_init(&ac->oc[1].ch_layout, nb_channels);
if (ret < 0)
return ret;

for (int i = 0; i < nb_channels; i++) {
AVChannelCustom *cm = &ac->oc[1].ch_layout.u.map[i];
cm->id = usac_ch_pos_to_av[get_bits(gb, 5)]; /* bsOutputChannelPos */
if (cm->id)
cm->id = AV_CHAN_UNKNOWN;


if (cm->id == AV_CHAN_NONE)
cm->id = AV_CHAN_UNKNOWN;


}

ret = av_channel_layout_retype(&ac->oc[1].ch_layout,
   AV_CHANNEL_ORDER_NATIVE,
   AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);


You can simply pass 0 instead of AV_CHANNEL_ORDER_NATIVE as the order 
parameter, because AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL automatically 
uses the canonical order and ignores the order parameter.



if (ret < 0)
return ret;

av_channel_layout_copy(&avctx->ch_layout, &ac->oc[1].ch_layout);


Missing error check.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Lynne via ffmpeg-devel

On 21/05/2024 23:33, Hendrik Leppkes wrote:

On Tue, May 21, 2024 at 9:52 PM Lynne via ffmpeg-devel
 wrote:



It should be the case here, we shouldn't need reordering as NATIVE just
lets you specify what order the elements appear in the bitstream.


NATIVE means "the FFmpeg native ordering", not "bitstream order".
CUSTOM lets you specify an arbitrary order but requires metadata to
that effect, but it makes it particularly hard to map to any standard
when playing or transcoding, so some efforts to try to unify it into a
NATIVE format is always appreciated if possible.


Right, I forgot about that, thanks.
Amended in my git repo to use Marton's code.


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Hendrik Leppkes
On Tue, May 21, 2024 at 9:52 PM Lynne via ffmpeg-devel
 wrote:
>
>
> It should be the case here, we shouldn't need reordering as NATIVE just
> lets you specify what order the elements appear in the bitstream.

NATIVE means "the FFmpeg native ordering", not "bitstream order".
CUSTOM lets you specify an arbitrary order but requires metadata to
that effect, but it makes it particularly hard to map to any standard
when playing or transcoding, so some efforts to try to unify it into a
NATIVE format is always appreciated if possible.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Marton Balint



On Tue, 21 May 2024, Lynne via ffmpeg-devel wrote:


On 21/05/2024 21:40, Marton Balint wrote:



 On Tue, 21 May 2024, Lynne via ffmpeg-devel wrote:


 On 21/05/2024 09:16, Marton Balint wrote:



  On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


  On 19/05/2024 21:39, Marton Balint wrote:



   On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


   This commit adds a decoder for the frequency-domain part of USAC.


   [...]



   +/* Finish later */
   +static const enum AVChannel usac_ch_pos_to_av[64] = {
   +    [0] = AV_CHAN_FRONT_LEFT,
   +    [1] = AV_CHAN_FRONT_RIGHT,
   +    [2] = AV_CHAN_FRONT_CENTER,
   +    [3] = AV_CHAN_LOW_FREQUENCY,
   +    [4] = AV_CHAN_BACK_LEFT, // unsure
   +    [5] = AV_CHAN_BACK_RIGHT, // unsure
   +    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
   +    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
   +    [8] = 0, /* rear surround left is missing */
   +    [9] = 0, /* rear surround right is missing */
   +    [10] = AV_CHAN_BACK_CENTER,
   +    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
   +    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
   +    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
   +    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
   +    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
   +    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
   +    [17] = AV_CHAN_TOP_FRONT_LEFT,
   +    [18] = AV_CHAN_TOP_FRONT_RIGHT,
   +    [19] = AV_CHAN_TOP_FRONT_CENTER,
   +    [20] = AV_CHAN_TOP_BACK_LEFT,
   +    [21] = AV_CHAN_TOP_BACK_RIGHT,
   +    [22] = AV_CHAN_TOP_BACK_CENTER,
   +    [23] = AV_CHAN_TOP_SIDE_LEFT,
   +    [24] = AV_CHAN_TOP_SIDE_RIGHT,
   +    [25] = AV_CHAN_TOP_CENTER,
   +    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
   +    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
   +    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
   +    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
   +    [30] = 0, /* top left surround is missing */
   +    [31] = 0, /* top right surround is missing */
   +};


   Some comment would be nice about the source of this table (which
  document,
   which table).

   It looks very similar to the ISO channel positons used in mov_chan.
 I
   think we follow this mapping in most cases:

   Left  Surround is SIDE_LEFT
   Right Surround is SIDE_RIGHT
   Rear Surround Left  is BACK_LEFT
   Rear Surround Right is BACK_RIGHT

   So in your table [4] and [5] should be SIDE, [8] and [9] should be
  BACK.
   [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.

   Yes, Left/Right Surround and Left/Right Side Surround will be the
 same,
   but those are not present in commonly used layouts at the same time.

   Regards,
   Marton
   ___
   ffmpeg-devel mailing list
   ffmpeg-devel@ffmpeg.org
   https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

   To unsubscribe, visit link above, or email
   ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


  Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

  0 L left front FL front left
  1 R right front FR front right
  2 C center front FC front centre
  3 LFE low frequency enhancement LFE1 low frequency effects-1
  4 Ls left surround LS left surround
  5 Rs right surround RS right surround
  6 Lc left front center FLc front left centre
  7 Rc right front center FRc front right centre
  8 Lsr rear surround left BL back left
  9 Rsr rear surround right BR back right
  10 Cs rear center BC back centre
  11 Lsd left surround direct LSd left surround direct
  12 Rsd right surround direct RSd right surround direct
  13 Lss left side surround SL side left
  14 Rss right side surround SR side right
  15 Lw left wide front FLw front left wide
  16 Rw right wide front FRw front right wide
  17 Lv left front vertical height TpFL top front left
  18 Rv right front vertical height TpFR top front right
  19 Cv center front vertical height TpFC top front centre
  20 Lvr left surround vertical height rear TpBL top back left
  21 Rvr right surround vertical height rear TpBR top back right
  22 Cvr center vertical height rear TpBC top back centre
  23 Lvss left vertical height side surround TpSiL top side left
  24 Rvss right vertical height side surround TpSiR top side right
  25 Ts top center surround TpC top centre
  26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
  27 Lb left front vertical bottom BtFL bottom front left
  28 Rb right front vertical bottom BtFR bottom front right
  29 Cb center front vertical bottom BtFC bottom front centre
  30 Lvs left vertical height surround TpLS top left surround
  31 Rvs right vertical height surround TpRS top right surround

  Third field is "Loudspeaker position", last field is "Loudspeaker
  position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each
 prefixed
  with an abbreviation.

  I've added the source to the table comment in the code.

  I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked
  earlier.


  Thanks. Later in the code when you actually use this I can see that you
  are creating a native 

Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Lynne via ffmpeg-devel

On 21/05/2024 21:40, Marton Balint wrote:



On Tue, 21 May 2024, Lynne via ffmpeg-devel wrote:


On 21/05/2024 09:16, Marton Balint wrote:



 On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


 On 19/05/2024 21:39, Marton Balint wrote:



  On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


  This commit adds a decoder for the frequency-domain part of USAC.


  [...]



  +/* Finish later */
  +static const enum AVChannel usac_ch_pos_to_av[64] = {
  +    [0] = AV_CHAN_FRONT_LEFT,
  +    [1] = AV_CHAN_FRONT_RIGHT,
  +    [2] = AV_CHAN_FRONT_CENTER,
  +    [3] = AV_CHAN_LOW_FREQUENCY,
  +    [4] = AV_CHAN_BACK_LEFT, // unsure
  +    [5] = AV_CHAN_BACK_RIGHT, // unsure
  +    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
  +    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
  +    [8] = 0, /* rear surround left is missing */
  +    [9] = 0, /* rear surround right is missing */
  +    [10] = AV_CHAN_BACK_CENTER,
  +    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
  +    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
  +    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
  +    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
  +    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
  +    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
  +    [17] = AV_CHAN_TOP_FRONT_LEFT,
  +    [18] = AV_CHAN_TOP_FRONT_RIGHT,
  +    [19] = AV_CHAN_TOP_FRONT_CENTER,
  +    [20] = AV_CHAN_TOP_BACK_LEFT,
  +    [21] = AV_CHAN_TOP_BACK_RIGHT,
  +    [22] = AV_CHAN_TOP_BACK_CENTER,
  +    [23] = AV_CHAN_TOP_SIDE_LEFT,
  +    [24] = AV_CHAN_TOP_SIDE_RIGHT,
  +    [25] = AV_CHAN_TOP_CENTER,
  +    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
  +    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
  +    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
  +    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
  +    [30] = 0, /* top left surround is missing */
  +    [31] = 0, /* top right surround is missing */
  +};


  Some comment would be nice about the source of this table (which
 document,
  which table).

  It looks very similar to the ISO channel positons used in 
mov_chan. I

  think we follow this mapping in most cases:

  Left  Surround is SIDE_LEFT
  Right Surround is SIDE_RIGHT
  Rear Surround Left  is BACK_LEFT
  Rear Surround Right is BACK_RIGHT

  So in your table [4] and [5] should be SIDE, [8] and [9] should be
 BACK.
  [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.

  Yes, Left/Right Surround and Left/Right Side Surround will be the 
same,

  but those are not present in commonly used layouts at the same time.

  Regards,
  Marton
  ___
  ffmpeg-devel mailing list
  ffmpeg-devel@ffmpeg.org
  https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

  To unsubscribe, visit link above, or email
  ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


 Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

 0 L left front FL front left
 1 R right front FR front right
 2 C center front FC front centre
 3 LFE low frequency enhancement LFE1 low frequency effects-1
 4 Ls left surround LS left surround
 5 Rs right surround RS right surround
 6 Lc left front center FLc front left centre
 7 Rc right front center FRc front right centre
 8 Lsr rear surround left BL back left
 9 Rsr rear surround right BR back right
 10 Cs rear center BC back centre
 11 Lsd left surround direct LSd left surround direct
 12 Rsd right surround direct RSd right surround direct
 13 Lss left side surround SL side left
 14 Rss right side surround SR side right
 15 Lw left wide front FLw front left wide
 16 Rw right wide front FRw front right wide
 17 Lv left front vertical height TpFL top front left
 18 Rv right front vertical height TpFR top front right
 19 Cv center front vertical height TpFC top front centre
 20 Lvr left surround vertical height rear TpBL top back left
 21 Rvr right surround vertical height rear TpBR top back right
 22 Cvr center vertical height rear TpBC top back centre
 23 Lvss left vertical height side surround TpSiL top side left
 24 Rvss right vertical height side surround TpSiR top side right
 25 Ts top center surround TpC top centre
 26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
 27 Lb left front vertical bottom BtFL bottom front left
 28 Rb right front vertical bottom BtFR bottom front right
 29 Cb center front vertical bottom BtFC bottom front centre
 30 Lvs left vertical height surround TpLS top left surround
 31 Rvs right vertical height surround TpRS top right surround

 Third field is "Loudspeaker position", last field is "Loudspeaker
 position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each 
prefixed

 with an abbreviation.

 I've added the source to the table comment in the code.

 I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked
 earlier.


 Thanks. Later in the code when you actually use this I can see that you
 are creating a native layout:

 +    channel_config_idx = get_bits(gb, 5); /* 
channelConfigurationIndex

 */
 +    if (!channel_config_idx) {
 +    /* UsacChannelConfig() */

Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Marton Balint



On Tue, 21 May 2024, Lynne via ffmpeg-devel wrote:


On 21/05/2024 09:16, Marton Balint wrote:



 On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


 On 19/05/2024 21:39, Marton Balint wrote:



  On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


  This commit adds a decoder for the frequency-domain part of USAC.


  [...]



  +/* Finish later */
  +static const enum AVChannel usac_ch_pos_to_av[64] = {
  +    [0] = AV_CHAN_FRONT_LEFT,
  +    [1] = AV_CHAN_FRONT_RIGHT,
  +    [2] = AV_CHAN_FRONT_CENTER,
  +    [3] = AV_CHAN_LOW_FREQUENCY,
  +    [4] = AV_CHAN_BACK_LEFT, // unsure
  +    [5] = AV_CHAN_BACK_RIGHT, // unsure
  +    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
  +    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
  +    [8] = 0, /* rear surround left is missing */
  +    [9] = 0, /* rear surround right is missing */
  +    [10] = AV_CHAN_BACK_CENTER,
  +    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
  +    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
  +    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
  +    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
  +    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
  +    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
  +    [17] = AV_CHAN_TOP_FRONT_LEFT,
  +    [18] = AV_CHAN_TOP_FRONT_RIGHT,
  +    [19] = AV_CHAN_TOP_FRONT_CENTER,
  +    [20] = AV_CHAN_TOP_BACK_LEFT,
  +    [21] = AV_CHAN_TOP_BACK_RIGHT,
  +    [22] = AV_CHAN_TOP_BACK_CENTER,
  +    [23] = AV_CHAN_TOP_SIDE_LEFT,
  +    [24] = AV_CHAN_TOP_SIDE_RIGHT,
  +    [25] = AV_CHAN_TOP_CENTER,
  +    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
  +    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
  +    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
  +    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
  +    [30] = 0, /* top left surround is missing */
  +    [31] = 0, /* top right surround is missing */
  +};


  Some comment would be nice about the source of this table (which
 document,
  which table).

  It looks very similar to the ISO channel positons used in mov_chan. I
  think we follow this mapping in most cases:

  Left  Surround is SIDE_LEFT
  Right Surround is SIDE_RIGHT
  Rear Surround Left  is BACK_LEFT
  Rear Surround Right is BACK_RIGHT

  So in your table [4] and [5] should be SIDE, [8] and [9] should be
 BACK.
  [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.

  Yes, Left/Right Surround and Left/Right Side Surround will be the same,
  but those are not present in commonly used layouts at the same time.

  Regards,
  Marton
  ___
  ffmpeg-devel mailing list
  ffmpeg-devel@ffmpeg.org
  https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

  To unsubscribe, visit link above, or email
  ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


 Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

 0 L left front FL front left
 1 R right front FR front right
 2 C center front FC front centre
 3 LFE low frequency enhancement LFE1 low frequency effects-1
 4 Ls left surround LS left surround
 5 Rs right surround RS right surround
 6 Lc left front center FLc front left centre
 7 Rc right front center FRc front right centre
 8 Lsr rear surround left BL back left
 9 Rsr rear surround right BR back right
 10 Cs rear center BC back centre
 11 Lsd left surround direct LSd left surround direct
 12 Rsd right surround direct RSd right surround direct
 13 Lss left side surround SL side left
 14 Rss right side surround SR side right
 15 Lw left wide front FLw front left wide
 16 Rw right wide front FRw front right wide
 17 Lv left front vertical height TpFL top front left
 18 Rv right front vertical height TpFR top front right
 19 Cv center front vertical height TpFC top front centre
 20 Lvr left surround vertical height rear TpBL top back left
 21 Rvr right surround vertical height rear TpBR top back right
 22 Cvr center vertical height rear TpBC top back centre
 23 Lvss left vertical height side surround TpSiL top side left
 24 Rvss right vertical height side surround TpSiR top side right
 25 Ts top center surround TpC top centre
 26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
 27 Lb left front vertical bottom BtFL bottom front left
 28 Rb right front vertical bottom BtFR bottom front right
 29 Cb center front vertical bottom BtFC bottom front centre
 30 Lvs left vertical height surround TpLS top left surround
 31 Rvs right vertical height surround TpRS top right surround

 Third field is "Loudspeaker position", last field is "Loudspeaker
 position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each prefixed
 with an abbreviation.

 I've added the source to the table comment in the code.

 I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked
 earlier.


 Thanks. Later in the code when you actually use this I can see that you
 are creating a native layout:


 +    channel_config_idx = get_bits(gb, 5); /* channelConfigurationIndex
 */
 +    if (!channel_config_idx) {
 +    /* UsacChannelConfig() */
 +    uint8_t channel_pos[64];
 +    uint8

Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Lynne via ffmpeg-devel

On 21/05/2024 09:16, Marton Balint wrote:



On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


On 19/05/2024 21:39, Marton Balint wrote:



 On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


 This commit adds a decoder for the frequency-domain part of USAC.


 [...]



 +/* Finish later */
 +static const enum AVChannel usac_ch_pos_to_av[64] = {
 +    [0] = AV_CHAN_FRONT_LEFT,
 +    [1] = AV_CHAN_FRONT_RIGHT,
 +    [2] = AV_CHAN_FRONT_CENTER,
 +    [3] = AV_CHAN_LOW_FREQUENCY,
 +    [4] = AV_CHAN_BACK_LEFT, // unsure
 +    [5] = AV_CHAN_BACK_RIGHT, // unsure
 +    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
 +    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
 +    [8] = 0, /* rear surround left is missing */
 +    [9] = 0, /* rear surround right is missing */
 +    [10] = AV_CHAN_BACK_CENTER,
 +    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
 +    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
 +    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
 +    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
 +    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
 +    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
 +    [17] = AV_CHAN_TOP_FRONT_LEFT,
 +    [18] = AV_CHAN_TOP_FRONT_RIGHT,
 +    [19] = AV_CHAN_TOP_FRONT_CENTER,
 +    [20] = AV_CHAN_TOP_BACK_LEFT,
 +    [21] = AV_CHAN_TOP_BACK_RIGHT,
 +    [22] = AV_CHAN_TOP_BACK_CENTER,
 +    [23] = AV_CHAN_TOP_SIDE_LEFT,
 +    [24] = AV_CHAN_TOP_SIDE_RIGHT,
 +    [25] = AV_CHAN_TOP_CENTER,
 +    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
 +    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
 +    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
 +    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
 +    [30] = 0, /* top left surround is missing */
 +    [31] = 0, /* top right surround is missing */
 +};


 Some comment would be nice about the source of this table (which 
document,

 which table).

 It looks very similar to the ISO channel positons used in mov_chan. I
 think we follow this mapping in most cases:

 Left  Surround is SIDE_LEFT
 Right Surround is SIDE_RIGHT
 Rear Surround Left  is BACK_LEFT
 Rear Surround Right is BACK_RIGHT

 So in your table [4] and [5] should be SIDE, [8] and [9] should be 
BACK.

 [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.

 Yes, Left/Right Surround and Left/Right Side Surround will be the same,
 but those are not present in commonly used layouts at the same time.

 Regards,
 Marton
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

 To unsubscribe, visit link above, or email
 ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

0 L left front FL front left
1 R right front FR front right
2 C center front FC front centre
3 LFE low frequency enhancement LFE1 low frequency effects-1
4 Ls left surround LS left surround
5 Rs right surround RS right surround
6 Lc left front center FLc front left centre
7 Rc right front center FRc front right centre
8 Lsr rear surround left BL back left
9 Rsr rear surround right BR back right
10 Cs rear center BC back centre
11 Lsd left surround direct LSd left surround direct
12 Rsd right surround direct RSd right surround direct
13 Lss left side surround SL side left
14 Rss right side surround SR side right
15 Lw left wide front FLw front left wide
16 Rw right wide front FRw front right wide
17 Lv left front vertical height TpFL top front left
18 Rv right front vertical height TpFR top front right
19 Cv center front vertical height TpFC top front centre
20 Lvr left surround vertical height rear TpBL top back left
21 Rvr right surround vertical height rear TpBR top back right
22 Cvr center vertical height rear TpBC top back centre
23 Lvss left vertical height side surround TpSiL top side left
24 Rvss right vertical height side surround TpSiR top side right
25 Ts top center surround TpC top centre
26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
27 Lb left front vertical bottom BtFL bottom front left
28 Rb right front vertical bottom BtFR bottom front right
29 Cb center front vertical bottom BtFC bottom front centre
30 Lvs left vertical height surround TpLS top left surround
31 Rvs right vertical height surround TpRS top right surround

Third field is "Loudspeaker position", last field is "Loudspeaker
position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each 
prefixed with an abbreviation.


I've added the source to the table comment in the code.

I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked 
earlier.


Thanks. Later in the code when you actually use this I can see that you 
are creating a native layout:


+    channel_config_idx = get_bits(gb, 5); /* 
channelConfigurationIndex */

+    if (!channel_config_idx) {
+    /* UsacChannelConfig() */
+    uint8_t channel_pos[64];
+    uint8_t nb_channels = get_escaped_value(gb, 5, 8, 16); /* 
numOutChannels */

+    if (nb_channels >= 64)
+    return AVERROR(EINVAL);
+
+    a

Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-21 Thread Marton Balint



On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


On 19/05/2024 21:39, Marton Balint wrote:



 On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


 This commit adds a decoder for the frequency-domain part of USAC.


 [...]



 +/* Finish later */
 +static const enum AVChannel usac_ch_pos_to_av[64] = {
 +    [0] = AV_CHAN_FRONT_LEFT,
 +    [1] = AV_CHAN_FRONT_RIGHT,
 +    [2] = AV_CHAN_FRONT_CENTER,
 +    [3] = AV_CHAN_LOW_FREQUENCY,
 +    [4] = AV_CHAN_BACK_LEFT, // unsure
 +    [5] = AV_CHAN_BACK_RIGHT, // unsure
 +    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
 +    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
 +    [8] = 0, /* rear surround left is missing */
 +    [9] = 0, /* rear surround right is missing */
 +    [10] = AV_CHAN_BACK_CENTER,
 +    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
 +    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
 +    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
 +    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
 +    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
 +    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
 +    [17] = AV_CHAN_TOP_FRONT_LEFT,
 +    [18] = AV_CHAN_TOP_FRONT_RIGHT,
 +    [19] = AV_CHAN_TOP_FRONT_CENTER,
 +    [20] = AV_CHAN_TOP_BACK_LEFT,
 +    [21] = AV_CHAN_TOP_BACK_RIGHT,
 +    [22] = AV_CHAN_TOP_BACK_CENTER,
 +    [23] = AV_CHAN_TOP_SIDE_LEFT,
 +    [24] = AV_CHAN_TOP_SIDE_RIGHT,
 +    [25] = AV_CHAN_TOP_CENTER,
 +    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
 +    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
 +    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
 +    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
 +    [30] = 0, /* top left surround is missing */
 +    [31] = 0, /* top right surround is missing */
 +};


 Some comment would be nice about the source of this table (which document,
 which table).

 It looks very similar to the ISO channel positons used in mov_chan. I
 think we follow this mapping in most cases:

 Left  Surround is SIDE_LEFT
 Right Surround is SIDE_RIGHT
 Rear Surround Left  is BACK_LEFT
 Rear Surround Right is BACK_RIGHT

 So in your table [4] and [5] should be SIDE, [8] and [9] should be BACK.
 [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.

 Yes, Left/Right Surround and Left/Right Side Surround will be the same,
 but those are not present in commonly used layouts at the same time.

 Regards,
 Marton
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

 To unsubscribe, visit link above, or email
 ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

0 L left front FL front left
1 R right front FR front right
2 C center front FC front centre
3 LFE low frequency enhancement LFE1 low frequency effects-1
4 Ls left surround LS left surround
5 Rs right surround RS right surround
6 Lc left front center FLc front left centre
7 Rc right front center FRc front right centre
8 Lsr rear surround left BL back left
9 Rsr rear surround right BR back right
10 Cs rear center BC back centre
11 Lsd left surround direct LSd left surround direct
12 Rsd right surround direct RSd right surround direct
13 Lss left side surround SL side left
14 Rss right side surround SR side right
15 Lw left wide front FLw front left wide
16 Rw right wide front FRw front right wide
17 Lv left front vertical height TpFL top front left
18 Rv right front vertical height TpFR top front right
19 Cv center front vertical height TpFC top front centre
20 Lvr left surround vertical height rear TpBL top back left
21 Rvr right surround vertical height rear TpBR top back right
22 Cvr center vertical height rear TpBC top back centre
23 Lvss left vertical height side surround TpSiL top side left
24 Rvss right vertical height side surround TpSiR top side right
25 Ts top center surround TpC top centre
26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
27 Lb left front vertical bottom BtFL bottom front left
28 Rb right front vertical bottom BtFR bottom front right
29 Cb center front vertical bottom BtFC bottom front centre
30 Lvs left vertical height surround TpLS top left surround
31 Rvs right vertical height surround TpRS top right surround

Third field is "Loudspeaker position", last field is "Loudspeaker
position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each prefixed with 
an abbreviation.


I've added the source to the table comment in the code.

I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked earlier.


Thanks. Later in the code when you actually use this I can see that you 
are creating a native layout:



+channel_config_idx = get_bits(gb, 5); /* channelConfigurationIndex */
+if (!channel_config_idx) {
+/* UsacChannelConfig() */
+uint8_t channel_pos[64];
+uint8_t nb_channels = get_escaped_value(gb, 5, 8, 16); /* 
numOutChannels */
+if (nb_channels >= 64)
+return AVERROR(EINVAL);
+
+av_channel_layout_uninit(&ac->oc[1].ch_layout);
+  

Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-19 Thread Lynne via ffmpeg-devel

On 20/05/2024 01:19, Michael Niedermayer wrote:

On Sun, May 19, 2024 at 06:54:44PM +0200, Lynne via ffmpeg-devel wrote:

This commit adds a decoder for the frequency-domain part of USAC.

What works:
  - Mono
  - Stereo (no prediction)
  - Stereo (mid/side coding)
  - Stereo (complex prediction)

What's left:
  - Speech coding

Known issues:
  - Desync with certain sequences
  - Preroll crossover missing (shouldn't matter, bitrate adaptation only)
---
  libavcodec/aac/Makefile  |3 +-
  libavcodec/aac/aacdec.c  |  188 +--
  libavcodec/aac/aacdec.h  |  187 +++
  libavcodec/aac/aacdec_ac.c   |  208 
  libavcodec/aac/aacdec_ac.h   |   54 +
  libavcodec/aac/aacdec_dsp_template.c |4 +-
  libavcodec/aac/aacdec_latm.h |   14 +-
  libavcodec/aac/aacdec_lpd.c  |  198 
  libavcodec/aac/aacdec_lpd.h  |   33 +
  libavcodec/aac/aacdec_usac.c | 1587 ++
  libavcodec/aac/aacdec_usac.h |   39 +
  libavcodec/aactab.c  |   42 +
  libavcodec/aactab.h  |   10 +
  13 files changed, 2491 insertions(+), 76 deletions(-)
  create mode 100644 libavcodec/aac/aacdec_ac.c
  create mode 100644 libavcodec/aac/aacdec_ac.h
  create mode 100644 libavcodec/aac/aacdec_lpd.c
  create mode 100644 libavcodec/aac/aacdec_lpd.h
  create mode 100644 libavcodec/aac/aacdec_usac.c
  create mode 100644 libavcodec/aac/aacdec_usac.h


seems to break fate

make  -j32 fate-source
TESTsource
--- ./tests/ref/fate/source 2024-05-20 01:14:59.40702 +0200
+++ tests/data/fate/source  2024-05-20 01:17:32.661142354 +0200
@@ -23,6 +25,7 @@
  compat/djgpp/math.h
  compat/float/float.h
  compat/float/limits.h
+libavcodec/aac/aacdec_ac.h
  libavcodec/bitstream_template.h
  tools/decode_simple.h
  Use of av_clip() where av_clip_uintp2() could be used:
Test source failed. Look at tests/data/fate/source.err for details.
make: *** [tests/Makefile:311: fate-source] Error 1

thx

[...]


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Fixed:
-#ifndef AVCODEC_AACDEC_AC_H
-#define AVCODEC_AACDEC_AC_H
+#ifndef AVCODEC_AAC_AACDEC_AC_H
+#define AVCODEC_AAC_AACDEC_AC_H

Thanks


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 06:54:44PM +0200, Lynne via ffmpeg-devel wrote:
> This commit adds a decoder for the frequency-domain part of USAC.
> 
> What works:
>  - Mono
>  - Stereo (no prediction)
>  - Stereo (mid/side coding)
>  - Stereo (complex prediction)
> 
> What's left:
>  - Speech coding
> 
> Known issues:
>  - Desync with certain sequences
>  - Preroll crossover missing (shouldn't matter, bitrate adaptation only)
> ---
>  libavcodec/aac/Makefile  |3 +-
>  libavcodec/aac/aacdec.c  |  188 +--
>  libavcodec/aac/aacdec.h  |  187 +++
>  libavcodec/aac/aacdec_ac.c   |  208 
>  libavcodec/aac/aacdec_ac.h   |   54 +
>  libavcodec/aac/aacdec_dsp_template.c |4 +-
>  libavcodec/aac/aacdec_latm.h |   14 +-
>  libavcodec/aac/aacdec_lpd.c  |  198 
>  libavcodec/aac/aacdec_lpd.h  |   33 +
>  libavcodec/aac/aacdec_usac.c | 1587 ++
>  libavcodec/aac/aacdec_usac.h |   39 +
>  libavcodec/aactab.c  |   42 +
>  libavcodec/aactab.h  |   10 +
>  13 files changed, 2491 insertions(+), 76 deletions(-)
>  create mode 100644 libavcodec/aac/aacdec_ac.c
>  create mode 100644 libavcodec/aac/aacdec_ac.h
>  create mode 100644 libavcodec/aac/aacdec_lpd.c
>  create mode 100644 libavcodec/aac/aacdec_lpd.h
>  create mode 100644 libavcodec/aac/aacdec_usac.c
>  create mode 100644 libavcodec/aac/aacdec_usac.h

seems to break fate

make  -j32 fate-source
TESTsource
--- ./tests/ref/fate/source 2024-05-20 01:14:59.40702 +0200
+++ tests/data/fate/source  2024-05-20 01:17:32.661142354 +0200
@@ -23,6 +25,7 @@
 compat/djgpp/math.h
 compat/float/float.h
 compat/float/limits.h
+libavcodec/aac/aacdec_ac.h
 libavcodec/bitstream_template.h
 tools/decode_simple.h
 Use of av_clip() where av_clip_uintp2() could be used:
Test source failed. Look at tests/data/fate/source.err for details.
make: *** [tests/Makefile:311: fate-source] Error 1

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-19 Thread Lynne via ffmpeg-devel

On 19/05/2024 21:39, Marton Balint wrote:



On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


This commit adds a decoder for the frequency-domain part of USAC.


[...]



+/* Finish later */
+static const enum AVChannel usac_ch_pos_to_av[64] = {
+    [0] = AV_CHAN_FRONT_LEFT,
+    [1] = AV_CHAN_FRONT_RIGHT,
+    [2] = AV_CHAN_FRONT_CENTER,
+    [3] = AV_CHAN_LOW_FREQUENCY,
+    [4] = AV_CHAN_BACK_LEFT, // unsure
+    [5] = AV_CHAN_BACK_RIGHT, // unsure
+    [6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
+    [7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
+    [8] = 0, /* rear surround left is missing */
+    [9] = 0, /* rear surround right is missing */
+    [10] = AV_CHAN_BACK_CENTER,
+    [11] = AV_CHAN_SURROUND_DIRECT_LEFT,
+    [12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
+    [13] = AV_CHAN_SIDE_LEFT, // fairly sure
+    [14] = AV_CHAN_SIDE_RIGHT, // fairly sure
+    [15] = AV_CHAN_WIDE_LEFT, // somewhat confident
+    [16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
+    [17] = AV_CHAN_TOP_FRONT_LEFT,
+    [18] = AV_CHAN_TOP_FRONT_RIGHT,
+    [19] = AV_CHAN_TOP_FRONT_CENTER,
+    [20] = AV_CHAN_TOP_BACK_LEFT,
+    [21] = AV_CHAN_TOP_BACK_RIGHT,
+    [22] = AV_CHAN_TOP_BACK_CENTER,
+    [23] = AV_CHAN_TOP_SIDE_LEFT,
+    [24] = AV_CHAN_TOP_SIDE_RIGHT,
+    [25] = AV_CHAN_TOP_CENTER,
+    [26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
+    [27] = AV_CHAN_BOTTOM_FRONT_LEFT,
+    [28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
+    [29] = AV_CHAN_BOTTOM_FRONT_CENTER,
+    [30] = 0, /* top left surround is missing */
+    [31] = 0, /* top right surround is missing */
+};


Some comment would be nice about the source of this table (which 
document, which table).


It looks very similar to the ISO channel positons used in mov_chan. I 
think we follow this mapping in most cases:


Left  Surround is SIDE_LEFT
Right Surround is SIDE_RIGHT
Rear Surround Left  is BACK_LEFT
Rear Surround Right is BACK_RIGHT

So in your table [4] and [5] should be SIDE, [8] and [9] should be BACK. 
[26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.


Yes, Left/Right Surround and Left/Right Side Surround will be the same, 
but those are not present in commonly used layouts at the same time.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Source of the table is ISO/IEC 23003-3, Table 74 — bsOutputChannelPos:

0 L left front FL front left
1 R right front FR front right
2 C center front FC front centre
3 LFE low frequency enhancement LFE1 low frequency effects-1
4 Ls left surround LS left surround
5 Rs right surround RS right surround
6 Lc left front center FLc front left centre
7 Rc right front center FRc front right centre
8 Lsr rear surround left BL back left
9 Rsr rear surround right BR back right
10 Cs rear center BC back centre
11 Lsd left surround direct LSd left surround direct
12 Rsd right surround direct RSd right surround direct
13 Lss left side surround SL side left
14 Rss right side surround SR side right
15 Lw left wide front FLw front left wide
16 Rw right wide front FRw front right wide
17 Lv left front vertical height TpFL top front left
18 Rv right front vertical height TpFR top front right
19 Cv center front vertical height TpFC top front centre
20 Lvr left surround vertical height rear TpBL top back left
21 Rvr right surround vertical height rear TpBR top back right
22 Cvr center vertical height rear TpBC top back centre
23 Lvss left vertical height side surround TpSiL top side left
24 Rvss right vertical height side surround TpSiR top side right
25 Ts top center surround TpC top centre
26 LFE2 low frequency enhancement 2 LFE2 low frequency effects-2
27 Lb left front vertical bottom BtFL bottom front left
28 Rb right front vertical bottom BtFR bottom front right
29 Cb center front vertical bottom BtFC bottom front centre
30 Lvs left vertical height surround TpLS top left surround
31 Rvs right vertical height surround TpRS top right surround

Third field is "Loudspeaker position", last field is "Loudspeaker
position according to IEC 100/1706/CDV/IEC 62574 (TC100)", each prefixed 
with an abbreviation.


I've added the source to the table comment in the code.

I've also fixed the SIDE/BACK/LFE2 issue in my github repo I linked earlier.

Thanks.


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-19 Thread Marton Balint




On Sun, 19 May 2024, Lynne via ffmpeg-devel wrote:


This commit adds a decoder for the frequency-domain part of USAC.


[...]



+/* Finish later */
+static const enum AVChannel usac_ch_pos_to_av[64] = {
+[0] = AV_CHAN_FRONT_LEFT,
+[1] = AV_CHAN_FRONT_RIGHT,
+[2] = AV_CHAN_FRONT_CENTER,
+[3] = AV_CHAN_LOW_FREQUENCY,
+[4] = AV_CHAN_BACK_LEFT, // unsure
+[5] = AV_CHAN_BACK_RIGHT, // unsure
+[6] = AV_CHAN_FRONT_LEFT_OF_CENTER,
+[7] = AV_CHAN_FRONT_RIGHT_OF_CENTER,
+[8] = 0, /* rear surround left is missing */
+[9] = 0, /* rear surround right is missing */
+[10] = AV_CHAN_BACK_CENTER,
+[11] = AV_CHAN_SURROUND_DIRECT_LEFT,
+[12] = AV_CHAN_SURROUND_DIRECT_RIGHT,
+[13] = AV_CHAN_SIDE_LEFT, // fairly sure
+[14] = AV_CHAN_SIDE_RIGHT, // fairly sure
+[15] = AV_CHAN_WIDE_LEFT, // somewhat confident
+[16] = AV_CHAN_WIDE_RIGHT, // somewhat confident
+[17] = AV_CHAN_TOP_FRONT_LEFT,
+[18] = AV_CHAN_TOP_FRONT_RIGHT,
+[19] = AV_CHAN_TOP_FRONT_CENTER,
+[20] = AV_CHAN_TOP_BACK_LEFT,
+[21] = AV_CHAN_TOP_BACK_RIGHT,
+[22] = AV_CHAN_TOP_BACK_CENTER,
+[23] = AV_CHAN_TOP_SIDE_LEFT,
+[24] = AV_CHAN_TOP_SIDE_RIGHT,
+[25] = AV_CHAN_TOP_CENTER,
+[26] = AV_CHAN_LOW_FREQUENCY, // actually LFE2
+[27] = AV_CHAN_BOTTOM_FRONT_LEFT,
+[28] = AV_CHAN_BOTTOM_FRONT_RIGHT,
+[29] = AV_CHAN_BOTTOM_FRONT_CENTER,
+[30] = 0, /* top left surround is missing */
+[31] = 0, /* top right surround is missing */
+};


Some comment would be nice about the source of this table (which 
document, which table).


It looks very similar to the ISO channel positons used in mov_chan. I 
think we follow this mapping in most cases:


Left  Surround is SIDE_LEFT
Right Surround is SIDE_RIGHT
Rear Surround Left  is BACK_LEFT
Rear Surround Right is BACK_RIGHT

So in your table [4] and [5] should be SIDE, [8] and [9] should be 
BACK. [26] can be AV_CHAN_LOW_FREQUENCY_2, we do have that.


Yes, Left/Right Surround and Left/Right Side Surround will be the same, 
but those are not present in commonly used layouts at the same time.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".