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 01/11] avcodec/flacdsp: Remove unused function parameter
@ 2022-08-01 12:16 Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 02/11] avcodec/flacdsp: Split encoder-only parts into a ctx of its own Andreas Rheinhardt
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-01 12:16 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Forgotten in e609cfd697f8eed7325591f767585041719807d1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/arm/flacdsp_init_arm.c | 3 +--
 libavcodec/flacdec.c              | 6 +++---
 libavcodec/flacdsp.c              | 7 +++----
 libavcodec/flacdsp.h              | 6 +++---
 libavcodec/flacenc.c              | 3 +--
 libavcodec/x86/flacdsp_init.c     | 3 +--
 tests/checkasm/flacdsp.c          | 4 ++--
 7 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/libavcodec/arm/flacdsp_init_arm.c b/libavcodec/arm/flacdsp_init_arm.c
index bac9ff1959..a16de9ee9a 100644
--- a/libavcodec/arm/flacdsp_init_arm.c
+++ b/libavcodec/arm/flacdsp_init_arm.c
@@ -26,8 +26,7 @@
 void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
                         int qlevel, int len);
 
-av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
-                                 int bps)
+av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
 {
     if (CONFIG_FLAC_DECODER)
         c->lpc16 = ff_flac_lpc_16_arm;
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 17f1821c50..5ddc5a34d2 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -117,7 +117,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
         return ret;
     flac_set_bps(s);
     ff_flacdsp_init(&s->dsp, avctx->sample_fmt,
-                    s->flac_stream_info.channels, s->flac_stream_info.bps);
+                    s->flac_stream_info.channels);
     s->got_streaminfo = 1;
 
     return 0;
@@ -185,7 +185,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
         return ret;
     flac_set_bps(s);
     ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt,
-                    s->flac_stream_info.channels, s->flac_stream_info.bps);
+                    s->flac_stream_info.channels);
     s->got_streaminfo = 1;
 
     return 0;
@@ -536,7 +536,7 @@ static int decode_frame(FLACContext *s)
         dump_headers(s->avctx, &s->flac_stream_info);
     }
     ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt,
-                    s->flac_stream_info.channels, s->flac_stream_info.bps);
+                    s->flac_stream_info.channels);
 
 //    dump_headers(s->avctx, &s->flac_stream_info);
 
diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index 79002dcac0..da8400ae0a 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -86,8 +86,7 @@ static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32],
 
 }
 
-av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
-                             int bps)
+av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
 {
     c->lpc16        = flac_lpc_16_c;
     c->lpc32        = flac_lpc_32_c;
@@ -125,8 +124,8 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha
     }
 
 #if ARCH_ARM
-    ff_flacdsp_init_arm(c, fmt, channels, bps);
+    ff_flacdsp_init_arm(c, fmt, channels);
 #elif ARCH_X86
-    ff_flacdsp_init_x86(c, fmt, channels, bps);
+    ff_flacdsp_init_x86(c, fmt, channels);
 #endif
 }
diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
index 4a7a36064a..9f8ed38b66 100644
--- a/libavcodec/flacdsp.h
+++ b/libavcodec/flacdsp.h
@@ -36,8 +36,8 @@ typedef struct FLACDSPContext {
                          const int32_t coefs[32], int shift);
 } FLACDSPContext;
 
-void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
-void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
-void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
+void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
+void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
+void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
 
 #endif /* AVCODEC_FLACDSP_H */
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 9350e42dbc..3cfefbc89f 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -425,8 +425,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
                       s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
 
     ff_bswapdsp_init(&s->bdsp);
-    ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, channels,
-                    avctx->bits_per_raw_sample);
+    ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, channels);
 
     dprint_compression_options(s);
 
diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
index ed2e5ed15b..7975712db9 100644
--- a/libavcodec/x86/flacdsp_init.c
+++ b/libavcodec/x86/flacdsp_init.c
@@ -52,8 +52,7 @@ DECORRELATE_FUNCS(16,  avx);
 DECORRELATE_FUNCS(32, sse2);
 DECORRELATE_FUNCS(32,  avx);
 
-av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
-                                 int bps)
+av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
 {
 #if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
index 6cd8ac50ef..ef93df8c81 100644
--- a/tests/checkasm/flacdsp.c
+++ b/tests/checkasm/flacdsp.c
@@ -76,12 +76,12 @@ void checkasm_check_flacdsp(void)
     int i, j;
 
     for (i = 0; i < 2; i++) {
-        ff_flacdsp_init(&h, fmts[i].fmt, 2, 0);
+        ff_flacdsp_init(&h, fmts[i].fmt, 2);
         for (j = 0; j < 3; j++)
             if (check_func(h.decorrelate[j], "flac_decorrelate_%s_%d", names[j], fmts[i].bits))
                 check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, 2, fmts[i].bits);
         for (j = 2; j <= MAX_CHANNELS; j += 2) {
-            ff_flacdsp_init(&h, fmts[i].fmt, j, 0);
+            ff_flacdsp_init(&h, fmts[i].fmt, j);
             if (check_func(h.decorrelate[0], "flac_decorrelate_indep%d_%d", j, fmts[i].bits))
                 check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, j, fmts[i].bits);
         }
-- 
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 02/11] avcodec/flacdsp: Split encoder-only parts into a ctx of its own
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 03/11] avcodec/internal: Move ff_thread_can_start_frame() to threadframe.h Andreas Rheinhardt
                   ` (9 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>
---
 configure                         |  4 +---
 libavcodec/Makefile               |  5 ++--
 libavcodec/arm/Makefile           |  4 ++--
 libavcodec/arm/flacdsp_init_arm.c |  5 +---
 libavcodec/flacdsp.c              |  4 ----
 libavcodec/flacenc.c              |  6 ++---
 libavcodec/flacencdsp.c           | 40 +++++++++++++++++++++++++++++++
 libavcodec/flacencdsp.h           | 34 ++++++++++++++++++++++++++
 libavcodec/x86/Makefile           |  3 ++-
 libavcodec/x86/flacdsp_init.c     | 12 ----------
 libavcodec/x86/flacencdsp_init.c  | 38 +++++++++++++++++++++++++++++
 tests/checkasm/Makefile           |  2 +-
 tests/checkasm/checkasm.c         |  2 +-
 13 files changed, 125 insertions(+), 34 deletions(-)
 create mode 100644 libavcodec/flacencdsp.c
 create mode 100644 libavcodec/flacencdsp.h
 create mode 100644 libavcodec/x86/flacencdsp_init.c

diff --git a/configure b/configure
index 8c7e8c9d1d..6cee752acd 100755
--- a/configure
+++ b/configure
@@ -2449,7 +2449,6 @@ CONFIG_EXTRA="
     faandct
     faanidct
     fdctdsp
-    flacdsp
     fmtconvert
     frame_thread_encoder
     g722dsp
@@ -2817,8 +2816,7 @@ ffv1_encoder_select="rangecoder"
 ffvhuff_decoder_select="huffyuv_decoder"
 ffvhuff_encoder_select="huffyuv_encoder"
 fic_decoder_select="golomb"
-flac_decoder_select="flacdsp"
-flac_encoder_select="bswapdsp flacdsp lpc"
+flac_encoder_select="bswapdsp lpc"
 flashsv2_decoder_select="inflate_wrapper"
 flashsv2_encoder_select="deflate_wrapper"
 flashsv_decoder_select="inflate_wrapper"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index aff7752856..10179b717e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -91,7 +91,6 @@ OBJS-$(CONFIG_FDCTDSP)                 += fdctdsp.o jfdctfst.o jfdctint.o
 FFT-OBJS-$(CONFIG_HARDCODED_TABLES)    += cos_tables.o
 OBJS-$(CONFIG_FFT)                     += avfft.o fft_float.o fft_fixed_32.o \
                                           fft_init_table.o $(FFT-OBJS-yes)
-OBJS-$(CONFIG_FLACDSP)                 += flacdsp.o
 OBJS-$(CONFIG_FMTCONVERT)              += fmtconvert.o
 OBJS-$(CONFIG_GOLOMB)                  += golomb.o
 OBJS-$(CONFIG_H263DSP)                 += h263dsp.o
@@ -345,8 +344,8 @@ OBJS-$(CONFIG_FFWAVESYNTH_DECODER)     += ffwavesynth.o
 OBJS-$(CONFIG_FIC_DECODER)             += fic.o
 OBJS-$(CONFIG_FITS_DECODER)            += fitsdec.o fits.o
 OBJS-$(CONFIG_FITS_ENCODER)            += fitsenc.o
-OBJS-$(CONFIG_FLAC_DECODER)            += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLAC_ENCODER)            += flacenc.o flacdata.o flac.o
+OBJS-$(CONFIG_FLAC_DECODER)            += flacdec.o flacdata.o flacdsp.o flac.o
+OBJS-$(CONFIG_FLAC_ENCODER)            += flacenc.o flacdata.o flacencdsp.o flac.o
 OBJS-$(CONFIG_FLASHSV_DECODER)         += flashsv.o
 OBJS-$(CONFIG_FLASHSV_ENCODER)         += flashsvenc.o
 OBJS-$(CONFIG_FLASHSV2_ENCODER)        += flashsv2enc.o
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index c4ab93aeeb..5d284bdc01 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -6,8 +6,6 @@ OBJS-$(CONFIG_AC3DSP)                  += arm/ac3dsp_init_arm.o         \
 OBJS-$(CONFIG_AUDIODSP)                += arm/audiodsp_init_arm.o
 OBJS-$(CONFIG_BLOCKDSP)                += arm/blockdsp_init_arm.o
 OBJS-$(CONFIG_FFT)                     += arm/fft_init_arm.o
-OBJS-$(CONFIG_FLACDSP)                 += arm/flacdsp_init_arm.o        \
-                                          arm/flacdsp_arm.o
 OBJS-$(CONFIG_FMTCONVERT)              += arm/fmtconvert_init_arm.o
 OBJS-$(CONFIG_G722DSP)                 += arm/g722dsp_init_arm.o
 OBJS-$(CONFIG_H264CHROMA)              += arm/h264chroma_init_arm.o
@@ -38,6 +36,8 @@ OBJS-$(CONFIG_VP8DSP)                  += arm/vp8dsp_init_arm.o
 OBJS-$(CONFIG_AAC_DECODER)             += arm/aacpsdsp_init_arm.o       \
                                           arm/sbrdsp_init_arm.o
 OBJS-$(CONFIG_DCA_DECODER)             += arm/synth_filter_init_arm.o
+OBJS-$(CONFIG_FLAC_DECODER)            += arm/flacdsp_init_arm.o        \
+                                          arm/flacdsp_arm.o
 OBJS-$(CONFIG_HEVC_DECODER)            += arm/hevcdsp_init_arm.o
 OBJS-$(CONFIG_MLP_DECODER)             += arm/mlpdsp_init_arm.o
 OBJS-$(CONFIG_RV40_DECODER)            += arm/rv40dsp_init_arm.o
diff --git a/libavcodec/arm/flacdsp_init_arm.c b/libavcodec/arm/flacdsp_init_arm.c
index a16de9ee9a..9962cc89f4 100644
--- a/libavcodec/arm/flacdsp_init_arm.c
+++ b/libavcodec/arm/flacdsp_init_arm.c
@@ -20,14 +20,11 @@
 
 #include "libavutil/attributes.h"
 #include "libavcodec/flacdsp.h"
-#include "config.h"
-#include "config_components.h"
 
 void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
                         int qlevel, int len);
 
 av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
 {
-    if (CONFIG_FLAC_DECODER)
-        c->lpc16 = ff_flac_lpc_16_arm;
+    c->lpc16 = ff_flac_lpc_16_arm;
 }
diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index da8400ae0a..42e231db53 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -27,7 +27,6 @@
 #define SAMPLE_SIZE 16
 #define PLANAR 0
 #include "flacdsp_template.c"
-#include "flacdsp_lpc_template.c"
 
 #undef  PLANAR
 #define PLANAR 1
@@ -38,7 +37,6 @@
 #define SAMPLE_SIZE 32
 #define PLANAR 0
 #include "flacdsp_template.c"
-#include "flacdsp_lpc_template.c"
 
 #undef  PLANAR
 #define PLANAR 1
@@ -90,8 +88,6 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha
 {
     c->lpc16        = flac_lpc_16_c;
     c->lpc32        = flac_lpc_32_c;
-    c->lpc16_encode = flac_lpc_encode_c_16;
-    c->lpc32_encode = flac_lpc_encode_c_32;
 
     switch (fmt) {
     case AV_SAMPLE_FMT_S32:
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 3cfefbc89f..00f78fc814 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -36,7 +36,7 @@
 #include "lpc.h"
 #include "flac.h"
 #include "flacdata.h"
-#include "flacdsp.h"
+#include "flacencdsp.h"
 
 #define FLAC_SUBFRAME_CONSTANT  0
 #define FLAC_SUBFRAME_VERBATIM  1
@@ -125,7 +125,7 @@ typedef struct FlacEncodeContext {
     uint8_t *md5_buffer;
     unsigned int md5_buffer_size;
     BswapDSPContext bdsp;
-    FLACDSPContext flac_dsp;
+    FLACEncDSPContext flac_dsp;
 
     int flushed;
     int64_t next_pts;
@@ -425,7 +425,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
                       s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
 
     ff_bswapdsp_init(&s->bdsp);
-    ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, channels);
+    ff_flacencdsp_init(&s->flac_dsp);
 
     dprint_compression_options(s);
 
diff --git a/libavcodec/flacencdsp.c b/libavcodec/flacencdsp.c
new file mode 100644
index 0000000000..46e5a0352b
--- /dev/null
+++ b/libavcodec/flacencdsp.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
+ *
+ * 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 "config.h"
+#include "flacencdsp.h"
+
+#define SAMPLE_SIZE 16
+#include "flacdsp_lpc_template.c"
+
+#undef  SAMPLE_SIZE
+#define SAMPLE_SIZE 32
+#include "flacdsp_lpc_template.c"
+
+
+av_cold void ff_flacencdsp_init(FLACEncDSPContext *c)
+{
+    c->lpc16_encode = flac_lpc_encode_c_16;
+    c->lpc32_encode = flac_lpc_encode_c_32;
+
+#if ARCH_X86
+    ff_flacencdsp_init_x86(c);
+#endif
+}
diff --git a/libavcodec/flacencdsp.h b/libavcodec/flacencdsp.h
new file mode 100644
index 0000000000..39811e2353
--- /dev/null
+++ b/libavcodec/flacencdsp.h
@@ -0,0 +1,34 @@
+/*
+ * 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_FLACENCDSP_H
+#define AVCODEC_FLACENCDSP_H
+
+#include <stdint.h>
+
+typedef struct FLACEncDSPContext {
+    void (*lpc16_encode)(int32_t *res, const int32_t *smp, int len, int order,
+                         const int32_t coefs[32], int shift);
+    void (*lpc32_encode)(int32_t *res, const int32_t *smp, int len, int order,
+                         const int32_t coefs[32], int shift);
+} FLACEncDSPContext;
+
+void ff_flacencdsp_init(FLACEncDSPContext *c);
+void ff_flacencdsp_init_x86(FLACEncDSPContext *c);
+
+#endif /* AVCODEC_FLACDSP_H */
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 6361161180..4e448623af 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -10,7 +10,6 @@ OBJS-$(CONFIG_DIRAC_DECODER)           += x86/diracdsp_init.o           \
                                           x86/dirac_dwt_init.o
 OBJS-$(CONFIG_FDCTDSP)                 += x86/fdctdsp_init.o
 OBJS-$(CONFIG_FFT)                     += x86/fft_init.o
-OBJS-$(CONFIG_FLACDSP)                 += x86/flacdsp_init.o
 OBJS-$(CONFIG_FMTCONVERT)              += x86/fmtconvert_init.o
 OBJS-$(CONFIG_H263DSP)                 += x86/h263dsp_init.o
 OBJS-$(CONFIG_H264CHROMA)              += x86/h264chroma_init.o
@@ -55,6 +54,8 @@ OBJS-$(CONFIG_CFHD_ENCODER)            += x86/cfhdencdsp_init.o
 OBJS-$(CONFIG_DCA_DECODER)             += x86/dcadsp_init.o x86/synth_filter_init.o
 OBJS-$(CONFIG_DNXHD_ENCODER)           += x86/dnxhdenc_init.o
 OBJS-$(CONFIG_EXR_DECODER)             += x86/exrdsp_init.o
+OBJS-$(CONFIG_FLAC_DECODER)            += x86/flacdsp_init.o
+OBJS-$(CONFIG_FLAC_ENCODER)            += x86/flacencdsp_init.o
 OBJS-$(CONFIG_OPUS_DECODER)            += x86/opusdsp_init.o
 OBJS-$(CONFIG_OPUS_ENCODER)            += x86/celt_pvq_init.o
 OBJS-$(CONFIG_HEVC_DECODER)            += x86/hevcdsp_init.o
diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
index 7975712db9..2deaf3117f 100644
--- a/libavcodec/x86/flacdsp_init.c
+++ b/libavcodec/x86/flacdsp_init.c
@@ -22,15 +22,12 @@
 #include "libavcodec/flacdsp.h"
 #include "libavutil/x86/cpu.h"
 #include "config.h"
-#include "config_components.h"
 
 void ff_flac_lpc_32_sse4(int32_t *samples, const int coeffs[32], int order,
                          int qlevel, int len);
 void ff_flac_lpc_32_xop(int32_t *samples, const int coeffs[32], int order,
                         int qlevel, int len);
 
-void ff_flac_enc_lpc_16_sse4(int32_t *, const int32_t *, int, int, const int32_t *,int);
-
 #define DECORRELATE_FUNCS(fmt, opt)                                                      \
 void ff_flac_decorrelate_ls_##fmt##_##opt(uint8_t **out, int32_t **in, int channels,     \
                                           int len, int shift);                           \
@@ -57,7 +54,6 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
 #if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
-#if CONFIG_FLAC_DECODER
     if (EXTERNAL_SSE2(cpu_flags)) {
         if (fmt == AV_SAMPLE_FMT_S16) {
             if (channels == 2)
@@ -104,13 +100,5 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
     if (EXTERNAL_XOP(cpu_flags)) {
         c->lpc32 = ff_flac_lpc_32_xop;
     }
-#endif
-
-#if CONFIG_FLAC_ENCODER
-    if (EXTERNAL_SSE4(cpu_flags)) {
-        if (CONFIG_GPL)
-            c->lpc16_encode = ff_flac_enc_lpc_16_sse4;
-    }
-#endif
 #endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/flacencdsp_init.c b/libavcodec/x86/flacencdsp_init.c
new file mode 100644
index 0000000000..5ab37e0a8f
--- /dev/null
+++ b/libavcodec/x86/flacencdsp_init.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 James Almer
+ *
+ * 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 "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/flacencdsp.h"
+
+void ff_flac_enc_lpc_16_sse4(int32_t *, const int32_t *, int, int, const int32_t *,int);
+
+av_cold void ff_flacencdsp_init_x86(FLACEncDSPContext *c)
+{
+#if HAVE_X86ASM && CONFIG_GPL
+    int cpu_flags = av_get_cpu_flags();
+
+    if (EXTERNAL_SSE4(cpu_flags)) {
+        if (CONFIG_GPL)
+            c->lpc16_encode = ff_flac_enc_lpc_16_sse4;
+    }
+#endif /* HAVE_X86ASM */
+}
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index e869c70b55..1ac170491b 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -3,7 +3,6 @@
 AVCODECOBJS-$(CONFIG_AUDIODSP)          += audiodsp.o
 AVCODECOBJS-$(CONFIG_BLOCKDSP)          += blockdsp.o
 AVCODECOBJS-$(CONFIG_BSWAPDSP)          += bswapdsp.o
-AVCODECOBJS-$(CONFIG_FLACDSP)           += flacdsp.o
 AVCODECOBJS-$(CONFIG_FMTCONVERT)        += fmtconvert.o
 AVCODECOBJS-$(CONFIG_G722DSP)           += g722dsp.o
 AVCODECOBJS-$(CONFIG_H264DSP)           += h264dsp.o
@@ -23,6 +22,7 @@ AVCODECOBJS-$(CONFIG_AAC_DECODER)       += aacpsdsp.o \
 AVCODECOBJS-$(CONFIG_ALAC_DECODER)      += alacdsp.o
 AVCODECOBJS-$(CONFIG_DCA_DECODER)       += synth_filter.o
 AVCODECOBJS-$(CONFIG_EXR_DECODER)       += exrdsp.o
+AVCODECOBJS-$(CONFIG_FLAC_DECODER)      += flacdsp.o
 AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER)   += huffyuvdsp.o
 AVCODECOBJS-$(CONFIG_JPEG2000_DECODER)  += jpeg2000dsp.o
 AVCODECOBJS-$(CONFIG_OPUS_DECODER)      += opusdsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 5ffcafbda9..e56fd3850e 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -96,7 +96,7 @@ static const struct {
     #if CONFIG_EXR_DECODER
         { "exrdsp", checkasm_check_exrdsp },
     #endif
-    #if CONFIG_FLACDSP
+    #if CONFIG_FLAC_DECODER
         { "flacdsp", checkasm_check_flacdsp },
     #endif
     #if CONFIG_FMTCONVERT
-- 
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 03/11] avcodec/internal: Move ff_thread_can_start_frame() to threadframe.h
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 02/11] avcodec/flacdsp: Split encoder-only parts into a ctx of its own Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 04/11] fftools/ffmpeg_opt: Fix copyinkf Andreas Rheinhardt
                   ` (8 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/internal.h    | 2 --
 libavcodec/threadframe.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 8809a7079a..b1a49579d8 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -218,8 +218,6 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
  */
 int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
 
-int ff_thread_can_start_frame(AVCodecContext *avctx);
-
 int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx);
 
 int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec);
diff --git a/libavcodec/threadframe.h b/libavcodec/threadframe.h
index 100e068e06..d2f93c5cd0 100644
--- a/libavcodec/threadframe.h
+++ b/libavcodec/threadframe.h
@@ -84,4 +84,6 @@ void ff_thread_release_ext_buffer(AVCodecContext *avctx, ThreadFrame *f);
 
 int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src);
 
+int ff_thread_can_start_frame(AVCodecContext *avctx);
+
 #endif
-- 
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 04/11] fftools/ffmpeg_opt: Fix copyinkf
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 02/11] avcodec/flacdsp: Split encoder-only parts into a ctx of its own Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 03/11] avcodec/internal: Move ff_thread_can_start_frame() to threadframe.h Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 05/11] avcodec/aacenc: Move aac_pce_configs to its only user Andreas Rheinhardt
                   ` (7 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

Broken in 9c2b800203a5a8f3d83f3b8f28e8c50d28186b39.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg_opt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index d7049069f4..a96bcf9b8a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1748,6 +1748,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
     ost->last_mux_dts = AV_NOPTS_VALUE;
     ost->last_filter_pts = AV_NOPTS_VALUE;
 
+    MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i,
+                         ost->copy_initial_nonkeyframes, oc, st);
+
     return ost;
 }
 
-- 
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 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 06/11] avcodec/sbrdsp: Remove unnecessary headers
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 05/11] avcodec/aacenc: Move aac_pce_configs to its only user Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 07/11] avcodec/aacenc_quantization: Remove always-zero function parameter Andreas Rheinhardt
                   ` (5 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/sbrdsp.c       | 1 -
 libavcodec/sbrdsp.h       | 1 -
 libavcodec/sbrdsp_fixed.c | 1 -
 3 files changed, 3 deletions(-)

diff --git a/libavcodec/sbrdsp.c b/libavcodec/sbrdsp.c
index a93b5f9c13..8d6ffdfe7e 100644
--- a/libavcodec/sbrdsp.c
+++ b/libavcodec/sbrdsp.c
@@ -23,7 +23,6 @@
 #define USE_FIXED 0
 
 #include "aac.h"
-#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/intfloat.h"
 #include "sbrdsp.h"
diff --git a/libavcodec/sbrdsp.h b/libavcodec/sbrdsp.h
index e6fd76d8ed..8513c423af 100644
--- a/libavcodec/sbrdsp.h
+++ b/libavcodec/sbrdsp.h
@@ -23,7 +23,6 @@
 
 #include <stdint.h>
 #include "aac_defines.h"
-#include "libavutil/softfloat.h"
 
 typedef struct SBRDSPContext {
     void (*sum64x5)(INTFLOAT *z);
diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c
index 0d34a2a710..f5784f801d 100644
--- a/libavcodec/sbrdsp_fixed.c
+++ b/libavcodec/sbrdsp_fixed.c
@@ -26,7 +26,6 @@
 #define USE_FIXED 1
 
 #include "aac.h"
-#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/intfloat.h"
 #include "sbrdsp.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

* [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 08/11] avcodec/aacenc_tns: Remove unused header
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
                   ` (5 preceding siblings ...)
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 07/11] avcodec/aacenc_quantization: Remove always-zero function parameter Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 09/11] avcodec/aacenc_quantization: Deduplicate quantization functions Andreas Rheinhardt
                   ` (3 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_tns.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/aacenc_tns.c b/libavcodec/aacenc_tns.c
index 2ffe1f8de8..195ff5e2b7 100644
--- a/libavcodec/aacenc_tns.c
+++ b/libavcodec/aacenc_tns.c
@@ -30,7 +30,6 @@
 #include "aacenc_tns.h"
 #include "aactab.h"
 #include "aacenc_utils.h"
-#include "aacenc_quantization.h"
 
 /* Could be set to 3 to save an additional bit at the cost of little quality */
 #define TNS_Q_BITS 4
-- 
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

* [FFmpeg-devel] [PATCH 10/11] avcodec/avcodec: Remove legacy cruft
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
                   ` (7 preceding siblings ...)
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 09/11] avcodec/aacenc_quantization: Deduplicate quantization functions Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
  2022-08-03 19:49 ` [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
  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/avcodec.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 60b215d2e9..abd6272f63 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -338,13 +338,6 @@ typedef struct RcOverride{
  */
 #define AV_CODEC_FLAG2_ICC_PROFILES   (1U << 31)
 
-/* Unsupported options :
- *              Syntax Arithmetic coding (SAC)
- *              Reference Picture Selection
- *              Independent Segment Decoding */
-/* /Fx */
-/* codec capabilities */
-
 /* Exported side data.
    These flags can be passed in AVCodecContext.export_side_data before initialization.
 */
-- 
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 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
                   ` (8 preceding siblings ...)
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 10/11] avcodec/avcodec: Remove legacy cruft Andreas Rheinhardt
@ 2022-08-01 12:23 ` Andreas Rheinhardt
  2022-08-05  1:45   ` Andreas Rheinhardt
  2022-08-03 19:49 ` [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
  10 siblings, 1 reply; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-01 12:23 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It has been deprecated in 94d68a41fabb55dd8c7e59b88fe4a28a637d1e5f
and can't be set via AVOptions. The only codecs that use it
(the MPEG-1/2 encoders) have private options for this.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/avcodec.h   | 5 -----
 libavcodec/mpeg12enc.c | 1 -
 2 files changed, 6 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index abd6272f63..1d55cdb07a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -300,11 +300,6 @@ typedef struct RcOverride{
  */
 #define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
 
-/**
- * timecode is in drop frame format. DEPRECATED!!!!
- */
-#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
-
 /**
  * Input bitstream might be truncated at a packet boundaries
  * instead of only at frame boundaries.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index a7e7aef010..ae2311b39f 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -234,7 +234,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
         }
     }
 
-    mpeg12->drop_frame_timecode = mpeg12->drop_frame_timecode || !!(avctx->flags2 & AV_CODEC_FLAG2_DROP_FRAME_TIMECODE);
     if (mpeg12->drop_frame_timecode)
         mpeg12->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME;
     if (mpeg12->drop_frame_timecode && mpeg12->frame_rate_index != 4) {
-- 
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

* Re: [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter
  2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
                   ` (9 preceding siblings ...)
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
@ 2022-08-03 19:49 ` Andreas Rheinhardt
  10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-03 19:49 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Forgotten in e609cfd697f8eed7325591f767585041719807d1.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/arm/flacdsp_init_arm.c | 3 +--
>  libavcodec/flacdec.c              | 6 +++---
>  libavcodec/flacdsp.c              | 7 +++----
>  libavcodec/flacdsp.h              | 6 +++---
>  libavcodec/flacenc.c              | 3 +--
>  libavcodec/x86/flacdsp_init.c     | 3 +--
>  tests/checkasm/flacdsp.c          | 4 ++--
>  7 files changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/libavcodec/arm/flacdsp_init_arm.c b/libavcodec/arm/flacdsp_init_arm.c
> index bac9ff1959..a16de9ee9a 100644
> --- a/libavcodec/arm/flacdsp_init_arm.c
> +++ b/libavcodec/arm/flacdsp_init_arm.c
> @@ -26,8 +26,7 @@
>  void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
>                          int qlevel, int len);
>  
> -av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
> -                                 int bps)
> +av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
>  {
>      if (CONFIG_FLAC_DECODER)
>          c->lpc16 = ff_flac_lpc_16_arm;
> diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
> index 17f1821c50..5ddc5a34d2 100644
> --- a/libavcodec/flacdec.c
> +++ b/libavcodec/flacdec.c
> @@ -117,7 +117,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
>          return ret;
>      flac_set_bps(s);
>      ff_flacdsp_init(&s->dsp, avctx->sample_fmt,
> -                    s->flac_stream_info.channels, s->flac_stream_info.bps);
> +                    s->flac_stream_info.channels);
>      s->got_streaminfo = 1;
>  
>      return 0;
> @@ -185,7 +185,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
>          return ret;
>      flac_set_bps(s);
>      ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt,
> -                    s->flac_stream_info.channels, s->flac_stream_info.bps);
> +                    s->flac_stream_info.channels);
>      s->got_streaminfo = 1;
>  
>      return 0;
> @@ -536,7 +536,7 @@ static int decode_frame(FLACContext *s)
>          dump_headers(s->avctx, &s->flac_stream_info);
>      }
>      ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt,
> -                    s->flac_stream_info.channels, s->flac_stream_info.bps);
> +                    s->flac_stream_info.channels);
>  
>  //    dump_headers(s->avctx, &s->flac_stream_info);
>  
> diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
> index 79002dcac0..da8400ae0a 100644
> --- a/libavcodec/flacdsp.c
> +++ b/libavcodec/flacdsp.c
> @@ -86,8 +86,7 @@ static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32],
>  
>  }
>  
> -av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
> -                             int bps)
> +av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
>  {
>      c->lpc16        = flac_lpc_16_c;
>      c->lpc32        = flac_lpc_32_c;
> @@ -125,8 +124,8 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha
>      }
>  
>  #if ARCH_ARM
> -    ff_flacdsp_init_arm(c, fmt, channels, bps);
> +    ff_flacdsp_init_arm(c, fmt, channels);
>  #elif ARCH_X86
> -    ff_flacdsp_init_x86(c, fmt, channels, bps);
> +    ff_flacdsp_init_x86(c, fmt, channels);
>  #endif
>  }
> diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
> index 4a7a36064a..9f8ed38b66 100644
> --- a/libavcodec/flacdsp.h
> +++ b/libavcodec/flacdsp.h
> @@ -36,8 +36,8 @@ typedef struct FLACDSPContext {
>                           const int32_t coefs[32], int shift);
>  } FLACDSPContext;
>  
> -void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
> -void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
> -void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps);
> +void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
> +void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
> +void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels);
>  
>  #endif /* AVCODEC_FLACDSP_H */
> diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
> index 9350e42dbc..3cfefbc89f 100644
> --- a/libavcodec/flacenc.c
> +++ b/libavcodec/flacenc.c
> @@ -425,8 +425,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
>                        s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
>  
>      ff_bswapdsp_init(&s->bdsp);
> -    ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, channels,
> -                    avctx->bits_per_raw_sample);
> +    ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, channels);
>  
>      dprint_compression_options(s);
>  
> diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
> index ed2e5ed15b..7975712db9 100644
> --- a/libavcodec/x86/flacdsp_init.c
> +++ b/libavcodec/x86/flacdsp_init.c
> @@ -52,8 +52,7 @@ DECORRELATE_FUNCS(16,  avx);
>  DECORRELATE_FUNCS(32, sse2);
>  DECORRELATE_FUNCS(32,  avx);
>  
> -av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
> -                                 int bps)
> +av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
>  {
>  #if HAVE_X86ASM
>      int cpu_flags = av_get_cpu_flags();
> diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
> index 6cd8ac50ef..ef93df8c81 100644
> --- a/tests/checkasm/flacdsp.c
> +++ b/tests/checkasm/flacdsp.c
> @@ -76,12 +76,12 @@ void checkasm_check_flacdsp(void)
>      int i, j;
>  
>      for (i = 0; i < 2; i++) {
> -        ff_flacdsp_init(&h, fmts[i].fmt, 2, 0);
> +        ff_flacdsp_init(&h, fmts[i].fmt, 2);
>          for (j = 0; j < 3; j++)
>              if (check_func(h.decorrelate[j], "flac_decorrelate_%s_%d", names[j], fmts[i].bits))
>                  check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, 2, fmts[i].bits);
>          for (j = 2; j <= MAX_CHANNELS; j += 2) {
> -            ff_flacdsp_init(&h, fmts[i].fmt, j, 0);
> +            ff_flacdsp_init(&h, fmts[i].fmt, j);
>              if (check_func(h.decorrelate[0], "flac_decorrelate_indep%d_%d", j, fmts[i].bits))
>                  check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, j, fmts[i].bits);
>          }

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] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
  2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
@ 2022-08-05  1:45   ` Andreas Rheinhardt
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2022-08-05  1:45 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> It has been deprecated in 94d68a41fabb55dd8c7e59b88fe4a28a637d1e5f
> and can't be set via AVOptions. The only codecs that use it
> (the MPEG-1/2 encoders) have private options for this.
> So remove it.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/avcodec.h   | 5 -----
>  libavcodec/mpeg12enc.c | 1 -
>  2 files changed, 6 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index abd6272f63..1d55cdb07a 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -300,11 +300,6 @@ typedef struct RcOverride{
>   */
>  #define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
>  
> -/**
> - * timecode is in drop frame format. DEPRECATED!!!!
> - */
> -#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
> -
>  /**
>   * Input bitstream might be truncated at a packet boundaries
>   * instead of only at frame boundaries.
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index a7e7aef010..ae2311b39f 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -234,7 +234,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
>          }
>      }
>  
> -    mpeg12->drop_frame_timecode = mpeg12->drop_frame_timecode || !!(avctx->flags2 & AV_CODEC_FLAG2_DROP_FRAME_TIMECODE);
>      if (mpeg12->drop_frame_timecode)
>          mpeg12->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME;
>      if (mpeg12->drop_frame_timecode && mpeg12->frame_rate_index != 4) {

Does this one need a version bump? I think so and have therefore not
applied it with the rest of this series.

- 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] 13+ messages in thread

end of thread, other threads:[~2022-08-05  1:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 12:16 [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 02/11] avcodec/flacdsp: Split encoder-only parts into a ctx of its own Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 03/11] avcodec/internal: Move ff_thread_can_start_frame() to threadframe.h Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 04/11] fftools/ffmpeg_opt: Fix copyinkf Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 05/11] avcodec/aacenc: Move aac_pce_configs to its only user Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 06/11] avcodec/sbrdsp: Remove unnecessary headers Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 07/11] avcodec/aacenc_quantization: Remove always-zero function parameter Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 08/11] avcodec/aacenc_tns: Remove unused header Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 09/11] avcodec/aacenc_quantization: Deduplicate quantization functions Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 10/11] avcodec/avcodec: Remove legacy cruft Andreas Rheinhardt
2022-08-01 12:23 ` [FFmpeg-devel] [PATCH 11/11] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
2022-08-05  1:45   ` Andreas Rheinhardt
2022-08-03 19:49 ` [FFmpeg-devel] [PATCH 01/11] avcodec/flacdsp: Remove unused function parameter 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