Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lynne <dev@lynne.ee>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] aactab: add and initialize 2D VLC tables for USAC Mps212
Date: Mon, 5 May 2025 16:48:22 +0200
Message-ID: <e6e239d7-e36c-4981-85c0-5c2b6a1e08c9@lynne.ee> (raw)
In-Reply-To: <AS8P250MB07441F15886FEE5ADBD07AB78F8E2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1.1.1: Type: text/plain, Size: 4608 bytes --]

On 05/05/2025 15:52, Andreas Rheinhardt wrote:
> Lynne:
>> ---
>>   libavcodec/aac/aacdec_tab.c |   54 ++
>>   libavcodec/aactab.c         | 1820 +++++++++++++++++++++++++++++++++++
>>   libavcodec/aactab.h         |   20 +
>>   3 files changed, 1894 insertions(+)
>>
> 
> 1. This should only be applied if it is used which this patch does not.

Just posting this for reviews.
>> diff --git a/libavcodec/aac/aacdec_tab.c b/libavcodec/aac/aacdec_tab.c
>> index 45a84a9a72..5ba20c0d8a 100644
>> --- a/libavcodec/aac/aacdec_tab.c
>> +++ b/libavcodec/aac/aacdec_tab.c
>> @@ -111,6 +111,16 @@ const AVChannelLayout ff_aac_ch_layout[] = {
>>   VLCElem ff_vlc_scalefactors[352];
>>   const VLCElem *ff_vlc_spectral[11];
>>   
>> +const VLCElem *ff_vlc_cld_lav3_2D[2][2];
>> +const VLCElem *ff_vlc_cld_lav5_2D[2][2];
>> +const VLCElem *ff_vlc_cld_lav7_2D[2][2];
>> +const VLCElem *ff_vlc_cld_lav9_2D[2][2];
>> +
>> +const VLCElem *ff_vlc_icc_lav1_2D[2][2];
>> +const VLCElem *ff_vlc_icc_lav3_2D[2][2];
>> +const VLCElem *ff_vlc_icc_lav5_2D[2][2];
>> +const VLCElem *ff_vlc_icc_lav7_2D[2][2];
>> +
>>   /// Huffman tables for SBR
>>   
>>   static const uint8_t sbr_huffman_tab[][2] = {
>> @@ -279,6 +289,50 @@ static av_cold void aacdec_common_init(void)
>>                                         0);
>>       }
>>   
>> +#define LAV_N_PAIR(NAME, NB) \
>> +    ff_vlc_ ## NAME[0][0] = ff_vlc_init_tables(&state, NB, NB, \
>> +                                               ff_aac_ ## NAME ## _0_0_bits, \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_0_bits), \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_0_bits), \
>> +                                               ff_aac_ ## NAME ## _0_0_codes, \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_0_codes), \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_0_codes), \
>> +                                               0); \
>> +    ff_vlc_ ## NAME[0][1] = ff_vlc_init_tables(&state, NB, NB, \
>> +                                               ff_aac_ ## NAME ## _0_1_bits, \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_1_bits), \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_1_bits), \
>> +                                               ff_aac_ ## NAME ## _0_1_codes, \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_1_codes), \
>> +                                               sizeof(ff_aac_ ## NAME ## _0_1_codes), \
>> +                                               0); \
>> +    ff_vlc_ ## NAME[1][0] = ff_vlc_init_tables(&state, NB, NB, \
>> +                                               ff_aac_ ## NAME ## _1_0_bits, \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_0_bits), \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_0_bits), \
>> +                                               ff_aac_ ## NAME ## _1_0_codes, \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_0_codes), \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_0_codes), \
>> +                                               0); \
>> +    ff_vlc_ ## NAME[1][1] = ff_vlc_init_tables(&state, NB, NB, \
>> +                                               ff_aac_ ## NAME ## _1_1_bits, \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_1_bits), \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_1_bits), \
>> +                                               ff_aac_ ## NAME ## _1_1_codes, \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_1_codes), \
>> +                                               sizeof(ff_aac_ ## NAME ## _1_1_codes), \
>> +                                               0);
> 
> 2. I am very much surprised that it works at all (does it?). You use the
> same state and therefore the same static storage as before; you add new
> VLCs, yet you do not increase the size of vlc_buf.

The tables are all rather small.

> 3. Can't you initialize this in a loop like ff_aac_sbr_vlc? This would
> remove code duplication as well as relocations.

I didn't know that was possible. vlc.h is poorly documented, with many 
overlapping, wrapped, renamed and macro'd functions that code from 
different decade have gotten adapted to.

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 637 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

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

  reply	other threads:[~2025-05-05 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05  7:18 Lynne
2025-05-05 13:52 ` Andreas Rheinhardt
2025-05-05 14:48   ` Lynne [this message]
2025-05-05 14:57     ` Andreas Rheinhardt
2025-05-05 15:02       ` Lynne
2025-05-06 17:59 ` Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6e239d7-e36c-4981-85c0-5c2b6a1e08c9@lynne.ee \
    --to=dev@lynne.ee \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git