From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 126334C382 for ; Sat, 8 Mar 2025 22:30:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B10768E71F; Sun, 9 Mar 2025 00:30:44 +0200 (EET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7987468E4DA for ; Sun, 9 Mar 2025 00:30:37 +0200 (EET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-22355618fd9so55702795ad.3 for ; Sat, 08 Mar 2025 14:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741473035; x=1742077835; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DfZi0lZv5SUJ1vFb6gcbvTZX9uloZYTyQSPqw1SdGn0=; b=R3DhiR//wR9L6uUIbA7nX4+b1uK83mSl6KsQh0LMLlMc3jfvN8m1YVRQlB8olHuY3e WjeRxNUPGRaG5q2wpvNC364rjpZ+ivQ0EI+Sa8Lh+G3T4Tv8NRB4fszDR4+erTIVeZZJ 4j3u83WzsPaCfcLqltiIKbdJBINoo98ACYHrfI/uYN1RtRhGx0Ez4QHeuAVSpHitQ7/S 98dVhSSCIbL/Gwv1iu5NinxAIw1r8vc7JaauX3vOB0EDrc25WBGKq/ypErbF7eYIYZUb HxW8+ype8kvWHi7IX3JUB0BTLV/LNUR7dG+S1kb3EGFKWLDlsrEo2/1H0kynYhC0GQSB 0z5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741473035; x=1742077835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DfZi0lZv5SUJ1vFb6gcbvTZX9uloZYTyQSPqw1SdGn0=; b=P7TDz+B84xOWGnRLmBTVTuhJaTbjIZCpCpCrdAS5WCfr5CoHqURJDaHzCg/f9H2SEy Jv/VsiFkDsENHiFenQX9w9DfsXdiURMlMEbbEgw7ptw3aWkm3d0OtMZSmLqVWgmmRIpo FUl93Kem/eP2Y//aBKh0m5/BE2cO6182EIFVYymBmN/RVJ7BckRfaPPl/2Wq7rnhBkEC Vs8yhpPXXmC4jWNbmKE1k0/QNoJIyz6xaUAgVLs/7ZgjhCQF3bxt9Z+J/4HgxO4uh6zV x1j6GxxpfgKkA5PsYSfkuP53evWSWlRR8wopD+YQV5w5RVQugLfDZD5e4Ii9tmC2oaFW OjRQ== X-Gm-Message-State: AOJu0YxcwCB0xsPuARPynUXcBhIc0DG3BE7NeU5mKl0GNdmreWsoQ6ee c02sxr6jqJ1GHCfiMLVniCYQ3N8vsP7/ENC2a3fJl3FjOylgfV0wrcWBqw== X-Gm-Gg: ASbGncuaS3+1rz8IzqTVstrl9OWG6Co8+0eol/DJ7+zVuAcgGSwIJPhdd/09dnR509Q bzZkb2N1vUiR7LpE7bDHa9yOEDXfYEE0YypNfKBMpjDwCHnpixn4/Si8DV9sUWsg8bXiOI3GFLG bT37pCCofWTJb4PkWLa+UAQjt/6/RvytJg+AiMHjP2woNf2cLQKShBI19l0R4elBbSNHeQ5e9IS 3SClYkLVmhm3ed40ZcT3tkdaBUY3ZFzlfQ7XY0XfwqogrDismInmLSBqSLK7A/qk06Y08lyHSOs T/AftEi8RwR6XDL0023W4/IZTPx7+dA3EndjpdugIAttR4tCGEEuj6PsrW9m X-Google-Smtp-Source: AGHT+IHywThUpQmnm5TboszGMYEuzdMpcoV8URGwftuWx/Rcs4nyOIh2zxMJMF5VlS6+ajWrkSuyFA== X-Received: by 2002:a05:6a21:6d96:b0:1ee:c7c8:ca4 with SMTP id adf61e73a8af0-1f544c92b65mr17550936637.36.1741473034542; Sat, 08 Mar 2025 14:30:34 -0800 (PST) Received: from localhost.localdomain ([2800:2121:b040:c:452e:44a2:5ade:32c7]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af28126d69bsm5054313a12.51.2025.03.08.14.30.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Mar 2025 14:30:33 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Mar 2025 19:30:17 -0300 Message-ID: <20250308223017.14560-1-jamrial@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250308012838.GA4991@pb2> References: <20250308012838.GA4991@pb2> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- libavfilter/drawutils.c | 2 ++ libavfilter/vsrc_testsrc.c | 19 +++++++++++++++++++ tests/fate/filter-video.mak | 6 ++++++ tests/ref/fate/filter-yuvtestsrc-nv24 | 10 ++++++++++ tests/ref/fate/filter-yuvtestsrc-p410 | 10 ++++++++++ 5 files changed, 47 insertions(+) create mode 100644 tests/ref/fate/filter-yuvtestsrc-nv24 create mode 100644 tests/ref/fate/filter-yuvtestsrc-p410 diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index b86f666f1f..c3d4bb0a25 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -39,6 +39,8 @@ static int fill_map(const AVPixFmtDescriptor *desc, uint8_t *map) return AVERROR(EINVAL); av_assert0(desc->nb_components == 3 + !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)); if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) { + if (desc->nb_components != av_pix_fmt_count_planes(av_pix_fmt_desc_get_id(desc))) + return AVERROR(EINVAL); map[RED] = desc->comp[0].plane; map[GREEN] = desc->comp[1].plane; map[BLUE] = desc->comp[2].plane; diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index c842cacceb..71188e624a 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -1229,6 +1229,23 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4], AV_WN16(&dstp[1][i*2 + j*dst_linesizep[1]], u); AV_WN16(&dstp[2][i*2 + j*dst_linesizep[2]], v); break; + case AV_PIX_FMT_NV24: + dstp[0][i + j*dst_linesizep[0] + 0] = y; + dstp[1][i*2 + j*dst_linesizep[1] + 0] = u; + dstp[1][i*2 + j*dst_linesizep[1] + 1] = v; + break; + case AV_PIX_FMT_NV42: + dstp[0][i + j*dst_linesizep[0] + 0] = y; + dstp[1][i*2 + j*dst_linesizep[1] + 1] = u; + dstp[1][i*2 + j*dst_linesizep[1] + 0] = v; + break; + case AV_PIX_FMT_P410: + case AV_PIX_FMT_P412: + case AV_PIX_FMT_P416: + AV_WN16(&dstp[0][i*2 + j*dst_linesizep[0] + 0], y << (16 - desc->comp[0].depth)); + AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 0], u << (16 - desc->comp[1].depth)); + AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 2], v << (16 - desc->comp[1].depth)); + break; } } @@ -1272,6 +1289,8 @@ static const enum AVPixelFormat yuvtest_pix_fmts[] = { AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA, AV_PIX_FMT_AYUV64, AV_PIX_FMT_VUYA, AV_PIX_FMT_VUYX, AV_PIX_FMT_XV48, AV_PIX_FMT_XV30LE, AV_PIX_FMT_V30XLE, AV_PIX_FMT_XV36, + AV_PIX_FMT_NV24, AV_PIX_FMT_NV42, + AV_PIX_FMT_P410, AV_PIX_FMT_P412, AV_PIX_FMT_P416, AV_PIX_FMT_NONE }; diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index cdd34b72ea..5d64d1e7f4 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -124,6 +124,12 @@ fate-filter-yuvtestsrc-yuv444p: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-yuv444p12 fate-filter-yuvtestsrc-yuv444p12: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=yuv444p12,scale -pix_fmt yuv444p12le +FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-nv24 +fate-filter-yuvtestsrc-nv24: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=nv24,scale -pix_fmt nv24 + +FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-p410 +fate-filter-yuvtestsrc-p410: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=p410,scale -pix_fmt p410le + FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-ayuv fate-filter-yuvtestsrc-ayuv: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt ayuv diff --git a/tests/ref/fate/filter-yuvtestsrc-nv24 b/tests/ref/fate/filter-yuvtestsrc-nv24 new file mode 100644 index 0000000000..1f4affd0cf --- /dev/null +++ b/tests/ref/fate/filter-yuvtestsrc-nv24 @@ -0,0 +1,10 @@ +#tb 0: 1/5 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +0, 0, 0, 1, 230400, 0x62632a4f +0, 1, 1, 1, 230400, 0x62632a4f +0, 2, 2, 1, 230400, 0x62632a4f +0, 3, 3, 1, 230400, 0x62632a4f +0, 4, 4, 1, 230400, 0x62632a4f diff --git a/tests/ref/fate/filter-yuvtestsrc-p410 b/tests/ref/fate/filter-yuvtestsrc-p410 new file mode 100644 index 0000000000..68199b4a15 --- /dev/null +++ b/tests/ref/fate/filter-yuvtestsrc-p410 @@ -0,0 +1,10 @@ +#tb 0: 1/5 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +0, 0, 0, 1, 460800, 0x2f2d2f95 +0, 1, 1, 1, 460800, 0x2f2d2f95 +0, 2, 2, 1, 460800, 0x2f2d2f95 +0, 3, 3, 1, 460800, 0x2f2d2f95 +0, 4, 4, 1, 460800, 0x2f2d2f95 -- 2.48.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".