From patchwork Wed Feb 9 09:14:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Kelly X-Patchwork-Id: 34208 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp1563679iov; Wed, 9 Feb 2022 01:14:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyogANbtPb4S2lb33jv9MnjOPuLR8h6SWsiQOcyF+jQl4mAYBobEcaYTQrT2jZ/8+4S7Pvr X-Received: by 2002:a17:906:7314:: with SMTP id di20mr510206ejc.259.1644398095246; Wed, 09 Feb 2022 01:14:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644398095; cv=none; d=google.com; s=arc-20160816; b=XxBSWbBfYqLN8yNe6UVMl0GUbh5gj+Vs2vUmXRVYhqFJqncB0voSBb1vR/7Fg9l12L ucjeDTcxywV69Tp79CAFcRAz01vOVxPS9DyFFqGZIBAgQfktsLvZPso/3xSCov/EX2SW qokFyyCVAqbUTXzkvJwLQ3KrIeM5cTZiI7VHe29JOKKv0ZmdeCrpLj8FJpkr6n0hIrDb Io/w9ul3MwIocV4O5U1sKf/Hb3yI+iuL/a/bXP2lzOZ58n24C+Mro7xZrh0ezmoxwUBr CZ8QRNYNfuE/GYVQS96YPI8XxyZfLHu/gC7KQh6qI2QTRwh7Jar1GrQ2eJVmI2ptV1dX ujLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:from:mime-version:message-id:date :dkim-signature:delivered-to; bh=l7zuD1XQNL8oCnaPYo+f/PaucAunEd9UWb7g0HSg83M=; b=epjm8I7/3heaqMnc6BhSKVnC8KaVq3YgWVPMdyAn58goZgiE7n6v5LfrhUd1JpIVws +hBmUV3nvzkpLuroTbvli5WiWDhnAJ6kRvtif1S+jPx6Y+KWgG0F3VsOjnBLbhTcZpeQ PWsH19Vps7VV044hv7BsQmnMsV307jsQAO4Z9HjclR0kv30cEy+Dn483PaS6Il9wssAW snb4JIA38Y8Swt1yX0ktV9mMSWHW3KOuLIUenv4yUUj0qEXXrP6nBxd4ZvSzLfn7G905 TGBx/CzqRcFd4szYt+xc1pGgdDGtIRp/pfBK5qfESguxx8KNclF+dfJGwZogiTWdTEbr kyag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20210112 header.b=oENRHJQU; 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 z13si12768031edd.111.2022.02.09.01.14.54; Wed, 09 Feb 2022 01:14:55 -0800 (PST) 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=@google.com header.s=20210112 header.b=oENRHJQU; 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 2F09568B1F8; Wed, 9 Feb 2022 11:14:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D503068B1CA for ; Wed, 9 Feb 2022 11:14:45 +0200 (EET) Received: by mail-wr1-f74.google.com with SMTP id w26-20020adf8bda000000b001e33dbc525cso829250wra.18 for ; Wed, 09 Feb 2022 01:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=xmp3gK13oFSRUDn8rWg1daSwCfIJwY0N+S2UW+Nr4uA=; b=oENRHJQU634by+9yLln0ujsxHTR2ecg6iw0eVZGvATJDAJJPTQUgUKd7Pd112S/ofN /qx3aXb0pwYXnCkGN1xleRUv2k8HA+9hMpkr+5/qp73NeT/qwGBbm/KSdMqLMX9vSljE o0lo4rPsGQJEwbkuydGCwT5GqJOoLlIq4CflJTsgZHrDN5jppAM4eDdL5PoUxFZ1bCoP zqbxXJ+t7xOcViPPSdYUUXP28Uez0N7LFP5zcdq3xZDjIA8KvwmnWrWhY/v7oT2ODfwb Fz1oR70PYZvGfZu41Ca2+g7GGCrMGae+APBH8LrtO8LMPcNCyB94GKLamrJgpPrlfxNq /o1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=xmp3gK13oFSRUDn8rWg1daSwCfIJwY0N+S2UW+Nr4uA=; b=OLzfedJNlZDC8DoxaILTVD8enJmyoJ7glE8RL8hrcHUwMGCFEQrFXAGNC/f7+Qix6B i8vQBSBgUMwNdktRJHENaXjxccWbxzT5Jlru+mGErCfw/clun2lJPFpivqljIiIVG51G Gqtkxuf+x9/1vC9g00OHaT8Bt49074wubmlha+x4KmBJOXpRQwDdxm1UBDFYyHsyCyPG nYwgIzCo8633rZnuZwQ5SNyZf+IJnBhiHr4EU/8bKY4YIW3VljphfoGvo3Ni1DcAcFrk FJMX3S7Eg5Dy9o0Pxy39GsRxFIYq9zjTDmShVOVHPzioMcp+Eok6fAzYv0LlW858OcaF Q09w== X-Gm-Message-State: AOAM5330wS2LPScO7DzdQ0QFyHqKzTcfxpBpnDqu0w6fO42e7u6Egb9R 4T8tduw38+H5p7cEGVtcTBRz0JDpcMMnJaImh/zdkP/09M6jIZ/9Y8S4H7ZA49reowvwux5ZNiU oQ3sCv114ctP6Fbcow9TSCsv+WuQTY+SiywAVvvazdWi3h7Gb1D+vuXIiMJP2uXbaJtbtTHE= X-Received: from alankelly0.zrh.corp.google.com ([2a00:79e0:61:301:388b:9d0c:1bc4:40c]) (user=alankelly job=sendgmr) by 2002:a1c:ed12:: with SMTP id l18mr1682515wmh.93.1644398085277; Wed, 09 Feb 2022 01:14:45 -0800 (PST) Date: Wed, 9 Feb 2022 10:14:42 +0100 Message-Id: <20220209091442.3456781-1-alankelly@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog From: Alan Kelly To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 4/5] libswscale: Propagate error codes from ff_shuffle_filter_coefficients 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 Cc: Alan Kelly Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: c9Nh7u6LlsnZ --- libswscale/swscale_internal.h | 2 +- libswscale/utils.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 3a78d95ba6..26d28d42e6 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -1144,5 +1144,5 @@ void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, #define MAX_LINES_AHEAD 4 //shuffle filter and filterPos for hyScale and hcScale filters in avx2 -void ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int filterSize, int16_t *filter, int dstW); +int ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int filterSize, int16_t *filter, int dstW); #endif /* SWSCALE_SWSCALE_INTERNAL_H */ diff --git a/libswscale/utils.c b/libswscale/utils.c index 31c365fcee..1f8705a417 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -278,7 +278,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_P416LE] = { 1, 1 }, }; -void ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, +int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int filterSize, int16_t *filter, int dstW) { @@ -286,13 +286,13 @@ void ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int i, j, k; int cpu_flags = av_get_cpu_flags(); if (!filter) - return; + return 0; if (EXTERNAL_AVX2_FAST(cpu_flags) && !(cpu_flags & AV_CPU_FLAG_SLOW_GATHER)) { if ((c->srcBpc == 8) && (c->dstBpc <= 14)) { int16_t *filterCopy = NULL; if (filterSize > 4) { if (!FF_ALLOC_TYPED_ARRAY(filterCopy, dstW * filterSize)) - return; + return AVERROR(ENOMEM); memcpy(filterCopy, filter, dstW * filterSize * sizeof(int16_t)); } // Do not swap filterPos for pixels which won't be processed by @@ -333,7 +333,7 @@ void ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, } } #endif - return; + return 0; } int sws_isSupportedInput(enum AVPixelFormat pix_fmt) @@ -1859,7 +1859,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, get_local_pos(c, 0, 0, 0), get_local_pos(c, 0, 0, 0))) < 0) goto fail; - ff_shuffle_filter_coefficients(c, c->hLumFilterPos, c->hLumFilterSize, c->hLumFilter, dstW); + if ((ff_shuffle_filter_coefficients(c, c->hLumFilterPos, c->hLumFilterSize, c->hLumFilter, dstW)) < 0) + goto nomem; if ((ret = initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, c->chrSrcW, c->chrDstW, filterAlign, 1 << 14, @@ -1869,7 +1870,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, get_local_pos(c, c->chrSrcHSubSample, c->src_h_chr_pos, 0), get_local_pos(c, c->chrDstHSubSample, c->dst_h_chr_pos, 0))) < 0) goto fail; - ff_shuffle_filter_coefficients(c, c->hChrFilterPos, c->hChrFilterSize, c->hChrFilter, c->chrDstW); + if ((ff_shuffle_filter_coefficients(c, c->hChrFilterPos, c->hChrFilterSize, c->hChrFilter, c->chrDstW)) < 0) + goto nomem; } } // initialize horizontal stuff