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

Lynne dev at lynne.ee
Wed May 22 23:25:05 EEST 2024


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
>>>  <ffmpeg-devel at ffmpeg.org> 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

Fixed both, thanks.
I'll keep AV_CHANNEL_ORDER_NATIVE as-is because its just more readable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240522/61fc201c/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240522/61fc201c/attachment.sig>


More information about the ffmpeg-devel mailing list