From patchwork Sat Sep 7 15:50:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14970 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 95C5D448FBC for ; Sat, 7 Sep 2019 18:50:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 75C25687F12; Sat, 7 Sep 2019 18:50:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BAD96807E5 for ; Sat, 7 Sep 2019 18:50:29 +0300 (EEST) Received: by mail-pg1-f194.google.com with SMTP id u17so5238424pgi.6 for ; Sat, 07 Sep 2019 08:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=1Jz02uD62aOo9tYRuIm9jEqCmhuqWZFC8++9N9s3zSA=; b=QGKxo/c29SAgOCHDHRi2urFa6YtxuHz4jaR70XkUIGoblLo4Kiovrk6BubE+DLs38Q +hwm2gOqZdOC1Fh948BUS9uaekuTWpBcOXmSGeV89OlC9EU+/+nGZ/f0Y7hrC9KwNhHg OSnn7Tlsa7R7Ukl1GnOFsdKlYOjquw2sb/MSdl1qTogZKyZr0j3+yO4Pne0k1PKrlkM1 I0W9j3fOdsjWrSpCy064RwEtQAhxGYwBxC9jwNFybAmQ/b9vYVXy6II124gqTtIBZd5m LJda8/dkoZd5yMXLNgcndor6gf67//a1dcxgImSwCHXU/qUgDP1NGj32x1rhti56lBgT amaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1Jz02uD62aOo9tYRuIm9jEqCmhuqWZFC8++9N9s3zSA=; b=YMFJP6B6IZQAsjxDEw++4uYeHpLhdgAGSkKRnrOEdFkFIRexUhoxc0cHsgVLwBlHyS ZfRIwyyQRjyy6NZ1Xv7reBTVw1CnBBE4aU+MgAVp3rV1MfKa5FsPYJ0bRP2h5VOK2bvQ 4k1f+Pd0LtkN9Th9n2LGVZPBUxvZnhl76K4y6fDXqmk8FNH0MTU+D7apPJok8UImb/qi QpRm7iFWLLaih0I6zP/WOdbNA06BR8Hbx4CFmuZG13bgP2WXEp/myK26LtoVazxq+QVo uaE+5aTHHpzEXXg6iUNWG+Is5d72I1r9dEFuO/hva+ebXYXQZJ5xkA/2ZRjBWHy6wAW3 4btQ== X-Gm-Message-State: APjAAAXFRM/cO4a6PsTbcnHTxRVlVWINQYBwQSDMtjssRUzLv/fLh/KT b1LywtC7WsjZPm46WOYR70YxXerZ X-Google-Smtp-Source: APXvYqwS4hp8JnyygUnd7xMjFP6p0yJdDCXKOs4+HRfr/BjwfdqGxbkbCEEewuDRk3RxgzyxRn4OrA== X-Received: by 2002:a63:ed55:: with SMTP id m21mr13261687pgk.343.1567871427456; Sat, 07 Sep 2019 08:50:27 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id y6sm13375486pfp.82.2019.09.07.08.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Sep 2019 08:50:26 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 Sep 2019 23:50:20 +0800 Message-Id: <20190907155020.2283-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [FFmpeg-devel] [PATCH v1] swscale/swscale: various cosmetics for the code style 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libswscale/swscale.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 4069550..3e2ebd5 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -271,7 +271,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], int lastInLumBuf = c->lastInLumBuf; int lastInChrBuf = c->lastInChrBuf; - int lumStart = 0; int lumEnd = c->descIndex[0]; int chrStart = lumEnd; @@ -283,22 +282,16 @@ static int swscale(SwsContext *c, const uint8_t *src[], SwsSlice *vout_slice = &c->slice[c->numSlice-1]; SwsFilterDescriptor *desc = c->desc; - int needAlpha = c->needAlpha; int hasLumHoles = 1; int hasChrHoles = 1; - if (isPacked(c->srcFormat)) { - src[0] = - src[1] = - src[2] = - src[3] = src[0]; - srcStride[0] = - srcStride[1] = - srcStride[2] = - srcStride[3] = srcStride[0]; + for ( int i = 0; i < 4; i++ ) { + src[i] = src[0]; + srcStride[i] = srcStride[0]; + } } srcStride[1] <<= c->vChrDrop; srcStride[2] <<= c->vChrDrop; @@ -324,7 +317,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], } } - if ( (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15 + if ((uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15 || (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15 || dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || dstStride[3]&15 || srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || srcStride[3]&15 @@ -341,11 +334,9 @@ static int swscale(SwsContext *c, const uint8_t *src[], * will not get executed. This is not really intended but works * currently, so people might do it. */ if (srcSliceY == 0) { - lumBufIndex = -1; - chrBufIndex = -1; + lumBufIndex = chrBufIndex = -1; dstY = 0; - lastInLumBuf = -1; - lastInChrBuf = -1; + lastInLumBuf = lastInChrBuf = -1; } if (!should_dither) { @@ -368,16 +359,14 @@ static int swscale(SwsContext *c, const uint8_t *src[], hout_slice->plane[2].sliceY = lastInChrBuf + 1; hout_slice->plane[3].sliceY = lastInLumBuf + 1; - hout_slice->plane[0].sliceH = - hout_slice->plane[1].sliceH = - hout_slice->plane[2].sliceH = - hout_slice->plane[3].sliceH = 0; + for(int i = 0; i < 4; i++) + hout_slice->plane[i].sliceH = 0; hout_slice->width = dstW; } for (; dstY < dstH; dstY++) { const int chrDstY = dstY >> c->chrDstVSubSample; - int use_mmx_vfilter= c->use_mmx_vfilter; + int use_mmx_vfilter = c->use_mmx_vfilter; // First line needed as input const int firstLumSrcY = FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]); @@ -396,7 +385,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], // handle holes (FAST_BILINEAR & weird filters) if (firstLumSrcY > lastInLumBuf) { - hasLumHoles = lastInLumBuf != firstLumSrcY - 1; if (hasLumHoles) { hout_slice->plane[0].sliceY = firstLumSrcY; @@ -408,7 +396,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], lastInLumBuf = firstLumSrcY - 1; } if (firstChrSrcY > lastInChrBuf) { - hasChrHoles = lastInChrBuf != firstChrSrcY - 1; if (hasChrHoles) { hout_slice->plane[1].sliceY = firstChrSrcY; @@ -440,7 +427,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], av_assert0((lastLumSrcY - firstLumSrcY + 1) <= hout_slice->plane[0].available_lines); av_assert0((lastChrSrcY - firstChrSrcY + 1) <= hout_slice->plane[1].available_lines); - posY = hout_slice->plane[0].sliceY + hout_slice->plane[0].sliceH; if (posY <= lastLumSrcY && !hasLumHoles) { firstPosY = FFMAX(firstLumSrcY, posY); @@ -503,10 +489,8 @@ static int swscale(SwsContext *c, const uint8_t *src[], yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, use_mmx_vfilter); } - { - for (i = vStart; i < vEnd; ++i) - desc[i].process(c, &desc[i], dstY, 1); - } + for (i = vStart; i < vEnd; ++i) + desc[i].process(c, &desc[i], dstY, 1); } if (isPlanar(dstFormat) && isALPHA(dstFormat) && !needAlpha) { int length = dstW;