Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 12/13] avcodec/dca_lbr: Hardcode lpc table to save space
Date: Tue, 13 Sep 2022 13:33:09 +0200
Message-ID: <GV1P250MB0737FE432B494D184BD6F7DD8F479@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB0737F59A25C260BC89CFE14F8F479@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

The code to initialize it takes more space (in .text) than
the table to be initialized (namely 86B vs 64B for GCC 11.2
with -O3 in an av_cold function), so hardcode the table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dca_lbr.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dca_lbr.c b/libavcodec/dca_lbr.c
index 579bd9c469..9a0eb62f06 100644
--- a/libavcodec/dca_lbr.c
+++ b/libavcodec/dca_lbr.c
@@ -119,7 +119,17 @@ static const uint16_t channel_layouts[7] = {
 };
 
 static float    cos_tab[256];
-static float    lpc_tab[16];
+static const float lpc_tab[16] = {
+    /* lpc_tab[i] = sin((i - 8) * (M_PI / ((i < 8) ? 17 : 15))) */
+    -0.995734176295034521871191178905, -0.961825643172819070408796290732,
+    -0.895163291355062322067016499754, -0.798017227280239503332805112796,
+    -0.673695643646557211712691912426, -0.526432162877355800244607799141,
+    -0.361241666187152948744714596184, -0.183749517816570331574408839621,
+     0.0,                               0.207911690817759337101742284405,
+     0.406736643075800207753985990341,  0.587785252292473129168705954639,
+     0.743144825477394235014697048974,  0.866025403784438646763723170753,
+     0.951056516295153572116439333379,  0.994521895368273336922691944981
+};
 
 av_cold void ff_dca_lbr_init_tables(void)
 {
@@ -127,9 +137,6 @@ av_cold void ff_dca_lbr_init_tables(void)
 
     for (i = 0; i < 256; i++)
         cos_tab[i] = cos(M_PI * i / 128);
-
-    for (i = 0; i < 16; i++)
-        lpc_tab[i] = sin((i - 8) * (M_PI / ((i < 8) ? 17 : 15)));
 }
 
 static int parse_lfe_24(DCALbrDecoder *s)
-- 
2.34.1

_______________________________________________
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".

  parent reply	other threads:[~2022-09-13 11:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 11:28 [FFmpeg-devel] [PATCH 01/13] avcodec/dolby_e_parser: Remove unnecessary headers Andreas Rheinhardt
2022-09-13 11:32 ` [FFmpeg-devel] [PATCH 02/13] avcodec/dcahuff: Remove unused define Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 03/13] avcodec/dcahuff: Avoid redundant offset table Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 04/13] avcodec/dca_core, dcahuff: Don't use DCAVLC unnecessarily Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 05/13] avcodec/dcahuff: Always use three bits for transition mode VLCs Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 06/13] avcodec/dcaenc: Create encoder-adapted tables Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 07/13] avcodec/dcahuff: Combine tables, use ff_init_vlc_from_lengths() Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 08/13] avcodec/dcahuff, dca_core, dca_lbr: Apply offset during VLC creation Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 09/13] avcodec/dca_core: Inline number of bits of scale factor VLCs Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 10/13] avcodec/dca_core: Don't use too big max_depth in get_vlc2() Andreas Rheinhardt
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 11/13] avcodec/dcahuff: Replace DCAVLC by ordinary VLCs Andreas Rheinhardt
2022-09-13 11:33 ` Andreas Rheinhardt [this message]
2022-09-13 11:33 ` [FFmpeg-devel] [PATCH 13/13] avcodec/dca_lbr: Inline nb_bits for VLCs Andreas Rheinhardt
2022-09-15 19:34 ` [FFmpeg-devel] [PATCH 01/13] avcodec/dolby_e_parser: Remove unnecessary headers Andreas Rheinhardt

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=GV1P250MB0737FE432B494D184BD6F7DD8F479@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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