From patchwork Thu Feb 22 04:17:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 7708 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.33 with SMTP id c30csp1586690jai; Wed, 21 Feb 2018 20:24:23 -0800 (PST) X-Google-Smtp-Source: AH8x224l7QDPGDR30JoztPzp433rWzbKGno6rVMT/99LdTytupRUmLabla3/Zh3pMONe1a80GqqZ X-Received: by 10.28.210.77 with SMTP id j74mr3866351wmg.13.1519273463046; Wed, 21 Feb 2018 20:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519273463; cv=none; d=google.com; s=arc-20160816; b=U8AmxvSwuYcMYpqTK8ZJPlS3J7T6DureH4Ylbvl3ygNjLjBqFs1Qclf7YINspsmAcQ JncKK7ktVcKZ1cb7xI+goqbmr8sBIvt9bF84DBNMtK5o0B5X9E9RrosK6pD2kogox3zt PcRD9mmjjKZ0eLFm6gW4akG8ZRL7rWm7I8NZTJ8vK9PFuPxlhOYTvGc9zN18ZHMyT2W2 XyPO/8T2RFPyXu7hcyvLtIbaEe/3hXM8UwQ00sVMGaC3uWoqfzym+GhbLBLhK0Ml2DJv ytDZ2rng9G3S1FbjTaLnU7Xp4bOcZAo4dgXcVK5r6c4MeiT6VKfVhGgZM89iYn5PCbML cpQw== 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=Ami97UOAY8GL8nbkJp9iRU/Kk192m60jYfb/da6CLSI=; b=KOrTHFxGtGqZwY0btXp85H0qIV94iSfxnzZ/QG7cmtxiUc1+PE2fa1iHgzDcbKv/yg OQE+4BXOkm19HFNOYFW4vBjXGbWFWvyWEr4dliYNpsCA3V76AFi0VXn5YNVr8WUNwD6u zbk3XUcjKt0AuE26odtsnOLeGaRxGhTMuN8VPR/SYI8+EjHO/V2CZmoPaMsklK4zfxv5 /MOnBKDoJ+rN8U6P99OYSdZgPSlpj5ssdZ+otuPK/v8z8Yxt1p0F3SUf3mrj+05pmCEj yUpCvscrTsv3YlJpEgXT4UJYp1u93BhmlSBzGc9LPM+wmZTMLZKTF53wZQDr54Qn0yDQ N8Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=pBAr3D/G; 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=QUARANTINE 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 y15si13999107wmh.164.2018.02.21.20.24.21; Wed, 21 Feb 2018 20:24:22 -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=@gmail.com header.s=20161025 header.b=pBAr3D/G; 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=QUARANTINE 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 EE87B68A516; Thu, 22 Feb 2018 06:24:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E6EE68A4A6 for ; Thu, 22 Feb 2018 06:24:11 +0200 (EET) Received: by mail-io0-f181.google.com with SMTP id z6so4541058iob.11 for ; Wed, 21 Feb 2018 20:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=NxdUk/JlMkJ4QZUPBVVdtJH7C8eiPYFcdMCEJdousso=; b=pBAr3D/GxPD5L49Bc/1C5Cu1Hmwn7odbILVBZ736vwu85sN7JSt2mjO9//QpHCjfax smpxPVmN0teazqfyqmTje9RSlAn0amJm58fOlQRg8Erw+5hNINf0b4cq8iMasZMZPMDc OgE4LnRP7yEJ1utvxYtqUs2zhbvyGh8IOzKCg62y96knZBFQiKogptuZO7Xu4quxg5rf 6905doXNowFxmhjJ3qyQa33lKtOtiTrjyOmuMnIaH+btizHQ7a/TKEZAUDQAcvTeGURP O7+NtIwG2UJ6InR1HRlQnoVViABDG4m3zOuPrUccF9IAXNP7t6cukL1xuw6YwEHD0gWU I3PA== 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=NxdUk/JlMkJ4QZUPBVVdtJH7C8eiPYFcdMCEJdousso=; b=rGl3sHU9HcA+Ng/RhmeZWDU5qFugPlBnp9i7VivFXjGcrgyO8MwJlsogcIhdMBzUNX bOrcCOj7AzyVUDk+8e3ycGgiZTPyUmKrEWNaaXhLm1wdHPA/nOwJAowxvMK9k3GJjudS gb+/4dlF0WEVFffaTcgpmH47vDtFr4W53Z2GQIhkI11/WryX4k1bmo4pWQ0LMxwEMTj6 b1gyeiy15EeD9CvOpg4GqEgtiK4nk1zVwK3LQJTNBINAZuaKw57l+ZRVA366rog+VoNe gEoM0ol8KETKiDIbvpRzj12Teqy75kidq8etwjYVERdIA/y1xa1S01PrHPsITKq4fudq M5Zg== X-Gm-Message-State: APf1xPA2NsG5PiYSBCPqg2lzpbmkvbcvGRgwpwvRd/LvrFfqO5SZZlBp /ghqj9GWCkEsIQ/Yr7xe91bxBotE X-Received: by 10.107.182.67 with SMTP id g64mr7005701iof.300.1519273059659; Wed, 21 Feb 2018 20:17:39 -0800 (PST) Received: from MacBook-Pro.localdomain ([71.201.155.37]) by smtp.gmail.com with ESMTPSA id i201sm23936898ita.14.2018.02.21.20.17.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 20:17:38 -0800 (PST) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Feb 2018 22:17:35 -0600 Message-Id: <20180222041735.30123-1-rodger.combs@gmail.com> X-Mailer: git-send-email 2.16.1 Subject: [FFmpeg-devel] [PATCH] lavfi/vf_transpose: fix regression with semiplanar formats 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" (e.g. nv12) Regression since 7b19e76aeb0ace57b99aaef156bbfe592e43e65e --- libavfilter/vf_transpose.c | 50 +++++++++++++++++++-------------- tests/ref/fate/filter-pixfmts-transpose | 8 +++--- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 3ff4cb4249..74a4bbcf58 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -52,6 +52,14 @@ enum TransposeDir { TRANSPOSE_CLOCK_FLIP, }; +typedef struct TransVtable { + void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, + uint8_t *dst, ptrdiff_t dst_linesize); + void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize, + uint8_t *dst, ptrdiff_t dst_linesize, + int w, int h); +} TransVtable; + typedef struct TransContext { const AVClass *class; int hsub, vsub; @@ -61,11 +69,7 @@ typedef struct TransContext { int passthrough; ///< PassthroughType, landscape passthrough mode enabled int dir; ///< TransposeDir - void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, - uint8_t *dst, ptrdiff_t dst_linesize); - void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize, - uint8_t *dst, ptrdiff_t dst_linesize, - int w, int h); + TransVtable vtables[4]; } TransContext; static int query_formats(AVFilterContext *ctx) @@ -233,19 +237,22 @@ static int config_props_output(AVFilterLink *outlink) else outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; - switch (s->pixsteps[0]) { - case 1: s->transpose_block = transpose_block_8_c; - s->transpose_8x8 = transpose_8x8_8_c; break; - case 2: s->transpose_block = transpose_block_16_c; - s->transpose_8x8 = transpose_8x8_16_c; break; - case 3: s->transpose_block = transpose_block_24_c; - s->transpose_8x8 = transpose_8x8_24_c; break; - case 4: s->transpose_block = transpose_block_32_c; - s->transpose_8x8 = transpose_8x8_32_c; break; - case 6: s->transpose_block = transpose_block_48_c; - s->transpose_8x8 = transpose_8x8_48_c; break; - case 8: s->transpose_block = transpose_block_64_c; - s->transpose_8x8 = transpose_8x8_64_c; break; + for (int i = 0; i < 4; i++) { + TransVtable *v = &s->vtables[i]; + switch (s->pixsteps[i]) { + case 1: v->transpose_block = transpose_block_8_c; + v->transpose_8x8 = transpose_8x8_8_c; break; + case 2: v->transpose_block = transpose_block_16_c; + v->transpose_8x8 = transpose_8x8_16_c; break; + case 3: v->transpose_block = transpose_block_24_c; + v->transpose_8x8 = transpose_8x8_24_c; break; + case 4: v->transpose_block = transpose_block_32_c; + v->transpose_8x8 = transpose_8x8_32_c; break; + case 6: v->transpose_block = transpose_block_48_c; + v->transpose_8x8 = transpose_8x8_48_c; break; + case 8: v->transpose_block = transpose_block_64_c; + v->transpose_8x8 = transpose_8x8_64_c; break; + } } av_log(ctx, AV_LOG_VERBOSE, @@ -290,6 +297,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, uint8_t *dst, *src; int dstlinesize, srclinesize; int x, y; + TransVtable *v = &s->vtables[plane]; dstlinesize = out->linesize[plane]; dst = out->data[plane] + start * dstlinesize; @@ -308,20 +316,20 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, for (y = start; y < end - 7; y += 8) { for (x = 0; x < outw - 7; x += 8) { - s->transpose_8x8(src + x * srclinesize + y * pixstep, + v->transpose_8x8(src + x * srclinesize + y * pixstep, srclinesize, dst + (y - start) * dstlinesize + x * pixstep, dstlinesize); } if (outw - x > 0 && end - y > 0) - s->transpose_block(src + x * srclinesize + y * pixstep, + v->transpose_block(src + x * srclinesize + y * pixstep, srclinesize, dst + (y - start) * dstlinesize + x * pixstep, dstlinesize, outw - x, end - y); } if (end - y > 0) - s->transpose_block(src + 0 * srclinesize + y * pixstep, + v->transpose_block(src + 0 * srclinesize + y * pixstep, srclinesize, dst + (y - start) * dstlinesize + 0 * pixstep, dstlinesize, outw, end - y); diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index 6f25f3dd27..fcad28b9ff 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -45,10 +45,10 @@ gray16be 4aef307021a91b1de67f1d4381a39132 gray16le 76f2afe156edca7ae05cfa4e5867126e gray9be 2c425fa532c940d226822da8b3592310 gray9le bcc575942910b3c72eaa72e8794f3acd -nv12 aca847644e5dc0e942419183014981a4 -nv21 098884e968d27286c8cf0d2fb1557dcd -p010be 5ff62dffa5dfdf823978c4f563f69c94 -p010le 20131abe34e084b04f1d169c66447825 +nv12 1965e3826144686748f2f6b516fca5ba +nv21 292adaf5271c5c8516b71640458c01f4 +p010be ad0de2cc9bff81688b182a870fcf7000 +p010le e7ff5143595021246733ce6bd0a769e8 rgb0 31ea5da7fe779c6ea0a33f1d28aad918 rgb24 47654cabaaad79170b90afd5a02161dd rgb444be 3cac1f0c43a74d2a95eb02e187070845