History

add encoder binary comparison test model

shihuade committed 12 years ago

Commit 78771341 parent ca61e2813 files · +9992 −4Browse files

Showing the changes to test/encoder_binary_comparison/Scripts (4 of 13 files). Show all

Unified · Split

4 files
  1. test/encoder_binary_comparison/Scripts/run_BinarySHA1Comparison.sh +408 −0
  2. test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh +131 −0
  3. test/encoder_binary_comparison/Scripts/run_ParseYUVInfo.sh +67 −0
  4. test/encoder_binary_comparison/Scripts/run_SafeDelete.sh +249 −0
test/encoder_binary_comparison/Scripts/run_BinarySHA1Comparison.sh+408−0
@@ -0,0 +1,408 @@
1+#!/bin/bash
2+#*******************************************************************************
3+# Encoder binary comparison test model
4+# -- Compared with Benchmark version using SHA-1 string
5+# -- Test bit stream under folder openh264/res
6+# -- SHA-1 string of Benchmark version for all cases of all bit streams
7+# under folder openh264/test/encoder_binary_comparion/SHA1Table
8+# -- For more detail,please refer to file AboutTest¡£
9+#
10+#brief:
11+# -- Test all cases in SHA1TableFile
12+# 1) Generate SHA1 string for each case
13+# 2) Compare with benchmark SHA1 string
14+# 3) If the SHA1 string are the same with benchmark version, test case is marked as passed
15+# 4) Otherwise, test case is marked as unpass! this may caused by:
16+# --the design of encoder has been changed and the bit stream also change
17+# --there may be some bugs in encoder and bit stream is not right
18+# -- Usage: ./run_BinarySHA1Comparison.sh ${TestYUVName} ${AllCaseSHA1TaleFile}
19+#
20+# date: 10/06/2014 Created
21+#*******************************************************************************
22+#global variable definition
23+#usage runGlobalVariableDef
24+runGlobalVariableDef()
25+{
26+ WorkingDirDir=""
27+ #test data space
28+ FinalResultPath=""
29+ IssueDataPath=""
30+ TempDataPath=""
31+ #for test sequence info
32+ TestSequenceName=""
33+ PicW=""
34+ PicH=""
35+ #test cfg file and test info output file
36+ ConfigureFile=""
37+ AllCaseFile=""
38+ #xxx.csv
39+ AllCasePassStatusFile=""
40+ #for encoder command
41+ declare -a EncoderCommandSet
42+ declare -a EncoderCommandName
43+ declare -a EncoderCommandValue
44+ #encoder parameters change based on the case info
45+ CaseInfo=""
46+ BitStreamFile=""
47+ DiffFlag=""
48+ #pass number
49+ TotalCaseNum=""
50+ PassCaseNum=""
51+ UnpassCaseNum=""
52+}
53+#called by runGlobalVariableInitial
54+#usage runEncoderCommandInital
55+runEncoderCommandInital()
56+{
57+ EncoderCommandSet=(-frms \
58+ -numtl \
59+ -scrsig \
60+ -rc \
61+ -tarb \
62+ "-lqp 0" \
63+ -iper \
64+ "-slcmd 0" \
65+ "-slcnum 0" \
66+ -thread \
67+ -ltr \
68+ -db \
69+ -nalsize \
70+ -denois \
71+ -scene \
72+ -bgd \
73+ -aq)
74+ EncoderCommandName=(FrEcoded \
75+ NumTempLayer \
76+ ContentSig \
77+ RC \
78+ BitRate \
79+ QP \
80+ IntraPeriod \
81+ SlcMd \
82+ SlcMum \
83+ ThrMum \
84+ LTR \
85+ LFilterIDC \
86+ MacNalSize \
87+ DenoiseFlag \
88+ SceneChangeFlag \
89+ BackgroundFlag \
90+ AQFlag)
91+ EncoderCommandValue=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
92+ NumParameter=${#EncoderCommandSet[@]}
93+}
94+runGlobalVariableInitial()
95+{
96+ #TestSpaceDir=../AllTestData CurrentDir=../AllTestData/TestSetXXX/***.264 eg ../AllTestData/TestSetCIF/BA1_MWD.264
97+ CurrentDir=`pwd`
98+ #test data space
99+ FinalResultPath="${CurrentDir}/result"
100+ IssueDataPath="${CurrentDir}/issue"
101+ TempDataPath="TempData"
102+ TestSequencePath="${CurrentDir}"
103+ #get YUV detail info $picW $picH $FPS
104+ declare -a aYUVInfo
105+ aYUVInfo=(`./run_ParseYUVInfo.sh ${TestSequenceName}`)
106+ PicW=${aYUVInfo[0]}
107+ PicH=${aYUVInfo[1]}
108+ #test cfg file and test info output file
109+ ConfigureFile=welsenc.cfg
110+ AllCasePassStatusFile="${FinalResultPath}/${TestSequenceName}_AllCaseOutput.csv"
111+ UnpassCaseFile="${FinalResultPath}/${TestSequenceName}_unpassCaseOutput.csv"
112+ UpdateSHA1TableFile="${FinalResultPath}/${TestSequenceName}_UpdateSHA1Table.csv"
113+ echo "BitMatched Status, \
114+ SHA-1-Target, SHA-1-Benchmark, \
115+ MD5-Target, MD5-Benchmark, \
116+ Bitstream-Target,Bitstream-Benchmark, \
117+ YUV-Target,YUV-Benchmark, \
118+ -frms, -numtl, -scrsig, -rc, \
119+ -tarb, -lqp 0, -iper, \
120+ -slcmd 0,-slcnum 0, -thread, \
121+ -ltr, -db, -nalsize,-denois, \
122+ -scene, -bgd, -aq">${AllCasePassStatusFile}
123+
124+ echo "BitMatched Status, \
125+ SHA-1-Target, SHA-1-Benchmark, \
126+ MD5-Target, MD5-Benchmark, \
127+ Bitstream-Target,Bitstream-Benchmark,\
128+ YUV-Target,YUV-Benchmark, \
129+ -frms, -numtl, -scrsig, -rc, \
130+ -tarb, -lqp 0, -iper, \
131+ -slcmd 0,-slcnum 0, -thread, \
132+ -ltr, -db, -nalsize,-denois, \
133+ -scene, -bgd, -aq">${UnpassCaseFile}
134+
135+ echo "SHA-1 Value, \
136+ MD5String, BitStreamSize, YUVSize, \
137+ -frms, -numtl, -scrsig, -rc, \
138+ -tarb, -lqp 0, -iper, \
139+ -slcmd 0,-slcnum 0, -thread, \
140+ -ltr, -db, -MaxNalSize,-denois, \
141+ -scene, -bgd, -aq">${UpdateSHA1TableFile}
142+ #intial Commandline parameters
143+ runEncoderCommandInital
144+ let "TotalCaseNum=0"
145+ let "PassCaseNum=0"
146+ let "UnpassCaseNum=0"
147+ EncoderCommand=""
148+ EncoderLogFile="${TempDataPath}/Encoder.log"
149+ TargetSHA1=""
150+ TargetMD5=""
151+ TargetYUVSize=""
152+ TargetBitstreamSize=""
153+ BenchmarkSHA1=""
154+ BenchmarkMD5=""
155+ BenchmarkYUVSize=""
156+ BenchmarkBitstreamSize=""
157+}
158+#***********************************************************
159+#called by runAllCaseTest
160+# parse case info --encoder preprocess
161+#usage runParseCaseInfo $CaseData
162+runParseCaseInfo()
163+{
164+ if [ $# -lt 1 ]
165+ then
166+ echo "runParseCaseInfo \$CaseData"
167+ return 1
168+ fi
169+ local TempData=""
170+ local BitstreamPrefix=""
171+ local CaseData=$@
172+ BenchmarkSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $1} ' `
173+ BenchmarkMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $2} ' `
174+ BenchmarkYUVSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $4} ' `
175+ BenchmarkBitstreamSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $3} ' `
176+ TempData=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s",$i)} ' `
177+ EncoderCommandValue=(${TempData})
178+ for((i=0; i<$NumParameter; i++))
179+ do
180+ BitstreamPrefix=${BitstreamPrefix}_${EncoderCommandName[$i]}_${EncoderCommandValue[$i]}
181+ done
182+ BitstreamTarget=${TempDataPath}/${TestSequenceName}_${BitstreamPrefix}_codec_target.264
183+ echo ""
184+ echo "BitstreamPrefix is ${BitstreamPrefix}"
185+ echo ""
186+}
187+#called by runAllCaseTest
188+#usage runEncodeOneCase
189+runEncodeOneCase()
190+{
191+ BitStreamFile=${BitstreamTarget}
192+ CaseCommand=" ${ConfigureFile} \
193+ -numl 1 \
194+ -lconfig 0 layer2.cfg \
195+ -sw ${PicW} -sh ${PicH} \
196+ -dw 0 ${PicW} -dh 0 ${PicH} \
197+ -frout 0 30 \
198+ -ltarb 0 ${EncoderCommandValue[4]} \
199+ ${EncoderCommandSet[0]} ${EncoderCommandValue[0]} \
200+ ${EncoderCommandSet[1]} ${EncoderCommandValue[1]} \
201+ ${EncoderCommandSet[2]} ${EncoderCommandValue[2]} \
202+ ${EncoderCommandSet[3]} ${EncoderCommandValue[3]} \
203+ ${EncoderCommandSet[4]} ${EncoderCommandValue[4]} \
204+ ${EncoderCommandSet[5]} ${EncoderCommandValue[5]} \
205+ ${EncoderCommandSet[6]} ${EncoderCommandValue[6]} \
206+ ${EncoderCommandSet[7]} ${EncoderCommandValue[7]} \
207+ ${EncoderCommandSet[8]} ${EncoderCommandValue[8]} \
208+ ${EncoderCommandSet[9]} ${EncoderCommandValue[9]} \
209+ ${EncoderCommandSet[10]} ${EncoderCommandValue[10]} \
210+ ${EncoderCommandSet[11]} ${EncoderCommandValue[11]} \
211+ ${EncoderCommandSet[12]} ${EncoderCommandValue[12]} \
212+ ${EncoderCommandSet[13]} ${EncoderCommandValue[13]} \
213+ ${EncoderCommandSet[14]} ${EncoderCommandValue[14]} \
214+ ${EncoderCommandSet[15]} ${EncoderCommandValue[15]} \
215+ ${EncoderCommandSet[16]} ${EncoderCommandValue[16]}"
216+ echo ${EncoderCommandSet[@]}
217+ echo ${EncoderCommandValue[@]}
218+ echo ${EncoderCommandSet[11]}
219+ echo ${EncoderCommandValue[11]}
220+ echo ${EncoderCommandSet[12]}
221+ echo ${EncoderCommandValue[12]}
222+ EncoderCommand="./h264enc ${CaseCommand} -bf ${BitStreamFile} -org ${TestSequencePath}/${TestSequenceName} "
223+ echo ""
224+ echo "case line is :"
225+ echo " ${EncoderCommand}"
226+ echo -e "\n\n"
227+ ./h264enc ${CaseCommand} \
228+ -bf ${BitStreamFile} \
229+ -org ${TestSequencePath}/${TestSequenceName} 2>${EncoderLogFile}
230+}
231+#usage? runGetFileSize $FileName
232+runGetFileSize()
233+{
234+ if [ $# -lt 1 ]
235+ then
236+ echo "usage runGetFileSize $FileName!"
237+ return 1
238+ fi
239+ local FileName=$1
240+ local FileSize=""
241+ local TempInfo=""
242+ TempInfo=`ls -l $FileName`
243+ FileSize=`echo $TempInfo | awk '{print $5}'`
244+ echo $FileSize
245+}
246+#called by runAllCaseTest
247+#usage runJSVMVerify
248+runBitStreamVerify()
249+{
250+ echo ""
251+ echo "******************************************"
252+ echo "Bit streamSHA1 value comparison.... "
253+ #*******************************************
254+ if [ ! -s ${BitStreamFile} ]
255+ then
256+ let "UnpassCaseNum++"
257+ DiffFlag="2:unpassed! 0 bits--bit stream"
258+ return 1
259+ fi
260+ #*******************************************
261+ #*******************************************
262+ #SHA1(run_Test.sh)= fde74d9e8194d0cf28991a0481c7158a033ec920
263+ TargetSHA1=`openssl sha1 ${BitStreamFile}`
264+ TargetSHA1=`echo ${TargetSHA1} | awk '{print $2}' `
265+ TargetMD5=`openssl md5 ${BitStreamFile}`
266+ TargetMD5=`echo ${TargetMD5} | awk '{print $2}' `
267+ TargetYUVSize=`runGetFileSize ${TestSequencePath}/${TestSequenceName} `
268+ TargetBitstreamSize=`runGetFileSize ${BitStreamFile}`
269+ if [[ "${TargetSHA1}" =~ "${BenchmarkSHA1}" ]]
270+ then
271+ echo "bitstream pass! SHA1--${TargetSHA1} ----- ${BenchmarkSHA1}"
272+ echo "bitstream pass! MD5-- ${TargetMD5} ----- ${BenchmarkMD5}"
273+ echo "YUV size pass! size--${TargetYUVSize}--${BenchmarkYUVSize} "
274+ echo "BitStreamSize pass! size--${TargetBitstreamSize}--${BenchmarkBitstreamSize}"
275+ DiffFlag="0:passed!"
276+ let "PassCaseNum++"
277+ return 0
278+ else
279+ echo "!!! SHA1 string not match: ${TargetSHA1} ----- ${BenchmarkSHA1} "
280+ echo "bitstream pass! MD5-- ${TargetMD5} ----- ${BenchmarkMD5}"
281+ echo "YUV size pass! size--${TargetYUVSize}--${BenchmarkYUVSize} "
282+ echo "BitStreamSize pass! size--${TargetBitstreamSize}--${BenchmarkBitstreamSize}"
283+ DiffFlag="1:unpassed!"
284+ let "UnpassCaseNum++"
285+ return 1
286+ fi
287+}
288+#called by runAllCaseTest
289+#delete temp data files and output single case test result to log file
290+#usage runSingleCasePostAction $CaseData
291+runSingleCasePostAction()
292+{
293+ if [ $# -lt 1 ]
294+ then
295+ echo "no parameter!"
296+ return 1
297+ fi
298+ local CaseData=$@
299+ CaseInfo=`echo $CaseData | awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s,",$i)} '`
300+ echo "${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, {TargetMD5}, ${BenchmarkMD5}, \
301+ ${TargetBitstreamSize} , ${BenchmarkBitstreamSize},\
302+ ${TargetYUVSize}, ${BenchmarkYUVSize},\
303+ ${CaseInfo}, ${EncoderCommand} " >>${AllCasePassStatusFile}
304+
305+ echo "${TargetSHA1}, ${TargetMD5},${TargetBitstreamSize}, ${TargetYUVSize},${CaseInfo}">>${UpdateSHA1TableFile}
306+
307+ ./run_SafeDelete.sh ${BitstreamTarget} >>${AllCaseConsoleLogFile}
308+}
309+#usage runOutputPassNum
310+runOutputPassNum()
311+{
312+ # output file locate in ../result
313+ echo ""
314+ echo "***********************************************************"
315+ echo "${TestSequenceName}"
316+ echo "total case Num is : ${TotalCaseNum}"
317+ echo "pass case Num is : ${PassCaseNum}"
318+ echo "unpass case Num is : ${UnpassCaseNum} "
319+ echo "***********************************************************"
320+ echo ""
321+}
322+# run all test case based on XXXcase.csv file
323+#usage runAllCaseTest
324+runAllCaseTest()
325+{
326+ local EncoderLogInfo=""
327+ while read CaseData
328+ do
329+ #get case parameter's value
330+ if [[ ! $CaseData =~ "SHA" ]]
331+ then
332+ echo "" >>${AllCaseConsoleLogFile}
333+ echo "" >>${AllCaseConsoleLogFile}
334+ echo "" >>${AllCaseConsoleLogFile}
335+ echo "********************case index is ${TotalCaseNum}**************************************" >>${AllCaseConsoleLogFile}
336+ runParseCaseInfo ${CaseData} >>${AllCaseConsoleLogFile}
337+ echo "" >>${AllCaseConsoleLogFile}
338+ runEncodeOneCase >>${AllCaseConsoleLogFile}
339+ cat ${EncoderLogFile}>>${AllCaseConsoleLogFile}
340+ runBitStreamVerify >>${AllCaseConsoleLogFile}
341+ let "DisplayFlag=TotalCaseNum%100"
342+ if [ ${DisplayFlag} -eq 0 ]
343+ then
344+ if [ "$DiffFlag" = "0:passed!" ]
345+ then
346+ echo -e "\033[32m OK! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1} ----- ${BenchmarkSHA1} \033[0m"
347+ echo -e "\033[32m ----MD5 (Current--Benchmark): ${TargetMD5}, ${BenchmarkMD5} \033[0m"
348+ echo -e "\033[32m ----BitstreamSize: ${TargetBitstreamSize}, ${BenchmarkBitstreamSize} YUVSize: ${TargetYUVSize}, ${BenchmarkYUVSize} \033[0m"
349+ fi
350+ fi
351+ #******************************************
352+ if [ ! "$DiffFlag" = "0:passed!" ]
353+ then
354+ echo -e "\033[31m Failed! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1} ----- ${BenchmarkSHA1} \033[0m"
355+ echo -e "\033[31m ----MD5 (Current--Benchmark): ${TargetMD5}, ${BenchmarkMD5} \033[0m"
356+ echo -e "\033[31m ----BitstreamSize: ${TargetBitstreamSize}, ${BenchmarkBitstreamSize} YUVSize: ${TargetYUVSize}, ${BenchmarkYUVSize} \033[0m"
357+ EncoderLogInfo=`cat ${EncoderLogFile}`
358+ echo -e "\033[31m ${EncoderLogInfo} \033[0m"
359+ echo "${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, ${TargetMD5}, ${BenchmarkMD5}, \
360+ ${TargetBitstreamSize} , ${BenchmarkBitstreamSize}, \
361+ ${TargetYUVSize}, ${BenchmarkYUVSize}, \
362+ ${CaseInfo}, ${EncoderCommand} ">>${UnpassCaseFile}
363+ fi
364+ runSingleCasePostAction ${CaseData}
365+ let "TotalCaseNum++"
366+ fi
367+ done <$AllCaseFile
368+}
369+#***********************************************************
370+# usage: runMain $TestYUV $AllCaseFile
371+runMain()
372+{
373+ if [ ! $# -eq 2 ]
374+ then
375+ echo "usage: run_BinarySHA1Comparison.sh \$TestYUV \$AllCaseFile"
376+ return 1
377+ fi
378+ runGlobalVariableDef
379+ #for test sequence info
380+ TestSequenceName=$1
381+ AllCaseFile=$2
382+ runGlobalVariableInitial
383+ TestFolder=`echo $CurrentDir | awk 'BEGIN {FS="/"} { i=NF; print $i}'`
384+ AllCaseConsoleLogFile="${FinalResultPath}/${TestSequenceName}.TestLog"
385+ CaseSummaryFile="${FinalResultPath}/${TestSequenceName}.Summary"
386+ FlagFile=""
387+ #run all cases
388+ runAllCaseTest
389+ # output file locate in ./result
390+ echo "${TestSequenceName}, \
391+ ${PassCaseNum} pass!, \
392+ ${UnpassCaseNum} unpass!,\
393+ detail file located in ../AllTestData/${TestFolder}/result">${CaseSummaryFile}
394+ runOutputPassNum
395+ #generate All case Flag
396+ if [ ! ${UnpassCaseNum} -eq 0 ]
397+ then
398+ echo ""
399+ exit 1
400+ else
401+ echo ""
402+ exit 0
403+ fi
404+}
405+TestYUVName=$1
406+AllCaseFile=$2
407+runMain ${TestYUVName} ${AllCaseFile}
408+
test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh+131−0
@@ -0,0 +1,131 @@
1+#!/bin/bash
2+#*******************************************************************************
3+# Encoder binary comparison test model
4+# -- Compared with benchmark version using SHA-1 string
5+# -- Test bit stream under folder openh264/res
6+# -- SHA-1 string of benchmark version for all cases of all bit streams
7+# under folder openh264/test/encoder_binary_comparion/SHA1Table
8+# -- For more detail,please refer to file AboutTest.
9+#
10+#brief:
11+# -- Transform test bit stream into YUV as test sequence,
12+# 1) Called by run_OneBitStream.sh before testing all cases
13+# 2) eg:
14+# -- input: ./run_BitStreamToYUV.sh TestABC.264
15+# -- output: TestABC.264_382X288.yuv
16+# -- Usage: run_BitStreamToYUV.sh ${BitStreamFile}
17+#
18+#
19+# date: 10/06/2014 Created
20+#*******************************************************************************
21+#usage: run_ParseDecoderLog $Decoder_LogFile
22+#eg: input: run_ParseDecoderLog test.264.log
23+# output 1024 720
24+run_ParseDecoderLog()
25+{
26+ if [ ! $# -eq 1 ]
27+ then
28+ echo "usage: run_ParseDecoderLog \$Decoder_LogFile"
29+ return 1
30+ fi
31+ local LogFile=$1
32+ local Width=""
33+ local Height=""
34+ while read line
35+ do
36+ if [[ $line =~ "iWidth" ]]
37+ then
38+ Width=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`
39+ fi
40+ if [[ $line =~ "height" ]]
41+ then
42+ Height=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`
43+ fi
44+ done < ${LogFile}
45+ echo "${Width} ${Height}"
46+}
47+#usage: run_BitStream2YUV $BitstreamName $OutputYUVName $LogFile
48+run_BitStream2YUV()
49+{
50+ if [ ! $# -eq 3 ]
51+ then
52+ echo "usage: run_BitStream2YUV \$BitstreamName \$OutputYUVName \$LogFile "
53+ return 1
54+ fi
55+ local BitStreamName=$1
56+ local OutputYUVNAMe=$2
57+ local LogFile=$3
58+
59+ if [ ! -f ${BitStreamName} ]
60+ then
61+ echo "bit stream file does not exist!"
62+ echo "detected by run_BitStreamToYUV.sh"
63+ return 1
64+ fi
65+ #decode bitstream
66+ ./h264dec ${BitStreamName} ${OutputYUVNAMe} 2> ${LogFile}
67+
68+ return 0
69+}
70+#usage: run_RegularizeYUVName $BitstreamName $OutputYUVName $LogFile
71+run_RegularizeYUVName()
72+{
73+ if [ ! $# -eq 3 ]
74+ then
75+ echo "usage: run_RegularizeYUVName \$BitstreamName \$OutputYUVName \$LogFile "
76+ return 1
77+ fi
78+ local BitStreamName=$1
79+ local OrignName=$2
80+ local LogFile=$3
81+ local RegularizedYUVName=""
82+
83+ declare -a aDecodedYUVInfo
84+
85+ aDecodedYUVInfo=(`run_ParseDecoderLog ${LogFile}`)
86+
87+ BitStreamName=`echo ${BitStreamName} | awk 'BEGIN {FS="/"} {print $NF}'`
88+ RegularizedYUVName="${BitStreamName}_${aDecodedYUVInfo[0]}x${aDecodedYUVInfo[1]}.yuv"
89+ mv -f ${OrignName} ${RegularizedYUVName}
90+ echo ""
91+ echo "file : ${OrignName} has been renamed as :${RegularizedYUVName}"
92+ echo ""
93+
94+ return 0
95+}
96+#usage: runMain ${BitStreamName}
97+runMain()
98+{
99+ if [ ! $# -eq 1 ]
100+ then
101+ echo "usage: runMain ${BitStreamName} "
102+ return 1
103+ fi
104+
105+ local BitStreameFile=$1
106+ local BitSteamName=`echo ${BitStreameFile} | awk 'BEGIN {FS="/"} {print $NF}'`
107+ local DecoderLogFile="${BitSteamName}_h264dec.log"
108+ local DecodedYUVName="${BitSteamName}_dec.yuv"
109+ local RegularizedName=""
110+
111+ #**********************
112+ #decoded test bit stream
113+ run_BitStream2YUV ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
114+ if [ ! $? -eq 0 ]
115+ then
116+ echo "bit stream decoded failed!"
117+ return 1
118+ fi
119+
120+
121+ #*********************
122+ #regularized YUV name
123+ run_RegularizeYUVName ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
124+
125+ return 0
126+}
127+BitStreamFile=$1
128+runMain ${BitStreamFile}
129+
130+
131+
test/encoder_binary_comparison/Scripts/run_ParseYUVInfo.sh+67−0
@@ -0,0 +1,67 @@
1+#!/bin/bash
2+#*******************************************************************************
3+# Encoder binary comparison test model
4+# -- Compared with benchmark version using SHA-1 string
5+# -- Test bit stream under folder openh264/res
6+# -- SHA-1 string of benchmark version for all cases of all bit streams
7+# under folder openh264/test/encoder_binary_comparion/SHA1Table
8+# -- For more detail,please refer to file AboutTest.
9+#
10+#brief:
11+# -- Parse sequence basic info such as picw pich and fps via name
12+# -- Usage: run_ParseYUVInfo.sh ${TestSequenceName}
13+#
14+# date: 10/06/2014 Created
15+#*******************************************************************************
16+#usage runGetYUVInfo $TestSequenceName
17+#eg. input: ABC_1920X1080_30fps_XXX.yuv output: 1920 1080 30
18+#eg. input: ABC_1920X1080_XXX.yuv output: 1920 1080 0
19+#eg. input: ABC_XXX.yuv output: 0 0 0
20+runGetYUVInfo()
21+{
22+ if [ ! $# -eq 1 ]
23+ then
24+ echo "runGetYUVInfo \$TestSequenceName"
25+ echo "detected by run_ParseYUVInfo.sh"
26+ return 1
27+ fi
28+
29+ local SequenceName=$1
30+ local PicWidth="0"
31+ local PicHeight="0"
32+ local FPS="0"
33+ declare -a aPicInfo
34+ aPicInfo=(`echo ${SequenceName} | awk 'BEGIN {FS="[_.]"} {for(i=1;i<=NF;i++) printf("%s ",$i)}'`)
35+ local Iterm
36+ local Index=""
37+ local Pattern_01="[xX]"
38+ local Pattern_02="^[1-9][0-9]"
39+ local Pattern_03="[0-9][0-9]$"
40+ local Pattern_04="fps$"
41+ #get PicW PicH info
42+ let "Index=0"
43+ for Iterm in ${aPicInfo[@]}
44+ do
45+ if [[ $Iterm =~ $Pattern_01 ]] && [[ $Iterm =~ $Pattern_02 ]] && [[ $Iterm =~ $Pattern_03 ]]
46+ then
47+ PicWidth=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $1}'`
48+ PicHeight=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $2}'`
49+ break
50+ fi
51+ let "Index++"
52+ done
53+ #get fps info
54+ let "Index++"
55+ if [ $Index -le ${#aPicInfo[@]} ]
56+ then
57+ if [[ ${aPicInfo[$Index]} =~ ^[1-9] ]] || [[ ${aPicInfo[$Index]} =~ $Pattern_04 ]]
58+ then
59+ FPS=`echo ${aPicInfo[$Index]} | awk 'BEGIN {FS="[a-zA-Z]" } {print $1} '`
60+ fi
61+ fi
62+ echo "$PicWidth $PicHeight $FPS"
63+}
64+TestSequenceName=$1
65+runGetYUVInfo ${TestSequenceName}
66+
67+
test/encoder_binary_comparison/Scripts/run_SafeDelete.sh+249−0
@@ -0,0 +1,249 @@
1+#!/bin/bash
2+#*******************************************************************************
3+# Encoder binary comparison test model
4+# -- Compared with benchmark version using SHA-1 string
5+# -- Test bit stream under folder openh264/res
6+# -- SHA-1 string of benchmark version for all cases of all bit streams
7+# under folder openh264/test/encoder_binary_comparion/SHA1Table
8+# -- For more detail,please refer to file AboutTest.
9+#
10+#brief:
11+# -- Usage: ./run_SafeDelere.sh $DeleteItermPath
12+# eg: 1 ./run_SafeDelere.sh tempdata.info --->delete only one file
13+# eg: 2 ./run_SafeDelere.sh ../TempDataFolder --->delete entire folder
14+# ./run_SafeDelere.sh /opt/TempData/ABC --->delete entire folder ABC
15+#
16+# date: 10/06/2014 Created
17+#*******************************************************************************
18+#usage: runGetFileName $FilePath
19+runGetFileName()
20+{
21+ #parameter check!
22+ if [ ! $# -eq 1 ]
23+ then
24+ echo "usage: runGetFileName \$FilePath"
25+ return 1
26+ fi
27+
28+ local PathInfo=$1
29+ local FileName=""
30+
31+ if [[ $PathInfo =~ ^"/" ]]
32+ then
33+ FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`
34+ echo "${FileName}"
35+ return 0
36+ elif [[ $PathInfo =~ ^".." ]]
37+ then
38+ FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`
39+ echo "${FileName}"
40+ return 0
41+ else
42+ FileName=${PathInfo}
43+ echo "${FileName}"
44+ return 0
45+ fi
46+
47+}
48+#******************************************************************************************************
49+#usage: runGetFileFullPath $FilePathInfo
50+#eg: current path is /opt/VideoTest/openh264/ABC
51+# runGetFileFullPath abc.txt --->/opt/VideoTest/openh264/ABC
52+# runGetFileFullPath ../123.txt --->/opt/VideoTest/openh264
53+# runGetFileFullPath /opt/VieoTest/456.txt --->/opt/VieoTest
54+runGetFileFullPath()
55+{
56+ #parameter check!
57+ if [ ! $# -eq 1 ]
58+ then
59+ echo "usage: runGetFileFullPath \$FilePathInfo "
60+ return 1
61+ fi
62+
63+ local PathInfo=$1
64+ local FullPath=""
65+ local CurrentDir=`pwd`
66+
67+ if [[ $PathInfo =~ ^"/" ]]
68+ then
69+ FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`
70+ cd ${FullPath}
71+ FullPath=`pwd`
72+ cd ${CurrentDir}
73+ echo "${FullPath}"
74+ return 0
75+ elif [[ $PathInfo =~ ^".." ]]
76+ then
77+ FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`
78+ cd ${FullPath}
79+ FullPath=`pwd`
80+ cd ${CurrentDir}
81+ echo "${FullPath}"
82+ return 0
83+ else
84+ FullPath=${CurrentDir}
85+ echo "${FullPath}"
86+ return 0
87+ fi
88+}
89+#******************************************************************************************************
90+#usage: runGetFolderFullPath $FolderPathInfo
91+#eg: current path is /opt/VideoTest/openh264/ABC
92+# runGetFolderFullPat SubFolder --->/opt/VideoTest/openh264/ABC/ SubFolder
93+# runGetFolderFullPat ../EFG --->/opt/VideoTest/openh264/EFG
94+# runGetFolderFullPat /opt/VieoTest/MyFolder --->/opt/VieoTest/MyFolder
95+runGetFolderFullPath()
96+{
97+ #parameter check!
98+ if [ ! $# -eq 1 ]
99+ then
100+ echo "usage: runGetFolderFullPath \$FolderPathInfo "
101+ return 1
102+ fi
103+
104+ local PathInfo=$1
105+ local FullPath=""
106+ local CurrentDir=`pwd`
107+
108+ if [[ $PathInfo =~ ^"/" ]]
109+ then
110+ FullPath=${PathInfo}
111+ cd ${FullPath}
112+ FullPath=`pwd`
113+ cd ${CurrentDir}
114+ echo "${FullPath}"
115+ return 0
116+ elif [[ $PathInfo =~ ^".." ]]
117+ then
118+ cd ${PathInfo}
119+ FullPath=`pwd`
120+ cd ${CurrentDir}
121+ echo "${FullPath}"
122+ return 0
123+ else
124+ FullPath="${CurrentDir}/${PathInfo}"
125+ cd ${FullPath}
126+ FullPath=`pwd`
127+ cd ${CurrentDir}
128+ echo "${FullPath}"
129+ return 0
130+ fi
131+
132+}
133+#******************************************************************************************************
134+#usage: runUserNameCheck $whoami
135+runUserNameCheck()
136+{
137+ #parameter check!
138+ if [ ! $# -eq 1 ]
139+ then
140+ echo "usage: runUserNameCheck \$whoami"
141+ return 1
142+ fi
143+
144+ local UserName=$1
145+
146+ if [ ${UserName} = "root" ]
147+ then
148+ echo ""
149+ echo "*********************************************"
150+ echo "delete files under root is not allowed"
151+ echo "detected by run_SafeDelere.sh"
152+ return 1
153+ else
154+ echo ""
155+ return 0
156+ fi
157+}
158+#******************************************************************************************************
159+#usage: runFolderLocationCheck $FullPath
160+runFolderLocationCheck()
161+{
162+ #parameter check!
163+ if [ ! $# -eq 1 ]
164+ then
165+ echo "usage: runFolderLocationCheck \$FullPath"
166+ return 1
167+ fi
168+
169+ local Location=$1
170+ local FileDirDepth=`echo ${Location} | awk 'BEGIN {FS="/"} {print NF}'`
171+
172+ #for other non-project folder data protection
173+ #eg /opt/VideoTest/DeletedItem depth=4
174+ if [ $FileDirDepth -lt 5 ]
175+ then
176+ echo ""
177+ echo "*********************************************"
178+ echo "FileDepth is $FileDirDepth, and it is less thab the minimum depth(5)"
179+ echo "unsafe delete! try to delete non-project related files: $FileDir"
180+ echo "detected by run_SafeDelere.sh"
181+ return 1
182+ fi
183+
184+ return 0
185+}
186+#******************************************************************************************************
187+#usage runSafeDelete $Pathinfo
188+runSafeDelete()
189+{
190+ #parameter check!
191+ if [ ! $# -eq 1 ]
192+ then
193+ echo "usage runSafeDelete \FileFullPath"
194+ return 1
195+ fi
196+
197+ local PathInfo=$1
198+ local UserName=`whoami`
199+ local FullPath=""
200+ local DeleteIterm=""
201+ local FileName=""
202+
203+ #user validity check
204+ runUserNameCheck ${UserName}
205+ if [ ! $? -eq 0 ]
206+ then
207+ return 1
208+ fi
209+
210+ #get full path
211+ if [ -d $PathInfo ]
212+ then
213+ FullPath=`runGetFolderFullPath ${PathInfo} `
214+ elif [ -f $PathInfo ]
215+ then
216+ FullPath=`runGetFileFullPath ${PathInfo} `
217+ else
218+ echo "delete iterm does not exist"
219+ echo "detected by run_SafeDelere.sh"
220+ return 1
221+ fi
222+
223+ #location validity check
224+ runFolderLocationCheck ${FullPath}
225+ if [ ! $? -eq 0 ]
226+ then
227+ return 1
228+ fi
229+
230+ #delete file/folder
231+ if [ -d $PathInfo ]
232+ then
233+ DeleteIterm=${FullPath}
234+ echo "deleted folder is: $DeleteIterm"
235+ rm -rf ${DeleteIterm}
236+ elif [ -f $PathInfo ]
237+ then
238+ FileName=`runGetFileName ${PathInfo}`
239+ DeleteIterm="${FullPath}/${FileName}"
240+ echo "deleted file is: $DeleteIterm"
241+ rm ${DeleteIterm}
242+ fi
243+ echo ""
244+
245+}
246+PathInfo=$1
247+runSafeDelete $PathInfo
248+
249+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t