From 82ecae8a7069104698d491000b37629cd8d96fd8 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Tue, 10 Jul 2012 22:14:57 -0700 Subject: lavfi: add alphaextract and alphamerge filters These filters are designed for storing and transmitting video sequences with alpha using higher-efficiency codecs such as x264 which don't natively support an alpha channel. 'alphaextract' takes an input stream with an alpha channel and returns a video containing just the alpha component as a grayscale value; 'alphamerge' takes an RGB or YUV stream and adds an alpha channel recovered from a second grayscale stream. Signed-off-by: Steven Robertson Signed-off-by: Stefano Sabatini --- tests/lavfi-regression.sh | 15 ++++++++++++--- tests/ref/lavfi/alphaextract_rgb | 1 + tests/ref/lavfi/alphaextract_yuv | 1 + tests/ref/lavfi/alphamerge_rgb | 1 + tests/ref/lavfi/alphamerge_yuv | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tests/ref/lavfi/alphaextract_rgb create mode 100644 tests/ref/lavfi/alphaextract_yuv create mode 100644 tests/ref/lavfi/alphamerge_rgb create mode 100644 tests/ref/lavfi/alphamerge_yuv (limited to 'tests') diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index dd5e2dac62..61040445bf 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -13,21 +13,25 @@ eval do_$test=y do_video_filter() { label=$1 - filters=$2 + filters="$2" shift 2 printf '%-20s' $label run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \ $ENC_OPTS -vf "$filters" -vcodec rawvideo $* -f nut md5: } -do_lavfi() { - vfilters="slicify=random,$2" +do_lavfi_plain() { + vfilters="$2" if [ $test = $1 ] ; then do_video_filter $test "$vfilters" fi } +do_lavfi() { + do_lavfi_plain $1 "slicify=random,$2" +} + do_lavfi_colormatrix() { do_lavfi "${1}1" "$1=$4:$5,$1=$5:$3,$1=$3:$4,$1=$4:$3,$1=$3:$5,$1=$5:$2" do_lavfi "${1}2" "$1=$2:$3,$1=$3:$2,$1=$2:$4,$1=$4:$2,$1=$2:$5,$1=$5:$4" @@ -60,6 +64,11 @@ do_lavfi "vflip" "vflip" do_lavfi "vflip_crop" "vflip,crop=iw-100:ih-100:100:100" do_lavfi "vflip_vflip" "vflip,vflip" +do_lavfi_plain "alphamerge_rgb" "[in]slicify=random,format=bgra,split,alphamerge[out]" +do_lavfi_plain "alphamerge_yuv" "[in]slicify=random,format=yuv420p,split,alphamerge[out]" +do_lavfi_plain "alphaextract_rgb" "[in]slicify=random,format=bgra,split,alphamerge,slicify=random,split[o3][o4];[o4]alphaextract[alpha];[o3][alpha]alphamerge[out]" +do_lavfi_plain "alphaextract_yuv" "[in]slicify=random,format=yuv420p,split,alphamerge,slicify=random,split[o3][o4];[o4]alphaextract[alpha];[o3][alpha]alphamerge[out]" + do_lavfi_colormatrix "colormatrix" bt709 fcc bt601 smpte240m do_lavfi_pixfmts(){ diff --git a/tests/ref/lavfi/alphaextract_rgb b/tests/ref/lavfi/alphaextract_rgb new file mode 100644 index 0000000000..3b86986bae --- /dev/null +++ b/tests/ref/lavfi/alphaextract_rgb @@ -0,0 +1 @@ +alphaextract_rgb b706818ea0d324e0d43adbaef9ab3470 diff --git a/tests/ref/lavfi/alphaextract_yuv b/tests/ref/lavfi/alphaextract_yuv new file mode 100644 index 0000000000..7bfcf8629f --- /dev/null +++ b/tests/ref/lavfi/alphaextract_yuv @@ -0,0 +1 @@ +alphaextract_yuv 430b779a379ad9c38f3b4c190f723cd4 diff --git a/tests/ref/lavfi/alphamerge_rgb b/tests/ref/lavfi/alphamerge_rgb new file mode 100644 index 0000000000..6dc3b9a513 --- /dev/null +++ b/tests/ref/lavfi/alphamerge_rgb @@ -0,0 +1 @@ +alphamerge_rgb b706818ea0d324e0d43adbaef9ab3470 diff --git a/tests/ref/lavfi/alphamerge_yuv b/tests/ref/lavfi/alphamerge_yuv new file mode 100644 index 0000000000..ecd7bf8d9b --- /dev/null +++ b/tests/ref/lavfi/alphamerge_yuv @@ -0,0 +1 @@ +alphamerge_yuv 430b779a379ad9c38f3b4c190f723cd4 -- cgit v1.2.3