From patchwork Mon Nov 22 21:58:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ridley Combs X-Patchwork-Id: 31544 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp7665710iob; Mon, 22 Nov 2021 13:58:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEgLeWgrHMTViLwG/Gn7DmGqGp2Vi+F6kt6tiQsE+Tn2EhDomq40i6hu5XLP/fs2mQOwlJ X-Received: by 2002:a05:6402:b23:: with SMTP id bo3mr608135edb.366.1637618333924; Mon, 22 Nov 2021 13:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637618333; cv=none; d=google.com; s=arc-20160816; b=MTyYHwFp+84XjgJl7CKVkTXMpgGZwYg2O8C2k1Onb/ZEx2HnlFc+fY4MFGZ/I1qbwN WcH8RK5E+FsIjfxdH5I16bcYWg8oxwwosLC5Or/bnzQt5W5x8jz12Qw4/nJ6CKap5uqm W/HO4DogZODmVnEbqlO0hkoy5dTYu5FtHBJZk+8K959+KuqhdM7xyh30JTwj/HE+CaGD 45HqA/WcEDyylDKNx7cWFtSDWddv/eHi+T0e8No4hoBRyfMxzU3Iprecjw/4xtFZnKL4 6v7CUDyGaZ8TLTPUgEk32FswgBLTxWzcDYb/+YHuvezIrsUWhFT/vWqR0fuH44SgWF51 fh2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=G0iqtDtMUaCamLmuXVy4ZEcb5szMCfLYdmvrxDeT83M=; b=JB/r7Ohr/LhI27r4PHbIrVwcgfOqQNnn/h8AyACx9KS4xwlc4hrekLXOarrtr0gfKF JIP79kkiLAA3Et4N6GrJK4L8Ug31O6MQRyruSPtPK1UyKpoOv3h5uKBsNKXSfrkMSTxU YthhV7HKh8O4aDO2JJz7u/Y6rzff9uLK1E4+erpMD6Kgxv3+iSLfzLm+ZtYE+Nsz79xQ rnyW94SFQoDcbh/eLUCtq7iUtNQ5d8QXwyPMEp4b+rAYtjaonHBNzvObwJfG/XQAX8xQ ZJNgnsvRyE1G+Tgh6F3ehgU3i2Eb5mAm+DZkxK1LMfKaEwsQbR3whT9BOenb60l+sB+L M3mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rcombs.me header.s=google header.b=YcGjCyCF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rcombs.me Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id he37si29442464ejc.123.2021.11.22.13.58.52; Mon, 22 Nov 2021 13:58:53 -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=@rcombs.me header.s=google header.b=YcGjCyCF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rcombs.me Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C52A768A755; Mon, 22 Nov 2021 23:58:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD1D268A940 for ; Mon, 22 Nov 2021 23:58:32 +0200 (EET) Received: by mail-io1-f47.google.com with SMTP id x6so3597089iol.13 for ; Mon, 22 Nov 2021 13:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rcombs.me; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/aS8o9WfrtiOuJCA8D5r9g4jgcUF+vw+abxBN9ZGang=; b=YcGjCyCFgxu6Fr4S3SEWLibOAHNtxarfjxcmY+7IaA12KQRgTpAS4lgnxLUJ51cMSt ASgGZg7nZ7Ndy85TkrmhJNr71Yo3MgvePfvtwA+ZAUTdwoaWIqEgKvCVyhwyw4TvHxkY PiMU9ezheaPaUDpLbLrZEjx7yd82Ps+jvH4qq211nhKf+two4avaoIF3tN3Z6lOg8YCq UuzAR7G9v3AhCvU+WERU4JqWl8gtyw95a8gImmXxgCfBw9gBSAnTv7HYPp58JYkZJo9n MsS7Q6Q/J6E7B2FMp0/xtVuv7oUWLzg89b8NqOuwdHBtbo9JdzCmQNUDYv8P6+QCzw6m w4+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/aS8o9WfrtiOuJCA8D5r9g4jgcUF+vw+abxBN9ZGang=; b=vOptqhquuZP2zL0Xht5J8mgFGbB2WWAHZBcqvRn7oi8X8O/Ne8UewJHkQNCjwaOiFO CgPtPViVDYGxGLfWu45d5S7JmODOVT6tfCUjMHizslweX4jt+XBayuGykxjlW85rj9al D6OxMZdH97zeykr9Z2pweIy713/vdyEy6WQyknpsUBiFVlZ2RJW2Ltg3FNJOoUE2sGUo UJhH3i2k1uEx2FRxBLSMBBd/eQIOy+WQI+FUW8fc6uhhLPyF7sihjHXid1NQ+6UgcdFT shE2FOIUk3hUBcUSTyGQ6E41SEQWMZrm8NvwvSyGTRM93oe38LwIon8UNFkSVRKFhea5 ijyw== X-Gm-Message-State: AOAM532zOXks9sHznpZ05AiI/yGf5lQj7VKPP4YSJN6j7DwXZ346d/J9 +Mumen54KxtUrFL7sPxO1q5KMwCrKH87zsM= X-Received: by 2002:a05:6638:2585:: with SMTP id s5mr353077jat.68.1637618310997; Mon, 22 Nov 2021 13:58:30 -0800 (PST) Received: from rcombs-mbp.localdomain ([2601:243:2000:5ac:edf5:499:2479:42a8]) by smtp.gmail.com with ESMTPSA id o1sm5668802ilj.41.2021.11.22.13.58.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Nov 2021 13:58:30 -0800 (PST) From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Nov 2021 15:58:07 -0600 Message-Id: <20211122215821.9849-2-rcombs@rcombs.me> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211122215821.9849-1-rcombs@rcombs.me> References: <20211122215821.9849-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/16] lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: vvg6w1UcDxci These are used by VideoToolbox hardware decoders. --- doc/APIchanges | 3 + libavutil/pixdesc.c | 96 ++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 18 ++++++ tests/ref/fate/imgutils | 8 +++ tests/ref/fate/sws-pixdesc-query | 44 +++++++++++++++ 5 files changed, 169 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 565f7e091e..bc9f4e38da 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-11-22 - xxxxxxxxxx - lavu 57.9.100 - pixfmt.h + Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416. + 2021-11-17 - xxxxxxxxxx - lavf 57.9.100 - frame.h Add AV_FRAME_DATA_DOVI_RPU_BUFFER. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 69cb198646..727d7540b3 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2393,6 +2393,102 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .name = "vulkan", .flags = AV_PIX_FMT_FLAG_HWACCEL, }, + [AV_PIX_FMT_P210BE] = { + .name = "p210be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 4, 0, 6, 10 }, /* U */ + { 1, 4, 2, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_P210LE] = { + .name = "p210le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 4, 0, 6, 10 }, /* U */ + { 1, 4, 2, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_P410BE] = { + .name = "p410be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 4, 0, 6, 10 }, /* U */ + { 1, 4, 2, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_P410LE] = { + .name = "p410le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 4, 0, 6, 10 }, /* U */ + { 1, 4, 2, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_P216BE] = { + .name = "p216be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + { 1, 4, 0, 0, 16 }, /* U */ + { 1, 4, 2, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_P216LE] = { + .name = "p216le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + { 1, 4, 0, 0, 16 }, /* U */ + { 1, 4, 2, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_P416BE] = { + .name = "p416be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + { 1, 4, 0, 0, 16 }, /* U */ + { 1, 4, 2, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_P416LE] = { + .name = "p416le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + { 1, 4, 0, 0, 16 }, /* U */ + { 1, 4, 2, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, }; static const char * const color_range_names[] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 53bdecfcb7..02e355eb4d 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -352,6 +352,19 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, liddle-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-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 }; @@ -444,6 +457,11 @@ enum AVPixelFormat { #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) +#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE) +#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE) +#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) + /** * Chromaticity coordinates of the source primaries. * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 495bbd46f0..b23d1b4c39 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -238,3 +238,11 @@ x2rgb10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 x2rgb10be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 x2bgr10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 x2bgr10be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +p210be planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 0 0, plane_offsets: 6144 0 0, total_size: 12288 +p210le planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 0 0, plane_offsets: 6144 0 0, total_size: 12288 +p410be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 +p410le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 +p216be planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 0 0, plane_offsets: 6144 0 0, total_size: 12288 +p216le planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 0 0, plane_offsets: 6144 0 0, total_size: 12288 +p416be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 +p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index a74109c3d7..553c039061 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -13,6 +13,10 @@ is16BPS: gray16le p016be p016le + p216be + p216le + p416be + p416le rgb48be rgb48le rgba64be @@ -57,6 +61,10 @@ isNBPS: nv20le p010be p010le + p210be + p210le + p410be + p410le x2bgr10be x2bgr10le x2rgb10be @@ -140,6 +148,10 @@ isBE: nv20be p010be p016be + p210be + p216be + p410be + p416be rgb444be rgb48be rgb555be @@ -193,6 +205,14 @@ isYUV: p010le p016be p016le + p210be + p210le + p216be + p216le + p410be + p410le + p416be + p416le uyvy422 uyyvyy411 xyz12be @@ -287,6 +307,14 @@ isPlanarYUV: p010le p016be p016le + p210be + p210le + p216be + p216le + p410be + p410le + p416be + p416le yuv410p yuv411p yuv420p @@ -370,6 +398,14 @@ isSemiPlanarYUV: p010le p016be p016le + p210be + p210le + p216be + p216le + p410be + p410le + p416be + p416le isRGB: 0bgr @@ -751,6 +787,14 @@ Planar: p010le p016be p016le + p210be + p210le + p216be + p216le + p410be + p410le + p416be + p416le yuv410p yuv411p yuv420p