From patchwork Fri Mar 2 23:40:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 7797 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp77707jaj; Fri, 2 Mar 2018 15:41:04 -0800 (PST) X-Google-Smtp-Source: AG47ELux/k7XorgWsTYBTLoBHmp6eFqiihMNp1bEJ0nEUnYD3xsLeL39+YFzLqLUK6UrG1RzBIUY X-Received: by 10.223.135.102 with SMTP id 35mr6753213wrz.53.1520034063962; Fri, 02 Mar 2018 15:41:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520034063; cv=none; d=google.com; s=arc-20160816; b=v70CVJQe2J4U47QWLEa1gLTRzaibyOsgE9cDzn4zhIweA0S9XcqUYvV3bqTwhIq0Ps rMDCYrc3A7XdycozaM5lzH/RP9x6/QoyfrYe+A86YLjjwrGt25ugu9G4vggbTzHYqZYq JugJsuvRx/KzkNgeuCDw95qqQ9+L9Vk7qfNfkayDDAe99r+968iqg+NnuNxy6dO//3zd nnqqP1sRGHGC5+IEJCAZo9qk6+qxt2/hY/h2gDE9SXSW3bkWaENJQgp3CMIYSxnefHs6 76xPTArdjHZI49oq42g/imsQn3g6sgTGcHJmLlZ6V84DiTaFEXy5gSHRWtvmVkQo4HUk CUkg== 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:cc: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=4qEnNwT4Wh1ilQuZCeJhXg9N+9RJio17WEFYXXbgdAQ=; b=f51LQU7ZXirfX6NvbeZESYhFc8Wx6EQtkolP9R2BpXdcoZqIdDyCgh/6F2o6OVjdFf /O8h9ClNStjR+lP8uneyFWtx+Bj6i/QDKwU9vZvSEu8l2d+VjGr+cAwEDXVAfHRISScS OLe5iY7nAvZaYIopwOlxOAyvMdywGeuSNjnTlw9nl9uuPUl8di+/XvkmmIHA89uwVsb+ WC2JDuwhVYzEqCXkPeurrsasjjRg504F+I+B+fj6hGwLn98kl+87x4MnJvG16mN4RCZ2 1HNwDPqzKPfruSawHKZ8/fwUEklzevZ954X0nsmKKB8/0CL6U3CB7sUcbvSguGv5DfIa zMNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=oPM9ZVbf; 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 o4si5294859wre.246.2018.03.02.15.41.01; Fri, 02 Mar 2018 15:41:03 -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=@overt.org header.s=mail header.b=oPM9ZVbf; 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 1578768A6C9; Sat, 3 Mar 2018 01:40:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f227.google.com (mail-io0-f227.google.com [209.85.223.227]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BF10B689983 for ; Sat, 3 Mar 2018 01:40:47 +0200 (EET) Received: by mail-io0-f227.google.com with SMTP id p78so12310700iod.13 for ; Fri, 02 Mar 2018 15:40:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=utTLNt01E9DUHCrw/rK58VKrpKpFNNoL00mHGjbDYUM=; b=AOMH/GCqOxXSowEVhLTa3Y1LR3ON1x37yp+VINoaQmb0Nu+8AjI5cwqoKI/iTDWvbH 8sOjDBDSVFrK2GoQRTZRQkqqaphZOT9aFsYkM6XrkweDY1i5MYfKpp2U8lfG6JMJM72N 2nLJ4UTuXQJIHVotcrNYlxFrwb3C/zX4J2ZZ9UBC+qydwOZA0czTu23FVEfpu68SjGr/ URX1NGqxeRmUBeU9WdK1RwKeyLs4vbJ0wTZqZxq6DU3DtKrsfAj/xkeYFFN92a+M9sUF j+22H31yfv6DbNE/0RgNGhDknB1C8uwUL5qaHdgvv2YWeH5N/BWdKISaaRUJyQ9Iflo3 k5CQ== X-Gm-Message-State: AElRT7ECB8f9SJFBxOM/MHUbFefrT/mduoCuZ8i9FDjKfpExd1HjhQ3+ 6x9GybGXwy96/FMUnf129HK6K7e4CGYE2Ws/uR4Le8SAPgq5WQ== X-Received: by 10.107.63.131 with SMTP id m125mr8514002ioa.211.1520034052680; Fri, 02 Mar 2018 15:40:52 -0800 (PST) Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com. [107.178.208.155]) by smtp-relay.gmail.com with ESMTPS id u84sm751844itc.11.2018.03.02.15.40.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 15:40:52 -0800 (PST) X-Relaying-Domain: gapps.overt.org Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 0DD7D6009C; Fri, 2 Mar 2018 23:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1520034052; bh=CRQJ7APZVPgIWkEj8vczABwxusazYx7yZISuOZeDKfY=; h=From:To:Cc:Subject:Date:From; b=oPM9ZVbf4tQR1qUT7BESOPyw0OiRLy3idXEH9GgrTHCR+JeSEMatr91fy0Agz3j0Q /Yb++P2dI3ozxIPB79Yl0b6qmHZEVOhc9nHq4Tc0ZckIFj89MQVyHJOjuCSEMWULfE k9hFewimxkVDoVlxRD/HdUo7KBTMD7XCqTmzEnQgXdj4eyxv9bXc07NKAz/ehJ9tJi yohaucW/mU3nsvXBnezHanw7r3zLJQGToofAF7haCWfqbUHIep6NTnO8tznLgolYWa JA3fzmKiK+JYp4JBIPVDpK0gYJgG+khgLxKCNX9Nf57W1wPW276InHi26YAE2Viwdt uBryQ5b2ecr2g== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 2 Mar 2018 15:40:39 -0800 Message-Id: <20180302234039.2632-1-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH] swscale: Introduce a helper to identify semi-planar 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 Cc: Philip Langdale MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This cleans up the ever-more-unreadable list of semi-planar exclusions for selecting the planar copy wrapper. --- libswscale/swscale_internal.h | 7 +++++++ libswscale/swscale_unscaled.c | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 0f51df95d7..d3d9da9a34 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -676,6 +676,13 @@ static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt) return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt)); } +static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + av_assert0(desc); + return (isPlanarYUV(pix_fmt) && desc->comp[1].plane == desc->comp[2].plane); +} + static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 766c9b4872..13f9cd83e3 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1930,12 +1930,7 @@ void ff_get_unscaled_swscale(SwsContext *c) (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && c->chrDstHSubSample == c->chrSrcHSubSample && c->chrDstVSubSample == c->chrSrcVSubSample && - dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && - dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE && - dstFormat != AV_PIX_FMT_P016LE && dstFormat != AV_PIX_FMT_P016BE && - srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 && - srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE && - srcFormat != AV_PIX_FMT_P016LE && srcFormat != AV_PIX_FMT_P016BE)) + !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat))) { if (isPacked(c->srcFormat)) c->swscale = packedCopyWrapper;