mirror of https://github.com/mpv-player/mpv
random improvements plus some readability cosmetics
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16658 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
49213050ed
commit
834e85efcc
|
@ -15,6 +15,8 @@ warning_frame_number () {
|
|||
|
||||
TEMPDIR="/tmp/psnr_video"
|
||||
WORKDIR=`pwd`
|
||||
OUTFILE=psnr.dat
|
||||
ERRFILE=errorsum.del
|
||||
|
||||
exit=0
|
||||
if [[ `which pnmpsnr 2> /dev/null` = "" ]]
|
||||
|
@ -73,7 +75,7 @@ fi
|
|||
|
||||
if [ $# -ge 5 ]; then
|
||||
FILE2_Options=$5
|
||||
echo "Mplayer options for ${FILE2}: $FILE2_Options"
|
||||
echo "MPlayer options for ${FILE2}: $FILE2_Options"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -90,7 +92,7 @@ rm -f *ppm
|
|||
rm -f *del
|
||||
|
||||
if [ $LastFrame -ge 0 ]; then
|
||||
mplayer $FILE1_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}/$FILE1 >/dev/null
|
||||
mplayer $FILE1_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}/$FILE1 > /dev/null
|
||||
else
|
||||
mplayer $FILE1_Options -nosound -vo pnm ${WORKDIR}/$FILE1 > /dev/null
|
||||
fi
|
||||
|
@ -101,12 +103,12 @@ echo "############## $FILE2 #################"
|
|||
|
||||
cd ${TEMPDIR}/FILE2
|
||||
|
||||
rm *ppm 2> /dev/null
|
||||
rm -f *ppm
|
||||
|
||||
if [ $LastFrame -ge 0 ]; then
|
||||
mplayer $FILE2_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}/$FILE2 >/dev/null
|
||||
mplayer $FILE2_Options -frames $LastFrame -nosound -vo pnm ${WORKDIR}/$FILE2 > /dev/null
|
||||
else
|
||||
mplayer $FILE2_Options -nosound -vo pnm ${WORKDIR}/$FILE2 >/dev/null
|
||||
mplayer $FILE2_Options -nosound -vo pnm ${WORKDIR}/$FILE2 > /dev/null
|
||||
fi
|
||||
|
||||
|
||||
|
@ -125,28 +127,28 @@ fi
|
|||
|
||||
|
||||
cd ${TEMPDIR}/FILE2
|
||||
#rm ../psnr.dat
|
||||
echo "File;Y;Cb;Cr" >../psnr.dat
|
||||
echo "0" > errorsum.del
|
||||
#rm ../$OUTFILE
|
||||
echo "File;Y;Cb;Cr" > ../$OUTFILE
|
||||
echo "0" > $ERRFILE
|
||||
i=0
|
||||
for FILE in `ls -1 *.ppm`
|
||||
do
|
||||
echo $FILE
|
||||
echo -n "$FILE">>../psnr.dat
|
||||
echo -n ";">>../psnr.dat
|
||||
echo -n "$FILE" >> ../$OUTFILE
|
||||
echo -n ";" >> ../$OUTFILE
|
||||
|
||||
YCBCR=`pnmpsnr ../FILE1/$FILE $FILE 2>&1 | tail -n 3 | cut -f 3 -d ':' | \
|
||||
( read Y X; read CB X; read CR X; echo "$Y;$CB;$CR;")`
|
||||
Y=`echo $YCBCR | cut -f 1 -d ';'`
|
||||
Y=`echo $YCBCR | cut -f 1 -d ';'`
|
||||
CB=`echo $YCBCR | cut -f 2 -d ';'`
|
||||
CR=`echo $YCBCR | cut -f 3 -d ';'`
|
||||
echo $YCBCR >>../psnr.dat
|
||||
echo $YCBCR >> ../$OUTFILE
|
||||
|
||||
ALL=`echo "(-10)*l((e(-$Y/10*l(10))+e(-$CB/10*l(10))/4+e(-$CR/10*l(10))/4)/1.5)/l(10)"|bc -l`
|
||||
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`
|
||||
ERRORSUM=`cat errorsum.del`
|
||||
echo `echo "scale=30; $ERROR + $ERRORSUM"|bc -l` > errorsum.del
|
||||
ALL=`echo "(-10)*l((e(-$Y/10*l(10))+e(-$CB/10*l(10))/4+e(-$CR/10*l(10))/4)/1.5)/l(10)" | bc -l`
|
||||
echo "$ALL" >> ../$OUTFILE
|
||||
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 $ERRFILE`
|
||||
echo `echo "scale=30; $ERROR + $ERRORSUM" | bc -l` > $ERRFILE
|
||||
|
||||
i=$(($i+1))
|
||||
if [[ $i = $LastFrame ]]
|
||||
|
@ -155,12 +157,12 @@ for FILE in `ls -1 *.ppm`
|
|||
fi
|
||||
done
|
||||
|
||||
ERRORSUM=`cat errorsum.del`
|
||||
ERRORSUM=`cat $ERRFILE`
|
||||
PSNR=`echo "-10*l($ERRORSUM/$i)/l(10)" | bc -l`
|
||||
echo "PSNR:;$PSNR">>../psnr.dat
|
||||
echo "PSNR:;$PSNR" >> ../$OUTFILE
|
||||
|
||||
cd ..
|
||||
mv psnr.dat ${WORKDIR}/
|
||||
mv $OUTFILE ${WORKDIR}/
|
||||
|
||||
if [[ `ls -1 ${TEMPDIR}/FILE1/*ppm | wc -l` = `ls -1 ${TEMPDIR}/FILE2/*ppm | wc -l` ]]
|
||||
then
|
||||
|
@ -173,6 +175,6 @@ fi
|
|||
cd ..
|
||||
rm -r ${TEMPDIR}
|
||||
|
||||
echo "Created ${WORKDIR}/psnr.dat"
|
||||
echo "Created ${WORKDIR}/$OUTFILE"
|
||||
echo
|
||||
|
||||
|
|
Loading…
Reference in New Issue