[FFmpeg-devel] [PATCH] tests/lavfi: rework lavfi-regression.sh, avoid use of ffmpeg -pix_fmts

Stefano Sabatini stefasab at gmail.com
Fri May 25 03:10:12 CEST 2012


Use lavfi-showfiltfmts for checking the format supported by the scale
filter instead. The advantage is that the scale filter may support
formats which are not supported by libswscale (namely: the pal8 format).

The new implementation is also a bit cleaner, because it doesn't depend
on the ffmpeg output.
---
 tests/lavfi-regression.sh                        |   25 ++++++++++-----------
 tests/ref/lavfi/{pixdesc => pixfmts_pixdesctest} |    1 +
 2 files changed, 13 insertions(+), 13 deletions(-)
 rename tests/ref/lavfi/{pixdesc => pixfmts_pixdesctest} (98%)

diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
index 4d669f2..e635079 100755
--- a/tests/lavfi-regression.sh
+++ b/tests/lavfi-regression.sh
@@ -68,19 +68,24 @@ do_lavfi_pixfmts(){
     filter_args=$2
 
     showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
-    exclude_fmts=${outfile}${1}_exclude_fmts
-    out_fmts=${outfile}${1}_out_fmts
+    scale_exclude_fmts=${outfile}${1}_scale_exclude_fmts
+    scale_in_fmts=${outfile}${1}_scale_in_fmts
+    scale_out_fmts=${outfile}${1}_scale_out_fmts
+    in_fmts=${outfile}${1}_in_fmts
 
     # exclude pixel formats which are not supported as input
-    $avconv -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2 | sort >$exclude_fmts
-    $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ fmt=substr($3, 5); print fmt }' | sort | comm -23 - $exclude_fmts >$out_fmts
+    $showfiltfmts scale | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_in_fmts
+    $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_out_fmts
+    comm -12 $scale_in_fmts $scale_out_fmts >$scale_exclude_fmts
+
+    $showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$in_fmts
+    pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
 
-    pix_fmts=$($showfiltfmts $filter $filter_args | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort | comm -12 - $out_fmts)
     for pix_fmt in $pix_fmts; do
         do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
     done
 
-    rm $exclude_fmts $out_fmts
+    rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
 }
 
 # all these filters have exactly one input and exactly one output
@@ -89,16 +94,10 @@ do_lavfi_pixfmts "crop"    "100:100:100:100"
 do_lavfi_pixfmts "hflip"   ""
 do_lavfi_pixfmts "null"    ""
 do_lavfi_pixfmts "pad"     "500:400:20:20"
+do_lavfi_pixfmts "pixdesctest" ""
 do_lavfi_pixfmts "scale"   "200:100"
 do_lavfi_pixfmts "vflip"   ""
 
-if [ -n "$do_pixdesc" ]; then
-    pix_fmts="$($avconv -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
-    for pix_fmt in $pix_fmts; do
-        do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
-    done
-fi
-
 do_lavfi_lavd() {
     label=$1
     graph=$2
diff --git a/tests/ref/lavfi/pixdesc b/tests/ref/lavfi/pixfmts_pixdesctest
similarity index 98%
rename from tests/ref/lavfi/pixdesc
rename to tests/ref/lavfi/pixfmts_pixdesctest
index cfff332..b033d69 100644
--- a/tests/ref/lavfi/pixdesc
+++ b/tests/ref/lavfi/pixfmts_pixdesctest
@@ -22,6 +22,7 @@ monob               668ebe8b8103b9046b251b2fa8a1d88f
 monow               9251497f3b0634f1165d12d5a289d943
 nv12                e0af357888584d36eec5aa0f673793ef
 nv21                9a3297f3b34baa038b1f37cb202b512f
+pal8                09b4a6a3167576627fe0540994c3eb24
 rgb0                def2717bc2208505244def3611922d05
 rgb24               b41eba9651e1b5fe386289b506188105
 rgb444be            9e89db334568c6b2e3d5d0540f4ba960
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list