mirror of
https://github.com/mpv-player/mpv
synced 2025-02-20 06:46:55 +00:00
Nits suggested by Diego
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16474 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ecea454c23
commit
7a7bfba6ed
18
TOOLS/README
18
TOOLS/README
@ -260,15 +260,15 @@ Author: Matthias Wieser
|
|||||||
|
|
||||||
Description: Calculates the PSNR between two existing video files.
|
Description: Calculates the PSNR between two existing video files.
|
||||||
The PSNR is calculated frame by frame.
|
The PSNR is calculated frame by frame.
|
||||||
Prints also the overall PSNR.
|
Also prints the overall PSNR.
|
||||||
The script can be used to:
|
The script can be used to:
|
||||||
* compare different softwarescalers (should I use
|
* Compare different softwarescalers (should I use
|
||||||
-sws 1 or -sws 2) ?
|
-sws 1 or -sws 2 ?)
|
||||||
* compare different resolutions (is it better to scale
|
* Compare different resolutions (is it better to scale
|
||||||
down to 640x360 or to 560x320)
|
down to 640x360 or to 560x320)
|
||||||
* compare different deinterlacers
|
* Compare different deinterlacers
|
||||||
* compare different video codecs
|
* Compare different video codecs
|
||||||
* compare video filters (is it better to use -vf hqdn3d
|
* Compare video filters (is it better to use -vf hqdn3d
|
||||||
or lavcopts:nr=400)
|
or lavcopts:nr=400)
|
||||||
* [...]
|
* [...]
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ Usage: psnr-video.sh <file1> <file2> [<frames>] [<options1>] [<options2>]
|
|||||||
[<options1>] are additional MPlayer options for <file1>
|
[<options1>] are additional MPlayer options for <file1>
|
||||||
[<options2>] are additional MPlayer options for <file2>
|
[<options2>] are additional MPlayer options for <file2>
|
||||||
|
|
||||||
A file called psnr.dat will be created with the following
|
A file called ./psnr.dat will be created with the following
|
||||||
content:
|
content:
|
||||||
|
|
||||||
File;Y;Cb;Cr
|
File;Y;Cb;Cr
|
||||||
@ -295,7 +295,7 @@ Usage: psnr-video.sh <file1> <file2> [<frames>] [<options1>] [<options2>]
|
|||||||
|
|
||||||
Note: This script relies on the the tool "pnmpsnr" for the
|
Note: This script relies on the the tool "pnmpsnr" for the
|
||||||
frame-by-frame PSNR calculation.
|
frame-by-frame PSNR calculation.
|
||||||
Be aware that psnr-video.sh needs a lot of temporal space
|
Be aware that psnr-video.sh needs a lot of temporary space
|
||||||
inside /temp/.
|
inside /temp/.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Helper script to ease comparing two video files
|
# Helper script to ease comparing the PSNR between two video files
|
||||||
# Copyleft 2001 by Matthias Wieser
|
# Copyleft 2005 by Matthias Wieser
|
||||||
# This file comes under GPL, see http://www.gnu.org/copyleft/gpl.html for more
|
# This file comes under GPL, see http://www.gnu.org/copyleft/gpl.html for more
|
||||||
# information on it's licensing.
|
# information on its licensing.
|
||||||
|
|
||||||
TEMPDIR="/tmp/psnr_video"
|
TEMPDIR="/tmp/psnr_video"
|
||||||
WORKDIR=`pwd`/
|
WORKDIR=`pwd`/
|
||||||
@ -10,12 +10,12 @@ if [ $# -le 1 ]; then
|
|||||||
echo
|
echo
|
||||||
echo "Usage: `basename $0` <file1> <file2> [<frames>] [<options1>] [<options2>]"
|
echo "Usage: `basename $0` <file1> <file2> [<frames>] [<options1>] [<options2>]"
|
||||||
echo
|
echo
|
||||||
echo " <file1> and <file2> are the video files for which the PSNR should be calculated."
|
echo " <file1> and <file2> are the files for which the PSNR should be calculated."
|
||||||
echo " [<frames>] is the number of frames to process, starting from frame 1."
|
echo " [<frames>] is the number of frames to process, starting from frame 1."
|
||||||
echo " [<options1>] are additional MPlayer options for <file1>"
|
echo " [<options1>] are additional MPlayer options for <file1>."
|
||||||
echo " [<options2>] are additional MPlayer options for <file2>"
|
echo " [<options2>] are additional MPlayer options for <file2>."
|
||||||
echo
|
echo
|
||||||
echo " Be aware that `basename $0` needs a lot of temporal space inside /temp/."
|
echo " Be aware that `basename $0` needs a lot of temporary space inside /tmp/."
|
||||||
echo
|
echo
|
||||||
echo "Example:"
|
echo "Example:"
|
||||||
echo " ./`basename $0` ./orig.avi ./test.avi 250 \"\" \"-vf pp=ac\""
|
echo " ./`basename $0` ./orig.avi ./test.avi 250 \"\" \"-vf pp=ac\""
|
||||||
@ -31,17 +31,17 @@ LastFrame=-1
|
|||||||
if [ $# -ge 3 ]; then
|
if [ $# -ge 3 ]; then
|
||||||
LastFrame=$3
|
LastFrame=$3
|
||||||
echo
|
echo
|
||||||
echo "Will process $LastFrame frames"
|
echo "Will process $LastFrame frames."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -ge 4 ]; then
|
if [ $# -ge 4 ]; then
|
||||||
FILE1Opts=$4
|
FILE1_Options=$4
|
||||||
echo "Mplayer options for ${FILE1}: $FILE1Opts"
|
echo "MPlayer options for ${FILE1}: $FILE1_Options"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -ge 5 ]; then
|
if [ $# -ge 5 ]; then
|
||||||
FILE2Opts=$5
|
FILE2_Options=$5
|
||||||
echo "Mplayer options for ${FILE2}: $FILE2Opts"
|
echo "Mplayer options for ${FILE2}: $FILE2_Options"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ${TEMPDIR}/FILE1
|
mkdir -p ${TEMPDIR}/FILE1
|
||||||
@ -53,13 +53,13 @@ echo "############## $FILE1 #################"
|
|||||||
|
|
||||||
cd ${TEMPDIR}/FILE1
|
cd ${TEMPDIR}/FILE1
|
||||||
|
|
||||||
rm *ppm 2> /dev/null
|
rm -f *ppm
|
||||||
rm *del 2> /dev/null
|
rm -f *del
|
||||||
|
|
||||||
if [ $LastFrame -ge 0 ]; then
|
if [ $LastFrame -ge 0 ]; then
|
||||||
mplayer $FILE1Opts -frames $LastFrame -nosound -vo pnm ${WORKDIR}$FILE1 >/dev/null
|
mplayer $FILE1_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}$FILE1 >/dev/null
|
||||||
else
|
else
|
||||||
mplayer $FILE1Opts -nosound -vo pnm ${WORKDIR}$FILE1 >/dev/null
|
mplayer $FILE1_Options -nosound -vo pnm ${WORKDIR}$FILE1 > /dev/null
|
||||||
fi
|
fi
|
||||||
### File 2
|
### File 2
|
||||||
|
|
||||||
@ -71,25 +71,25 @@ cd ${TEMPDIR}/FILE2
|
|||||||
rm *ppm 2> /dev/null
|
rm *ppm 2> /dev/null
|
||||||
|
|
||||||
if [ $LastFrame -ge 0 ]; then
|
if [ $LastFrame -ge 0 ]; then
|
||||||
mplayer $FILE2Opts -frames $LastFrame -nosound -vo pnm ${WORKDIR}$FILE2 >/dev/null
|
mplayer $FILE2_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}$FILE2 >/dev/null
|
||||||
else
|
else
|
||||||
mplayer $FILE2Opts -nosound -vo pnm ${WORKDIR}$FILE2 >/dev/null
|
mplayer $FILE2_Options -nosound -vo pnm ${WORKDIR}$FILE2 >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
### PSNR
|
### PSNR
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "############## Calculation PSNR #################"
|
echo "############## PSNR Calculation #################"
|
||||||
|
|
||||||
if [[ `ls -1 ${TEMPDIR}/FILE1/*ppm|wc -l` = `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` ]]
|
if [[ `ls -1 ${TEMPDIR}/FILE1/*ppm | wc -l` = `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` ]]
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo "Files have differing numbers of frames!"
|
echo "Files have differing numbers of frames!"
|
||||||
echo "$FILE1 has `ls -1 ${TEMPDIR}/FILE1/*ppm|wc -l` frames,"
|
echo "$FILE1 has `ls -1 ${TEMPDIR}/FILE1/*ppm | wc -l` frames,"
|
||||||
echo "$FILE2 has `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` frames."
|
echo "$FILE2 has `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` frames."
|
||||||
echo "Processing the first `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` frames."
|
echo "Processing the first `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` frames."
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ for FILE in `ls -1 *.ppm`
|
|||||||
echo "$ALL">>../psnr.dat
|
echo "$ALL">>../psnr.dat
|
||||||
ERROR=`echo "scale=30; (e(-1*$Y/10*l(10))+e(-1*$CB/10*l(10))/4+e(-1*$CR/10*l(10))/4)/1.5"|bc -l`
|
ERROR=`echo "scale=30; (e(-1*$Y/10*l(10))+e(-1*$CB/10*l(10))/4+e(-1*$CR/10*l(10))/4)/1.5"|bc -l`
|
||||||
ERRORSUM=`cat errorsum.del`
|
ERRORSUM=`cat errorsum.del`
|
||||||
echo `echo "scale=30; $ERROR + $ERRORSUM"|bc -l` > errorsum.del
|
echo `echo "scale=30; $ERROR + $ERRORSUM" | bc -l` > errorsum.del
|
||||||
i=$(($i+1))
|
i=$(($i+1))
|
||||||
if [[ $i = $LastFrame ]]
|
if [[ $i = $LastFrame ]]
|
||||||
then
|
then
|
||||||
@ -126,19 +126,19 @@ for FILE in `ls -1 *.ppm`
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
ERRORSUM=`cat errorsum.del`
|
ERRORSUM=`cat errorsum.del`
|
||||||
PSNR=`echo "-10*l($ERRORSUM/$i)/l(10)"|bc -l`
|
PSNR=`echo "-10*l($ERRORSUM/$i)/l(10)" | bc -l`
|
||||||
echo "PSNR:;$PSNR">>../psnr.dat
|
echo "PSNR:;$PSNR">>../psnr.dat
|
||||||
cd ..
|
cd ..
|
||||||
mv psnr.dat ${WORKDIR}
|
mv psnr.dat ${WORKDIR}
|
||||||
|
|
||||||
if [[ `ls -1 ${TEMPDIR}/FILE1/*ppm|wc -l` = `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` ]]
|
if [[ `ls -1 ${TEMPDIR}/FILE1/*ppm | wc -l` = `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` ]]
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo "Files have differing numbers of frames!"
|
echo "Files have differing numbers of frames!"
|
||||||
echo "$FILE1 has `ls -1 ${TEMPDIR}/FILE1/*ppm|wc -l` frames,"
|
echo "$FILE1 has `ls -1 ${TEMPDIR}/FILE1/*ppm | wc -l` frames,"
|
||||||
echo "$FILE2 has `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` frames."
|
echo "$FILE2 has `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` frames."
|
||||||
echo "Processed the first `ls -1 ${TEMPDIR}/FILE2/*ppm|wc -l` frames."
|
echo "Processed the first `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` frames."
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user