From patchwork Sat Oct 28 20:55:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 5733 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp972330jah; Sat, 28 Oct 2017 13:55:48 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TxnluG9N8hc5KMfguYyci3mrlM8uhABjZT18kzsL7y1nutcuvRB+ReyeziMsbPwNAndex5 X-Received: by 10.223.190.14 with SMTP id n14mr4157734wrh.46.1509224148103; Sat, 28 Oct 2017 13:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509224148; cv=none; d=google.com; s=arc-20160816; b=uW1D3JEoqP7d6yqrfdVApCGhwXA2yyo+dsBx9BbuU3l1chJ/slSN3xmePzhPzVcJDV 4HsfpqxNC2No45GaRaS3P6a8L9rbPJ/tnrHji/b9jHt7SMnCBTym0cjK7s9l6wPEQZv7 HFxQbQL8Sd4Pz1JzSWp/+vaxkTybpX4TcqlcHqZQwmhxm1LMQxVh/vkMgbJ7Jt3Mf75d 2HdvKml05OcXGn+b1CHhDBcIDL1seCifctOdmW4g05f1Y/41Opf5DEC/S59ZE10iNAOh jT9FrnCOHJXKEuNLxWOwrGwJ1pQm74mjXhFjXPUNJR8WEH088Prj5OZ+67RYqp0/rJC9 F6Kw== 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:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=L/WYgSQgrLNKkr5e5cZezeOxiTSyNapDk2i2yar1/6o=; b=aSD2o6FEK/KS0ENtpndbGjjKcNSENYYRmOFACfxFcOsEKud/GpUkn+k72rMUOIBuJw jIrQ6oAmCiwqz8APz/vj4C3caX9DRl65hF6ouWWZaB+LJj5Iv2vicYTnawndhr+2az5J udNm0apPnVIH9D3JCFBhLCz3MIjSJXVDncwce+bm0E6ODZAaBrHNJ646SnBNVWi5Cp89 F/Nf3MuXYLGNxG3do2AjSPo5WoSTvCJQ/WHlpjhIPwS9+LkBclx2moEMZor6GlgRQLpk V3eMKXHdFuLTDivavnzl98QYoqG2bgYb1BYH3CItMgymEQ+ws5/xU0thOeVKjKruQBSk ZGKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gaA47H/w; 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 f190si174854wma.212.2017.10.28.13.55.45; Sat, 28 Oct 2017 13:55:48 -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.s=20161025 header.b=gaA47H/w; 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 536B0689E30; Sat, 28 Oct 2017 23:55:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f173.google.com (mail-io0-f173.google.com [209.85.223.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE09D68995F for ; Sat, 28 Oct 2017 23:55:28 +0300 (EEST) Received: by mail-io0-f173.google.com with SMTP id e89so19449485ioi.11 for ; Sat, 28 Oct 2017 13:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=67MEhsS6CMwLJH6nrRdF4VgmraTsJmCpqMN6Dm7wmEI=; b=gaA47H/wXa9h6/wJwF2YtqoYF4kY6tM/WmXesSS0m6dDwKANUh0R7ZBIPJge/v16Qe dxGxAoh9iOsXgx7VOQoqU168WkmwgYfLNdZG4Q5aHNtoNln2s+r6AoEg7XpgtGu1KQu3 a1wHabqUXU4N0xtk2wna3ZEkIg7EL1iciXPXQil0P3TVEVbHQJr3AxNsvNID0KgCJGFM ZBJqWBuqAOk1la4U0TdnJtkHr5962CajRMBosFtZUyhj39aB/s/ob6+BXJ/UFQeIZQew bSqVfX4Fn+ku3UNNs4EZhpWT3VWOdAR2uLaOqvcvLeP0qZXP8BQQHH/RqZrWZUmhH+8M RTBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=67MEhsS6CMwLJH6nrRdF4VgmraTsJmCpqMN6Dm7wmEI=; b=Rxo6Dgw9pI52ITjkR/hghwh3OcBOl3FZGk5omlrcRowmPaSYPUpi2Jod1iugmLDlYb fjSgg3cmtIG737xOp35DowMXTnr/ijCDoiYfAMWFYQmuO61oik/Jcc9fHaqyZyGIJHmi oaU2EWAKV6Bf4yIFu61TKG+XEM2zwrTfzCyAtiwK68ikf2TWhOe69KV7iMEuZyFeUGsT Vd0oMO3nBgzaVNff81N7CmLmSsVgbbkeAdXw59NMT8XDYGdshBSAYEY+5OXLM13VpZ9y IQTH2lxjyV/fXkuM1qbSIzQz+KyPj484JGkS4BQf4UhPfY8vHCeudQcLUVz/pV7Wq0/L 9LGA== X-Gm-Message-State: AMCzsaVNkHCPaAChhLlYLzOWxk5C7OhmopOLhgaeRjKFhNKi/DmS7KDz dwEXpRgPMpKiWXb5VZzULNZ4U5BmWcDMhpx+FuI= X-Received: by 10.36.120.136 with SMTP id p130mr369727itc.54.1509224136037; Sat, 28 Oct 2017 13:55:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.63.101 with HTTP; Sat, 28 Oct 2017 13:55:15 -0700 (PDT) From: Carl Eugen Hoyos Date: Sat, 28 Oct 2017 22:55:15 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [RFC]lswr/rematrix: Support s32p 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" Hi! Attached patch fixes a random testcase for ticket #6785 here but I don't know if this is the correct fix. Please review, Carl Eugen From a93b9309d74f5eadece371ee1e682d266af6cd83 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 28 Oct 2017 22:52:02 +0200 Subject: [PATCH] lswr/rematrix: Support s32p. Fixes ticket #6785. --- libswresample/rematrix.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 66a43c1..a6aa6b0 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -445,14 +445,23 @@ av_cold int swri_rematrix_init(SwrContext *s){ s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ - // Only for dithering currently -// s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); - s->native_one = av_mallocz(sizeof(int)); + s->native_one = av_mallocz(sizeof(int64_t)); if (!s->native_one) return AVERROR(ENOMEM); -// for (i = 0; i < nb_out; i++) -// for (j = 0; j < nb_in; j++) -// ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; + s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int)); + if (!s->native_matrix) { + av_freep(&s->native_one); + return AVERROR(ENOMEM); + } + for (i = 0; i < nb_out; i++) { + double rem = 0; + + for (j = 0; j < nb_in; j++) { + double target = s->matrix[i][j] * 32768 + rem; + ((int*)s->native_matrix)[i * nb_in + j] = lrintf(target); + rem += target - ((int64_t*)s->native_matrix)[i * nb_in + j]; + } + } *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; -- 1.7.10.4