From patchwork Wed Jul 18 17:31:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Gorzel X-Patchwork-Id: 9750 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp793486jad; Wed, 18 Jul 2018 10:32:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcor0TNqZ8QEE725nM/TjDTpiuEhf4RI6yMfUYFrck/obmBp6bv8oX6fNYaFpduyEw8XQja X-Received: by 2002:a1c:c8:: with SMTP id 191-v6mr2127337wma.115.1531935120760; Wed, 18 Jul 2018 10:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531935120; cv=none; d=google.com; s=arc-20160816; b=KbFgXjHa+op+SaqUaite8Wlzpkv3HGN61ebdqQ8yx2J4IUZ13SOET8JityFGJemtYf xqnJxQOVhAfbqmubcfO6yx8OgHaRbH092oWYYl7A1glt7jFE1+4l8EuRFBZHGC6y4epp RK+iG/kV9hcw9+/ti3rgn0UMaYaLptUSSmuNyJblzQ6L2AMnRahA7+sAGynBETKhxhr6 YaDvyKHSvoPZvwx+IIeklyKnBMYIB2fdt+grOLP6FeUhZUUm97mhC5UTX+9utKribL1g StRNSb5S8o3u8ByxmZ5MsCWC4h6EktREltgmfKLCKMlMbMEgVeHs5FB09BEeqVgjp75P KoWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:from:references:message-id :in-reply-to:date:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=N5OHhONFDEdxb8YHoSUTd1PT3bWg+Epc/qbiI0srxWA=; b=WRFipTUq/5uoHde7OQEkMmYQm8lFMlscu32njLd+mJxr2xoOGxs73hMzprCgKH80PF ZDhxrw4qwvLx3P55ayz6Zdyrvlus4jq3pDOYLjHmXKpyWcybeSDsAno1wHe66bWY7n41 4tzJLu2d93wLW5/+v8w7KfJNdP8l4IgSsVepxkm0BvaA62zSnqCRyI5qVW3kKMM3NQh1 0hsMO8Y/laa4dXNY8Lbc4tSIEPUkOBcuGjklhQhPuQmaOgWxwCx3lwwrERVdzqpwJkAr RbE9Awx+qPEHGR8hjM1Up9b0ODrsoI7fEoAGIVXEmlLQ1hsXZ0/mz6w/IIH5GzoHEXM2 D/GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=JgVCLvEs; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 192-v6si1883822wmv.14.2018.07.18.10.32.00; Wed, 18 Jul 2018 10:32:00 -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=@google.com header.s=20161025 header.b=JgVCLvEs; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A58B680578; Wed, 18 Jul 2018 20:31:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f201.google.com (mail-io0-f201.google.com [209.85.223.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CAAB680462 for ; Wed, 18 Jul 2018 20:31:41 +0300 (EEST) Received: by mail-io0-f201.google.com with SMTP id s14-v6so3917679ioc.0 for ; Wed, 18 Jul 2018 10:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=ileGRWvJRnHyyPlcEFxLXFcSOHgZ9tAKo3Mqs0Ksegs=; b=JgVCLvEsg3OvVnV1dihPK5Q3V/GNJEi5quuvfEVgugyZ9V7mTJ6NdfF1ISzdDBkim6 aSwASlzEzhoL74tmM9t0AlZDKK90vMMI8N6ASK2T188ufradoSqmM/gCwPVcS4xBuBib /dl5cVMKV+pp9JZVRersR2Afl0xTUxeHAgMmqz/9tPdF4SKrY826I16JHq+k5dMqpCeC XCy3FoEkhC2TQ3XKxk1xKg0eF+4+eXGpYlX7nWJg5X3AT+BXSUQ1u8zcAQuwzEbpQ6ey m7J+GRXQJI9FbhuzBAWmBeQJuJ3g8nLHVC4/2Xdv4ABNHZNqCL7EjFhodHx33HvFqC/Z uVDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=ileGRWvJRnHyyPlcEFxLXFcSOHgZ9tAKo3Mqs0Ksegs=; b=ScvnVU1Il/ZFHEG7VOYIhOkMx9gKKPTqCMRq861I70y/PhOVaLG6y9WlznGxXDwgCG 7sFqhK3bvqFcyH87vi4umhqcCfWNbEX5LJoPQfTM7bxptSETaj+E8vvNdfXutpXaM3Bv dgrXzuyEng1J3TFyyTbd5pUPJCQ1XWOUMq8X/DmE9KF7RBkVps4zQ/hRYTRuYtJWSSEP TClfozy3cXimwplWEvkTyY0t/d74T8aoKusnP9Wi1uoabdMCQJxDqD19vZaRcVULPgis NNiU0866Xx9iGx9Ux2LbnGSN/Iehy+PxMpYeZT5y1F7W86bvc+thE/vzR7osxxMS+ISe HMxA== X-Gm-Message-State: AOUpUlGOkZhqQoAEKDtvOpOMMZaMZCZMVPhroX+FIhMr+Or/wwSHspkN 2F9uhMTwnOu6aralRJfu8RtCm+hJ5z6znSMU0QwYj4GgOyKUBHJjEjUO7kmTMDOF67GCUjlV+Wd MJHqM/DdkyIhVZmzNp439opIxsBxeK25jgTM8WvUjNkonhEwU1Q7HXq+PbSvLlhA= MIME-Version: 1.0 X-Received: by 2002:a24:5953:: with SMTP id p80-v6mr1401445itb.1.1531935111004; Wed, 18 Jul 2018 10:31:51 -0700 (PDT) Date: Wed, 18 Jul 2018 18:31:46 +0100 In-Reply-To: Message-Id: <20180718173146.247064-1-gorzel@google.com> References: X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog From: Marcin Gorzel To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] libswresample: Use channel count if channel layout is undefined 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 Cc: Marcin Gorzel Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Rematrixing supports up to 64 channels. However, there is only a limited number of channel layouts defined. Since the in/out channel count is obtained from the channel layout, for undefined layouts (e.g. for 9, 10, 11 channels etc.) the rematrixing fails. In ticket #6790 the problem has been partially addressed by applying a patch to swr_set_matrix() in rematrix.c:72. However, a similar change must be also applied to swri_rematrix_init() in rematrix.c:389 and swri_rematrix_init_x86() in rematrix_init.c:36. --- libswresample/rematrix.c | 6 ++++-- libswresample/x86/rematrix_init.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 8227730056..d1a0cfe7f8 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -384,8 +384,10 @@ av_cold static int auto_matrix(SwrContext *s) av_cold int swri_rematrix_init(SwrContext *s){ int i, j; - int nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout); - int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout); + int nb_in = (s->in.ch_count > 0) ? s->in.ch_count : + av_get_channel_layout_nb_channels(s->in_ch_layout); + int nb_out = (s->out.ch_count > 0) ? s->out.ch_count : + av_get_channel_layout_nb_channels(s->out_ch_layout); s->mix_any_f = NULL; diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c index d71b41a73e..4f9c92e4ab 100644 --- a/libswresample/x86/rematrix_init.c +++ b/libswresample/x86/rematrix_init.c @@ -33,8 +33,10 @@ D(int16, sse2) av_cold int swri_rematrix_init_x86(struct SwrContext *s){ #if HAVE_X86ASM int mm_flags = av_get_cpu_flags(); - int nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout); - int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout); + int nb_in = (s->in.ch_count > 0) ? s->in.ch_count : + av_get_channel_layout_nb_channels(s->in_ch_layout); + int nb_out = (s->out.ch_count > 0) ? s->out.ch_count : + av_get_channel_layout_nb_channels(s->out_ch_layout); int num = nb_in * nb_out; int i,j;