diff mbox

[FFmpeg-devel] v6 Opus Pyramid Vector Quantization Search in x86 SIMD asm

Message ID CABA=pqewSPXXQnA9CjVbJi06YRE_R2Ya1Cb3ya+xSwHCVRdoeQ@mail.gmail.com
State Superseded
Headers show

Commit Message

Ivan Kalvachev July 27, 2017, 11:28 a.m. UTC
On 7/27/17, Rostislav Pehlivanov <atomnuker@gmail.com> wrote:
> On 27 July 2017 at 09:38, Ivan Kalvachev <ikalvachev@gmail.com> wrote:
>
>> On 7/27/17, Rostislav Pehlivanov <atomnuker@gmail.com> wrote:
>> > On 26 July 2017 at 15:56, Ivan Kalvachev <ikalvachev@gmail.com> wrote:
>> >
>> >> +    if (ARCH_X86 && CONFIG_OPUS_ENCODER)
>> >> +        ff_opus_dsp_init_x86(s);
>> >>
>> >
>> > Just change it to
>> > +    if (ARCH_X86)
>> >
>> > The init function is named opus_dsp, so it'll get used to other opus
>> > things, not just the encoder.
>>
>> But at the moment it does not.
>> I do prefer to leave that task for the one that
>> adds opus decoder functions.
>>
>> Also this change alone would break compilation, since
>> it also requires changing the libavcodec/x86/Makefile
>> and adding the guard inside the opus_dsp_init.c
>>
>> Another option is to have "opus_enc_dsp_init.c" and call
>> the function "ff_opus_enc_dsp_init_x86()".
>>
>> Do tell me which option do you prefer
>> and do you insist on v7 just for that.
>>
>> > The assembly code looks fine to me, but other people will have to take a
>> > look at it in case I'm missing something.
>
> The former, but that can be changed later after pushing

Here is the patch.
I'll merge it in v7, if there is one.

Please note that makefile needs to use two separate
config_opus_decoder/encoder, since there is no config_opus_codec . All
other dsp seem to use separate files for encoder and decoder dsp.

Best Regards.
diff mbox

Patch

From 1a6ee9b2880c67db25737a6317f09cbbac441c83 Mon Sep 17 00:00:00 2001
From: Ivan Kalvachev <ikalvachev@gmail.com>
Date: Thu, 27 Jul 2017 14:21:33 +0300
Subject: [PATCH 2/6] Build opus dsp for encoder and decoder.

---
 libavcodec/opus_pvq.c          | 2 +-
 libavcodec/x86/Makefile        | 1 +
 libavcodec/x86/opus_dsp_init.c | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
index 3aa502929c..2fb276099b 100644
--- a/libavcodec/opus_pvq.c
+++ b/libavcodec/opus_pvq.c
@@ -947,7 +947,7 @@  int av_cold ff_celt_pvq_init(CeltPVQ **pvq)
     s->encode_band        = pvq_encode_band;
     s->band_cost          = pvq_band_cost;
 
-    if (ARCH_X86 && CONFIG_OPUS_ENCODER)
+    if (ARCH_X86)
         ff_opus_dsp_init_x86(s);
 
     *pvq = s;
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 9875f48797..e36644c72a 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -52,6 +52,7 @@  OBJS-$(CONFIG_APNG_DECODER)            += x86/pngdsp_init.o
 OBJS-$(CONFIG_CAVS_DECODER)            += x86/cavsdsp.o
 OBJS-$(CONFIG_DCA_DECODER)             += x86/dcadsp_init.o x86/synth_filter_init.o
 OBJS-$(CONFIG_DNXHD_ENCODER)           += x86/dnxhdenc_init.o
+OBJS-$(CONFIG_OPUS_DECODER)            += x86/opus_dsp_init.o
 OBJS-$(CONFIG_OPUS_ENCODER)            += x86/opus_dsp_init.o
 OBJS-$(CONFIG_HEVC_DECODER)            += x86/hevcdsp_init.o
 OBJS-$(CONFIG_JPEG2000_DECODER)        += x86/jpeg2000dsp_init.o
diff --git a/libavcodec/x86/opus_dsp_init.c b/libavcodec/x86/opus_dsp_init.c
index f4c25822db..c51f786ee8 100644
--- a/libavcodec/x86/opus_dsp_init.c
+++ b/libavcodec/x86/opus_dsp_init.c
@@ -32,6 +32,7 @@  av_cold void ff_opus_dsp_init_x86(CeltPVQ *s)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if CONFIG_OPUS_ENCODER
     if (EXTERNAL_SSE2(cpu_flags))
         s->pvq_search = ff_pvq_search_sse2;
 
@@ -40,4 +41,5 @@  av_cold void ff_opus_dsp_init_x86(CeltPVQ *s)
 
     if (EXTERNAL_AVX(cpu_flags))
         s->pvq_search = ff_pvq_search_avx;
+#endif
 }
-- 
2.13.2