From patchwork Mon May 31 07:55:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 27992 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp2657528iof; Mon, 31 May 2021 00:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR3WJ7abBjayX/764/VkZ0IuXbSfn/lFBzcSs08xCk7ptd5Xim3wPBoMROEwyQkx2IkUHx X-Received: by 2002:a17:906:ad9a:: with SMTP id la26mr21940702ejb.122.1622447919951; Mon, 31 May 2021 00:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622447919; cv=none; d=google.com; s=arc-20160816; b=rzkkpLB2zpBOdq3bi+jk/Kj90ICk8nUADAlzOprrHW8ovQGoMHcvA9Kunsf16v3WfC 4/mysHz+xg4ti0ysPloKqNC1lgTqni55zThINsorUWkLsZFkFEjVf06Z3/ILluEhUY4v Z/Ot5nejGi5xSdp+OLwmbZTAH+TagqLdUrtgi86rzWTwUqtGvoSaidJKQWAmLMUAviVS uB8oj+ktM24+g4E0asaH9wdwsciuMZtmjaApt3+DWInMtiQR1cPhNrp+2x/gjfze+R67 vWKx6MbY/Y1VzlC4bzFwD9tiPgWW82J92ov4/urydMArsaKnEcjWsDHS7VdcRaY5ojsg DG6w== 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=8igbb4REmQiMjisjIfX7RdtBjWdgi+0/iQSzbhJpVWQ=; b=QrodNXE5nqttiJh+rkpU1eTm8U7txiTnPSHw0wwmScOpRZ/MuXUh+pUjnu8do+zvs8 yaa2yXuWlYCIzglNLrT4dKFDwmcDllk+JWhQG/G8HDW6mj9+DqZmnX82zEEQsu6zkn/K lcfiOy6MDUgSX1MGsW5qzwzFDTEPTflRCz7GIMpZ2B5IyFkCDvD1DiEHthKjiQMhbwax hTtaTtfAMqcHN43I67F6qwOOhO1tT/oTjNhQS6gYTDKL11/l0NcN0UIcrz9CDWO2ieGO zV/urzlK0P+YUYvOXtw6wL5qShQlnFtrmOuKH9IUqdlpAXB2G83A3wgDdM4qkyysK+Wa b99Q== 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 h14si12643326edr.451.2021.05.31.00.58.39; Mon, 31 May 2021 00:58:39 -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 8C2CD689A63; Mon, 31 May 2021 10:55:49 +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 20FF4688374 for ; Mon, 31 May 2021 10:55:28 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 6FECC240693 for ; Mon, 31 May 2021 09:55:23 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id KwUzHKnmpzH2 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 E5086240697 for ; Mon, 31 May 2021 09:55:21 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 150923A173A; Mon, 31 May 2021 09:55:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 May 2021 09:55:06 +0200 Message-Id: <20210531075515.19544-15-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 15/24] sws: merge handling frame start into a single block 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: MI4u4D0zzZ1m Also, return an error code on failure rather than 0. --- libswscale/swscale.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 74da1bf42c..73bc0c5617 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -912,11 +912,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c, if (srcSliceH == 0) return 0; - if (frame_start && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { - av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); - return 0; - } if (frame_start) { + if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { + av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); + return AVERROR(EINVAL); + } + if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; }