1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'f8df5e2f31a5ba7b30a0e1caaaf5a03c753b3f9b'

* commit 'f8df5e2f31a5ba7b30a0e1caaaf5a03c753b3f9b':
  tests: Add a convenience function for video-only lavf tests

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-03-14 14:47:57 -03:00
commit ac4b5d8622
21 changed files with 104 additions and 179 deletions

View File

@ -89,11 +89,11 @@ include $(SRC_PATH)/$(APITESTSDIR)/Makefile
include $(SRC_PATH)/tests/fate/acodec.mak
include $(SRC_PATH)/tests/fate/vcodec.mak
include $(SRC_PATH)/tests/fate/avformat.mak
include $(SRC_PATH)/tests/fate/lavf-audio.mak
include $(SRC_PATH)/tests/fate/lavf-container.mak
include $(SRC_PATH)/tests/fate/lavf-image.mak
include $(SRC_PATH)/tests/fate/lavf-image2pipe.mak
include $(SRC_PATH)/tests/fate/lavf-video.mak
include $(SRC_PATH)/tests/fate/seek.mak
include $(SRC_PATH)/tests/fate/aac.mak
@ -170,6 +170,7 @@ include $(SRC_PATH)/tests/fate/qt.mak
include $(SRC_PATH)/tests/fate/qtrle.mak
include $(SRC_PATH)/tests/fate/real.mak
include $(SRC_PATH)/tests/fate/screen.mak
include $(SRC_PATH)/tests/fate/segment.mak
include $(SRC_PATH)/tests/fate/source.mak
include $(SRC_PATH)/tests/fate/speedhq.mak
include $(SRC_PATH)/tests/fate/subtitles.mak

View File

@ -340,16 +340,12 @@ lavf_image2pipe(){
do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
}
lavffatetest(){
t="${test#lavf-fate-}"
ref=${base}/ref/lavf-fate/$t
${base}/lavf-regression.sh $t lavf-fate tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags" "$target_samples"
}
lavftest(){
lavf_video(){
t="${test#lavf-}"
ref=${base}/ref/lavf/$t
${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags" "$target_samples"
outdir="tests/data/lavf"
file=${outdir}/lavf.$t
do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $1 $2
do_avconv_crc $file $DEC_OPTS -i $target_path/$file $1
}
refcmp_metadata(){

View File

@ -93,6 +93,10 @@ fate-copy-trac2211-avi: $(TARGET_SAMPLES)/h264/bbc2.sample.h264
fate-copy-trac2211-avi: CMD = transcode "h264 -r 14" $(TARGET_SAMPLES)/h264/bbc2.sample.h264\
avi "-c:a copy -c:v copy"
FATE_STREAMCOPY-$(call ALLYES, APNG_DEMUXER APNG_MUXER) += fate-copy-apng
fate-copy-apng: fate-lavf-apng
fate-copy-apng: CMD = transcode apng "$(TARGET_PATH)/tests/data/lavf/lavf.apng" apng "-c:v copy"
FATE_STREAMCOPY-$(call DEMMUX, OGG, OGG) += fate-limited_input_seek fate-limited_input_seek-copyts
fate-limited_input_seek: $(TARGET_SAMPLES)/vorbis/moog_small.ogg
fate-limited_input_seek: CMD = md5 -ss 1.5 -t 1.3 -i $(TARGET_SAMPLES)/vorbis/moog_small.ogg -c:a copy -fflags +bitexact -f ogg

29
tests/fate/lavf-video.mak Normal file
View File

@ -0,0 +1,29 @@
FATE_LAVF_VIDEO-$(call ENCDEC, APNG, APNG) += apng
FATE_LAVF_VIDEO-$(call ENCDEC, APNG, APNG) += apng.png
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gray.fits
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gray16be.fits
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gbrp.fits
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gbrap.fits
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gbrp16be.fits
FATE_LAVF_VIDEO-$(call ENCDEC, FITS, FITS) += gbrap16be.fits
FATE_LAVF_VIDEO-$(call ENCDEC, GIF, FITS) += gif
FATE_LAVF_VIDEO-$(CONFIG_YUV4MPEGPIPE_MUXER) += y4m
FATE_LAVF_VIDEO = $(FATE_LAVF_VIDEO-yes:%=fate-lavf-%)
$(FATE_LAVF_VIDEO): CMD = lavf_video
$(FATE_LAVF_VIDEO): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
$(FATE_LAVF_VIDEO): $(VREF)
fate-lavf-apng: CMD = lavf_video "-pix_fmt rgb24"
fate-lavf-apng.png: CMD = lavf_video "-pix_fmt rgb24" "-frames:v 1 -f apng"
fate-lavf-gray.fits: CMD = lavf_video "-pix_fmt gray"
fate-lavf-gray16be.fits: CMD = lavf_video "-pix_fmt gray16be"
fate-lavf-gbrp.fits: CMD = lavf_video "-pix_fmt gbrp"
fate-lavf-gbrap.fits: CMD = lavf_video "-pix_fmt gbrap"
fate-lavf-gbrp16be.fits: CMD = lavf_video "-pix_fmt gbrp16be"
fate-lavf-gbrap16be.fits: CMD = lavf_video "-pix_fmt gbrap16be"
fate-lavf-gif: CMD = lavf_video "-pix_fmt rgb24"
FATE_AVCONV += $(FATE_LAVF_VIDEO)
fate-lavf-video fate-lavf: $(FATE_LAVF_VIDEO)

View File

@ -200,7 +200,7 @@ FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2, MPEGTS) += ts
FATE_SEEK_LAVF-$(call ENCDEC, PCM_U8, VOC) += voc
FATE_SEEK_LAVF-$(call ENCDEC, PCM_S16LE, WAV) += wav
FATE_SEEK_LAVF-$(call ENCDEC, MP2, WTV) += wtv
FATE_SEEK_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg
FATE_SEEK_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER) += y4m
fate-seek-lavf-aiff: SRC = lavf/lavf.aiff
fate-seek-lavf-al: SRC = lavf/lavf.al
@ -241,7 +241,7 @@ fate-seek-lavf-ts: SRC = lavf/lavf.ts
fate-seek-lavf-voc: SRC = lavf/lavf.voc
fate-seek-lavf-wav: SRC = lavf/lavf.wav
fate-seek-lavf-wtv: SRC = lavf/lavf.wtv
fate-seek-lavf-yuv4mpeg: SRC = lavf/lavf.y4m
fate-seek-lavf-y4m: SRC = lavf/lavf.y4m
FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)

View File

@ -1,17 +1,3 @@
FATE_LAVF-$(call ENCDEC, APNG, APNG) += apng
FATE_LAVF-$(call ENCDEC, FITS, FITS) += fits
FATE_LAVF-$(call ENCDEC, GIF, IMAGE2) += gif
FATE_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg
FATE_LAVF += $(FATE_LAVF-yes:%=fate-lavf-%)
$(FATE_LAVF): $(AREF) $(VREF)
$(FATE_LAVF): CMD = lavftest
$(FATE_LAVF): CMP =
FATE_AVCONV += $(FATE_LAVF)
fate-lavf: $(FATE_LAVF)
tests/data/mp4-to-ts.m3u8: TAG = GEN
tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \

View File

@ -1,53 +0,0 @@
#!/bin/sh
#
# automatic regression test for libavformat
#
#
#set -x
set -e
. $(dirname $0)/regression-funcs.sh
eval do_$test=y
ENC_OPTS="$ENC_OPTS -metadata title=lavftest"
# streamed images
# mjpeg
#file=${outfile}lavf.mjpeg
#do_avconv $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
#do_avconv_crc $file -i $target_path/$file
if [ -n "$do_gif" ] ; then
file=${outfile}lavf.gif
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
fi
if [ -n "$do_apng" ] ; then
file=${outfile}lavf.apng
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -pix_fmt rgb24
do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
file_copy=${outfile}lavf.copy.apng
do_avconv $file_copy $DEC_OPTS -i $file $ENC_OPTS -c copy
do_avconv_crc $file_copy $DEC_OPTS -i $target_path/$file_copy
file=${outfile}lavf.png
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt rgb24 -frames:v 1 -f apng
do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
fi
if [ -n "$do_yuv4mpeg" ] ; then
file=${outfile}lavf.y4m
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
do_avconv_crc $file -i $target_path/$file
fi
if [ -n "$do_fits" ] ; then
pix_fmts="gray gray16be gbrp gbrap gbrp16be gbrap16be"
for pix_fmt in $pix_fmts ; do
file=${outfile}${pix_fmt}lavf.fits
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt $pix_fmt
do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt $pix_fmt
done
fi

32
tests/ref/fate/copy-apng Normal file
View File

@ -0,0 +1,32 @@
a4c46fad7716ad094eb3c78b74ca0244 *tests/data/fate/copy-apng.apng
6209864 tests/data/fate/copy-apng.apng
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 352x288
#sar 0: 0/1
0, 0, 0, 1, 304128, 0x348bb7a0
0, 1, 1, 1, 304128, 0xaf9634d7
0, 2, 2, 1, 304128, 0x81161fd3
0, 3, 3, 1, 304128, 0x6839b383
0, 4, 4, 1, 304128, 0xa55299b8
0, 5, 5, 1, 304128, 0x66fb65b3
0, 6, 6, 1, 304128, 0xe6be2a99
0, 7, 7, 1, 304128, 0xfb33cb55
0, 8, 8, 1, 304128, 0x51ab3d74
0, 9, 9, 1, 304128, 0x67dc44ee
0, 10, 10, 1, 304128, 0x2eac3b50
0, 11, 11, 1, 304128, 0xd4a4c377
0, 12, 12, 1, 304128, 0x1eefe29c
0, 13, 13, 1, 304128, 0x3a84d488
0, 14, 14, 1, 304128, 0x70d3b165
0, 15, 15, 1, 304128, 0x578e58d4
0, 16, 16, 1, 304128, 0x08bba87e
0, 17, 17, 1, 304128, 0xccc86c47
0, 18, 18, 1, 304128, 0x70bf9aa2
0, 19, 19, 1, 304128, 0x3fc3d5b5
0, 20, 20, 1, 304128, 0xef52590b
0, 21, 21, 1, 304128, 0x4f7adde0
0, 22, 22, 1, 304128, 0xc076ef54
0, 23, 23, 1, 304128, 0xed2bba2d
0, 24, 24, 1, 304128, 0x6fce6367

View File

@ -1,9 +1,3 @@
a4c46fad7716ad094eb3c78b74ca0244 *./tests/data/lavf/lavf.apng
6209864 ./tests/data/lavf/lavf.apng
./tests/data/lavf/lavf.apng CRC=0x87b3c15f
a4c46fad7716ad094eb3c78b74ca0244 *./tests/data/lavf/lavf.copy.apng
6209864 ./tests/data/lavf/lavf.copy.apng
./tests/data/lavf/lavf.copy.apng CRC=0x87b3c15f
c5900fdd1b2fc30b985793f5226fd0c4 *./tests/data/lavf/lavf.png
248854 ./tests/data/lavf/lavf.png
./tests/data/lavf/lavf.png CRC=0xd8c7b7a1
a4c46fad7716ad094eb3c78b74ca0244 *tests/data/lavf/lavf.apng
6209864 tests/data/lavf/lavf.apng
tests/data/lavf/lavf.apng CRC=0x87b3c15f

3
tests/ref/lavf/apng.png Normal file
View File

@ -0,0 +1,3 @@
c5900fdd1b2fc30b985793f5226fd0c4 *tests/data/lavf/lavf.apng.png
248854 tests/data/lavf/lavf.apng.png
tests/data/lavf/lavf.apng.png CRC=0xd8c7b7a1

View File

@ -0,0 +1,3 @@
28eb102547b82acca57ef097a6c639d8 *tests/data/lavf/lavf.gbrap.fits
10224000 tests/data/lavf/lavf.gbrap.fits
tests/data/lavf/lavf.gbrap.fits CRC=0x883af247

View File

@ -0,0 +1,3 @@
ff5fb24a67aeabd4f56088ca8b03d8b0 *tests/data/lavf/lavf.gbrap16be.fits
20376000 tests/data/lavf/lavf.gbrap16be.fits
tests/data/lavf/lavf.gbrap16be.fits CRC=0xa981271b

3
tests/ref/lavf/gbrp.fits Normal file
View File

@ -0,0 +1,3 @@
dae49b5f6eb58981ba91e3e108355717 *tests/data/lavf/lavf.gbrp.fits
7704000 tests/data/lavf/lavf.gbrp.fits
tests/data/lavf/lavf.gbrp.fits CRC=0x80745c5e

View File

@ -0,0 +1,3 @@
693ea80c33eb9b348db27a0bc4a5cc8a *tests/data/lavf/lavf.gbrp16be.fits
15336000 tests/data/lavf/lavf.gbrp16be.fits
tests/data/lavf/lavf.gbrp16be.fits CRC=0x9573fb2b

View File

@ -1,3 +1,3 @@
e35f5ea283bbcb249818e0078ec72664 *./tests/data/lavf/lavf.gif
2011766 ./tests/data/lavf/lavf.gif
./tests/data/lavf/lavf.gif CRC=0x2429faff
e35f5ea283bbcb249818e0078ec72664 *tests/data/lavf/lavf.gif
2011766 tests/data/lavf/lavf.gif
tests/data/lavf/lavf.gif CRC=0x2429faff

3
tests/ref/lavf/gray.fits Normal file
View File

@ -0,0 +1,3 @@
d76b46a5a336b56f73451817cdf3897c *tests/data/lavf/lavf.gray.fits
2664000 tests/data/lavf/lavf.gray.fits
tests/data/lavf/lavf.gray.fits CRC=0x7aa0122f

View File

@ -0,0 +1,3 @@
15e85a553bbd07783f92377ed369308b *tests/data/lavf/lavf.gray16be.fits
5184000 tests/data/lavf/lavf.gray16be.fits
tests/data/lavf/lavf.gray16be.fits CRC=0x8b840cff

3
tests/ref/lavf/y4m Normal file
View File

@ -0,0 +1,3 @@
ec8178cb152f9cdbfd9cb724d977db2e *tests/data/lavf/lavf.y4m
3801808 tests/data/lavf/lavf.y4m
tests/data/lavf/lavf.y4m CRC=0x0a941f26

View File

@ -1,3 +0,0 @@
ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
3801808 ./tests/data/lavf/lavf.y4m
./tests/data/lavf/lavf.y4m CRC=0x0a941f26

View File

@ -1,85 +0,0 @@
#!/bin/sh
#
# common regression functions for ffmpeg
#
#
test="${1#regtest-}"
test_ref=$2
raw_src_dir=$3
target_exec=$4
target_path=$5
threads=${6:-1}
cpuflags=${8:-all}
target_samples=$9
datadir="./tests/data"
target_datadir="${target_path}/${datadir}"
this="$test.$test_ref"
outfile="$datadir/$test_ref/"
# various files
ffmpeg="$target_exec ${target_path}/ffmpeg${PROGSUF}"
raw_src="${target_path}/$raw_src_dir/%02d.pgm"
raw_dst="$datadir/$this.out.yuv"
pcm_src="$target_datadir/asynth1.sw"
pcm_src_1ch="$target_datadir/asynth-16000-1.wav"
pcm_ref_1ch="$datadir/$test_ref-16000-1.ref.wav"
crcfile="$datadir/$this.crc"
target_crcfile="$target_datadir/$this.crc"
cleanfiles="$raw_dst $crcfile"
trap 'rm -f -- $cleanfiles' EXIT
[ "${V-0}" -gt 0 ] && echov=echov || echov=:
echov(){
echo "$@" >&3
}
. $(dirname $0)/md5.sh
AVCONV_OPTS="-nostdin -nostats -y -cpuflags $cpuflags"
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
DEC_OPTS="$COMMON_OPTS -threads $threads"
ENC_OPTS="$COMMON_OPTS -threads $threads -dct fastint"
run_avconv()
{
$echov $ffmpeg $AVCONV_OPTS $*
$ffmpeg $AVCONV_OPTS $*
}
do_avconv()
{
f="$1"
shift
set -- $* ${target_path}/$f
run_avconv $*
do_md5sum $f
echo $(wc -c $f)
}
do_avconv_nomd5()
{
f="$1"
shift
set -- $* ${target_path}/$f
run_avconv $*
if [ $f = $raw_dst ] ; then
$tiny_psnr $f $raw_ref
elif [ $f = $pcm_dst ] ; then
$tiny_psnr $f $pcm_ref 2
else
echo $(wc -c $f)
fi
}
do_avconv_crc()
{
f="$1"
shift
run_avconv $* -f crc "$target_crcfile"
echo "$f $(cat $crcfile)"
}