From patchwork Sun Oct 7 17:50:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 10609 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:ab0:73d2:0:0:0:0:0 with SMTP id m18csp2761654uaq; Sun, 7 Oct 2018 10:51:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV61jd1aVHCLG0rt6VSaMHtvNSzU1UPAVKGzlIYgMsLYkSp0aRrtGsPiJ1t7KXiNr+FwiI42g X-Received: by 2002:adf:ed8e:: with SMTP id c14-v6mr13577545wro.39.1538934707080; Sun, 07 Oct 2018 10:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538934707; cv=none; d=google.com; s=arc-20160816; b=ovkH+KVAW5nwUGWQHd4vcilXmYvASqInEoO8cfFp36B9jVClMhu64pSsEeQBZjnVSD xiuLemsZ9ZHb8En3FKEQ0EpYEQGozfpWR0Tzl6fXZPT0J/K4gorYuM9lIZhhi9SX2swD yFtq73mh8WkIFW6f9MfBZXCL8ddMXctInSlMtmkSUaY8vMppA9xeXeo/rfPHC2PvWs1G EuPF8H+SNzE3KbDJH3wDUXU6YUqMgu0UUH/BenB2UXhVg2PBV/a+QNhpD6ieMWS0pcLJ csG95+uHBktHpKhiazdtdEH/cQ82NSLs4T4lt4tYjKwe9Jc6rmikQAlAkv7oih1fTMT4 WbHQ== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=7oSJNlQeKi5EKoq/2aEKjfJE9xNSBSlO/sD+iIIlDxw=; b=pzCaQEZ0eWIgP6t+7PV+ihivTuWuoAQFntjT0vQ3nOiZMEpycjgljzOfL6R39eivQF f4orhAouYeKzqel0yPP3BzYAR7byf1Do0F7FMUa1rwt6xUnIUmXR+22mV2b2hP1V88Wc iLgUs+qvZ3ck02jglBs5j7An6ergN1paumDo6gYicpUmU+GttxBxD8hhmhz6bdwq0wH1 y85RQObprnTDzwodwghepEnPtTskGw6eFXJI0C8ErDxBAjm9t+2tGdtEHGQypsfN7hjB LfRJFWSEwZyG9xIaSHJat7r6MyngTs3QkrItCDMAIUhHgO+A8Tt8V4yVf0qH/EtC+Kwh l3YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=qrnBmkdK; 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 p6-v6si11237334wrw.296.2018.10.07.10.51.46; Sun, 07 Oct 2018 10:51:47 -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; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=qrnBmkdK; 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 ED22C689FC6; Sun, 7 Oct 2018 20:51:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f226.google.com (mail-oi1-f226.google.com [209.85.167.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C5FB689E21 for ; Sun, 7 Oct 2018 20:51:06 +0300 (EEST) Received: by mail-oi1-f226.google.com with SMTP id w81-v6so14095009oiw.9 for ; Sun, 07 Oct 2018 10:51:27 -0700 (PDT) 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:in-reply-to:references; bh=dkz264heJjKsGl/tik1mUAL1ZyYLvAjIl/RcuSRzi3U=; b=UOZM1e9rmlcOzVA0hdNkEuPGCRrjAfO/UrImoYV6BqVBsJgbUig5tXsjIBop4AXp27 6hj5LoBBRhOkQCdk3wDJjyUq7j2ZZ5jHM497Wwcdv1FyP8/jykFzS/elUHJZqm10sLbm 3rqxD0fiZE1HGZKGDLR0GfFxhj0Dk4HqbUbuU76FYPfQAaUjWDygx3cD8dD6W6FTcYDo K01fRCTxY5Gf0iBDt22ZkwTfGf4mKive3U9SzPo6FrNjg6RXrAUnDpBxaqw7AjL/Oim2 A9EXXoaO//Z5dxggJ0Lr5wkA/DRDYlXleFuiQRk9mah92rM5kdqap6wKibR5I8N6t+fY hRXg== X-Gm-Message-State: ABuFfoi5MSFf2qHgJZwo3U4BJicRpDH+XDgB465uE1VsrIpzej/Vqx+B IiJCNaVcCX41col+z/p18K3fdvi9dMAi33m7bSKIsS+7sb4nyw== X-Received: by 2002:aca:5bc5:: with SMTP id p188-v6mr3662634oib.339.1538934686329; Sun, 07 Oct 2018 10:51:26 -0700 (PDT) Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com. [107.178.208.155]) by smtp-relay.gmail.com with ESMTPS id u46sm767829otc.4.2018.10.07.10.51.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Oct 2018 10:51:26 -0700 (PDT) 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 885D360197; Sun, 7 Oct 2018 17:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1538934685; bh=9/k2i+Kax8ia9V4W3zRyZp0HXK/qwjnrAqAC143lIHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qrnBmkdKtjHKMT6geOzmmO05wak7wp2DKu8oeO9KvGs22HdYEe+MOJH6C+ICqBQR4 9pJvkVMaqM6jV6VfFyVNG29ttp3Q9ge9WdftppC81QO1D7khg6BwtOb99GsSxcfQo3 4/xQ8ooE+oj5TlPwKBY2KIKGoyKZwwNXivfl9wTE0tZTDhyqJ9aC+SCl7yV8zzxbck hkpZAuNnkNDV09b/arN0eXVlVY5aoDpPvC9sw+nXOIS16KIvN2yRV6DWr0R1H5wYpe D8qxrBeRMN117eIhMy7H9/P1aPP9a2z8lyh8UiTYHPVWqOL9F1ghuknBpAcObcUVm3 rX6YBJFoJGb7A== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org, Timo Rothenpieler Date: Sun, 7 Oct 2018 10:50:53 -0700 Message-Id: <20181007175057.31070-2-philipl@overt.org> In-Reply-To: <20181007175057.31070-1-philipl@overt.org> References: <20181007175057.31070-1-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 1/5] avutil: Add YUV444P10_LSB and YUV444P12_LSB pixel 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" Currently, ffmpeg defines a set of YUV444P formats for use where the bits-per-pixel are between 8 and 16 bits. In these formats, the bits are packed in the MSBs of the 16 bits of available storage. On the other hand, all the hardware vendors have defined their equivalent formats with the bits packed in the LSBs, which has the virtue of making the memory layouts compatible with being treated as full 16 bit values (which is also why P010 is defined this way). So, to be able to use these hardware compatible formats, we need definitions for them in ffmpeg. Right now, I need this for nvdec, but Vulkan also uses the same format definitions. Signed-off-by: Philip Langdale --- libavutil/pixdesc.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 8 ++++++++ libavutil/version.h | 4 ++-- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 970a83214c..c48a100907 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1629,6 +1629,54 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV444P10LE_LSB] = { + .name = "yuv444p10lelsb", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */ + { 1, 2, 0, 6, 10, 1, 9, 1 }, /* U */ + { 2, 2, 0, 6, 10, 1, 9, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P10BE_LSB] = { + .name = "yuv444p10belsb", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */ + { 1, 2, 0, 6, 10, 1, 9, 1 }, /* U */ + { 2, 2, 0, 6, 10, 1, 9, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P12LE_LSB] = { + .name = "yuv444p12lelsb", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 4, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 4, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 4, 12, 1, 11, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P12BE_LSB] = { + .name = "yuv444p12belsb", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 4, 12, 1, 11, 1 }, /* Y */ + { 1, 2, 0, 4, 12, 1, 11, 1 }, /* U */ + { 2, 2, 0, 4, 12, 1, 11, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_D3D11VA_VLD] = { .name = "d3d11va_vld", .log2_chroma_w = 1, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 6815f8dc7b..910cb0a995 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -340,6 +340,11 @@ enum AVPixelFormat { AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian + AV_PIX_FMT_YUV444P10LE_LSB, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), LSB packed, little-endian + AV_PIX_FMT_YUV444P10BE_LSB, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), LSB packed, big-endian + AV_PIX_FMT_YUV444P12LE_LSB, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y samples), LSB packed, little-endian + AV_PIX_FMT_YUV444P12BE_LSB, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y samples), LSB packed, big-endian + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -391,6 +396,9 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) +#define AV_PIX_FMT_YUV444P10_LSB AV_PIX_FMT_NE(YUV444P10BE_LSB, YUV444P10LE_LSB) +#define AV_PIX_FMT_YUV444P12_LSB AV_PIX_FMT_NE(YUV444P12BE_LSB, YUV444P12LE_LSB) + #define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) #define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) #define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) diff --git a/libavutil/version.h b/libavutil/version.h index f84ec89154..377714a91e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 19 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 20 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \