* [FFmpeg-devel] [PATCH 05/11] avcodec/aacenc: Move aac_pce_configs to its only user
2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
` (2 preceding siblings ...)
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 04/11] fftools/ffmpeg_opt: Fix copyinkf Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 06/11] avcodec/sbrdsp: Remove unnecessary headers Andreas Rheinhardt
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-01 12:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacenc.c | 273 ++++++++++++++++++++++++++++++++++++++++++++
libavcodec/aacenc.h | 273 --------------------------------------------
2 files changed, 273 insertions(+), 273 deletions(-)
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index ee179542bd..4f51485fc4 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -51,6 +51,279 @@
#include "psymodel.h"
+/**
+ * List of PCE (Program Configuration Element) for the channel layouts listed
+ * in channel_layout.h
+ *
+ * For those wishing in the future to add other layouts:
+ *
+ * - num_ele: number of elements in each group of front, side, back, lfe channels
+ * (an element is of type SCE (single channel), CPE (channel pair) for
+ * the first 3 groups; and is LFE for LFE group).
+ *
+ * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group
+ *
+ * - index: there are three independent indices for SCE, CPE and LFE;
+ * they are incremented irrespective of the group to which the element belongs;
+ * they are not reset when going from one group to another
+ *
+ * Example: for 7.0 channel layout,
+ * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group)
+ * .index = { { 0, 0 }, { 1 }, { 2 }, },
+ * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs)
+ *
+ * The index order impacts the channel ordering. But is otherwise arbitrary
+ * (the sequence could have been 2, 0, 1 instead of 0, 1, 2).
+ *
+ * Spec allows for discontinuous indices, e.g. if one has a total of two SCE,
+ * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder
+ * which at this time requires that indices fully cover some range starting
+ * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15).
+ *
+ * - config_map: total number of elements and their types. Beware, the way the
+ * types are ordered impacts the final channel ordering.
+ *
+ * - reorder_map: reorders the channels.
+ *
+ */
+static const AACPCEInfo aac_pce_configs[] = {
+ {
+ .layout = AV_CHANNEL_LAYOUT_MONO,
+ .num_ele = { 1, 0, 0, 0 },
+ .pairing = { { 0 }, },
+ .index = { { 0 }, },
+ .config_map = { 1, TYPE_SCE, },
+ .reorder_map = { 0 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_STEREO,
+ .num_ele = { 1, 0, 0, 0 },
+ .pairing = { { 1 }, },
+ .index = { { 0 }, },
+ .config_map = { 1, TYPE_CPE, },
+ .reorder_map = { 0, 1 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_2POINT1,
+ .num_ele = { 1, 0, 0, 1 },
+ .pairing = { { 1 }, },
+ .index = { { 0 },{ 0 },{ 0 },{ 0 } },
+ .config_map = { 2, TYPE_CPE, TYPE_LFE },
+ .reorder_map = { 0, 1, 2 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_2_1,
+ .num_ele = { 1, 0, 1, 0 },
+ .pairing = { { 1 },{ 0 },{ 0 } },
+ .index = { { 0 },{ 0 },{ 0 }, },
+ .config_map = { 2, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_SURROUND,
+ .num_ele = { 2, 0, 0, 0 },
+ .pairing = { { 1, 0 }, },
+ .index = { { 0, 0 }, },
+ .config_map = { 2, TYPE_CPE, TYPE_SCE, },
+ .reorder_map = { 0, 1, 2 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_3POINT1,
+ .num_ele = { 2, 0, 0, 1 },
+ .pairing = { { 1, 0 }, },
+ .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
+ .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+ .reorder_map = { 0, 1, 2, 3 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_4POINT0,
+ .num_ele = { 2, 0, 1, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 0 }, },
+ .index = { { 0, 0 }, { 0 }, { 1 } },
+ .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_4POINT1,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 0 }, },
+ .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_2_2,
+ .num_ele = { 1, 1, 0, 0 },
+ .pairing = { { 1 }, { 1 }, },
+ .index = { { 0 }, { 1 }, },
+ .config_map = { 2, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_QUAD,
+ .num_ele = { 1, 0, 1, 0 },
+ .pairing = { { 1 }, { 0 }, { 1 }, },
+ .index = { { 0 }, { 0 }, { 1 } },
+ .config_map = { 2, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_5POINT0,
+ .num_ele = { 2, 1, 0, 0 },
+ .pairing = { { 1, 0 }, { 1 }, },
+ .index = { { 0, 0 }, { 1 } },
+ .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_5POINT1,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 1 } },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_5POINT0_BACK,
+ .num_ele = { 2, 0, 1, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1 } },
+ .index = { { 0, 0 }, { 0 }, { 1 } },
+ .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_5POINT1_BACK,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 1 } },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_6POINT0,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 1 }, { 0 }, },
+ .index = { { 0, 0 }, { 1 }, { 1 } },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT,
+ .num_ele = { 2, 1, 0, 0 },
+ .pairing = { { 1, 1 }, { 1 } },
+ .index = { { 1, 0 }, { 2 }, },
+ .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, },
+ .reorder_map = { 0, 1, 2, 3, 4, 5 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_HEXAGONAL,
+ .num_ele = { 2, 0, 2, 0 },
+ .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
+ .index = { { 0, 0 },{ 0 },{ 1, 1 } },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, },
+ .reorder_map = { 0, 1, 2, 3, 4, 5 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_6POINT1,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
+ .index = { { 0, 0 },{ 1 },{ 1, 2 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_6POINT1_BACK,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
+ .index = { { 0, 0 }, { 1 }, { 1, 2 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
+ .index = { { 0, 0 }, { 1 }, { 1, 2 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_7POINT0,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 1 }, { 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 2 }, },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT,
+ .num_ele = { 2, 1, 1, 0 },
+ .pairing = { { 1, 0 }, { 1 }, { 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 2 }, },
+ .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_7POINT1,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
+ .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_OCTAGONAL,
+ .num_ele = { 2, 1, 2, 0 },
+ .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
+ .index = { { 0, 0 }, { 1 }, { 2, 1 } },
+ .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+ },
+ { /* Meant for order 2/mixed ambisonics */
+ .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9,
+ .u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER },
+ .num_ele = { 2, 2, 2, 0 },
+ .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
+ .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
+ .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
+ },
+ { /* Meant for order 2/mixed ambisonics */
+ .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10,
+ .u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER |
+ AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER },
+ .num_ele = { 2, 2, 2, 0 },
+ .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, },
+ .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } },
+ .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
+ },
+ {
+ .layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL,
+ .num_ele = { 4, 2, 4, 0 },
+ .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
+ .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
+ .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+ },
+};
+
static void put_pce(PutBitContext *pb, AVCodecContext *avctx)
{
int i, j;
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index a001c7ca60..f5a2b78c6d 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -102,279 +102,6 @@ typedef struct AACPCEInfo {
uint8_t reorder_map[16]; ///< maps channels from lavc to aac order
} AACPCEInfo;
-/**
- * List of PCE (Program Configuration Element) for the channel layouts listed
- * in channel_layout.h
- *
- * For those wishing in the future to add other layouts:
- *
- * - num_ele: number of elements in each group of front, side, back, lfe channels
- * (an element is of type SCE (single channel), CPE (channel pair) for
- * the first 3 groups; and is LFE for LFE group).
- *
- * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group
- *
- * - index: there are three independent indices for SCE, CPE and LFE;
- * they are incremented irrespective of the group to which the element belongs;
- * they are not reset when going from one group to another
- *
- * Example: for 7.0 channel layout,
- * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group)
- * .index = { { 0, 0 }, { 1 }, { 2 }, },
- * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs)
- *
- * The index order impacts the channel ordering. But is otherwise arbitrary
- * (the sequence could have been 2, 0, 1 instead of 0, 1, 2).
- *
- * Spec allows for discontinuous indices, e.g. if one has a total of two SCE,
- * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder
- * which at this time requires that indices fully cover some range starting
- * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15).
- *
- * - config_map: total number of elements and their types. Beware, the way the
- * types are ordered impacts the final channel ordering.
- *
- * - reorder_map: reorders the channels.
- *
- */
-static const AACPCEInfo aac_pce_configs[] = {
- {
- .layout = AV_CHANNEL_LAYOUT_MONO,
- .num_ele = { 1, 0, 0, 0 },
- .pairing = { { 0 }, },
- .index = { { 0 }, },
- .config_map = { 1, TYPE_SCE, },
- .reorder_map = { 0 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_STEREO,
- .num_ele = { 1, 0, 0, 0 },
- .pairing = { { 1 }, },
- .index = { { 0 }, },
- .config_map = { 1, TYPE_CPE, },
- .reorder_map = { 0, 1 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_2POINT1,
- .num_ele = { 1, 0, 0, 1 },
- .pairing = { { 1 }, },
- .index = { { 0 },{ 0 },{ 0 },{ 0 } },
- .config_map = { 2, TYPE_CPE, TYPE_LFE },
- .reorder_map = { 0, 1, 2 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_2_1,
- .num_ele = { 1, 0, 1, 0 },
- .pairing = { { 1 },{ 0 },{ 0 } },
- .index = { { 0 },{ 0 },{ 0 }, },
- .config_map = { 2, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_SURROUND,
- .num_ele = { 2, 0, 0, 0 },
- .pairing = { { 1, 0 }, },
- .index = { { 0, 0 }, },
- .config_map = { 2, TYPE_CPE, TYPE_SCE, },
- .reorder_map = { 0, 1, 2 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_3POINT1,
- .num_ele = { 2, 0, 0, 1 },
- .pairing = { { 1, 0 }, },
- .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
- .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE },
- .reorder_map = { 0, 1, 2, 3 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_4POINT0,
- .num_ele = { 2, 0, 1, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 0 }, },
- .index = { { 0, 0 }, { 0 }, { 1 } },
- .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_4POINT1,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 0 }, },
- .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_2_2,
- .num_ele = { 1, 1, 0, 0 },
- .pairing = { { 1 }, { 1 }, },
- .index = { { 0 }, { 1 }, },
- .config_map = { 2, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_QUAD,
- .num_ele = { 1, 0, 1, 0 },
- .pairing = { { 1 }, { 0 }, { 1 }, },
- .index = { { 0 }, { 0 }, { 1 } },
- .config_map = { 2, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_5POINT0,
- .num_ele = { 2, 1, 0, 0 },
- .pairing = { { 1, 0 }, { 1 }, },
- .index = { { 0, 0 }, { 1 } },
- .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_5POINT1,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1 }, },
- .index = { { 0, 0 }, { 1 }, { 1 } },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_5POINT0_BACK,
- .num_ele = { 2, 0, 1, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1 } },
- .index = { { 0, 0 }, { 0 }, { 1 } },
- .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_5POINT1_BACK,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1 }, },
- .index = { { 0, 0 }, { 1 }, { 1 } },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_6POINT0,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 1 }, { 0 }, },
- .index = { { 0, 0 }, { 1 }, { 1 } },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT,
- .num_ele = { 2, 1, 0, 0 },
- .pairing = { { 1, 1 }, { 1 } },
- .index = { { 1, 0 }, { 2 }, },
- .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, },
- .reorder_map = { 0, 1, 2, 3, 4, 5 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_HEXAGONAL,
- .num_ele = { 2, 0, 2, 0 },
- .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
- .index = { { 0, 0 },{ 0 },{ 1, 1 } },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, },
- .reorder_map = { 0, 1, 2, 3, 4, 5 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_6POINT1,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
- .index = { { 0, 0 },{ 1 },{ 1, 2 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_6POINT1_BACK,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
- .index = { { 0, 0 }, { 1 }, { 1, 2 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
- .index = { { 0, 0 }, { 1 }, { 1, 2 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_7POINT0,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 1 }, { 1 }, },
- .index = { { 0, 0 }, { 1 }, { 2 }, },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT,
- .num_ele = { 2, 1, 1, 0 },
- .pairing = { { 1, 0 }, { 1 }, { 1 }, },
- .index = { { 0, 0 }, { 1 }, { 2 }, },
- .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_7POINT1,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
- .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, },
- .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
- .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_OCTAGONAL,
- .num_ele = { 2, 1, 2, 0 },
- .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
- .index = { { 0, 0 }, { 1 }, { 2, 1 } },
- .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
- },
- { /* Meant for order 2/mixed ambisonics */
- .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9,
- .u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER },
- .num_ele = { 2, 2, 2, 0 },
- .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
- .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
- .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
- },
- { /* Meant for order 2/mixed ambisonics */
- .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10,
- .u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER |
- AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER },
- .num_ele = { 2, 2, 2, 0 },
- .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, },
- .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } },
- .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
- },
- {
- .layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL,
- .num_ele = { 4, 2, 4, 0 },
- .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
- .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
- .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
- .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
- },
-};
-
/**
* AAC encoder context
*/
--
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".
^ permalink raw reply [flat|nested] 13+ messages in thread
* [FFmpeg-devel] [PATCH 07/11] avcodec/aacenc_quantization: Remove always-zero function parameter
2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
` (4 preceding siblings ...)
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 06/11] avcodec/sbrdsp: Remove unnecessary headers Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 08/11] avcodec/aacenc_tns: Remove unused header Andreas Rheinhardt
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-01 12:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
rtz is only ever nonzero for quantize_and_encode_band().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
This commit touches aaccoder_mips.c, but honestly I was not able
to compile it at all (neither before nor after this change),
because all I got were errors like:
"{standard input}:1114: Error: float register should be even, was 1"
Furthermore, ff_aac_coder_init_mips() is crazy: It overwrites pointers
in ff_aac_coders; the latter is a const array with static lifetime.
Modifying it will crash on every system that uses relro.
This encoder should probably use an ordinary DSP context that is part
of the context and not static instead.
(Anyway, most coder functions are always the same for all coders,
so the function pointer is unnecessary.)
libavcodec/aaccoder.c | 14 +++++++-------
libavcodec/aaccoder_trellis.h | 2 +-
libavcodec/aacenc_is.c | 6 +++---
libavcodec/aacenc_ltp.c | 4 ++--
libavcodec/aacenc_quantization.h | 8 ++++----
libavcodec/aacenc_quantization_misc.h | 2 +-
libavcodec/mips/aaccoder_mips.c | 12 ++++++------
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index f460479498..2988247a15 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -123,7 +123,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
rd += quantize_band_cost(s, &sce->coeffs[start + w*128],
&s->scoefs[start + w*128], size,
sce->sf_idx[(win+w)*16+swb], aac_cb_out_map[cb],
- lambda / band->threshold, INFINITY, NULL, NULL, 0);
+ lambda / band->threshold, INFINITY, NULL, NULL);
}
cost_stay_here = path[swb][cb].cost + rd;
cost_get_here = minrd + rd + run_bits + 4;
@@ -346,7 +346,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],
- q + q0, cb, lambda / band->threshold, INFINITY, NULL, NULL, 0);
+ q + q0, cb, lambda / band->threshold, INFINITY, NULL, NULL);
}
minrd = FFMIN(minrd, dist);
@@ -658,7 +658,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
sce->ics.swb_sizes[g],
sce->sf_idx[(w+w2)*16+g],
sce->band_alt[(w+w2)*16+g],
- lambda/band->threshold, INFINITY, NULL, NULL, 0);
+ lambda/band->threshold, INFINITY, NULL, NULL);
/* Estimate rd on average as 5 bits for SF, 4 for the CB, plus spread energy * lambda/thr */
dist2 += band->energy/(band->spread*band->spread)*lambda*dist_thresh/band->threshold;
}
@@ -842,25 +842,25 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
sce0->ics.swb_sizes[g],
sce0->sf_idx[w*16+g],
sce0->band_type[w*16+g],
- lambda / (band0->threshold + FLT_MIN), INFINITY, &b1, NULL, 0);
+ lambda / (band0->threshold + FLT_MIN), INFINITY, &b1, NULL);
dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[w*16+g],
sce1->band_type[w*16+g],
- lambda / (band1->threshold + FLT_MIN), INFINITY, &b2, NULL, 0);
+ lambda / (band1->threshold + FLT_MIN), INFINITY, &b2, NULL);
dist2 += quantize_band_cost(s, M,
M34,
sce0->ics.swb_sizes[g],
mididx,
midcb,
- lambda / (minthr + FLT_MIN), INFINITY, &b3, NULL, 0);
+ lambda / (minthr + FLT_MIN), INFINITY, &b3, NULL);
dist2 += quantize_band_cost(s, S,
S34,
sce1->ics.swb_sizes[g],
sididx,
sidcb,
- mslambda / (minthr * bmax + FLT_MIN), INFINITY, &b4, NULL, 0);
+ mslambda / (minthr * bmax + FLT_MIN), INFINITY, &b4, NULL);
B0 += b1+b2;
B1 += b3+b4;
dist1 -= b1+b2;
diff --git a/libavcodec/aaccoder_trellis.h b/libavcodec/aaccoder_trellis.h
index 940ebf029d..4810ff3208 100644
--- a/libavcodec/aaccoder_trellis.h
+++ b/libavcodec/aaccoder_trellis.h
@@ -127,7 +127,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
&s->scoefs[start + w*128], size,
sce->sf_idx[win*16+swb],
aac_cb_out_map[cb],
- 0, INFINITY, NULL, NULL, 0);
+ 0, INFINITY, NULL, NULL);
}
cost_stay_here = path[swb][cb].cost + bits;
cost_get_here = minbits + bits + run_bits + 4;
diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c
index 2f5b7eb8dc..1810790d88 100644
--- a/libavcodec/aacenc_is.c
+++ b/libavcodec/aacenc_is.c
@@ -68,15 +68,15 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe,
sce0->ics.swb_sizes[g],
sce0->sf_idx[w*16+g],
sce0->band_type[w*16+g],
- s->lambda / band0->threshold, INFINITY, NULL, NULL, 0);
+ s->lambda / band0->threshold, INFINITY, NULL, NULL);
dist1 += quantize_band_cost(s, &R[start + (w+w2)*128], R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[w*16+g],
sce1->band_type[w*16+g],
- s->lambda / band1->threshold, INFINITY, NULL, NULL, 0);
+ s->lambda / band1->threshold, INFINITY, NULL, NULL);
dist2 += quantize_band_cost(s, IS, I34, sce0->ics.swb_sizes[g],
is_sf_idx, is_band_type,
- s->lambda / minthr, INFINITY, NULL, NULL, 0);
+ s->lambda / minthr, INFINITY, NULL, NULL);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
dist_spec_err += (L34[i] - I34[i])*(L34[i] - I34[i]);
dist_spec_err += (R34[i] - I34[i]*e01_34)*(R34[i] - I34[i]*e01_34);
diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
index f77f0b6a72..f7fb85bbf8 100644
--- a/libavcodec/aacenc_ltp.c
+++ b/libavcodec/aacenc_ltp.c
@@ -194,11 +194,11 @@ void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce,
s->abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, &sce->coeffs[start+(w+w2)*128], C34, sce->ics.swb_sizes[g],
sce->sf_idx[(w+w2)*16+g], sce->band_type[(w+w2)*16+g],
- s->lambda/band->threshold, INFINITY, &bits_tmp1, NULL, 0);
+ s->lambda/band->threshold, INFINITY, &bits_tmp1, NULL);
dist2 += quantize_band_cost(s, PCD, PCD34, sce->ics.swb_sizes[g],
sce->sf_idx[(w+w2)*16+g],
sce->band_type[(w+w2)*16+g],
- s->lambda/band->threshold, INFINITY, &bits_tmp2, NULL, 0);
+ s->lambda/band->threshold, INFINITY, &bits_tmp2, NULL);
bits1 += bits_tmp1;
bits2 += bits_tmp2;
}
diff --git a/libavcodec/aacenc_quantization.h b/libavcodec/aacenc_quantization.h
index fc5a46b875..f3c3553886 100644
--- a/libavcodec/aacenc_quantization.h
+++ b/libavcodec/aacenc_quantization.h
@@ -250,20 +250,20 @@ static float (*const quantize_and_encode_band_cost_rtz_arr[])(
static inline float quantize_band_cost(struct AACEncContext *s, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
- int *bits, float *energy, int rtz)
+ int *bits, float *energy)
{
return quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
- cb, lambda, uplim, bits, energy, rtz);
+ cb, lambda, uplim, bits, energy, 0);
}
static inline int quantize_band_cost_bits(struct AACEncContext *s, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
- int *bits, float *energy, int rtz)
+ int *bits, float *energy)
{
int auxbits;
quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
- cb, 0.0f, uplim, &auxbits, energy, rtz);
+ cb, 0.0f, uplim, &auxbits, energy, 0);
if (bits) {
*bits = auxbits;
}
diff --git a/libavcodec/aacenc_quantization_misc.h b/libavcodec/aacenc_quantization_misc.h
index 28676ca8d5..c789754f4f 100644
--- a/libavcodec/aacenc_quantization_misc.h
+++ b/libavcodec/aacenc_quantization_misc.h
@@ -38,7 +38,7 @@ static inline float quantize_band_cost_cached(struct AACEncContext *s, int w, in
entry = &s->quantize_band_cost_cache[scale_idx][w*16+g];
if (entry->generation != s->quantize_band_cost_cache_generation || entry->cb != cb || entry->rtz != rtz) {
entry->rd = quantize_band_cost(s, in, scaled, size, scale_idx,
- cb, lambda, uplim, &entry->bits, &entry->energy, rtz);
+ cb, lambda, uplim, &entry->bits, &entry->energy);
entry->cb = cb;
entry->rtz = rtz;
entry->generation = s->quantize_band_cost_cache_generation;
diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c
index d690c8c24a..bf27a2a5da 100644
--- a/libavcodec/mips/aaccoder_mips.c
+++ b/libavcodec/mips/aaccoder_mips.c
@@ -1472,7 +1472,7 @@ static float (*const get_band_numbits_arr[])(struct AACEncContext *s,
static float quantize_band_cost_bits(struct AACEncContext *s, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
- int *bits, float *energy, int rtz)
+ int *bits, float *energy)
{
return get_band_numbits(s, NULL, in, scaled, size, scale_idx, cb, lambda, uplim, bits);
}
@@ -2326,7 +2326,7 @@ static float (*const get_band_cost_arr[])(struct AACEncContext *s,
static float quantize_band_cost(struct AACEncContext *s, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
- int *bits, float *energy, int rtz)
+ int *bits, float *energy)
{
return get_band_cost(s, NULL, in, scaled, size, scale_idx, cb, lambda, uplim, bits, energy);
}
@@ -2424,25 +2424,25 @@ static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)
sce0->ics.swb_sizes[g],
sce0->sf_idx[w*16+g],
sce0->band_type[w*16+g],
- lambda / band0->threshold, INFINITY, &b1, NULL, 0);
+ lambda / band0->threshold, INFINITY, &b1, NULL);
dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[w*16+g],
sce1->band_type[w*16+g],
- lambda / band1->threshold, INFINITY, &b2, NULL, 0);
+ lambda / band1->threshold, INFINITY, &b2, NULL);
dist2 += quantize_band_cost(s, M,
M34,
sce0->ics.swb_sizes[g],
mididx,
midcb,
- lambda / minthr, INFINITY, &b3, NULL, 0);
+ lambda / minthr, INFINITY, &b3, NULL);
dist2 += quantize_band_cost(s, S,
S34,
sce1->ics.swb_sizes[g],
sididx,
sidcb,
- mslambda / (minthr * bmax), INFINITY, &b4, NULL, 0);
+ mslambda / (minthr * bmax), INFINITY, &b4, NULL);
B0 += b1+b2;
B1 += b3+b4;
dist1 -= b1+b2;
--
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".
^ permalink raw reply [flat|nested] 13+ messages in thread
* [FFmpeg-devel] [PATCH 09/11] avcodec/aacenc_quantization: Deduplicate quantization functions
2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
` (6 preceding siblings ...)
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 08/11] avcodec/aacenc_tns: Remove unused header Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 10/11] avcodec/avcodec: Remove legacy cruft Andreas Rheinhardt
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-01 12:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Up until now, there were four copies of
quantize_and_encode_band_cost_(ZERO|[SU]QUAD|[SU]PAIR|ESC|NONE|NOISE|STEREO)
(namely in aaccoder.o, aacenc_is.o, aacenc_ltp.o, aacenc_pred.o).
As 43b378a0d321e3d01f196cec95e13acfac80d464 says, this is meant to
enable more optimizations.
Yet neither GCC nor Clang performed such optimizations: The functions
in the aforementioned files are not optimized according to
the specifics of the calls in the respective file. Therefore
duplicating them is a waste of space; this commit therefore stops doing
so. The remaining copy is placed into aaccoder.c (which is the only
place where the "round to zero" variant of quantize_and_encode_band()
is used, so that this can be completely internal to aaccoder.c).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aaccoder.c | 223 ++++++++++++++++++++++++++++
libavcodec/aacenc_pred.c | 18 +--
libavcodec/aacenc_quantization.h | 239 ++-----------------------------
3 files changed, 244 insertions(+), 236 deletions(-)
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 2988247a15..e3b6b2f02c 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -62,6 +62,229 @@
#include "libavcodec/aaccoder_trellis.h"
+typedef float (*quantize_and_encode_band_func)(struct AACEncContext *s, PutBitContext *pb,
+ const float *in, float *quant, const float *scaled,
+ int size, int scale_idx, int cb,
+ const float lambda, const float uplim,
+ int *bits, float *energy);
+
+/**
+ * Calculate rate distortion cost for quantizing with given codebook
+ *
+ * @return quantization distortion
+ */
+static av_always_inline float quantize_and_encode_band_cost_template(
+ struct AACEncContext *s,
+ PutBitContext *pb, const float *in, float *out,
+ const float *scaled, int size, int scale_idx,
+ int cb, const float lambda, const float uplim,
+ int *bits, float *energy, int BT_ZERO, int BT_UNSIGNED,
+ int BT_PAIR, int BT_ESC, int BT_NOISE, int BT_STEREO,
+ const float ROUNDING)
+{
+ const int q_idx = POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512;
+ const float Q = ff_aac_pow2sf_tab [q_idx];
+ const float Q34 = ff_aac_pow34sf_tab[q_idx];
+ const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
+ const float CLIPPED_ESCAPE = 165140.0f*IQ;
+ float cost = 0;
+ float qenergy = 0;
+ const int dim = BT_PAIR ? 2 : 4;
+ int resbits = 0;
+ int off;
+
+ if (BT_ZERO || BT_NOISE || BT_STEREO) {
+ for (int i = 0; i < size; i++)
+ cost += in[i]*in[i];
+ if (bits)
+ *bits = 0;
+ if (energy)
+ *energy = qenergy;
+ if (out) {
+ for (int i = 0; i < size; i += dim)
+ for (int j = 0; j < dim; j++)
+ out[i+j] = 0.0f;
+ }
+ return cost * lambda;
+ }
+ if (!scaled) {
+ s->abs_pow34(s->scoefs, in, size);
+ scaled = s->scoefs;
+ }
+ s->quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
+ if (BT_UNSIGNED) {
+ off = 0;
+ } else {
+ off = aac_cb_maxval[cb];
+ }
+ for (int i = 0; i < size; i += dim) {
+ const float *vec;
+ int *quants = s->qcoefs + i;
+ int curidx = 0;
+ int curbits;
+ float quantized, rd = 0.0f;
+ for (int j = 0; j < dim; j++) {
+ curidx *= aac_cb_range[cb];
+ curidx += quants[j] + off;
+ }
+ curbits = ff_aac_spectral_bits[cb-1][curidx];
+ vec = &ff_aac_codebook_vectors[cb-1][curidx*dim];
+ if (BT_UNSIGNED) {
+ for (int j = 0; j < dim; j++) {
+ float t = fabsf(in[i+j]);
+ float di;
+ if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
+ if (t >= CLIPPED_ESCAPE) {
+ quantized = CLIPPED_ESCAPE;
+ curbits += 21;
+ } else {
+ int c = av_clip_uintp2(quant(t, Q, ROUNDING), 13);
+ quantized = c*cbrtf(c)*IQ;
+ curbits += av_log2(c)*2 - 4 + 1;
+ }
+ } else {
+ quantized = vec[j]*IQ;
+ }
+ di = t - quantized;
+ if (out)
+ out[i+j] = in[i+j] >= 0 ? quantized : -quantized;
+ if (vec[j] != 0.0f)
+ curbits++;
+ qenergy += quantized*quantized;
+ rd += di*di;
+ }
+ } else {
+ for (int j = 0; j < dim; j++) {
+ quantized = vec[j]*IQ;
+ qenergy += quantized*quantized;
+ if (out)
+ out[i+j] = quantized;
+ rd += (in[i+j] - quantized)*(in[i+j] - quantized);
+ }
+ }
+ cost += rd * lambda + curbits;
+ resbits += curbits;
+ if (cost >= uplim)
+ return uplim;
+ if (pb) {
+ put_bits(pb, ff_aac_spectral_bits[cb-1][curidx], ff_aac_spectral_codes[cb-1][curidx]);
+ if (BT_UNSIGNED)
+ for (int j = 0; j < dim; j++)
+ if (ff_aac_codebook_vectors[cb-1][curidx*dim+j] != 0.0f)
+ put_bits(pb, 1, in[i+j] < 0.0f);
+ if (BT_ESC) {
+ for (int j = 0; j < 2; j++) {
+ if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) {
+ int coef = av_clip_uintp2(quant(fabsf(in[i+j]), Q, ROUNDING), 13);
+ int len = av_log2(coef);
+
+ put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
+ put_sbits(pb, len, coef);
+ }
+ }
+ }
+ }
+ }
+
+ if (bits)
+ *bits = resbits;
+ if (energy)
+ *energy = qenergy;
+ return cost;
+}
+
+static inline float quantize_and_encode_band_cost_NONE(struct AACEncContext *s, PutBitContext *pb,
+ const float *in, float *quant, const float *scaled,
+ int size, int scale_idx, int cb,
+ const float lambda, const float uplim,
+ int *bits, float *energy) {
+ av_assert0(0);
+ return 0.0f;
+}
+
+#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING) \
+static float quantize_and_encode_band_cost_ ## NAME( \
+ struct AACEncContext *s, \
+ PutBitContext *pb, const float *in, float *quant, \
+ const float *scaled, int size, int scale_idx, \
+ int cb, const float lambda, const float uplim, \
+ int *bits, float *energy) { \
+ return quantize_and_encode_band_cost_template( \
+ s, pb, in, quant, scaled, size, scale_idx, \
+ BT_ESC ? ESC_BT : cb, lambda, uplim, bits, energy, \
+ BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, \
+ ROUNDING); \
+}
+
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ZERO, 1, 0, 0, 0, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(SQUAD, 0, 0, 0, 0, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(UQUAD, 0, 1, 0, 0, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(SPAIR, 0, 0, 1, 0, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(UPAIR, 0, 1, 1, 0, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ESC, 0, 1, 1, 1, 0, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ESC_RTZ, 0, 1, 1, 1, 0, 0, ROUND_TO_ZERO)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NOISE, 0, 0, 0, 0, 1, 0, ROUND_STANDARD)
+QUANTIZE_AND_ENCODE_BAND_COST_FUNC(STEREO,0, 0, 0, 0, 0, 1, ROUND_STANDARD)
+
+static quantize_and_encode_band_func quantize_and_encode_band_cost_arr[] =
+{
+ quantize_and_encode_band_cost_ZERO,
+ quantize_and_encode_band_cost_SQUAD,
+ quantize_and_encode_band_cost_SQUAD,
+ quantize_and_encode_band_cost_UQUAD,
+ quantize_and_encode_band_cost_UQUAD,
+ quantize_and_encode_band_cost_SPAIR,
+ quantize_and_encode_band_cost_SPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_ESC,
+ quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
+ quantize_and_encode_band_cost_NOISE,
+ quantize_and_encode_band_cost_STEREO,
+ quantize_and_encode_band_cost_STEREO,
+};
+
+static quantize_and_encode_band_func quantize_and_encode_band_cost_rtz_arr[] =
+{
+ quantize_and_encode_band_cost_ZERO,
+ quantize_and_encode_band_cost_SQUAD,
+ quantize_and_encode_band_cost_SQUAD,
+ quantize_and_encode_band_cost_UQUAD,
+ quantize_and_encode_band_cost_UQUAD,
+ quantize_and_encode_band_cost_SPAIR,
+ quantize_and_encode_band_cost_SPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_UPAIR,
+ quantize_and_encode_band_cost_ESC_RTZ,
+ quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
+ quantize_and_encode_band_cost_NOISE,
+ quantize_and_encode_band_cost_STEREO,
+ quantize_and_encode_band_cost_STEREO,
+};
+
+float ff_quantize_and_encode_band_cost(struct AACEncContext *s, PutBitContext *pb,
+ const float *in, float *quant, const float *scaled,
+ int size, int scale_idx, int cb,
+ const float lambda, const float uplim,
+ int *bits, float *energy)
+{
+ return quantize_and_encode_band_cost_arr[cb](s, pb, in, quant, scaled, size,
+ scale_idx, cb, lambda, uplim,
+ bits, energy);
+}
+
+static inline void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb,
+ const float *in, float *out, int size, int scale_idx,
+ int cb, const float lambda, int rtz)
+{
+ (rtz ? quantize_and_encode_band_cost_rtz_arr : quantize_and_encode_band_cost_arr)[cb](s, pb, in, out, NULL, size, scale_idx, cb,
+ lambda, INFINITY, NULL, NULL);
+}
+
/**
* structure used in optimal codebook search
*/
diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c
index d111192f06..447444cb82 100644
--- a/libavcodec/aacenc_pred.c
+++ b/libavcodec/aacenc_pred.c
@@ -271,9 +271,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
/* Normal coefficients */
s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs);
- dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
- O34, num_coeffs, sce->sf_idx[sfb],
- cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL, 0);
+ dist1 = ff_quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
+ O34, num_coeffs, sce->sf_idx[sfb],
+ cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL);
cost_coeffs += cost1;
/* Encoded coefficients - needed for #bits, band type and quant. error */
@@ -284,9 +284,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max);
else
cb_p = cb_n;
- quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
- sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
- &cost2, NULL, 0);
+ ff_quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
+ sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
+ &cost2, NULL);
/* Reconstructed coefficients - needed for distortion measurements */
for (i = 0; i < num_coeffs; i++)
@@ -296,9 +296,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max);
else
cb_p = cb_n;
- dist2 = quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
- P34, num_coeffs, sce->sf_idx[sfb],
- cb_p, s->lambda / band->threshold, INFINITY, NULL, NULL, 0);
+ dist2 = ff_quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
+ P34, num_coeffs, sce->sf_idx[sfb],
+ cb_p, s->lambda / band->threshold, INFINITY, NULL, NULL);
for (i = 0; i < num_coeffs; i++)
dist_spec_err += (O34[i] - P34[i])*(O34[i] - P34[i]);
dist_spec_err *= s->lambda / band->threshold;
diff --git a/libavcodec/aacenc_quantization.h b/libavcodec/aacenc_quantization.h
index f3c3553886..185430b0dd 100644
--- a/libavcodec/aacenc_quantization.h
+++ b/libavcodec/aacenc_quantization.h
@@ -28,232 +28,25 @@
#ifndef AVCODEC_AACENC_QUANTIZATION_H
#define AVCODEC_AACENC_QUANTIZATION_H
-#include "aactab.h"
-#include "aacenc.h"
-#include "aacenctab.h"
-#include "aacenc_utils.h"
-
-/**
- * Calculate rate distortion cost for quantizing with given codebook
- *
- * @return quantization distortion
- */
-static av_always_inline float quantize_and_encode_band_cost_template(
- struct AACEncContext *s,
- PutBitContext *pb, const float *in, float *out,
- const float *scaled, int size, int scale_idx,
- int cb, const float lambda, const float uplim,
- int *bits, float *energy, int BT_ZERO, int BT_UNSIGNED,
- int BT_PAIR, int BT_ESC, int BT_NOISE, int BT_STEREO,
- const float ROUNDING)
-{
- const int q_idx = POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512;
- const float Q = ff_aac_pow2sf_tab [q_idx];
- const float Q34 = ff_aac_pow34sf_tab[q_idx];
- const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
- const float CLIPPED_ESCAPE = 165140.0f*IQ;
- int i, j;
- float cost = 0;
- float qenergy = 0;
- const int dim = BT_PAIR ? 2 : 4;
- int resbits = 0;
- int off;
+#include <stddef.h>
- if (BT_ZERO || BT_NOISE || BT_STEREO) {
- for (i = 0; i < size; i++)
- cost += in[i]*in[i];
- if (bits)
- *bits = 0;
- if (energy)
- *energy = qenergy;
- if (out) {
- for (i = 0; i < size; i += dim)
- for (j = 0; j < dim; j++)
- out[i+j] = 0.0f;
- }
- return cost * lambda;
- }
- if (!scaled) {
- s->abs_pow34(s->scoefs, in, size);
- scaled = s->scoefs;
- }
- s->quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
- if (BT_UNSIGNED) {
- off = 0;
- } else {
- off = aac_cb_maxval[cb];
- }
- for (i = 0; i < size; i += dim) {
- const float *vec;
- int *quants = s->qcoefs + i;
- int curidx = 0;
- int curbits;
- float quantized, rd = 0.0f;
- for (j = 0; j < dim; j++) {
- curidx *= aac_cb_range[cb];
- curidx += quants[j] + off;
- }
- curbits = ff_aac_spectral_bits[cb-1][curidx];
- vec = &ff_aac_codebook_vectors[cb-1][curidx*dim];
- if (BT_UNSIGNED) {
- for (j = 0; j < dim; j++) {
- float t = fabsf(in[i+j]);
- float di;
- if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
- if (t >= CLIPPED_ESCAPE) {
- quantized = CLIPPED_ESCAPE;
- curbits += 21;
- } else {
- int c = av_clip_uintp2(quant(t, Q, ROUNDING), 13);
- quantized = c*cbrtf(c)*IQ;
- curbits += av_log2(c)*2 - 4 + 1;
- }
- } else {
- quantized = vec[j]*IQ;
- }
- di = t - quantized;
- if (out)
- out[i+j] = in[i+j] >= 0 ? quantized : -quantized;
- if (vec[j] != 0.0f)
- curbits++;
- qenergy += quantized*quantized;
- rd += di*di;
- }
- } else {
- for (j = 0; j < dim; j++) {
- quantized = vec[j]*IQ;
- qenergy += quantized*quantized;
- if (out)
- out[i+j] = quantized;
- rd += (in[i+j] - quantized)*(in[i+j] - quantized);
- }
- }
- cost += rd * lambda + curbits;
- resbits += curbits;
- if (cost >= uplim)
- return uplim;
- if (pb) {
- put_bits(pb, ff_aac_spectral_bits[cb-1][curidx], ff_aac_spectral_codes[cb-1][curidx]);
- if (BT_UNSIGNED)
- for (j = 0; j < dim; j++)
- if (ff_aac_codebook_vectors[cb-1][curidx*dim+j] != 0.0f)
- put_bits(pb, 1, in[i+j] < 0.0f);
- if (BT_ESC) {
- for (j = 0; j < 2; j++) {
- if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) {
- int coef = av_clip_uintp2(quant(fabsf(in[i+j]), Q, ROUNDING), 13);
- int len = av_log2(coef);
-
- put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
- put_sbits(pb, len, coef);
- }
- }
- }
- }
- }
-
- if (bits)
- *bits = resbits;
- if (energy)
- *energy = qenergy;
- return cost;
-}
-
-static inline float quantize_and_encode_band_cost_NONE(struct AACEncContext *s, PutBitContext *pb,
- const float *in, float *quant, const float *scaled,
- int size, int scale_idx, int cb,
- const float lambda, const float uplim,
- int *bits, float *energy) {
- av_assert0(0);
- return 0.0f;
-}
-
-#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING) \
-static float quantize_and_encode_band_cost_ ## NAME( \
- struct AACEncContext *s, \
- PutBitContext *pb, const float *in, float *quant, \
- const float *scaled, int size, int scale_idx, \
- int cb, const float lambda, const float uplim, \
- int *bits, float *energy) { \
- return quantize_and_encode_band_cost_template( \
- s, pb, in, quant, scaled, size, scale_idx, \
- BT_ESC ? ESC_BT : cb, lambda, uplim, bits, energy, \
- BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, \
- ROUNDING); \
-}
-
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ZERO, 1, 0, 0, 0, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(SQUAD, 0, 0, 0, 0, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(UQUAD, 0, 1, 0, 0, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(SPAIR, 0, 0, 1, 0, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(UPAIR, 0, 1, 1, 0, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ESC, 0, 1, 1, 1, 0, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ESC_RTZ, 0, 1, 1, 1, 0, 0, ROUND_TO_ZERO)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NOISE, 0, 0, 0, 0, 1, 0, ROUND_STANDARD)
-QUANTIZE_AND_ENCODE_BAND_COST_FUNC(STEREO,0, 0, 0, 0, 0, 1, ROUND_STANDARD)
-
-static float (*const quantize_and_encode_band_cost_arr[])(
- struct AACEncContext *s,
- PutBitContext *pb, const float *in, float *quant,
- const float *scaled, int size, int scale_idx,
- int cb, const float lambda, const float uplim,
- int *bits, float *energy) = {
- quantize_and_encode_band_cost_ZERO,
- quantize_and_encode_band_cost_SQUAD,
- quantize_and_encode_band_cost_SQUAD,
- quantize_and_encode_band_cost_UQUAD,
- quantize_and_encode_band_cost_UQUAD,
- quantize_and_encode_band_cost_SPAIR,
- quantize_and_encode_band_cost_SPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_ESC,
- quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
- quantize_and_encode_band_cost_NOISE,
- quantize_and_encode_band_cost_STEREO,
- quantize_and_encode_band_cost_STEREO,
-};
+#include "aacenc.h"
+#include "put_bits.h"
-static float (*const quantize_and_encode_band_cost_rtz_arr[])(
- struct AACEncContext *s,
- PutBitContext *pb, const float *in, float *quant,
- const float *scaled, int size, int scale_idx,
- int cb, const float lambda, const float uplim,
- int *bits, float *energy) = {
- quantize_and_encode_band_cost_ZERO,
- quantize_and_encode_band_cost_SQUAD,
- quantize_and_encode_band_cost_SQUAD,
- quantize_and_encode_band_cost_UQUAD,
- quantize_and_encode_band_cost_UQUAD,
- quantize_and_encode_band_cost_SPAIR,
- quantize_and_encode_band_cost_SPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_UPAIR,
- quantize_and_encode_band_cost_ESC_RTZ,
- quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
- quantize_and_encode_band_cost_NOISE,
- quantize_and_encode_band_cost_STEREO,
- quantize_and_encode_band_cost_STEREO,
-};
-#define quantize_and_encode_band_cost( \
- s, pb, in, quant, scaled, size, scale_idx, cb, \
- lambda, uplim, bits, energy, rtz) \
- ((rtz) ? quantize_and_encode_band_cost_rtz_arr : quantize_and_encode_band_cost_arr)[cb]( \
- s, pb, in, quant, scaled, size, scale_idx, cb, \
- lambda, uplim, bits, energy)
+float ff_quantize_and_encode_band_cost(AACEncContext *s, PutBitContext *pb,
+ const float *in, float *quant, const float *scaled,
+ int size, int scale_idx, int cb,
+ const float lambda, const float uplim,
+ int *bits, float *energy);
static inline float quantize_band_cost(struct AACEncContext *s, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
int *bits, float *energy)
{
- return quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
- cb, lambda, uplim, bits, energy, 0);
+ return ff_quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
+ cb, lambda, uplim, bits, energy);
}
static inline int quantize_band_cost_bits(struct AACEncContext *s, const float *in,
@@ -262,22 +55,14 @@ static inline int quantize_band_cost_bits(struct AACEncContext *s, const float *
int *bits, float *energy)
{
int auxbits;
- quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
- cb, 0.0f, uplim, &auxbits, energy, 0);
+ ff_quantize_and_encode_band_cost(s, NULL, in, NULL, scaled, size, scale_idx,
+ cb, 0.0f, uplim, &auxbits, energy);
if (bits) {
*bits = auxbits;
}
return auxbits;
}
-static inline void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb,
- const float *in, float *out, int size, int scale_idx,
- int cb, const float lambda, int rtz)
-{
- quantize_and_encode_band_cost(s, pb, in, out, NULL, size, scale_idx, cb, lambda,
- INFINITY, NULL, NULL, rtz);
-}
-
#include "aacenc_quantization_misc.h"
#endif /* AVCODEC_AACENC_QUANTIZATION_H */
--
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".
^ permalink raw reply [flat|nested] 13+ messages in thread