From patchwork Thu Jul 27 11:28:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Kalvachev X-Patchwork-Id: 4470 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp1895243vsb; Thu, 27 Jul 2017 04:29:11 -0700 (PDT) X-Received: by 10.223.165.71 with SMTP id j7mr3804111wrb.147.1501154951550; Thu, 27 Jul 2017 04:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501154951; cv=none; d=google.com; s=arc-20160816; b=do5SvSqI1kwXakthAxJXmhj89E4LWa+ukZ0nVjr9+5G9ERceuxWLnjroXIsqEXmHiw sIV390OgbKWRAZMRgtdS/eRMBpEK5TpKUc+ThLMCK5vr3VuNOYLXo0W6VKwk8ikrMmSd cyNDXXcEuq30vUy5CweJdOhcGJwOIjIP6tah422c2J+slZKyTG0T5vmyQenZyuAQTBMO LUXW0fO94QrCJ7vN12bX+zP5bxGi0OjoC/aQCqSFE/zFRPgXqK0Z8OC3bSNkaTpqWWMB xd3njQmpHmZr1UaLUQrFDcAq1pUNmS+LtnzD+LYhQQiCl2/yFewXSflSudNU3d5c9iG0 8/dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=KdIc9haN6dlbQtz+NVMIXlztVwvSiPLSEhlM/RWBRfw=; b=NmEWADKp/rLHT4O4Rpq241Y089HKGQewtwrg2wyn0W4Y7Q2F8tCNzPEiElXOzjZMp+ 1Xc/S+LsF8IijeFY0SKx2Z1wXo2wWHfA43ICGLE6U2SRPBZKqlobNJU4h8BZ3NSiHEdm TRa+Kgsyn4mMxVDCXqszYz/AFGwC5zS9Ygz14xjufimwj1pMb3abLW3fh78PqK5c6vFn u+3ItaTK8Vf2r0vazkYo1aT7UMFuAxdGCKgwDatJNm1SEnpdtVVH+gowcHw0NOm1eLm9 IhRuwfNy31rOKcPtMfg+/LezGy5vAiGpshT0zCeHcBYq9O23yswolTwfKq6HdvXyjd7S y+Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=E6vpYBhq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 36si19303956wrr.268.2017.07.27.04.29.06; Thu, 27 Jul 2017 04:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=E6vpYBhq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC988680A28; Thu, 27 Jul 2017 14:29:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C9EC6680617 for ; Thu, 27 Jul 2017 14:28:56 +0300 (EEST) Received: by mail-pg0-f54.google.com with SMTP id y129so96831982pgy.4 for ; Thu, 27 Jul 2017 04:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=EFgGTU9I+BhIb0gFvJYt2GFj0SunFDYG1DJ4vi0sfOU=; b=E6vpYBhqPePe0r3QmFazK5QvkrJEW/xLv3e0bGW1HxRtHiT+BlcJp0gbhmQn50vmVW VC4RWmRUf88Es8jKeCRQ0A8ILizN/f4zew9GlCARVisK0GFRP2Rvhx3+WjWUqwLlW7Cb PiCpE/FylkvhWsaXEhAfmCA5dOCnk5IbKxxXXuGCuQ8OmHNdSsU0b13Sg4m3Nbp1uv3z f/Segn+5xFgQZmLFLuC+ybk35fyFI0K05ev5rGZ6iUXX2Dkk0o3/OjgFVD09JrNDxD3s s7vUzuYcMfGFVGDa8aUDPMKdgsFJe/W9Vff0RlnNrSZy1lEYi4CjcDFn+5LSNX/m77ZH hBgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=EFgGTU9I+BhIb0gFvJYt2GFj0SunFDYG1DJ4vi0sfOU=; b=IeLB+Ty5tBSzxKEffqonPHbIzhPghw1RpCS+KUXR3rA0UEt2hYCf0HV8eXDD1ojPE9 J91dihZSfv+4c/tZd01q6iOito9EioWF6fgj7kHBF4uWRcX6yqys9JT1qvpG6CUjDNUh 7o1VUH/xYNwtWQk2N61ERT87ZiFdjUnoRBQqHxPnjb780TLkqvygceTJ74lJEUtxmGWf HUom7/j+yvIQZddnGsuuS2+ZloKcOZEFrY7fFqnQwUXnQp8WRanvtngq49D9sE6kFYwq 0+j7QcD7rbuJN1mFyn2ouOKdSm6Vqt/RwkZPM6QHCXzFIUuDKtjmAX2MUAHShVrrr/ba NttQ== X-Gm-Message-State: AIVw112ZpQiUeuJkSLW9ZFpvlYKaGT/vOY0cfwpzwA3lHcg8oYiFOLfH IYRACPrIc21OJKopNego+0Wmw+SjGw== X-Received: by 10.99.54.9 with SMTP id d9mr3822279pga.195.1501154935697; Thu, 27 Jul 2017 04:28:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.149.8 with HTTP; Thu, 27 Jul 2017 04:28:54 -0700 (PDT) In-Reply-To: References: From: Ivan Kalvachev Date: Thu, 27 Jul 2017 14:28:54 +0300 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]v6 Opus Pyramid Vector Quantization Search in x86 SIMD asm X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 7/27/17, Rostislav Pehlivanov wrote: > On 27 July 2017 at 09:38, Ivan Kalvachev wrote: > >> On 7/27/17, Rostislav Pehlivanov wrote: >> > On 26 July 2017 at 15:56, Ivan Kalvachev 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. From 1a6ee9b2880c67db25737a6317f09cbbac441c83 Mon Sep 17 00:00:00 2001 From: Ivan Kalvachev 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