Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function
@ 2022-05-12 12:19 Andreas Rheinhardt
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 2/3] avcodec/ac3tab: Move some tables only used by ac3.c to it Andreas Rheinhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-12 12:19 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Removed in 7b11eead1b4e08728561595e6b610cf8fe2b7122.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/ac3.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index dabd49f4cc..8e66d47629 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -214,8 +214,6 @@ typedef enum {
     EAC3_FRAME_TYPE_RESERVED
 } EAC3FrameType;
 
-void ff_ac3_common_init(void);
-
 /**
  * Calculate the log power-spectral density of the input signal.
  * This gives a rough estimate of signal power in the frequency domain by using
-- 
2.32.0

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avcodec/ac3tab: Move some tables only used by ac3.c to it
  2022-05-12 12:19 [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
@ 2022-05-12 12:21 ` Andreas Rheinhardt
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h Andreas Rheinhardt
  2022-05-13 17:04 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-12 12:21 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/ac3.c    | 86 +++++++++++++++++++++++++++++++++++++++++++--
 libavcodec/ac3tab.c | 82 ------------------------------------------
 libavcodec/ac3tab.h |  2 --
 3 files changed, 84 insertions(+), 86 deletions(-)

diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index e1d0f12073..01fb3b3d7a 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -68,6 +68,88 @@ const uint8_t ff_ac3_bin_to_band_tab[253] = {
     49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
 };
 
+static const uint8_t ac3_log_add_tab[260]= {
+0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
+0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
+0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
+0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
+0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
+0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
+0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
+0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
+0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
+0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
+0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
+0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
+0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
+0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
+0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
+0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
+0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
+0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+static const uint16_t ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3]= {
+{ 0x04d0,0x04f0,0x0580 },
+{ 0x04d0,0x04f0,0x0580 },
+{ 0x0440,0x0460,0x04b0 },
+{ 0x0400,0x0410,0x0450 },
+{ 0x03e0,0x03e0,0x0420 },
+{ 0x03c0,0x03d0,0x03f0 },
+{ 0x03b0,0x03c0,0x03e0 },
+{ 0x03b0,0x03b0,0x03d0 },
+{ 0x03a0,0x03b0,0x03c0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03a0 },
+{ 0x0390,0x03a0,0x03a0 },
+{ 0x0390,0x0390,0x03a0 },
+{ 0x0390,0x0390,0x03a0 },
+{ 0x0380,0x0390,0x03a0 },
+{ 0x0380,0x0380,0x03a0 },
+{ 0x0370,0x0380,0x03a0 },
+{ 0x0370,0x0380,0x03a0 },
+{ 0x0360,0x0370,0x0390 },
+{ 0x0360,0x0370,0x0390 },
+{ 0x0350,0x0360,0x0390 },
+{ 0x0350,0x0360,0x0390 },
+{ 0x0340,0x0350,0x0380 },
+{ 0x0340,0x0350,0x0380 },
+{ 0x0330,0x0340,0x0380 },
+{ 0x0320,0x0340,0x0370 },
+{ 0x0310,0x0320,0x0360 },
+{ 0x0300,0x0310,0x0350 },
+{ 0x02f0,0x0300,0x0340 },
+{ 0x02f0,0x02f0,0x0330 },
+{ 0x02f0,0x02f0,0x0320 },
+{ 0x02f0,0x02f0,0x0310 },
+{ 0x0300,0x02f0,0x0300 },
+{ 0x0310,0x0300,0x02f0 },
+{ 0x0340,0x0320,0x02f0 },
+{ 0x0390,0x0350,0x02f0 },
+{ 0x03e0,0x0390,0x0300 },
+{ 0x0420,0x03e0,0x0310 },
+{ 0x0460,0x0420,0x0330 },
+{ 0x0490,0x0450,0x0350 },
+{ 0x04a0,0x04a0,0x03c0 },
+{ 0x0460,0x0490,0x0410 },
+{ 0x0440,0x0460,0x0470 },
+{ 0x0440,0x0440,0x04a0 },
+{ 0x0520,0x0480,0x0460 },
+{ 0x0800,0x0630,0x0440 },
+{ 0x0840,0x0840,0x0450 },
+{ 0x0840,0x0840,0x04e0 },
+};
+
 static inline int calc_lowcomp1(int a, int b0, int b1, int c)
 {
     if ((b0 + 256) == b1) {
@@ -109,7 +191,7 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
             int max = FFMAX(v, psd[bin]);
             /* logadd */
             int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255);
-            v = max + ff_ac3_log_add_tab[adr];
+            v = max + ac3_log_add_tab[adr];
         }
         band_psd[band++] = v;
     } while (end > ff_ac3_band_start_tab[band]);
@@ -183,7 +265,7 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
         if (tmp > 0) {
             excite[band] += tmp >> 2;
         }
-        mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
+        mask[band] = FFMAX(ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
     }
 
     /* delta bit allocation */
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 766e293a1d..9344368a99 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -114,88 +114,6 @@ const uint8_t ff_eac3_default_cpl_band_struct[18] = {
     0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1
 };
 
-const uint8_t ff_ac3_log_add_tab[260]= {
-0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
-0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
-0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
-0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
-0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
-0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
-0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
-0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
-0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
-0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
-0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
-0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
-0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
-0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
-0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
-0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-
-const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3]= {
-{ 0x04d0,0x04f0,0x0580 },
-{ 0x04d0,0x04f0,0x0580 },
-{ 0x0440,0x0460,0x04b0 },
-{ 0x0400,0x0410,0x0450 },
-{ 0x03e0,0x03e0,0x0420 },
-{ 0x03c0,0x03d0,0x03f0 },
-{ 0x03b0,0x03c0,0x03e0 },
-{ 0x03b0,0x03b0,0x03d0 },
-{ 0x03a0,0x03b0,0x03c0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03a0 },
-{ 0x0390,0x03a0,0x03a0 },
-{ 0x0390,0x0390,0x03a0 },
-{ 0x0390,0x0390,0x03a0 },
-{ 0x0380,0x0390,0x03a0 },
-{ 0x0380,0x0380,0x03a0 },
-{ 0x0370,0x0380,0x03a0 },
-{ 0x0370,0x0380,0x03a0 },
-{ 0x0360,0x0370,0x0390 },
-{ 0x0360,0x0370,0x0390 },
-{ 0x0350,0x0360,0x0390 },
-{ 0x0350,0x0360,0x0390 },
-{ 0x0340,0x0350,0x0380 },
-{ 0x0340,0x0350,0x0380 },
-{ 0x0330,0x0340,0x0380 },
-{ 0x0320,0x0340,0x0370 },
-{ 0x0310,0x0320,0x0360 },
-{ 0x0300,0x0310,0x0350 },
-{ 0x02f0,0x0300,0x0340 },
-{ 0x02f0,0x02f0,0x0330 },
-{ 0x02f0,0x02f0,0x0320 },
-{ 0x02f0,0x02f0,0x0310 },
-{ 0x0300,0x02f0,0x0300 },
-{ 0x0310,0x0300,0x02f0 },
-{ 0x0340,0x0320,0x02f0 },
-{ 0x0390,0x0350,0x02f0 },
-{ 0x03e0,0x0390,0x0300 },
-{ 0x0420,0x03e0,0x0310 },
-{ 0x0460,0x0420,0x0330 },
-{ 0x0490,0x0450,0x0350 },
-{ 0x04a0,0x04a0,0x03c0 },
-{ 0x0460,0x0490,0x0410 },
-{ 0x0440,0x0460,0x0470 },
-{ 0x0440,0x0440,0x04a0 },
-{ 0x0520,0x0480,0x0460 },
-{ 0x0800,0x0630,0x0440 },
-{ 0x0840,0x0840,0x0450 },
-{ 0x0840,0x0840,0x04e0 },
-};
-
 const uint8_t ff_ac3_bap_tab[64]= {
     0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
     3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index bc470204fe..2d8d3a57f9 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -34,8 +34,6 @@ extern const int      ff_ac3_sample_rate_tab[];
 extern const uint16_t ff_ac3_bitrate_tab[19];
 extern const uint8_t  ff_ac3_rematrix_band_tab[5];
 extern const uint8_t  ff_eac3_default_cpl_band_struct[18];
-extern const uint8_t  ff_ac3_log_add_tab[260];
-extern const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3];
 extern const uint8_t  ff_ac3_bap_tab[64];
 extern const uint8_t  ff_ac3_slow_decay_tab[4];
 extern const uint8_t  ff_ac3_fast_decay_tab[4];
-- 
2.32.0

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h
  2022-05-12 12:19 [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 2/3] avcodec/ac3tab: Move some tables only used by ac3.c to it Andreas Rheinhardt
@ 2022-05-12 12:21 ` Andreas Rheinhardt
  2022-05-12 12:40   ` Andreas Rheinhardt
  2022-05-13 17:04 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
  2 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-12 12:21 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Move AC3HeaderInfo into ac3_parser_internal.h and the rest
into a new header ac3defs.h.

This also breaks an include cycle of ac3.h and ac3tab.h
(the latter now only needs ac3defs.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/ac3.c                    |   1 +
 libavcodec/ac3.h                    | 115 ----------------------------
 libavcodec/ac3_parser.c             |   2 +
 libavcodec/ac3_parser_internal.h    |  41 +++++++++-
 libavcodec/ac3dec.c                 |   1 +
 libavcodec/ac3dec_data.c            |   1 -
 libavcodec/ac3defs.h                | 104 +++++++++++++++++++++++++
 libavcodec/ac3dsp.c                 |   3 +-
 libavcodec/ac3enc.c                 |   2 +
 libavcodec/ac3enc.h                 |   1 +
 libavcodec/ac3tab.c                 |   1 -
 libavcodec/ac3tab.h                 |   2 +-
 libavcodec/eac3_data.c              |   2 +-
 libavcodec/mips/ac3dsp_mips.c       |   1 +
 libavcodec/x86/ac3dsp_init.c        |   1 -
 libavformat/hls_sample_encryption.c |   1 +
 libavformat/spdifdec.c              |   2 +-
 libavformat/spdifenc.c              |   2 +-
 18 files changed, 159 insertions(+), 124 deletions(-)
 create mode 100644 libavcodec/ac3defs.h

diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index 01fb3b3d7a..60491d1a7a 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -28,6 +28,7 @@
 #include "libavutil/macros.h"
 
 #include "ac3.h"
+#include "ac3defs.h"
 
 /**
  * Starting frequency coefficient bin for each critical band.
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index 8e66d47629..29f9f9df8d 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -30,28 +30,8 @@
 #include <math.h>
 #include <stdint.h>
 
-#define EAC3_MAX_CHANNELS 16          /**< maximum number of channels in EAC3 */
-#define AC3_MAX_CHANNELS 7            /**< maximum number of channels, including coupling channel */
-#define CPL_CH 0                      /**< coupling channel index */
-
-#define AC3_MAX_COEFS   256
-#define AC3_BLOCK_SIZE  256
-#define AC3_MAX_BLOCKS    6
-#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
-#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
-#define AC3_CRITICAL_BANDS 50
-#define AC3_MAX_CPL_BANDS  18
-
 #include "ac3tab.h"
 
-/* exponent encoding strategy */
-#define EXP_REUSE 0
-#define EXP_NEW   1
-
-#define EXP_D15   1
-#define EXP_D25   2
-#define EXP_D45   3
-
 #ifndef USE_FIXED
 #define USE_FIXED 0
 #endif
@@ -112,58 +92,6 @@ typedef float                   SHORTFLOAT;
 #define LEVEL_ZERO              0.0000000000000000
 #define LEVEL_ONE               1.0000000000000000
 
-/** Delta bit allocation strategy */
-typedef enum {
-    DBA_REUSE = 0,
-    DBA_NEW,
-    DBA_NONE,
-    DBA_RESERVED
-} AC3DeltaStrategy;
-
-/** Channel mode (audio coding mode) */
-typedef enum {
-    AC3_CHMODE_DUALMONO = 0,
-    AC3_CHMODE_MONO,
-    AC3_CHMODE_STEREO,
-    AC3_CHMODE_3F,
-    AC3_CHMODE_2F1R,
-    AC3_CHMODE_3F1R,
-    AC3_CHMODE_2F2R,
-    AC3_CHMODE_3F2R
-} AC3ChannelMode;
-
-/** Dolby Surround mode */
-typedef enum AC3DolbySurroundMode {
-    AC3_DSURMOD_NOTINDICATED = 0,
-    AC3_DSURMOD_OFF,
-    AC3_DSURMOD_ON,
-    AC3_DSURMOD_RESERVED
-} AC3DolbySurroundMode;
-
-/** Dolby Surround EX mode */
-typedef enum AC3DolbySurroundEXMode {
-    AC3_DSUREXMOD_NOTINDICATED = 0,
-    AC3_DSUREXMOD_OFF,
-    AC3_DSUREXMOD_ON,
-    AC3_DSUREXMOD_PLIIZ
-} AC3DolbySurroundEXMode;
-
-/** Dolby Headphone mode */
-typedef enum AC3DolbyHeadphoneMode {
-    AC3_DHEADPHONMOD_NOTINDICATED = 0,
-    AC3_DHEADPHONMOD_OFF,
-    AC3_DHEADPHONMOD_ON,
-    AC3_DHEADPHONMOD_RESERVED
-} AC3DolbyHeadphoneMode;
-
-/** Preferred Stereo Downmix mode */
-typedef enum AC3PreferredStereoDownmixMode {
-    AC3_DMIXMOD_NOTINDICATED = 0,
-    AC3_DMIXMOD_LTRT,
-    AC3_DMIXMOD_LORO,
-    AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2
-} AC3PreferredStereoDownmixMode;
-
 typedef struct AC3BitAllocParameters {
     int sr_code;
     int sr_shift;
@@ -171,49 +99,6 @@ typedef struct AC3BitAllocParameters {
     int cpl_fast_leak, cpl_slow_leak;
 } AC3BitAllocParameters;
 
-/**
- * @struct AC3HeaderInfo
- * Coded AC-3 header values up to the lfeon element, plus derived values.
- */
-typedef struct AC3HeaderInfo {
-    /** @name Coded elements
-     * @{
-     */
-    uint16_t sync_word;
-    uint16_t crc1;
-    uint8_t sr_code;
-    uint8_t bitstream_id;
-    uint8_t bitstream_mode;
-    uint8_t channel_mode;
-    uint8_t lfe_on;
-    uint8_t frame_type;
-    int substreamid;                        ///< substream identification
-    int center_mix_level;                   ///< Center mix level index
-    int surround_mix_level;                 ///< Surround mix level index
-    uint16_t channel_map;
-    int num_blocks;                         ///< number of audio blocks
-    int dolby_surround_mode;
-    /** @} */
-
-    /** @name Derived values
-     * @{
-     */
-    uint8_t sr_shift;
-    uint16_t sample_rate;
-    uint32_t bit_rate;
-    uint8_t channels;
-    uint16_t frame_size;
-    uint64_t channel_layout;
-    /** @} */
-} AC3HeaderInfo;
-
-typedef enum {
-    EAC3_FRAME_TYPE_INDEPENDENT = 0,
-    EAC3_FRAME_TYPE_DEPENDENT,
-    EAC3_FRAME_TYPE_AC3_CONVERT,
-    EAC3_FRAME_TYPE_RESERVED
-} EAC3FrameType;
-
 /**
  * Calculate the log power-spectral density of the input signal.
  * This gives a rough estimate of signal power in the frequency domain by using
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 86e8d417eb..119b1598c5 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -25,6 +25,8 @@
 
 #include "libavutil/channel_layout.h"
 #include "parser.h"
+#include "ac3defs.h"
+#include "ac3tab.h"
 #include "ac3_parser.h"
 #include "ac3_parser_internal.h"
 #include "aac_ac3_parser.h"
diff --git a/libavcodec/ac3_parser_internal.h b/libavcodec/ac3_parser_internal.h
index 3648802a73..dd57dc95a6 100644
--- a/libavcodec/ac3_parser_internal.h
+++ b/libavcodec/ac3_parser_internal.h
@@ -21,9 +21,48 @@
 #ifndef AVCODEC_AC3_PARSER_INTERNAL_H
 #define AVCODEC_AC3_PARSER_INTERNAL_H
 
-#include "ac3.h"
+#include <stddef.h>
+#include <stdint.h>
+
+#include "ac3defs.h"
 #include "get_bits.h"
 
+/**
+ * @struct AC3HeaderInfo
+ * Coded AC-3 header values up to the lfeon element, plus derived values.
+ */
+typedef struct AC3HeaderInfo {
+    /** @name Coded elements
+     * @{
+     */
+    uint16_t sync_word;
+    uint16_t crc1;
+    uint8_t sr_code;
+    uint8_t bitstream_id;
+    uint8_t bitstream_mode;
+    uint8_t channel_mode;
+    uint8_t lfe_on;
+    uint8_t frame_type;
+    int substreamid;                        ///< substream identification
+    int center_mix_level;                   ///< Center mix level index
+    int surround_mix_level;                 ///< Surround mix level index
+    uint16_t channel_map;
+    int num_blocks;                         ///< number of audio blocks
+    int dolby_surround_mode;
+    /** @} */
+
+    /** @name Derived values
+     * @{
+     */
+    uint8_t sr_shift;
+    uint16_t sample_rate;
+    uint32_t bit_rate;
+    uint8_t channels;
+    uint16_t frame_size;
+    uint64_t channel_layout;
+    /** @} */
+} AC3HeaderInfo;
+
 /**
  * Parse AC-3 frame header.
  * Parse the header up to the lfeon element, which is the first 52 or 54 bits
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index fe330d0d3b..ad2b3615c8 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -43,6 +43,7 @@
 #include "ac3_parser_internal.h"
 #include "ac3dec.h"
 #include "ac3dec_data.h"
+#include "ac3defs.h"
 #include "kbdwin.h"
 
 /**
diff --git a/libavcodec/ac3dec_data.c b/libavcodec/ac3dec_data.c
index d0a9b1ec40..a3794ab223 100644
--- a/libavcodec/ac3dec_data.c
+++ b/libavcodec/ac3dec_data.c
@@ -25,7 +25,6 @@
  */
 
 #include "ac3dec_data.h"
-#include "ac3.h"
 
 /**
  * Table used to ungroup 3 values stored in 5 bits.
diff --git a/libavcodec/ac3defs.h b/libavcodec/ac3defs.h
new file mode 100644
index 0000000000..ff92f0ac4a
--- /dev/null
+++ b/libavcodec/ac3defs.h
@@ -0,0 +1,104 @@
+/*
+ * Common AC-3 definitions
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AC3DEFS_H
+#define AVCODEC_AC3DEFS_H
+
+#define EAC3_MAX_CHANNELS 16          /**< maximum number of channels in EAC3 */
+#define AC3_MAX_CHANNELS 7            /**< maximum number of channels, including coupling channel */
+#define CPL_CH 0                      /**< coupling channel index */
+
+#define AC3_MAX_COEFS   256
+#define AC3_BLOCK_SIZE  256
+#define AC3_MAX_BLOCKS    6
+#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
+#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
+#define AC3_CRITICAL_BANDS 50
+#define AC3_MAX_CPL_BANDS  18
+
+/* exponent encoding strategy */
+#define EXP_REUSE 0
+#define EXP_NEW   1
+
+#define EXP_D15   1
+#define EXP_D25   2
+#define EXP_D45   3
+
+/** Delta bit allocation strategy */
+typedef enum {
+    DBA_REUSE = 0,
+    DBA_NEW,
+    DBA_NONE,
+    DBA_RESERVED
+} AC3DeltaStrategy;
+
+/** Channel mode (audio coding mode) */
+typedef enum {
+    AC3_CHMODE_DUALMONO = 0,
+    AC3_CHMODE_MONO,
+    AC3_CHMODE_STEREO,
+    AC3_CHMODE_3F,
+    AC3_CHMODE_2F1R,
+    AC3_CHMODE_3F1R,
+    AC3_CHMODE_2F2R,
+    AC3_CHMODE_3F2R
+} AC3ChannelMode;
+
+/** Dolby Surround mode */
+typedef enum AC3DolbySurroundMode {
+    AC3_DSURMOD_NOTINDICATED = 0,
+    AC3_DSURMOD_OFF,
+    AC3_DSURMOD_ON,
+    AC3_DSURMOD_RESERVED
+} AC3DolbySurroundMode;
+
+/** Dolby Surround EX mode */
+typedef enum AC3DolbySurroundEXMode {
+    AC3_DSUREXMOD_NOTINDICATED = 0,
+    AC3_DSUREXMOD_OFF,
+    AC3_DSUREXMOD_ON,
+    AC3_DSUREXMOD_PLIIZ
+} AC3DolbySurroundEXMode;
+
+/** Dolby Headphone mode */
+typedef enum AC3DolbyHeadphoneMode {
+    AC3_DHEADPHONMOD_NOTINDICATED = 0,
+    AC3_DHEADPHONMOD_OFF,
+    AC3_DHEADPHONMOD_ON,
+    AC3_DHEADPHONMOD_RESERVED
+} AC3DolbyHeadphoneMode;
+
+/** Preferred Stereo Downmix mode */
+typedef enum AC3PreferredStereoDownmixMode {
+    AC3_DMIXMOD_NOTINDICATED = 0,
+    AC3_DMIXMOD_LTRT,
+    AC3_DMIXMOD_LORO,
+    AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2
+} AC3PreferredStereoDownmixMode;
+
+typedef enum {
+    EAC3_FRAME_TYPE_INDEPENDENT = 0,
+    EAC3_FRAME_TYPE_DEPENDENT,
+    EAC3_FRAME_TYPE_AC3_CONVERT,
+    EAC3_FRAME_TYPE_RESERVED
+} EAC3FrameType;
+
+#endif /* AVCODEC_AC3DEFS_H */
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index d006ca8c0a..b41f436967 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -29,8 +29,9 @@
 #include "libavutil/intmath.h"
 #include "libavutil/mem_internal.h"
 
-#include "ac3.h"
+#include "ac3defs.h"
 #include "ac3dsp.h"
+#include "ac3tab.h"
 #include "mathops.h"
 
 static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 7efa1d122c..c57904b01b 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -47,6 +47,8 @@
 #include "audiodsp.h"
 #include "ac3dsp.h"
 #include "ac3.h"
+#include "ac3defs.h"
+#include "ac3tab.h"
 #include "fft.h"
 #include "ac3enc.h"
 #include "eac3enc.h"
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index d87ec94096..f0dc006759 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -32,6 +32,7 @@
 
 #include "libavutil/opt.h"
 #include "ac3.h"
+#include "ac3defs.h"
 #include "ac3dsp.h"
 #include "avcodec.h"
 #include "codec_internal.h"
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 9344368a99..48c89a8ba0 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -26,7 +26,6 @@
 
 #include "libavutil/channel_layout.h"
 
-#include "ac3.h"
 #include "ac3tab.h"
 
 /**
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index 2d8d3a57f9..2531d80677 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -24,7 +24,7 @@
 
 #include <stdint.h>
 
-#include "ac3.h"
+#include "ac3defs.h"
 
 extern const uint16_t ff_ac3_frame_size_tab[38][3];
 extern const uint8_t  ff_ac3_channels_tab[8];
diff --git a/libavcodec/eac3_data.c b/libavcodec/eac3_data.c
index 2ef0e2053c..d556d35b82 100644
--- a/libavcodec/eac3_data.c
+++ b/libavcodec/eac3_data.c
@@ -27,7 +27,7 @@
 #include <stddef.h>
 
 #include "eac3_data.h"
-#include "ac3.h"
+#include "ac3defs.h"
 
 const uint8_t ff_eac3_bits_vs_hebap[20] = {
     0,  2,  3,  4,  5,  7,  8,  9,  3,  4,
diff --git a/libavcodec/mips/ac3dsp_mips.c b/libavcodec/mips/ac3dsp_mips.c
index e5cee16081..8f62c03aaf 100644
--- a/libavcodec/mips/ac3dsp_mips.c
+++ b/libavcodec/mips/ac3dsp_mips.c
@@ -56,6 +56,7 @@
 #include "config.h"
 #include "libavcodec/ac3dsp.h"
 #include "libavcodec/ac3.h"
+#include "libavcodec/ac3tab.h"
 #include "libavutil/mips/asmdefs.h"
 
 #if HAVE_INLINE_ASM
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 923c3e0a31..5f20e6dc31 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -22,7 +22,6 @@
 #include "libavutil/attributes.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/ac3.h"
 #include "libavcodec/ac3dsp.h"
 
 void ff_ac3_exponent_min_mmx   (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
diff --git a/libavformat/hls_sample_encryption.c b/libavformat/hls_sample_encryption.c
index 08cdf964b6..089662905b 100644
--- a/libavformat/hls_sample_encryption.c
+++ b/libavformat/hls_sample_encryption.c
@@ -33,6 +33,7 @@
 
 #include "libavcodec/adts_header.h"
 #include "libavcodec/adts_parser.h"
+#include "libavcodec/ac3tab.h"
 #include "libavcodec/ac3_parser_internal.h"
 
 
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index e39a304247..2af75ca9db 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -27,7 +27,7 @@
 
 #include "libavutil/bswap.h"
 
-#include "libavcodec/ac3.h"
+#include "libavcodec/ac3defs.h"
 #include "libavcodec/adts_parser.h"
 
 #include "avformat.h"
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 3be89328df..0a634e4232 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -49,7 +49,7 @@
 #include "avformat.h"
 #include "avio_internal.h"
 #include "spdif.h"
-#include "libavcodec/ac3.h"
+#include "libavcodec/ac3defs.h"
 #include "libavcodec/adts_parser.h"
 #include "libavcodec/dca.h"
 #include "libavcodec/dca_syncwords.h"
-- 
2.32.0

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h Andreas Rheinhardt
@ 2022-05-12 12:40   ` Andreas Rheinhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-12 12:40 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Move AC3HeaderInfo into ac3_parser_internal.h and the rest
> into a new header ac3defs.h.
> 
> This also breaks an include cycle of ac3.h and ac3tab.h
> (the latter now only needs ac3defs.h).
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/ac3.c                    |   1 +
>  libavcodec/ac3.h                    | 115 ----------------------------
>  libavcodec/ac3_parser.c             |   2 +
>  libavcodec/ac3_parser_internal.h    |  41 +++++++++-
>  libavcodec/ac3dec.c                 |   1 +
>  libavcodec/ac3dec_data.c            |   1 -
>  libavcodec/ac3defs.h                | 104 +++++++++++++++++++++++++
>  libavcodec/ac3dsp.c                 |   3 +-
>  libavcodec/ac3enc.c                 |   2 +
>  libavcodec/ac3enc.h                 |   1 +
>  libavcodec/ac3tab.c                 |   1 -
>  libavcodec/ac3tab.h                 |   2 +-
>  libavcodec/eac3_data.c              |   2 +-
>  libavcodec/mips/ac3dsp_mips.c       |   1 +
>  libavcodec/x86/ac3dsp_init.c        |   1 -
>  libavformat/hls_sample_encryption.c |   1 +
>  libavformat/spdifdec.c              |   2 +-
>  libavformat/spdifenc.c              |   2 +-
>  18 files changed, 159 insertions(+), 124 deletions(-)
>  create mode 100644 libavcodec/ac3defs.h
> 
> diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
> index 01fb3b3d7a..60491d1a7a 100644
> --- a/libavcodec/ac3.c
> +++ b/libavcodec/ac3.c
> @@ -28,6 +28,7 @@
>  #include "libavutil/macros.h"
>  
>  #include "ac3.h"
> +#include "ac3defs.h"
>  
>  /**
>   * Starting frequency coefficient bin for each critical band.
> diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
> index 8e66d47629..29f9f9df8d 100644
> --- a/libavcodec/ac3.h
> +++ b/libavcodec/ac3.h
> @@ -30,28 +30,8 @@
>  #include <math.h>
>  #include <stdint.h>
>  
> -#define EAC3_MAX_CHANNELS 16          /**< maximum number of channels in EAC3 */
> -#define AC3_MAX_CHANNELS 7            /**< maximum number of channels, including coupling channel */
> -#define CPL_CH 0                      /**< coupling channel index */
> -
> -#define AC3_MAX_COEFS   256
> -#define AC3_BLOCK_SIZE  256
> -#define AC3_MAX_BLOCKS    6
> -#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
> -#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
> -#define AC3_CRITICAL_BANDS 50
> -#define AC3_MAX_CPL_BANDS  18
> -
>  #include "ac3tab.h"
>  
> -/* exponent encoding strategy */
> -#define EXP_REUSE 0
> -#define EXP_NEW   1
> -
> -#define EXP_D15   1
> -#define EXP_D25   2
> -#define EXP_D45   3
> -
>  #ifndef USE_FIXED
>  #define USE_FIXED 0
>  #endif
> @@ -112,58 +92,6 @@ typedef float                   SHORTFLOAT;
>  #define LEVEL_ZERO              0.0000000000000000
>  #define LEVEL_ONE               1.0000000000000000
>  
> -/** Delta bit allocation strategy */
> -typedef enum {
> -    DBA_REUSE = 0,
> -    DBA_NEW,
> -    DBA_NONE,
> -    DBA_RESERVED
> -} AC3DeltaStrategy;
> -
> -/** Channel mode (audio coding mode) */
> -typedef enum {
> -    AC3_CHMODE_DUALMONO = 0,
> -    AC3_CHMODE_MONO,
> -    AC3_CHMODE_STEREO,
> -    AC3_CHMODE_3F,
> -    AC3_CHMODE_2F1R,
> -    AC3_CHMODE_3F1R,
> -    AC3_CHMODE_2F2R,
> -    AC3_CHMODE_3F2R
> -} AC3ChannelMode;
> -
> -/** Dolby Surround mode */
> -typedef enum AC3DolbySurroundMode {
> -    AC3_DSURMOD_NOTINDICATED = 0,
> -    AC3_DSURMOD_OFF,
> -    AC3_DSURMOD_ON,
> -    AC3_DSURMOD_RESERVED
> -} AC3DolbySurroundMode;
> -
> -/** Dolby Surround EX mode */
> -typedef enum AC3DolbySurroundEXMode {
> -    AC3_DSUREXMOD_NOTINDICATED = 0,
> -    AC3_DSUREXMOD_OFF,
> -    AC3_DSUREXMOD_ON,
> -    AC3_DSUREXMOD_PLIIZ
> -} AC3DolbySurroundEXMode;
> -
> -/** Dolby Headphone mode */
> -typedef enum AC3DolbyHeadphoneMode {
> -    AC3_DHEADPHONMOD_NOTINDICATED = 0,
> -    AC3_DHEADPHONMOD_OFF,
> -    AC3_DHEADPHONMOD_ON,
> -    AC3_DHEADPHONMOD_RESERVED
> -} AC3DolbyHeadphoneMode;
> -
> -/** Preferred Stereo Downmix mode */
> -typedef enum AC3PreferredStereoDownmixMode {
> -    AC3_DMIXMOD_NOTINDICATED = 0,
> -    AC3_DMIXMOD_LTRT,
> -    AC3_DMIXMOD_LORO,
> -    AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2
> -} AC3PreferredStereoDownmixMode;
> -
>  typedef struct AC3BitAllocParameters {
>      int sr_code;
>      int sr_shift;
> @@ -171,49 +99,6 @@ typedef struct AC3BitAllocParameters {
>      int cpl_fast_leak, cpl_slow_leak;
>  } AC3BitAllocParameters;
>  
> -/**
> - * @struct AC3HeaderInfo
> - * Coded AC-3 header values up to the lfeon element, plus derived values.
> - */
> -typedef struct AC3HeaderInfo {
> -    /** @name Coded elements
> -     * @{
> -     */
> -    uint16_t sync_word;
> -    uint16_t crc1;
> -    uint8_t sr_code;
> -    uint8_t bitstream_id;
> -    uint8_t bitstream_mode;
> -    uint8_t channel_mode;
> -    uint8_t lfe_on;
> -    uint8_t frame_type;
> -    int substreamid;                        ///< substream identification
> -    int center_mix_level;                   ///< Center mix level index
> -    int surround_mix_level;                 ///< Surround mix level index
> -    uint16_t channel_map;
> -    int num_blocks;                         ///< number of audio blocks
> -    int dolby_surround_mode;
> -    /** @} */
> -
> -    /** @name Derived values
> -     * @{
> -     */
> -    uint8_t sr_shift;
> -    uint16_t sample_rate;
> -    uint32_t bit_rate;
> -    uint8_t channels;
> -    uint16_t frame_size;
> -    uint64_t channel_layout;
> -    /** @} */
> -} AC3HeaderInfo;
> -
> -typedef enum {
> -    EAC3_FRAME_TYPE_INDEPENDENT = 0,
> -    EAC3_FRAME_TYPE_DEPENDENT,
> -    EAC3_FRAME_TYPE_AC3_CONVERT,
> -    EAC3_FRAME_TYPE_RESERVED
> -} EAC3FrameType;
> -
>  /**
>   * Calculate the log power-spectral density of the input signal.
>   * This gives a rough estimate of signal power in the frequency domain by using
> diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
> index 86e8d417eb..119b1598c5 100644
> --- a/libavcodec/ac3_parser.c
> +++ b/libavcodec/ac3_parser.c
> @@ -25,6 +25,8 @@
>  
>  #include "libavutil/channel_layout.h"
>  #include "parser.h"
> +#include "ac3defs.h"
> +#include "ac3tab.h"
>  #include "ac3_parser.h"
>  #include "ac3_parser_internal.h"
>  #include "aac_ac3_parser.h"
> diff --git a/libavcodec/ac3_parser_internal.h b/libavcodec/ac3_parser_internal.h
> index 3648802a73..dd57dc95a6 100644
> --- a/libavcodec/ac3_parser_internal.h
> +++ b/libavcodec/ac3_parser_internal.h
> @@ -21,9 +21,48 @@
>  #ifndef AVCODEC_AC3_PARSER_INTERNAL_H
>  #define AVCODEC_AC3_PARSER_INTERNAL_H
>  
> -#include "ac3.h"
> +#include <stddef.h>
> +#include <stdint.h>
> +
> +#include "ac3defs.h"
>  #include "get_bits.h"
>  
> +/**
> + * @struct AC3HeaderInfo
> + * Coded AC-3 header values up to the lfeon element, plus derived values.
> + */
> +typedef struct AC3HeaderInfo {
> +    /** @name Coded elements
> +     * @{
> +     */
> +    uint16_t sync_word;
> +    uint16_t crc1;
> +    uint8_t sr_code;
> +    uint8_t bitstream_id;
> +    uint8_t bitstream_mode;
> +    uint8_t channel_mode;
> +    uint8_t lfe_on;
> +    uint8_t frame_type;
> +    int substreamid;                        ///< substream identification
> +    int center_mix_level;                   ///< Center mix level index
> +    int surround_mix_level;                 ///< Surround mix level index
> +    uint16_t channel_map;
> +    int num_blocks;                         ///< number of audio blocks
> +    int dolby_surround_mode;
> +    /** @} */
> +
> +    /** @name Derived values
> +     * @{
> +     */
> +    uint8_t sr_shift;
> +    uint16_t sample_rate;
> +    uint32_t bit_rate;
> +    uint8_t channels;
> +    uint16_t frame_size;
> +    uint64_t channel_layout;
> +    /** @} */
> +} AC3HeaderInfo;
> +
>  /**
>   * Parse AC-3 frame header.
>   * Parse the header up to the lfeon element, which is the first 52 or 54 bits
> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index fe330d0d3b..ad2b3615c8 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
> @@ -43,6 +43,7 @@
>  #include "ac3_parser_internal.h"
>  #include "ac3dec.h"
>  #include "ac3dec_data.h"
> +#include "ac3defs.h"
>  #include "kbdwin.h"
>  
>  /**
> diff --git a/libavcodec/ac3dec_data.c b/libavcodec/ac3dec_data.c
> index d0a9b1ec40..a3794ab223 100644
> --- a/libavcodec/ac3dec_data.c
> +++ b/libavcodec/ac3dec_data.c
> @@ -25,7 +25,6 @@
>   */
>  
>  #include "ac3dec_data.h"
> -#include "ac3.h"
>  
>  /**
>   * Table used to ungroup 3 values stored in 5 bits.
> diff --git a/libavcodec/ac3defs.h b/libavcodec/ac3defs.h
> new file mode 100644
> index 0000000000..ff92f0ac4a
> --- /dev/null
> +++ b/libavcodec/ac3defs.h
> @@ -0,0 +1,104 @@
> +/*
> + * Common AC-3 definitions
> + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_AC3DEFS_H
> +#define AVCODEC_AC3DEFS_H
> +
> +#define EAC3_MAX_CHANNELS 16          /**< maximum number of channels in EAC3 */
> +#define AC3_MAX_CHANNELS 7            /**< maximum number of channels, including coupling channel */
> +#define CPL_CH 0                      /**< coupling channel index */
> +
> +#define AC3_MAX_COEFS   256
> +#define AC3_BLOCK_SIZE  256
> +#define AC3_MAX_BLOCKS    6
> +#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
> +#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
> +#define AC3_CRITICAL_BANDS 50
> +#define AC3_MAX_CPL_BANDS  18
> +
> +/* exponent encoding strategy */
> +#define EXP_REUSE 0
> +#define EXP_NEW   1
> +
> +#define EXP_D15   1
> +#define EXP_D25   2
> +#define EXP_D45   3
> +
> +/** Delta bit allocation strategy */
> +typedef enum {
> +    DBA_REUSE = 0,
> +    DBA_NEW,
> +    DBA_NONE,
> +    DBA_RESERVED
> +} AC3DeltaStrategy;
> +
> +/** Channel mode (audio coding mode) */
> +typedef enum {
> +    AC3_CHMODE_DUALMONO = 0,
> +    AC3_CHMODE_MONO,
> +    AC3_CHMODE_STEREO,
> +    AC3_CHMODE_3F,
> +    AC3_CHMODE_2F1R,
> +    AC3_CHMODE_3F1R,
> +    AC3_CHMODE_2F2R,
> +    AC3_CHMODE_3F2R
> +} AC3ChannelMode;
> +
> +/** Dolby Surround mode */
> +typedef enum AC3DolbySurroundMode {
> +    AC3_DSURMOD_NOTINDICATED = 0,
> +    AC3_DSURMOD_OFF,
> +    AC3_DSURMOD_ON,
> +    AC3_DSURMOD_RESERVED
> +} AC3DolbySurroundMode;
> +
> +/** Dolby Surround EX mode */
> +typedef enum AC3DolbySurroundEXMode {
> +    AC3_DSUREXMOD_NOTINDICATED = 0,
> +    AC3_DSUREXMOD_OFF,
> +    AC3_DSUREXMOD_ON,
> +    AC3_DSUREXMOD_PLIIZ
> +} AC3DolbySurroundEXMode;
> +
> +/** Dolby Headphone mode */
> +typedef enum AC3DolbyHeadphoneMode {
> +    AC3_DHEADPHONMOD_NOTINDICATED = 0,
> +    AC3_DHEADPHONMOD_OFF,
> +    AC3_DHEADPHONMOD_ON,
> +    AC3_DHEADPHONMOD_RESERVED
> +} AC3DolbyHeadphoneMode;
> +
> +/** Preferred Stereo Downmix mode */
> +typedef enum AC3PreferredStereoDownmixMode {
> +    AC3_DMIXMOD_NOTINDICATED = 0,
> +    AC3_DMIXMOD_LTRT,
> +    AC3_DMIXMOD_LORO,
> +    AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2
> +} AC3PreferredStereoDownmixMode;
> +
> +typedef enum {
> +    EAC3_FRAME_TYPE_INDEPENDENT = 0,
> +    EAC3_FRAME_TYPE_DEPENDENT,
> +    EAC3_FRAME_TYPE_AC3_CONVERT,
> +    EAC3_FRAME_TYPE_RESERVED
> +} EAC3FrameType;
> +
> +#endif /* AVCODEC_AC3DEFS_H */
> diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
> index d006ca8c0a..b41f436967 100644
> --- a/libavcodec/ac3dsp.c
> +++ b/libavcodec/ac3dsp.c
> @@ -29,8 +29,9 @@
>  #include "libavutil/intmath.h"
>  #include "libavutil/mem_internal.h"
>  
> -#include "ac3.h"
> +#include "ac3defs.h"
>  #include "ac3dsp.h"
> +#include "ac3tab.h"
>  #include "mathops.h"
>  
>  static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
> diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
> index 7efa1d122c..c57904b01b 100644
> --- a/libavcodec/ac3enc.c
> +++ b/libavcodec/ac3enc.c
> @@ -47,6 +47,8 @@
>  #include "audiodsp.h"
>  #include "ac3dsp.h"
>  #include "ac3.h"
> +#include "ac3defs.h"
> +#include "ac3tab.h"
>  #include "fft.h"
>  #include "ac3enc.h"
>  #include "eac3enc.h"
> diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
> index d87ec94096..f0dc006759 100644
> --- a/libavcodec/ac3enc.h
> +++ b/libavcodec/ac3enc.h
> @@ -32,6 +32,7 @@
>  
>  #include "libavutil/opt.h"
>  #include "ac3.h"
> +#include "ac3defs.h"
>  #include "ac3dsp.h"
>  #include "avcodec.h"
>  #include "codec_internal.h"
> diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
> index 9344368a99..48c89a8ba0 100644
> --- a/libavcodec/ac3tab.c
> +++ b/libavcodec/ac3tab.c
> @@ -26,7 +26,6 @@
>  
>  #include "libavutil/channel_layout.h"
>  
> -#include "ac3.h"
>  #include "ac3tab.h"
>  
>  /**
> diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
> index 2d8d3a57f9..2531d80677 100644
> --- a/libavcodec/ac3tab.h
> +++ b/libavcodec/ac3tab.h
> @@ -24,7 +24,7 @@
>  
>  #include <stdint.h>
>  
> -#include "ac3.h"
> +#include "ac3defs.h"
>  
>  extern const uint16_t ff_ac3_frame_size_tab[38][3];
>  extern const uint8_t  ff_ac3_channels_tab[8];
> diff --git a/libavcodec/eac3_data.c b/libavcodec/eac3_data.c
> index 2ef0e2053c..d556d35b82 100644
> --- a/libavcodec/eac3_data.c
> +++ b/libavcodec/eac3_data.c
> @@ -27,7 +27,7 @@
>  #include <stddef.h>
>  
>  #include "eac3_data.h"
> -#include "ac3.h"
> +#include "ac3defs.h"
>  
>  const uint8_t ff_eac3_bits_vs_hebap[20] = {
>      0,  2,  3,  4,  5,  7,  8,  9,  3,  4,
> diff --git a/libavcodec/mips/ac3dsp_mips.c b/libavcodec/mips/ac3dsp_mips.c
> index e5cee16081..8f62c03aaf 100644
> --- a/libavcodec/mips/ac3dsp_mips.c
> +++ b/libavcodec/mips/ac3dsp_mips.c
> @@ -56,6 +56,7 @@
>  #include "config.h"
>  #include "libavcodec/ac3dsp.h"
>  #include "libavcodec/ac3.h"
> +#include "libavcodec/ac3tab.h"
>  #include "libavutil/mips/asmdefs.h"
>  
>  #if HAVE_INLINE_ASM
> diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
> index 923c3e0a31..5f20e6dc31 100644
> --- a/libavcodec/x86/ac3dsp_init.c
> +++ b/libavcodec/x86/ac3dsp_init.c
> @@ -22,7 +22,6 @@
>  #include "libavutil/attributes.h"
>  #include "libavutil/x86/asm.h"
>  #include "libavutil/x86/cpu.h"
> -#include "libavcodec/ac3.h"
>  #include "libavcodec/ac3dsp.h"
>  
>  void ff_ac3_exponent_min_mmx   (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
> diff --git a/libavformat/hls_sample_encryption.c b/libavformat/hls_sample_encryption.c
> index 08cdf964b6..089662905b 100644
> --- a/libavformat/hls_sample_encryption.c
> +++ b/libavformat/hls_sample_encryption.c
> @@ -33,6 +33,7 @@
>  
>  #include "libavcodec/adts_header.h"
>  #include "libavcodec/adts_parser.h"
> +#include "libavcodec/ac3tab.h"
>  #include "libavcodec/ac3_parser_internal.h"
>  
>  
> diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
> index e39a304247..2af75ca9db 100644
> --- a/libavformat/spdifdec.c
> +++ b/libavformat/spdifdec.c
> @@ -27,7 +27,7 @@
>  
>  #include "libavutil/bswap.h"
>  
> -#include "libavcodec/ac3.h"
> +#include "libavcodec/ac3defs.h"
>  #include "libavcodec/adts_parser.h"
>  
>  #include "avformat.h"
> diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
> index 3be89328df..0a634e4232 100644
> --- a/libavformat/spdifenc.c
> +++ b/libavformat/spdifenc.c
> @@ -49,7 +49,7 @@
>  #include "avformat.h"
>  #include "avio_internal.h"
>  #include "spdif.h"
> -#include "libavcodec/ac3.h"
> +#include "libavcodec/ac3defs.h"
>  #include "libavcodec/adts_parser.h"
>  #include "libavcodec/dca.h"
>  #include "libavcodec/dca_syncwords.h"

Btw: Some of the arrays declared in ac3tab.h are only used by ac3.h. If
these declarations (in particular ff_ac3_band_start_tab) were moved to
ac3.h, ac3tab.h would no longer need AC3_CRITICAL_BANDS and therefore no
longer need ac3.h/ac3defs.h. This is another way to break this cycle.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function
  2022-05-12 12:19 [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 2/3] avcodec/ac3tab: Move some tables only used by ac3.c to it Andreas Rheinhardt
  2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h Andreas Rheinhardt
@ 2022-05-13 17:04 ` Andreas Rheinhardt
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-13 17:04 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Removed in 7b11eead1b4e08728561595e6b610cf8fe2b7122.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/ac3.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
> index dabd49f4cc..8e66d47629 100644
> --- a/libavcodec/ac3.h
> +++ b/libavcodec/ac3.h
> @@ -214,8 +214,6 @@ typedef enum {
>      EAC3_FRAME_TYPE_RESERVED
>  } EAC3FrameType;
>  
> -void ff_ac3_common_init(void);
> -
>  /**
>   * Calculate the log power-spectral density of the input signal.
>   * This gives a rough estimate of signal power in the frequency domain by using

Will apply this patchset tomorrow unless there are objections.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-13 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 12:19 [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt
2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 2/3] avcodec/ac3tab: Move some tables only used by ac3.c to it Andreas Rheinhardt
2022-05-12 12:21 ` [FFmpeg-devel] [PATCH 3/3] avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h Andreas Rheinhardt
2022-05-12 12:40   ` Andreas Rheinhardt
2022-05-13 17:04 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ac3: Remove declaration of inexistent function Andreas Rheinhardt

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