[FFmpeg-devel] [PATCH v3 1/6] avcodec: make AC-3 bit rate table available in a separate header
Jan Ekström
jeebjp at gmail.com
Tue Jun 21 09:46:29 EEST 2022
From: Jan Ekström <jan.ekstrom at 24i.com>
This makes it possible to include it from libavformat
Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>
---
libavcodec/Makefile | 8 +++++---
libavcodec/ac3_bitrate_tab.c | 22 ++++++++++++++++++++++
libavcodec/ac3_bitrate_tab.h | 33 +++++++++++++++++++++++++++++++++
libavcodec/ac3tab.c | 6 ------
4 files changed, 60 insertions(+), 9 deletions(-)
create mode 100644 libavcodec/ac3_bitrate_tab.c
create mode 100644 libavcodec/ac3_bitrate_tab.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3b8f7b5e01..10697d31f7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -190,8 +190,9 @@ OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o \
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
- ac3.o kbdwin.o
-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o
+ ac3.o kbdwin.o ac3_bitrate_tab.o
+OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o \
+ ac3.o kbdwin.o ac3_bitrate_tab.o
OBJS-$(CONFIG_AC3_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_ACELP_KELVIN_DECODER) += g729dec.o lsp.o celp_math.o celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
OBJS-$(CONFIG_AGM_DECODER) += agm.o
@@ -1110,7 +1111,8 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o
OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
- ac3_channel_layout_tab.o
+ ac3_channel_layout_tab.o \
+ ac3_bitrate_tab.o
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
diff --git a/libavcodec/ac3_bitrate_tab.c b/libavcodec/ac3_bitrate_tab.c
new file mode 100644
index 0000000000..9ae8794a4c
--- /dev/null
+++ b/libavcodec/ac3_bitrate_tab.c
@@ -0,0 +1,22 @@
+/*
+ * AC-3 bit rate table
+ * copyright (c) 2001 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
+ */
+
+#include "ac3_bitrate_tab.h"
diff --git a/libavcodec/ac3_bitrate_tab.h b/libavcodec/ac3_bitrate_tab.h
new file mode 100644
index 0000000000..44fc5f59ec
--- /dev/null
+++ b/libavcodec/ac3_bitrate_tab.h
@@ -0,0 +1,33 @@
+/*
+ * AC-3 bit rate table
+ * copyright (c) 2001 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_AC3_BITRATE_TAB_H
+#define AVCODEC_AC3_BITRATE_TAB_H
+
+#include <stdint.h>
+
+/* possible bitrates */
+const uint16_t ff_ac3_bitrate_tab[19] = {
+ 32, 40, 48, 56, 64, 80, 96, 112, 128,
+ 160, 192, 224, 256, 320, 384, 448, 512, 576, 640
+};
+
+#endif
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 48c89a8ba0..75865fd7d2 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -94,12 +94,6 @@ const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
/* possible frequencies */
const int ff_ac3_sample_rate_tab[] = { 48000, 44100, 32000, 0 };
-/* possible bitrates */
-const uint16_t ff_ac3_bitrate_tab[19] = {
- 32, 40, 48, 56, 64, 80, 96, 112, 128,
- 160, 192, 224, 256, 320, 384, 448, 512, 576, 640
-};
-
/**
* Table of bin locations for rematrixing bands
* reference: Section 7.5.2 Rematrixing : Frequency Band Definitions
--
2.36.1
More information about the ffmpeg-devel
mailing list