From patchwork Fri Jun 19 01:52:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Wang X-Patchwork-Id: 20493 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp105889ybm; Thu, 18 Jun 2020 18:53:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOA9RVECDTvFVXxYVKNX1DqtLHY/0uUgQicWqel+lnOVjjKbfGi0oUP/67c2xJ5tB9AoOU X-Received: by 2002:a1c:9ad8:: with SMTP id c207mr1069737wme.45.1592531615052; Thu, 18 Jun 2020 18:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592531615; cv=none; d=google.com; s=arc-20160816; b=YdRSFIWX0s9e6PDjIwa2I8xOxNbRGToFnbl9frPJoqLK+kiJP80xBk7/l3MrAf9MCe U+Si7i4ddWMOMh2BdAD3bp3cayKTqUd0KyQp23PhQbvtLa5+bgWSi0I6yi+ypze6KrlS aLGeAojq7OxQ8n2jxKOfqsj3W7vfni8aJfag4QYSvJnWITM4cDC3Kpsl4/VMQqktnqXu pupuRAcAaMFuJdtwQ2Z5Unm9vSJo4O9FlPF3TzsJ3MD9ghbRKAXJjB9ZMRDrTBFsd1cL RHZBhZoHdp6EWg1Ebhk+B7l+gAgt747thekcHzGKjEb8fQTame/8A1PpEsu9pMOKncyb YTNg== 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:ironport-sdr :ironport-sdr:delivered-to; bh=oPPQ/Y8I2z2Jfw9p5S3zoOPO4c86AShg+yXohItEi2o=; b=PARdFjR1Ns9Y6JLdNCa/x4sXBHgRtrmZjEsaAiBRiX4bCKt1LVeeGZS7yHQZf04cqy a1THLENSoQsDXo1M5/zrg7SSfIDC2UP6f2WQwzxuqBkI/UdDtS8laBq1PXgy26mFXRez J2qZ+FW87xKBuDFlyERWZB+Ge67c0w9uVKagxkHNjtoAiNfNWMd4aoDTxYejftSmPtGH IqaCew7XWleEVWh/d5ie6FjN+Ub+ChLm87w0nJh5oy0tzohosIKTbnL1Ju4ABMGLeZfw us7ECDiQokG1d3xe/ofM5FhMSFNchsKk13NKXbDi0OM7AmtwOQh2QeVe53Dgz/iwkdYB EiHw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q14si4708515wrg.562.2020.06.18.18.53.34; Thu, 18 Jun 2020 18:53:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8263D68B510; Fri, 19 Jun 2020 04:53:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE5C368B260 for ; Fri, 19 Jun 2020 04:53:25 +0300 (EEST) IronPort-SDR: 7iKqCXrVsPjrTjiZuAIwkU4GWNu3M9ZkWBOn9mz8GZfaKSquoXaJWkzfq+07q5M2OX0ObFRSBu L4gazBDGM2yQ== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="204278644" X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="204278644" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 18:53:22 -0700 IronPort-SDR: xkc6N4IqS4vQ7bFy41Y8eOiygclpzRejlJJOVA9dTRCEZeKxrEj6p8TEoXYj/CAT6rrC06gKqg CoVmcbBOUtqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="317989391" Received: from f.sh.intel.com ([10.239.159.122]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jun 2020 18:53:21 -0700 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Jun 2020 09:52:40 +0800 Message-Id: <20200619015248.21873-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH v1 1/9] lavu/pix_fmt: add P012 pixel format 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: Fei Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4Q/gV9FUoomo Content-Length: 5775 P012 is 12bit planner format which is similar to NV12. It using two bytes to store 12bit valid data and 4bit zero in LSB. This format will be used for hardware decode/encode in VAAPI and QSV. Signed-off-by: Fei Wang --- libavutil/pixdesc.c | 24 ++++++++++++++++++++++++ libavutil/pixfmt.h | 5 +++++ libavutil/version.h | 2 +- tests/ref/fate/sws-pixdesc-query | 11 +++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 8274713226..38297e2e83 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2147,6 +2147,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, }, + [AV_PIX_FMT_P012LE] = { + .name = "p012le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 2, 0, 4, 12, 1, 11, 1 }, /* Y */ + { 1, 4, 0, 4, 12, 3, 11, 1 }, /* U */ + { 1, 4, 2, 4, 12, 3, 11, 3 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_P012BE] = { + .name = "p012be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 2, 0, 4, 12, 1, 11, 1 }, /* Y */ + { 1, 4, 0, 4, 12, 3, 11, 1 }, /* U */ + { 1, 4, 2, 4, 12, 3, 11, 3 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, + }, [AV_PIX_FMT_P016LE] = { .name = "p016le", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index a46acf3c5e..261e1ea352 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -360,6 +360,10 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, little-endian + AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, 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 }; @@ -450,6 +454,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_P012 AV_PIX_FMT_NE(P012BE, P012LE) /** * Chromaticity coordinates of the source primaries. diff --git a/libavutil/version.h b/libavutil/version.h index 3ce9b1831e..a63f79feb1 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 55 +#define LIBAVUTIL_VERSION_MINOR 56 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index c3cccfa492..f738a3ad74 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -57,6 +57,8 @@ isNBPS: nv20le p010be p010le + p012be + p012le x2rgb10be x2rgb10le xyz12be @@ -137,6 +139,7 @@ isBE: grayf32be nv20be p010be + p012be p016be rgb444be rgb48be @@ -188,6 +191,8 @@ isYUV: nv42 p010be p010le + p012be + p012le p016be p016le uyvy422 @@ -282,6 +287,8 @@ isPlanarYUV: nv42 p010be p010le + p012be + p012le p016be p016le yuv410p @@ -365,6 +372,8 @@ isSemiPlanarYUV: nv42 p010be p010le + p012be + p012le p016be p016le @@ -740,6 +749,8 @@ Planar: nv42 p010be p010le + p012be + p012le p016be p016le yuv410p