[FFmpeg-cvslog] avcodec/aacps: Move initializing common stuff to aacdec_common.c
Andreas Rheinhardt
git at videolan.org
Tue Oct 31 23:20:00 EET 2023
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Sep 25 01:46:50 2023 +0200| [4fe91e3676a1885d0e00321963845aa3acc6eee0] | committer: Andreas Rheinhardt
avcodec/aacps: Move initializing common stuff to aacdec_common.c
ff_ps_init() initializes some tables for AAC parametric stereo
and some of them are only valid for the fixed- or floating-point
decoder, whereas others (namely VLCs) are valid for both.
The latter are therefore initialized by ff_ps_init_common()
and because the two versions of ff_ps_init() can be run
concurrently, it is guarded by an AVOnce.
Yet now that there is ff_aacdec_common_init_once() there is
a better way to do this: Call ff_ps_init_common()
from ff_aacdec_common_init_once(). That way there is no need
to guard ff_ps_init_common() by an AVOnce any more.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fe91e3676a1885d0e00321963845aa3acc6eee0
---
libavcodec/aacdec_common.c | 3 +++
libavcodec/aacps.c | 1 -
libavcodec/aacps_common.c | 9 +--------
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index 4af60e8c7c..75368b7075 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -27,6 +27,7 @@
#include "aac.h"
#include "aacdectab.h"
+#include "aacps.h"
#include "aactab.h"
#include "vlc.h"
@@ -312,6 +313,8 @@ static av_cold void aacdec_common_init(void)
sbr_vlc_offsets[i], 0);
tab += sbr_huffman_nb_codes[i];
}
+
+ ff_ps_init_common();
}
av_cold void ff_aacdec_common_init_once(void)
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index ed00006a3a..5a3e6b3dfd 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -739,7 +739,6 @@ int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][
av_cold void AAC_RENAME(ff_ps_init)(void) {
ps_tableinit();
- ff_ps_init_common();
}
av_cold void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
diff --git a/libavcodec/aacps_common.c b/libavcodec/aacps_common.c
index 11bdb960cf..6b5493d4c2 100644
--- a/libavcodec/aacps_common.c
+++ b/libavcodec/aacps_common.c
@@ -21,7 +21,6 @@
#include <stdint.h>
#include "libavutil/common.h"
-#include "libavutil/thread.h"
#include "aacps.h"
#include "get_bits.h"
#include "aacpsdata.c"
@@ -298,7 +297,7 @@ err:
#define PS_VLC_ROW(name) \
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
-static av_cold void ps_init_common(void)
+av_cold void ff_ps_init_common(void)
{
// Syntax initialization
static const struct {
@@ -328,9 +327,3 @@ static av_cold void ps_init_common(void)
PS_INIT_VLC_STATIC(8, 5, 32);
PS_INIT_VLC_STATIC(9, 5, 32);
}
-
-av_cold void ff_ps_init_common(void)
-{
- static AVOnce init_static_once = AV_ONCE_INIT;
- ff_thread_once(&init_static_once, ps_init_common);
-}
More information about the ffmpeg-cvslog
mailing list