diff mbox series

[FFmpeg-devel,3/5] avutil/tx_template: Don't waste space for inexistent factors

Message ID AS8P250MB074401A2AF976238F94F118B8F2C9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 2af5f55b2e28d3ac4f055aacba3700075268164f
Headers show
Series [FFmpeg-devel,1/5] avformat/argo_cvg: Mark overrides as const | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 22, 2022, 1:59 p.m. UTC
It is possible to avoid the factors array for the power-of-two
tables for which said array is unused by using a different
structure for initialization the same structure for power-of-two
tables as for non-power-of-two-tables. This saves 3*15*16B
from .data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/tx_template.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index 6b63cc575f..b44a6189cc 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -55,9 +55,14 @@  TABLE_DEF( 9,  8);
 typedef struct FFSRTabsInitOnce {
     void (*func)(void);
     AVOnce control;
-    int factors[TX_MAX_SUB]; /* Must be sorted high -> low */
 } FFSRTabsInitOnce;
 
+typedef struct FFSRTabsInitOnceExt {
+    void (*func)(void);
+    AVOnce control;
+    int factors[TX_MAX_SUB]; /* Must be sorted high -> low */
+} FFSRTabsInitOnceExt;
+
 #define INIT_FF_SR_TAB(len)                                        \
 static av_cold void TX_TAB(ff_tx_init_tab_ ##len)(void)            \
 {                                                                  \
@@ -145,7 +150,7 @@  static av_cold void TX_TAB(ff_tx_init_tab_9)(void)
     TX_TAB(ff_tx_tab_9)[7] = TX_TAB(ff_tx_tab_9)[3] - TX_TAB(ff_tx_tab_9)[4];
 }
 
-static FFSRTabsInitOnce nptwo_tabs_init_once[] = {
+static FFSRTabsInitOnceExt nptwo_tabs_init_once[] = {
     { TX_TAB(ff_tx_init_tab_53),      AV_ONCE_INIT, { 15, 5, 3 } },
     { TX_TAB(ff_tx_init_tab_9),       AV_ONCE_INIT, {  9 }       },
     { TX_TAB(ff_tx_init_tab_7),       AV_ONCE_INIT, {  7 }       },