[x265] [PATCH] Add Regression scripts

Steve Borho steve at borho.org
Mon Jul 22 19:13:02 CEST 2013


On Mon, Jul 22, 2013 at 9:57 PM, <mahesh at multicorewareinc.com> wrote:

> # HG changeset patch
> # User maheshpittala
> # Date 1374548233 25200
> # Node ID 6d17f18b3a1bc15e15a3da94d648f7b72ad73330
> # Parent  6cdc5ccdbd36a65a1cb06786a105ec2794c0723c
> Add Regression scripts
>
> diff -r 6cdc5ccdbd36 -r 6d17f18b3a1b source/BuildandRun.bat
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/source/BuildandRun.bat    Mon Jul 22 19:57:13 2013 -0700
>

This is still the wrong folder, these need to go under build/regression/,
not source/


> @@ -0,0 +1,64 @@
> + at echo off
> +
> +cd ..\"%buildconfig%"
>

Is this cd really necessary?  I think the caller should ensure CWD is valid


> +call:makesolution 8bit "ENABLE_PPA:BOOL=ON"
> +call:makesolution 16bit "HIGH_BIT_DEPTH:BOOL=ON"
> +EXIT /B
> +
> +:makesolution
> +
> +set build_folder=%~1
> +set cmake_option=%~2
> +if exist %build_folder% rd /s /q %build_folder%
> +mkdir %build_folder%
> +cd %build_folder%
> +
> +cmake  -D ENABLE_TESTS:BOOL=ON -D %cmake_option% -G "%generator%"
> ..\..\..\source
>

much better


> +if exist %solution% (
>

You use %solution% here and x265.sln below.  I would prefer to just use
x265.sln everywhere.


> +
> + call %vcvars%
> + MSBuild /property:Configuration="Release" x265.sln >>
> buildlog_release.txt
> +
> +  if %errorlevel% equ 1 (
> +   echo %generator% %build_folder% build failed in release mode refer the
> build log  >> "%LOG%"
> +   exit 1
> +   )
> +  if not exist Release\x265.exe echo build Application with
> %build_folder% failed for %generator%  refer the build log >> "%LOG%"
> +
> +
> + MSBuild /property:Configuration="Debug" x265.sln >> buildlog_debug.txt
> +
> +  if %errorlevel% equ 1 (
> +   echo %generator% %build_folder% build failed in debug mode refer the
> build log  >> "%LOG%"
> +   exit 1
> +   )
> +  if not exist Debug\x265.exe echo build Application with %build_folder%
> failed for %generator%  refer the build log >> "%LOG%"
> +) else (
> +echo %build_folder% solution is not created for %generator% >> "%LOG%"
> +)
> +
> +
> +if exist Release\x265.exe (
> +
> + Release\x265.exe  %video1%.y4m -f %frames% --wpp --tu-intra-depth 1
> --tu-inter-depth 2 --no-tskip --max-merge 1 --threads 4 --no-rdoq --hash 1
> -o str1.out -r rec1.yuv >> %build_folder%.txt 2>&1
> + Release\x265.exe  %video2%.y4m -f %frames% --wpp --tu-intra-depth 1
> --tu-inter-depth 2 --no-tskip --max-merge 1 --threads 4 --no-rdoq --hash 1
> -o str2.out -r rec2.yuv >> %build_folder%.txt 2>&1
> + Release\x265.exe  %video3%.y4m -f %frames% --wpp --tu-intra-depth 1
> --tu-inter-depth 2 --no-tskip --max-merge 1 --threads 4 --no-rdoq --hash 1
> -o str3.out -r rec3.yuv >> %build_folder%.txt 2>&1
> + Debug\x265.exe  %video1%.y4m -f %frames% --wpp --tu-intra-depth 1
> --tu-inter-depth 2 --no-tskip --max-merge 1 --threads 4 --no-rdoq --hash 1
> -o str4.out -r rec4.yuv >> %build_folder%.txt 2>&1
> +
> + %decoder% -b str1.out -o str1.yuv >>
> "%workingdir%"\decoder_out_%build_folder%.txt
> + %decoder% -b str2.out -o str2.yuv >>
> "%workingdir%"\decoder_out_%build_folder%.txt
> + %decoder% -b str3.out -o str3.yuv >>
> "%workingdir%"\decoder_out_%build_folder%.txt
> +
> + FC  /b rec1.yuv str1.yuv > NULL || echo Reconstructed frames mismatch
> for %video1% >> "%workingdir%"\DiffBin.txt
> + FC  /b rec2.yuv str2.yuv > NULL || echo Reconstructed frames mismatch
> for %video2% >> "%workingdir%"\DiffBin.txt
> + FC  /b rec3.yuv str3.yuv > NULL || echo Reconstructed frames mismatch
> for %video3% >> "%workingdir%"\DiffBin.txt
> +)
> +
> +if exist test\Release\TestBench.exe (
> + test\Release\TestBench.exe >> testbench.txt
>

You should be able to use the simpler:   TestBench >> testbench.txt || echo
test bench failed >> %LOG%


> + if %errorlevel% equ -1 (
> +   echo %generator% %build_folder% Testbench failed refer the testbench
> log  >> "%LOG%"
> +   )
> +)
> + cd ..\
> diff -r 6cdc5ccdbd36 -r 6d17f18b3a1b source/Main.bat
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/source/Main.bat   Mon Jul 22 19:57:13 2013 -0700
> @@ -0,0 +1,41 @@
> + at echo off
> +
> +for /f "tokens=1,2,3,4,5,6,7,8 delims==" %%a in (config.txt) do (
> +if %%a==repository set repository=%%b
> +if %%a==FramesToCheck_BinMismatch set frames=%%b
> +if %%a==FramesToRun_PSNRperformance set frames1=%%b
> +if %%a==decoder set decoder=%%b
> +if %%a==drpsnr set drpsnr=%%b
> +if %%a==video1 set video1=%%b
> +if %%a==video2 set video2=%%b
> +if %%a==video3 set video3=%%b
> +)
> +
> +set "save_path=%path%"
> +set "save_include=%INCLUDE%"
> +set "save_lib=%LIB%"
> +set "save_libpath=%LIBPATH%"
> +set solution="x265.sln"
> +set HG=hg
>

it's ok to hard-code x265.sln and hg


> +set workingdir=%CD%
> +
> +if exist "%workingdir%"\regression.log del "%workingdir%"\regression.log
> +set LOG="%workingdir%"\regression.log
>

there is no mkdir here to set %errorlevel%


> +if %errorlevel% equ 1 (
> + echo Working directory not created >> "%LOG%"
> + exit 1
> +)
> +
> +"%HG%" pull -u "%repository%"
> +"%HG%" summary >> "%LOG%"
> +
> +if %errorlevel% equ 1 (
> + echo "Pull failed" >> "%LOG%"
> + exit 1
> +)
>

hg summary will overwrite %errorlevel%.  If you want to catch pull failures
this check needs to be moved up one line


> +
> +call compilers.bat
> +call %workingdir%\PSNR_Performance.bat
> +start python %workingdir%\performance_csv.py
> +start python %workingdir%\Send_Mail.py
> diff -r 6cdc5ccdbd36 -r 6d17f18b3a1b source/compilers.bat
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/source/compilers.bat      Mon Jul 22 19:57:13 2013 -0700
> @@ -0,0 +1,28 @@
> + at echo off
> +
> +call:buildconfigs "%VS110COMNTOOLS%" vc11-x86_64 "Visual Studio 11 Win64"
> +call:buildconfigs "%VS110COMNTOOLS%" vc11-x86 "Visual Studio 11"
> +call:buildconfigs "%VS100COMNTOOLS%" vc10-x86_64 "Visual Studio 10 Win64"
> +call:buildconfigs "%VS100COMNTOOLS%" vc10-x86 "Visual Studio 10"
> +call:buildconfigs "%VS90COMNTOOLS%" vc9-x86_64 "Visual Studio 9 2008
> Win64"
> +call:buildconfigs "%VS90COMNTOOLS%" vc9-x86 "Visual Studio 9 2008 Win64"
> +EXIT /B
> +
> +:buildconfigs
> +
> +set compiler=%~1
> +set buildconfig=%~2
> +set generator=%~3
> +
> +echo running %generator% >> "%LOG%"
> +set vcvars="%compiler%\..\..\VC\vcvarsall.bat"
> +call %workingdir%\BuildandRun.bat
> +
> +set path=""
> +set INCLUDE=""
> +set LIB=""
> +set LIBPATH=""
>

redundant sets above, should be removed


> +set "path=%save_path%"
> +set "INCLUDE=%save_include%"
> +set "LIB=%save_lib%"
> +set "LIBPATH=%save_libpath%"
>

Please drop this Python script from this patch.

diff -r 6cdc5ccdbd36 -r 6d17f18b3a1b source/performance_csv.py
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/source/performance_csv.py Mon Jul 22 19:57:13 2013 -0700
> @@ -0,0 +1,157 @@
> +#!/usr/bin/python
> +import os
> +import re
> +searchquery1 = 'encoded'
> +searchquery2 = '    Global'
> +inputs_var=0
> +cmd_var=0
> +inc=0
> +
> +os.remove("Performance_Results.csv")
> +enc_nordo =
> ['encoder_output_BasketballDrive_1920x1080_50_no_rdo.txt','encoder_output_FourPeople_1280x720_60_no_rdo.txt','encoder_output_Kimono1_1920x1080_24_no_rdo.txt']
> +psnr_nordo
> =['dr_psnr_output_BasketballDrive_1920x1080_50_no_rdo.txt','dr_psnr_output_FourPeople_1280x720_60_no_rdo.txt','dr_psnr_output_Kimono1_1920x1080_24_no_rdo.txt']
> +enc_rdo =
> ['encoder_output_BasketballDrive_1920x1080_50_rdo.txt','encoder_output_FourPeople_1280x720_60_rdo.txt','encoder_output_Kimono1_1920x1080_24_rdo.txt']
> +psnr_rdo =
> ['dr_psnr_output_BasketballDrive_1920x1080_50_rdo.txt','dr_psnr_output_FourPeople_1280x720_60_rdo.txt','dr_psnr_output_Kimono1_1920x1080_24_rdo.txt']
> +
> +cmdlines = open('commandlines.txt', 'r').read().splitlines()
> +
> +inputs = [' 1.BasketballDrive_1920x1080_50.y4m', '
> 2.FourPeople_1280x720_60.y4m', ' 3.Kimono1_1920x1080_24.y4m']
> +
> +log = open('Performance_Results.csv','w')
> +print (",,,,,,,,,, NO_RDO,,,,,,,,,, RDO  ", file = log)
> +
> +print ("    COMMAND LINE,,,,,,,     ,    TOTAL TIME(seconds),
>  SPEED(fps),    BITRATE(kb/s),    FRAMES,    PSNR(Y)_Global,    PSNR(U),
>  PSNR(V), avg,      ,    TOTAL TIME(seconds),    SPEED(fps),
>  BITRATE(kb/s),    FRAMES,    PSNR(Y)_Global,    PSNR(U),    PSNR(V), avg",
> file = log)
> +print (" ", file = log)
> +
> +for enc in enc_nordo:
> +       print ("%s" %(inputs[inputs_var]), file = log)
> +       print (" ", file = log)
> +       psnr=psnr_nordo[inputs_var]
> +
> +       out1 = open('output1.txt', 'a')
> +       print ("encoder output for nordo...", file = out1)
> +       out1.close()
> +       out2 = open('output2.txt', 'a')
> +       print ("dr_psnr output for nordo...", file = out2)
> +       out3 = open('output3.txt', 'a')
> +       print ("encoder output for rdo...", file = out3)
> +       out3.close()
> +       out4 = open('output4.txt', 'a')
> +       print ("dr_psnr output for rdo...", file = out4)
> +       out4.close()
> +
> +       #encoder output for nordo
> +       f1 = open(enc, 'r')
> +       out1 = open('output1.txt', 'a')
> +       line1 = f1.readlines()
> +       for i, line in enumerate(line1):
> +         if line.startswith(searchquery1):
> +             for char in line:
> +              line = re.sub('[(]','',line)
> +              line = re.sub('[s]','',line)
> +             out1.write(line)
> +       f1.close ()
> +       out1.close()
> +
> +       #dr_psnr output for nordo
> +       f2 = open(psnr, 'r')
> +       out2 = open('output2.txt', 'a')
> +       line2 = f2.readlines()
> +       for i, line in enumerate(line2):
> +         if line.startswith(searchquery2):
> +             out2.write(line)
> +       f2.close ()
> +       out2.close()
> +
> +       #encoder output for rdo
> +       f3 = open(enc_rdo[inc], 'r')
> +       out3 = open('output3.txt', 'a')
> +       line3 = f3.readlines()
> +       for i, line in enumerate(line3):
> +         if line.startswith(searchquery1):
> +             for char in line:
> +              line = re.sub('[(]','',line)
> +              line = re.sub('[s]','',line)
> +             out3.write(line)
> +       f3.close ()
> +       out3.close()
> +
> +       #dr_psnr output for rdo
> +       f4 = open(psnr_rdo[inc], 'r')
> +       out4 = open('output4.txt', 'a')
> +       line4 = f4.readlines()
> +       for i, line in enumerate(line4):
> +         if line.startswith(searchquery2):
> +             out4.write(line)
> +       f4.close ()
> +       out4.close()
> +
> +       out1 = open('output1.txt')
> +       out2 = open('output2.txt')
> +       out3 = open('output3.txt')
> +       out4 = open('output4.txt')
> +
> +       log = open('Performance_Results.csv','a')
> +       eof1 = out1.readline()
> +       eof2 = out2.readline()
> +       eof3 = out3.readline()
> +       eof4 = out4.readline()
> +
> +       #for a in eof1:
> +       num_lines = sum(1 for line in open('output1.txt'))
> +
> +       for index in range(num_lines-1):
> +           #for b in eof2:
> +                  eof1 = out1.readline()
> +                  eof2 = out2.readline()
> +                  eof3 = out3.readline()
> +                  eof4 = out4.readline()
> +
> +                  col1 = eof1.split()
> +                  print (col1)
> +                  col2 = eof2.split()
> +                  print (col2)
> +                  col3 = eof3.split()
> +                  print (col3)
> +                  col4 = eof4.split()
> +                  print (col4)
> +
> +                  time = col1[4]
> +                  time1 = col3[4]
> +
> +                  speed = col1[5]
> +                  speed1 = col3[5]
> +
> +                  bitrate = float(col1[7])
> +                  bitrate1 = float(col3[7])
> +
> +                  frames = int(col1[1])
> +                  frames1 = int(col3[1])
> +
> +                  psnr_y  = float(col2[1])
> +                  psnr_u  = float(col2[2])
> +                  psnr_v  = float(col2[3])
> +                  avg_psnr = (float)((psnr_y+psnr_u+psnr_v)/3)
> +
> +                  psnr_y1  = float(col4[1])
> +                  psnr_u1  = float(col4[2])
> +                  psnr_v1  = float(col4[3])
> +                  avg_psnr1 = (float)((psnr_y1+psnr_u1+psnr_v1)/3)
> +
> +                  print
> ("%s,,,,,,,,%s,%s,%f,%d,%f,%f,%f,%f,,%s,%s,%f,%d,%f,%f,%f,%f"
> %(cmdlines[cmd_var],time,speed,bitrate,frames,psnr_y,psnr_u,psnr_v,avg_psnr,time1,speed1,bitrate1,frames1,psnr_y1,psnr_u1,psnr_v1,avg_psnr1),
> file = log)
> +                  cmd_var=cmd_var+1
> +
> +
> +       out1.close()
> +       out2.close()
> +       out3.close()
> +       out4.close()
> +       os.remove("output1.txt")
> +       os.remove("output2.txt")
> +       os.remove("output3.txt")
> +       os.remove("output4.txt")
> +       inputs_var=inputs_var+1
> +       cmd_var=0
> +       inc=inc+1
> +       print (" ", file = log)
> +log.close()
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> http://mailman.videolan.org/listinfo/x265-devel
>
>


-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/private/x265-devel/attachments/20130722/10adf7ae/attachment-0001.html>


More information about the x265-devel mailing list