From patchwork Sat Sep 16 17:18:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 5167 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp1861657jaa; Sat, 16 Sep 2017 10:20:02 -0700 (PDT) X-Received: by 10.223.187.211 with SMTP id z19mr25753478wrg.97.1505582402703; Sat, 16 Sep 2017 10:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505582402; cv=none; d=google.com; s=arc-20160816; b=ovG9035F1bzVYEfSdhHxBuO4wE8higUythtdfvhIBMdflmU1o3sCLb5GOOGr2gIaKA zVChF2cl7WBzr7+Tj7OHCauFFUPyQBI+ltJ2EWG7dqt1aKFsaOpkxyooGKnAzPOI59Sg ACy9vyGMgDdkMMlEeGna/5A4oQLJXqSPUahqHmbguVplnQyT8pOY95QVwCSE5CPX7KL/ Zg/kdjhLGH29GxANhV6MnzesoRxrU0bLzEIXt9U3bTI6FTsjWgePe46s5oDHj8CQ2OFi HYeaYo5KOBbQVDJc8e1X+W9m2wal0nLUr247rRuqbWCa8RuujkEgWMOKKQxomLLWREGM BIkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=G3rC459BKY9lPJYJIMnIU+3epju54IMFfZHfnHJpLQA=; b=OSPDeqbt4AcDLUQwdh58+NI9pn8ylQYq21lA9PGwQpdrydo3JSZD0zxCik/MVsskFP ASH/KDiuYjkdWXHdLYIEUBtF1tzFaxKazGyN0TfkW0K+W0I2a+YEyjhx8ZmBv0X6fXtB MEFgrZ34j3pEsJ6KlYlyalvTudK5co1ksFn6/uu1Jt7RWmmcHUTej68aT39nzeiMYDkT AbH4CgRJsu8dd98svmegmHnJI1vmHyjK6cRI5lCeKSX4F7d3cp2/kqf0dcGylT/SXArA /PawzMmRrv3mUWyarDmwPwHXVnnrsk84lEStSItihnDl9NcwslEC8ekML38trRbIIapv DV1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=aDm8JYtP; 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 y13si2912998wrc.158.2017.09.16.10.20.00; Sat, 16 Sep 2017 10:20:02 -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=aDm8JYtP; 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 4DFEF689C95; Sat, 16 Sep 2017 20:19:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F970689A32 for ; Sat, 16 Sep 2017 20:19:45 +0300 (EEST) Received: by mail-qt0-f196.google.com with SMTP id u48so3348033qtc.4 for ; Sat, 16 Sep 2017 10:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=Nky8+tPG2L5mBibAezYt7rOLuuIUYp2x+SoF2lWcOUk=; b=aDm8JYtPZw73Qd5l0NBnB2ExtrzWJAAtKp8tzKPURb8NF4+cyRtK30hqjriGpCVxyr 8rWQXKDt2SWOC0V+ohoN4+WRrLWgOOPvPIrNRpcrqUz5EBqsHLORxwfo3d6zXaJwqg+6 6R7/jkzz9z8mwGQ4VHXhwqbWL2LLcWGYCoZr4dPxMirTl7qPxfVCR30nY5BRQXspw/LH 0ZtufzvnUs/Ou+6HpaRrlsCzCB+OHOcysJeskAgSSU/yzNnTC1o5lXBvEsttkGQxwrft 3wIteMSqF93F/OYirquu9QmuAaopEourfXoiHUmzph1IukCz3s/Ynf9ni7O5ZwyXt+pQ KokQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=Nky8+tPG2L5mBibAezYt7rOLuuIUYp2x+SoF2lWcOUk=; b=Usc8J6McE9by+Ep2/AGuKTkW++GlVxjLcHrKidcuiHeVSWVrEU+rzrIKITrVfyOU6D TKXbgW/TAp+dzkfP5CuUd4Bkq9VWkVo4KRauIDa14Y4WsTbmvprWT7SibMk/TVfE10Zb xpv4gv/R8PHmM14Eg7WyXxFCR4vuClaaIALAuOI9eg5PjH5irgvX4cena+A8XLx3aW7C IcmIj8gcd8zzu9y4mp+CRe5iF94cycqQ5kg3T7XbMYDGqfOC82sJQq7wADoT7LbH4Ly/ 5wB1+pk3AZxI7dVG5XpHQP2RY1qVhutygpXW5tDc7EIulA8IULDVdqeqPrYclgXnAFte lR8Q== X-Gm-Message-State: AHPjjUh/KcliGVhY0VD7ceSuzmVpObsXrAVb3hAoJacCuRjj7yTLEW9n AfnHFP08grOBcwn0 X-Google-Smtp-Source: AOwi7QDubYWF8yjdtxnUNuGyX9JKwj6Dej1CSjkqeGN14mC0EEBc5ydwmhyxQh9pzd8QzxGRRksZsg== X-Received: by 10.200.36.24 with SMTP id c24mr17025870qtc.202.1505582391508; Sat, 16 Sep 2017 10:19:51 -0700 (PDT) Received: from localhost.localdomain ([181.231.68.242]) by smtp.gmail.com with ESMTPSA id b126sm2315964qka.54.2017.09.16.10.19.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 16 Sep 2017 10:19:47 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 16 Sep 2017 14:18:34 -0300 Message-Id: <20170916171834.2208-1-jamrial@gmail.com> X-Mailer: git-send-email 2.13.3 Subject: [FFmpeg-devel] [PATCH] avfilter/lut: simplify endianness specific code 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/vf_lut.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 11c039ead7..2e0dedb730 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -372,17 +372,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) for (j = 0; j < w; j++) { switch (step) { -#if HAVE_BIGENDIAN - case 4: outrow[3] = av_bswap16(tab[3][av_bswap16(inrow[3])]); // Fall-through - case 3: outrow[2] = av_bswap16(tab[2][av_bswap16(inrow[2])]); // Fall-through - case 2: outrow[1] = av_bswap16(tab[1][av_bswap16(inrow[1])]); // Fall-through - default: outrow[0] = av_bswap16(tab[0][av_bswap16(inrow[0])]); -#else - case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through - case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through - case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through - default: outrow[0] = tab[0][inrow[0]]; -#endif + case 4: outrow[3] = av_le2ne16(tab[3][av_le2ne16(inrow[3])]); // Fall-through + case 3: outrow[2] = av_le2ne16(tab[2][av_le2ne16(inrow[2])]); // Fall-through + case 2: outrow[1] = av_le2ne16(tab[1][av_le2ne16(inrow[1])]); // Fall-through + default: outrow[0] = av_le2ne16(tab[0][av_le2ne16(inrow[0])]); } outrow += step; inrow += step; @@ -437,11 +430,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { -#if HAVE_BIGENDIAN - outrow[j] = av_bswap16(tab[av_bswap16(inrow[j])]); -#else - outrow[j] = tab[inrow[j]]; -#endif + outrow[j] = av_le2ne16(tab[av_le2ne16(inrow[j])]); } inrow += in_linesize; outrow += out_linesize;