From patchwork Sat Mar 11 17:05:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40647 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp482126pzb; Sat, 11 Mar 2023 09:05:39 -0800 (PST) X-Google-Smtp-Source: AK7set+fdyq9sxZeUygMlsK0r0yXzF1J5Fe9UqrIJLR0CAS/QXDxUE20Eb62ZutSGpxLo4bEWRtk X-Received: by 2002:a17:907:320b:b0:91d:9745:407a with SMTP id xg11-20020a170907320b00b0091d9745407amr4986852ejb.14.1678554339400; Sat, 11 Mar 2023 09:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678554339; cv=none; d=google.com; s=arc-20160816; b=u0F7azMTLhnDP45cfYb/A7TCuIvYRwxP7pHMZ1G18MKbDyhWl0SXJaFz54zjFWxSzn 9NVxBPf275KolNRH1/2s3qvpTT4bwXVmgJGyiZQADRFAfnYlpkp1LtXZDTLY6rxCtjsm YV5Giy7SZ9ZBQ5aCIIUJBDNjHMTGHoLxalaR5kjWzPc5BB5IOCzEszdhLp2UnPeg3t// uRfk/sN5RJin4v4gOTRAka3T3gUMwQWxvbgaetks+ixgp+Q3yer9vCC0RP6b6qFaqa2o wmj7cuX4VT3AD9Wd+MuZuAD8ECEIuPmk74udL0Nfs5SoFQDeit9m/c1mlcg6I6uMPgz7 EBiQ== 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:message-id:date:to:from :delivered-to; bh=VDv2JEFDx+/VtXb3RgdVjnK6vTZ57cSuZbwQ2rW2l3w=; b=GUdMjrK8QrAf1Pp6kGJdt0vjqpl4gRy7rDKWpEPNAeeIAbQSJaAa/cI9q4kPXJWIGp skV6V4FUwec23+DpRAroocbLmRBtgv8QO11vPXhbnCPI9F/0XwFmqZ71RMnMcLqgfJDm hnqJjsveTFagndta0fVnkfwyNmQNvdjTveARDiPaJoY3FO3EU7UPQmDuPO3yhEa3nH5P e85UlWdEwT0YwSLTWW6QxJTuvxRHK5Z4PUzBU+l2A8l8QbeVR7mSpY7jHpj+SrHYPf2b yZw/lvszDvbaK1akCOZDdTuFZQ+JG1BGGSPo0iy61zxa7DdMydsyrL/RLTd15aMfcNKb mmaQ== 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b9-20020aa7c909000000b004c180fc7861si1231446edt.357.2023.03.11.09.05.38; Sat, 11 Mar 2023 09:05:39 -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; 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 1BE7F68BB3C; Sat, 11 Mar 2023 19:05:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7216968AFD7 for ; Sat, 11 Mar 2023 19:05:28 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id A068D2404EA for ; Sat, 11 Mar 2023 18:05:27 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id jPWNeER20M0a for ; Sat, 11 Mar 2023 18:05:24 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BBFAC240178 for ; Sat, 11 Mar 2023 18:05:24 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 54C773A00B6 for ; Sat, 11 Mar 2023 18:05:18 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Mar 2023 18:05:02 +0100 Message-Id: <20230311170502.3451-1-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] tests/fate: add simple tests for libx264 and libx265 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: OCU4qzuZJlwb Since these are external encoders not under our control, we cannot test the encoded output exactly as is done for internal encoders. We can still test however that the output is decodable and produces the expected number of frames with expected dimensions, pixel formats, and timestamps. --- A minimal proof of concept, more tests for these and other external encoders are welcome. Samples were picked at a whim, better suggestions also welcome. --- tests/Makefile | 1 + tests/fate-run.sh | 16 +++++++ tests/fate/enc_external.mak | 10 +++++ tests/ref/fate/libx264-simple | 85 +++++++++++++++++++++++++++++++++++ tests/ref/fate/libx265-simple | 25 +++++++++++ 5 files changed, 137 insertions(+) create mode 100644 tests/fate/enc_external.mak create mode 100644 tests/ref/fate/libx264-simple create mode 100644 tests/ref/fate/libx265-simple diff --git a/tests/Makefile b/tests/Makefile index 1d50e1d175..8071bd829d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -178,6 +178,7 @@ include $(SRC_PATH)/tests/fate/dpcm.mak include $(SRC_PATH)/tests/fate/dvvideo.mak include $(SRC_PATH)/tests/fate/ea.mak include $(SRC_PATH)/tests/fate/exif.mak +include $(SRC_PATH)/tests/fate/enc_external.mak # Must be included after lavf-video.mak include $(SRC_PATH)/tests/fate/ffmpeg.mak include $(SRC_PATH)/tests/fate/ffprobe.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 61cc59acc0..e12279e4cf 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -282,6 +282,22 @@ stream_remux(){ run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return } +# this function is for testing external encoders, +# where the precise output is not controlled by us +# we can still test e.g. that the output can be decoded correctly +enc_external(){ + srcfile=$1 + enc_fmt=$2 + enc_opt=$3 + probe_opt=$4 + + srcfile=$(target_path $srcfile) + encfile=$(target_path "${outdir}/${test}.${enc_fmt}") + + ffmpeg -i $srcfile $enc_opt -f $enc_fmt -y $encfile || return + run ffprobe${PROGSUF}${EXECSUF} -bitexact $probe_opt $encfile || return +} + # FIXME: There is a certain duplication between the avconv-related helper # functions above and below that should be refactored. ffmpeg2="$target_exec ${target_path}/ffmpeg${PROGSUF}${EXECSUF}" diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak new file mode 100644 index 0000000000..6492b52fa1 --- /dev/null +++ b/tests/fate/enc_external.mak @@ -0,0 +1,10 @@ +FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 H264, MOV, H264_DEMUXER) += fate-libx264-simple +fate-libx264-simple: CMD = enc_external $(TARGET_SAMPLES)/h264-conformance/BA1_Sony_D.jsv \ + mp4 "-c:v libx264" "-show_entries frame=width,height,pix_fmt,pts,pkt_dts -of flat" + +FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX265 HEVC, MOV, HEVC_DEMUXER) += fate-libx265-simple +fate-libx265-simple: CMD = enc_external $(TARGET_SAMPLES)/hevc-conformance/POC_A_Bossen_3.bit \ + mp4 "-c:v libx265" "-show_entries frame=width,height,pix_fmt,pts,pkt_dts -of flat" + +FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes) +fate-enc-external: $(FATE_ENC_EXTERNAL-yes) diff --git a/tests/ref/fate/libx264-simple b/tests/ref/fate/libx264-simple new file mode 100644 index 0000000000..b7f7e67c3b --- /dev/null +++ b/tests/ref/fate/libx264-simple @@ -0,0 +1,85 @@ +frames.frame.0.pts=0 +frames.frame.0.pkt_dts=0 +frames.frame.0.width=176 +frames.frame.0.height=144 +frames.frame.0.pix_fmt="yuv420p" +frames.frame.1.pts=512 +frames.frame.1.pkt_dts=512 +frames.frame.1.width=176 +frames.frame.1.height=144 +frames.frame.1.pix_fmt="yuv420p" +frames.frame.2.pts=1024 +frames.frame.2.pkt_dts=1024 +frames.frame.2.width=176 +frames.frame.2.height=144 +frames.frame.2.pix_fmt="yuv420p" +frames.frame.3.pts=1536 +frames.frame.3.pkt_dts=1536 +frames.frame.3.width=176 +frames.frame.3.height=144 +frames.frame.3.pix_fmt="yuv420p" +frames.frame.4.pts=2048 +frames.frame.4.pkt_dts=2048 +frames.frame.4.width=176 +frames.frame.4.height=144 +frames.frame.4.pix_fmt="yuv420p" +frames.frame.5.pts=2560 +frames.frame.5.pkt_dts=2560 +frames.frame.5.width=176 +frames.frame.5.height=144 +frames.frame.5.pix_fmt="yuv420p" +frames.frame.6.pts=3072 +frames.frame.6.pkt_dts=3072 +frames.frame.6.width=176 +frames.frame.6.height=144 +frames.frame.6.pix_fmt="yuv420p" +frames.frame.7.pts=3584 +frames.frame.7.pkt_dts=3584 +frames.frame.7.width=176 +frames.frame.7.height=144 +frames.frame.7.pix_fmt="yuv420p" +frames.frame.8.pts=4096 +frames.frame.8.pkt_dts=4096 +frames.frame.8.width=176 +frames.frame.8.height=144 +frames.frame.8.pix_fmt="yuv420p" +frames.frame.9.pts=4608 +frames.frame.9.pkt_dts=4608 +frames.frame.9.width=176 +frames.frame.9.height=144 +frames.frame.9.pix_fmt="yuv420p" +frames.frame.10.pts=5120 +frames.frame.10.pkt_dts=5120 +frames.frame.10.width=176 +frames.frame.10.height=144 +frames.frame.10.pix_fmt="yuv420p" +frames.frame.11.pts=5632 +frames.frame.11.pkt_dts=5632 +frames.frame.11.width=176 +frames.frame.11.height=144 +frames.frame.11.pix_fmt="yuv420p" +frames.frame.12.pts=6144 +frames.frame.12.pkt_dts=6144 +frames.frame.12.width=176 +frames.frame.12.height=144 +frames.frame.12.pix_fmt="yuv420p" +frames.frame.13.pts=6656 +frames.frame.13.pkt_dts=6656 +frames.frame.13.width=176 +frames.frame.13.height=144 +frames.frame.13.pix_fmt="yuv420p" +frames.frame.14.pts=7168 +frames.frame.14.pkt_dts=7168 +frames.frame.14.width=176 +frames.frame.14.height=144 +frames.frame.14.pix_fmt="yuv420p" +frames.frame.15.pts=7680 +frames.frame.15.pkt_dts="N/A" +frames.frame.15.width=176 +frames.frame.15.height=144 +frames.frame.15.pix_fmt="yuv420p" +frames.frame.16.pts=8192 +frames.frame.16.pkt_dts="N/A" +frames.frame.16.width=176 +frames.frame.16.height=144 +frames.frame.16.pix_fmt="yuv420p" diff --git a/tests/ref/fate/libx265-simple b/tests/ref/fate/libx265-simple new file mode 100644 index 0000000000..dffe4bcb0e --- /dev/null +++ b/tests/ref/fate/libx265-simple @@ -0,0 +1,25 @@ +frames.frame.0.pts=0 +frames.frame.0.pkt_dts=0 +frames.frame.0.width=416 +frames.frame.0.height=240 +frames.frame.0.pix_fmt="yuv420p" +frames.frame.1.pts=512 +frames.frame.1.pkt_dts=512 +frames.frame.1.width=416 +frames.frame.1.height=240 +frames.frame.1.pix_fmt="yuv420p" +frames.frame.2.pts=1024 +frames.frame.2.pkt_dts=1024 +frames.frame.2.width=416 +frames.frame.2.height=240 +frames.frame.2.pix_fmt="yuv420p" +frames.frame.3.pts=1536 +frames.frame.3.pkt_dts="N/A" +frames.frame.3.width=416 +frames.frame.3.height=240 +frames.frame.3.pix_fmt="yuv420p" +frames.frame.4.pts=2048 +frames.frame.4.pkt_dts="N/A" +frames.frame.4.width=416 +frames.frame.4.height=240 +frames.frame.4.pix_fmt="yuv420p"