From patchwork Mon May 31 07:55:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 28008 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp2657939iof; Mon, 31 May 2021 00:59:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMdYe3+mO5igGbjZNrC0Tu3r96uE6rJqVNKbHPA2pnKAXlUKv0j/iSg+mpLS5Lw4iBttD+ X-Received: by 2002:a17:906:a0d3:: with SMTP id bh19mr22315340ejb.205.1622447957784; Mon, 31 May 2021 00:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622447957; cv=none; d=google.com; s=arc-20160816; b=PRBaAug6yVgs7opxS7Z/QRdz6A3lvy4KcmedE1kCBx1HLQnZdwabSI/oWFWWRLUc4Q +nIQL5Kymx4K0dpyma250Angmeu6j4N1t2GQcbCRKf8WrZ8snxfnLR3Ge+j87KznlQSd v1PmREj5cOdNWp3bACOpNFJyRBrZNYRSV8WYrEaO2w/HvgsWzZFrx0vwyga63QNtR0FO 4m6cOlXbuRBGz8yn4YihP7/JQFJYUFckyCsh+FgT80R/sqzVCTuVwyKkTFzFYK6EXKQZ eln8sVRzGNB9Uyb75iQc2OnDHtYboV1E5A0G9kSf4heOiutzPBSSnUi9TZi06ErO/Gel LDcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=9ASLDZFCZnXD04bydRpf7/QiGVKhrDYjEpOQ3LqpRzI=; b=oCKnf9FG9VFFzcMZd4B56/sXlCcGbArW/JEDBxqhQj/zdWK6ikNcKtlL87vtTk4sly RvmfC/jOkIQqkorJXeKhWOhi5RemQAOt2n+cS4bw++N3aYw83qON6gCpY2e9tiLcQVK+ aFJ5RM+w6aEstBEXbbKIA7A0d164QHh4BeFF1kRWkIEQd3d6uAzrNM2XE5Ye763G5tw+ PW3yeHh9h1Sx11xQaZZN2wVa5hVw7BgUjCiwCDgCq2mAdqDTZA90IEf0wWoDAciQu8OK SNCjuTO3dEHuSt8nvcySYGucA7BGE1QSElxJUTEqIYLiDd5IbXKLLS3BnIDKpWWz3P1z eypw== ARC-Authentication-Results: i=1; mx.google.com; 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 m26si12984613edp.58.2021.05.31.00.59.17; Mon, 31 May 2021 00:59:17 -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; 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 60F3F6801CA; Mon, 31 May 2021 10:55:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 829E0688078 for ; Mon, 31 May 2021 10:55:28 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D6AD9240692 for ; Mon, 31 May 2021 09:55:24 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id j7eLZ99_CPqI for ; Mon, 31 May 2021 09:55:23 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id EE9F6240699 for ; Mon, 31 May 2021 09:55:21 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 114143A1727; Mon, 31 May 2021 09:55:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 May 2021 09:55:05 +0200 Message-Id: <20210531075515.19544-14-anton@khirnov.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210531075515.19544-1-anton@khirnov.net> References: <20210531075515.19544-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/24] sws: make checking for the start of a new frame more explicit X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 2kXqPtAFsKtU --- libswscale/swscale.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index cc3700c704..74da1bf42c 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -866,6 +866,7 @@ int attribute_align_arg sws_scale(struct SwsContext *c, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { + const int frame_start = !c->sliceDir; int i, ret; const uint8_t *src2[4]; uint8_t *dst2[4]; @@ -911,11 +912,11 @@ int attribute_align_arg sws_scale(struct SwsContext *c, if (srcSliceH == 0) return 0; - if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { + if (frame_start && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); return 0; } - if (c->sliceDir == 0) { + if (frame_start) { if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; }