History

syn/unify with local SHA1 script and update SHA1 tables

huade committed 11 years ago

Commit 057799e1 parent c0feee810 files · +8095 −8859Browse files

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

Unified · Split

4 files
  1. test/encoder_binary_comparison/Scripts/run_BinarySHA1Comparison.sh +374 −362
  2. test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh +98 −93
  3. test/encoder_binary_comparison/Scripts/run_ParseYUVInfo.sh +49 −49
  4. test/encoder_binary_comparison/Scripts/run_SafeDelete.sh +213 −213
test/encoder_binary_comparison/Scripts/run_BinarySHA1Comparison.sh+374−362
@@ -1,430 +1,442 @@
11 #!/bin/bash
2−#*******************************************************************************
2+#***************************************************************************************************************
33 # 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?¡ê
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?¡ê
99 #brief:
10−# -- Test all cases in SHA1TableFile
11−# 1) Generate SHA1 string for each case
12−# 2) Compare with benchmark SHA1 string
13−# 3) If the SHA1 string are the same with benchmark version, test case is marked as passed
14−# 4) Otherwise, test case is marked as unpass! this may caused by:
15−# --the design of encoder has been changed and the bit stream also change
16−# --there may be some bugs in encoder and bit stream is not right
17−# -- Usage: ./run_BinarySHA1Comparison.sh ${TestYUVName} ${AllCaseSHA1TaleFile}
10+# -- Test all cases in SHA1TableFile
11+# 1) Generate SHA1 string for each case
12+# 2) Compare with benchmark SHA1 string
13+# 3) If the SHA1 string are the same with benchmark version, test case is marked as passed
14+# 4) Otherwise, test case is marked as unpass! this may caused by:
15+# --the design of encoder has been changed and the bit stream also change
16+# --there may be some bugs in encoder and bit stream is not right
17+# -- Usage: ./run_BinarySHA1Comparison.sh ${TestYUVName} ${AllCaseSHA1TaleFile}
1818 #
19−# date: 10/06/2014 Created
20−#*******************************************************************************
19+# date: 10/06/2014 Created
20+#***************************************************************************************************************
2121 #global variable definition
2222 #usage runGlobalVariableDef
2323 runGlobalVariableDef()
2424 {
25− WorkingDirDir=""
26− #test data space
27− FinalResultPath=""
28− IssueDataPath=""
29− TempDataPath=""
30− #for test sequence info
31− TestSequenceName=""
32− PicW=""
33− PicH=""
34− #test cfg file and test info output file
35− ConfigureFile=""
36− AllCaseFile=""
37− #xxx.csv
38− AllCasePassStatusFile=""
39− #for encoder command
40− declare -a aEncoderCommandSet
41− declare -a aEncoderCommandName
42− declare -a aEncoderCommandValue
43− declare -a aRecYUVFileList
44− #encoder parameters change based on the case info
45− let "EncoderFlag = 0"
46− CaseInfo=""
47− BitStreamFile=""
48− DiffFlag=""
49− #pass number
50− TotalCaseNum=""
51− PassCaseNum=""
52− UnpassCaseNum=""
25+ WorkingDirDir=""
26+ #test data space
27+ FinalResultPath=""
28+ IssueDataPath=""
29+ TempDataPath=""
30+ #for test sequence info
31+ TestSequenceName=""
32+ PicW=""
33+ PicH=""
34+ #test cfg file and test info output file
35+ ConfigureFile=""
36+ AllCaseFile=""
37+ #xxx.csv
38+ AllCasePassStatusFile=""
39+ #for encoder command
40+ declare -a aEncoderCommandSet
41+ declare -a aEncoderCommandName
42+ declare -a aEncoderCommandValue
43+ declare -a aRecYUVFileList
44+ #encoder parameters change based on the case info
45+ let "EncoderFlag = 0"
46+ CaseInfo=""
47+ BitStreamFile=""
48+ DiffFlag=""
49+ #pass number
50+ TotalCaseNum=""
51+ PassCaseNum=""
52+ UnpassCaseNum=""
5353 }
5454 #called by runGlobalVariableInitial
5555 #usage runEncoderCommandInital
5656 runEncoderCommandInital()
5757 {
58− aEncoderCommandSet=( -utype -frms -numl -numtl \
59− -sw -sh "-dw 0" "-dh 0" "-dw 1" "-dh 1" "-dw 2" "-dh 2" "-dw 3" "-dh 3" \
60− "-frout 0" "-frout 1" "-frout 2" "-frout 3" \
61− "-lqp 0" "-lqp 1" "-lqp 2" "-lqp 3" \
62− -rc -tarb "-ltarb 0" "-ltarb 1" "-ltarb 2" "-ltarb 3" \
63− "-slcmd 0" "-slcnum 0" "-slcmd 1" "-slcnum 1"\
64− "-slcmd 2" "-slcnum 2" "-slcmd 3" "-slcnum 3"\
65− -nalsize \
66− -iper -thread -ltr \
67− -db -denois -scene -bgd -aq )
68− aEncoderCommandName=(usagetype frms numl numtl \
69− sw sh dw0 dh0 dw1 dh1 dw2 dh2 dw3 dh3 \
70− frout0 frout1 frout2 frout3 \
71− lqp0 lqp1 lqp2 lqp3 \
72− rc tarb ltarb0 ltarb1 ltarb2 ltarb3 \
73− slcmd0 slcnum0 slcmd1 slcnum1 \
74− slcmd2 slcnum2 slcmd3 slcnum3 \
75− MaxNalSZ \
76− iper thread ltr \
77− db denois scene bgd aq )
78− NumParameter=${#aEncoderCommandSet[@]}
79− for ((i=0;i<NumParameter; i++))
80− do
81− aEncoderCommandValue[$i]=0
82− done
58+
59+ aEncoderCommandSet=( -utype -frms -numl -numtl \
60+ -sw -sh "-dw 0" "-dh 0" "-dw 1" "-dh 1" "-dw 2" "-dh 2" "-dw 3" "-dh 3" \
61+ "-frout 0" "-frout 1" "-frout 2" "-frout 3" \
62+ "-lqp 0" "-lqp 1" "-lqp 2" "-lqp 3" \
63+ -rc -fs -tarb "-ltarb 0" "-ltarb 1" "-ltarb 2" "-ltarb 3" \
64+ "-slcmd 0" "-slcnum 0" "-slcmd 1" "-slcnum 1"\
65+ "-slcmd 2" "-slcnum 2" "-slcmd 3" "-slcnum 3"\
66+ -nalsize \
67+ -iper -thread -ltr \
68+ -db -denois -scene -bgd -aq )
69+
70+ aEncoderCommandName=(usagetype frms numl numtl \
71+ sw sh dw0 dh0 dw1 dh1 dw2 dh2 dw3 dh3 \
72+ frout0 frout1 frout2 frout3 \
73+ lqp0 lqp1 lqp2 lqp3 \
74+ rc FrSkip tarb ltarb0 ltarb1 ltarb2 ltarb3 \
75+ slcmd0 slcnum0 slcmd1 slcnum1 \
76+ slcmd2 slcnum2 slcmd3 slcnum3 \
77+ MaxNalSZ \
78+ iper thread ltr \
79+ db denois scene bgd aq )
80+
81+
82+ NumParameter=${#aEncoderCommandSet[@]}
83+ for ((i=0;i<NumParameter; i++))
84+ do
85+ aEncoderCommandValue[$i]=0
86+ done
8387
8488 }
8589 runGlobalVariableInitial()
8690 {
87− #TestSpaceDir=../AllTestData CurrentDir=../AllTestData/TestSetXXX/***.264 eg ../AllTestData/TestSetCIF/BA1_MWD.264
88− CurrentDir=`pwd`
89− #test data space
90− FinalResultPath="${CurrentDir}/result"
91− IssueDataPath="${CurrentDir}/issue"
92− TempDataPath="TempData"
93− TestSequencePath="${CurrentDir}"
94− #get YUV detail info $picW $picH $FPS
95− declare -a aYUVInfo
96− aYUVInfo=(`./run_ParseYUVInfo.sh ${TestSequenceName}`)
97− PicW=${aYUVInfo[0]}
98− PicH=${aYUVInfo[1]}
99− #test cfg file and test info output file
100− ConfigureFile=welsenc.cfg
101− AllCasePassStatusFile="${FinalResultPath}/${TestSequenceName}_AllCaseOutput.csv"
102− UnpassCaseFile="${FinalResultPath}/${TestSequenceName}_unpassCaseOutput.csv"
103− UpdateSHA1TableFile="${FinalResultPath}/${TestSequenceName}_UpdateSHA1Table.csv"
104− HeadLine1="BitMatched Status, SHA-1-Target, SHA-1-Benchmark, MD5-Target, MD5-Benchmark,\
105− Bitstream-Target,Bitstream-Benchmark,YUV-Target,YUV-Benchmark,\
106− -utype, -frms, -numl, -numtl, -sw, -sh,\
107− -dw 0, -dh 0, -dw 1, -dh 1, -dw 2, -dh 2, -dw 3, -dh 3,\
108− -frout 0, -frout 1, -frout 2, -frout 3,\
109− -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
110− -rc, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
111− -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
112− -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
113− -nalsize,\
114− -iper, -thread, -ltr, -db, -denois,\
115− -scene, -bgd , -aq, "
116− HeadLine2="SHA-1 Value, MD5String, BitStreamSize, YUVSize, \
117− -utype, -frms, -numl, -numtl, -sw, -sh,\
118− -dw 0, -dh 0, -dw 1, -dh 1,-dw 2, -dh 2, -dw 3, -dh 3,\
119− -frout 0, -frout 1, -frout 2, -frout 3,\
120− -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
121− -rc, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
122− -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
123− -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
124− -nalsize,\
125− -iper, -thread, -ltr, -db, -denois,\
126− -scene , bgd , -aq "
127− echo ${HeadLine1}>${AllCasePassStatusFile}
128− echo ${HeadLine1}>${UnpassCaseFile}
129− echo ${HeadLine2}>${UpdateSHA1TableFile}
130−
131− #intial Commandline parameters
132− runEncoderCommandInital
133− let "TotalCaseNum=0"
134− let "PassCaseNum=0"
135− let "UnpassCaseNum=0"
136− EncoderCommand=""
137− EncoderLogFile="${TempDataPath}/Encoder.log"
138− TargetSHA1=""
139− TargetMD5=""
140− TargetYUVSize=""
141− TargetBitstreamSize=""
142− BenchmarkSHA1=""
143− BenchmarkMD5=""
144− BenchmarkYUVSize=""
145− BenchmarkBitstreamSize=""
91+ #TestSpaceDir=../AllTestData CurrentDir=../AllTestData/TestSetXXX/***.264 eg ../AllTestData/TestSetCIF/BA1_MWD.264
92+ CurrentDir=`pwd`
93+ #test data space
94+ FinalResultPath="${CurrentDir}/result"
95+ IssueDataPath="${CurrentDir}/issue"
96+ TempDataPath="TempData"
97+ TestSequencePath="${CurrentDir}"
98+ #get YUV detail info $picW $picH $FPS
99+ declare -a aYUVInfo
100+ aYUVInfo=(`./run_ParseYUVInfo.sh ${TestSequenceName}`)
101+ PicW=${aYUVInfo[0]}
102+ PicH=${aYUVInfo[1]}
103+ #test cfg file and test info output file
104+ ConfigureFile=welsenc.cfg
105+ AllCasePassStatusFile="${FinalResultPath}/${TestSequenceName}_AllCaseOutput.csv"
106+ UnpassCaseFile="${FinalResultPath}/${TestSequenceName}_unpassCaseOutput.csv"
107+ UpdateSHA1TableFile="${FinalResultPath}/${TestSequenceName}_UpdateSHA1Table.csv"
108+
109+ HeadLine1="EncoderFlag, DecoderFlag, FPS, BitSreamSHA1, BitSreamMD5, InputYUVSHA1, InputYUVMD5,\
110+ -utype, -frms, -numl, -numtl, -sw, -sh,\
111+ -dw 0, -dh 0, -dw 1, -dh 1, -dw 2, -dh 2, -dw 3, -dh 3,\
112+ -frout 0, -frout 1, -frout 2, -frout 3,\
113+ -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
114+ -rc,-fs, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
115+ -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
116+ -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
117+ -nalsize,\
118+ -iper, -thread, -ltr, -db, -denois,\
119+ -scene, -bgd , -aq, "
120+
121+ HeadLine2="BitSreamSHA1, BitSreamMD5, InputYUVSHA1, InputYUVMD5,\
122+ -utype, -frms, -numl, -numtl, -sw, -sh,\
123+ -dw 0, -dh 0, -dw 1, -dh 1,-dw 2, -dh 2, -dw 3, -dh 3,\
124+ -frout 0, -frout 1, -frout 2, -frout 3,\
125+ -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
126+ -rc, -fs, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
127+ -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
128+ -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
129+ -nalsize,\
130+ -iper, -thread, -ltr, -db, -denois,\
131+ -scene , bgd , -aq "
132+
133+
134+
135+ echo ${HeadLine1}>${AllCasePassStatusFile}
136+ echo ${HeadLine1}>${UnpassCaseFile}
137+ echo ${HeadLine2}>${UpdateSHA1TableFile}
138+
139+ #intial Commandline parameters
140+ runEncoderCommandInital
141+ let "TotalCaseNum=0"
142+ let "PassCaseNum=0"
143+ let "UnpassCaseNum=0"
144+ EncoderCommand=""
145+ EncoderLogFile="${TempDataPath}/Encoder.log"
146+ TargetSHA1=""
147+ TargetMD5=""
148+ TargetYUVSHA1=""
149+ TargetYUVMD5=""
150+ BenchmarkSHA1=""
151+ BenchmarkMD5=""
152+ BenchmarkYUVSHA1=""
153+ BenchmarkYUVMD5=""
146154 }
147155 #***********************************************************
148−#called by runAllCaseTest
156+#called by runAllCaseTest
149157 # parse case info --encoder preprocess
150−#usage runParseCaseInfo $CaseData
158+#usage runParseCaseInfo $CaseData
151159 runParseCaseInfo()
152160 {
153− if [ $# -lt 1 ]
154− then
161+ if [ $# -lt 1 ]
162+ then
155163 echo "no parameter!"
156164 return 1
157− fi
158− local TempData=""
159− local CaseData=$@
160− local BitstreamPrefix=""
161− BenchmarkSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $1} ' `
162− BenchmarkMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $2} ' `
163− BenchmarkYUVSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $4} ' `
164− BenchmarkBitstreamSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $3} ' `
165−
166− declare -a aTempParamIndex=( 6 7 8 9 10 11 12 13 15 16 17 19 20 21 24 25 26 27 30 31 32 33 34 35 )
167− TempData=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s",$i)} ' `
168− aEncoderCommandValue=(${TempData})
169− let "TempParamFlag=0"
170− for((i=0; i<$NumParameter; i++))
171− do
165+ fi
166+ local TempData=""
167+ local CaseData=$@
168+ local BitstreamPrefix=""
169+ BenchmarkSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $1} ' `
170+ BenchmarkMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $2} ' `
171+ BenchmarkYUVSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $3} ' `
172+ BenchmarkYUVMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $4} ' `
173+
174+
175+ declare -a aTempParamIndex=( 6 7 8 9 10 11 12 13 15 16 17 19 20 21 25 26 27 28 31 32 33 34 35 36 )
176+ TempData=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s",$i)} ' `
177+ aEncoderCommandValue=(${TempData})
178+ let "TempParamFlag=0"
179+
180+ for((i=0; i<$NumParameter; i++))
181+ do
172182 for ParnmIndex in ${aTempParamIndex[@]}
173183 do
174− if [ $i -eq ${ParnmIndex} ]
175− then
176− let "TempParamFlag=1"
177− fi
184+ if [ $i -eq ${ParnmIndex} ]
185+ then
186+ let "TempParamFlag=1"
187+ fi
178188 done
189+
179190 if [ ${TempParamFlag} -eq 0 ]
180191 then
181− BitstreamPrefix=${BitstreamPrefix}_${aEncoderCommandName[$i]}_${aEncoderCommandValue[$i]}
192+ BitstreamPrefix=${BitstreamPrefix}_${aEncoderCommandName[$i]}_${aEncoderCommandValue[$i]}
182193 fi
183194 let "TempParamFlag=0"
184− done
195+ done
185196
186− BitstreamTarget=${TempDataPath}/${TestSequenceName}_${BitstreamPrefix}_codec_target.264
187− echo ""
188− echo "BitstreamPrefix is ${BitstreamPrefix}"
189− echo ""
197+ BitstreamTarget=${TempDataPath}/${TestSequenceName}_${BitstreamPrefix}_codec_target.264
198+ echo ""
199+ echo "BitstreamPrefix is ${BitstreamPrefix}"
200+ echo ""
190201 }
202+
191203 runEncodeOneCase()
192204 {
193− local ParamCommand=""
194− BitStreamFile=${BitstreamTarget}
205+ local ParamCommand=""
206+ BitStreamFile=${BitstreamTarget}
195207
196− for ((i=4; i<${NumParameter}; i++))
197− do
208+ for ((i=4; i<${NumParameter}; i++))
209+ do
198210 ParamCommand="${ParamCommand} ${aEncoderCommandSet[$i]} ${aEncoderCommandValue[$i]} "
199− done
200− for((i=0;i<4;i++))
201− do
211+ done
212+
213+ for((i=0;i<4;i++))
214+ do
202215 aRecYUVFileList[$i]="${TempDataPath}/${TestYUVName}_rec${i}.yuv"
203− done
204− ParamCommand="${aEncoderCommandSet[0]} ${aEncoderCommandValue[0]} ${aEncoderCommandSet[1]} ${aEncoderCommandValue[1]} \
205− ${aEncoderCommandSet[2]} ${aEncoderCommandValue[2]} \
206− -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
207− ${aEncoderCommandSet[3]} ${aEncoderCommandValue[3]} \
208− ${ParamCommand}"
209− echo ""
210− echo "---------------Encode One Case-------------------------------------------"
211− echo "case line is :"
212− EncoderCommand="./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
213− -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
214− -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
215− -org ${TestSequencePath}/${TestSequenceName}"
216− echo ${EncoderCommand}
217− echo -e "\n\n"
218− ./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
219− -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
220− -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
221− -org ${TestSequencePath}/${TestSequenceName} 2>${EncoderLogFile}
222− if [ $? -eq 0 ]
223− then
216+ done
217+
218+ ParamCommand="${aEncoderCommandSet[0]} ${aEncoderCommandValue[0]} ${aEncoderCommandSet[1]} ${aEncoderCommandValue[1]} \
219+ ${aEncoderCommandSet[2]} ${aEncoderCommandValue[2]} \
220+ -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
221+ ${aEncoderCommandSet[3]} ${aEncoderCommandValue[3]} \
222+ ${ParamCommand}"
223+ echo ""
224+ echo "---------------Encode One Case-------------------------------------------"
225+ echo "case line is :"
226+ EncoderCommand="./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
227+ -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
228+ -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
229+ -org ${TestSequencePath}/${TestSequenceName}"
230+ echo ${EncoderCommand}
231+ echo -e "\n\n"
232+ ./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
233+ -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
234+ -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
235+ -org ${TestSequencePath}/${TestSequenceName} 2>${EncoderLogFile}
236+ if [ $? -eq 0 ]
237+ then
224238 let "EncoderFlag=0"
225− else
239+ else
226240 let "EncoderFlag=1"
227− fi
241+ fi
228242
229− #delete the core down file as core down files for disk space limitation
230− for file in ./core*
231− do
243+ #delete the core down file as core down files for disk space limitation
244+ for file in ./core*
245+ do
232246 if [ -e ${file} ]
233247 then
234− ./run_SafeDelete.sh ${file}
248+ ./run_SafeDelete.sh ${file}
235249 fi
236− done
237− return 0
238−}
239−#usage? runGetFileSize $FileName
240−runGetFileSize()
241−{
242− if [ $# -lt 1 ]
243− then
244− echo "usage runGetFileSize $FileName!"
245− return 1
246− fi
247− local FileName=$1
248− local FileSize=""
249− local TempInfo=""
250− TempInfo=`ls -l $FileName`
251− FileSize=`echo $TempInfo | awk '{print $5}'`
252− echo $FileSize
250+ done
251+ return 0
253252 }
254−#called by runAllCaseTest
255−#usage runJSVMVerify
253+
254+#called by runAllCaseTest
255+#usage runJSVMVerify
256256 runBitStreamVerify()
257257 {
258− echo ""
259− echo "******************************************"
260− echo "Bit streamSHA1 value comparison.... "
261− #*******************************************
262− TargetSHA1="NULL"
263− TargetMD5="NULL"
264− TargetYUVSize="NULL"
265− TargetBitstreamSize="NULL"
266−
267− if [ ${EncoderFlag} -eq 1 ]
268− then
269− let "UnpassCaseNum++"
270− echo "1:unpassed! encoder initial failed or crash!"
271− DiffFlag="1:unpassed! encoder initial failed or crash!"
272− return 1
273− fi
274−
275− if [ ! -s ${BitStreamFile} ]
276− then
277− let "UnpassCaseNum++"
278− echo "2:unpassed! 0 bits--bit stream"
279− DiffFlag="2:unpassed! 0 bits--bit stream"
280− return 1
281− fi
282− #*******************************************
283− #*******************************************
284− echo ""
285− echo "${BitStreamFile}"
286− #SHA1
287− TargetSHA1=`openssl sha1 ${BitStreamFile}`
288− TargetSHA1=`echo ${TargetSHA1} | awk '{print $2}' `
289− TargetMD5=`openssl md5 ${BitStreamFile}`
290− TargetMD5=`echo ${TargetMD5} | awk '{print $2}' `
291− TargetYUVSize=`runGetFileSize ${TestSequencePath}/${TestSequenceName} `
292− TargetBitstreamSize=`runGetFileSize ${BitStreamFile}`
293− if [[ "${TargetSHA1}" =~ "${BenchmarkSHA1}" ]]
294− then
295− echo "bitstream pass! SHA1--${TargetSHA1} ----- ${BenchmarkSHA1}"
296− echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
297− echo "YUV size info: size--${TargetYUVSize} ---- ${BenchmarkYUVSize} "
298− echo "BitStreamSize info: size--${TargetBitstreamSize} ---- ${BenchmarkBitstreamSize}"
299− DiffFlag="0:passed!"
300− let "PassCaseNum++"
301− return 0
302− else
303− echo "!!! SHA1 string not match: ${TargetSHA1} ----- ${BenchmarkSHA1} "
304− echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
305− echo "YUV size info: size--${TargetYUVSize} ---- ${BenchmarkYUVSize} "
306− echo "BitStreamSize info: size--${TargetBitstreamSize} ---- ${BenchmarkBitstreamSize}"
307− DiffFlag="3:unpassed!"
308− let "UnpassCaseNum++"
309− return 1
310− fi
258+ echo ""
259+ echo "******************************************"
260+ echo "Bit streamSHA1 value comparison.... "
261+ #*******************************************
262+ TargetSHA1="NULL"
263+ TargetMD5="NULL"
264+ TargetYUVSHA1="NULL"
265+ TargetYUVMD5="NULL"
266+
267+ if [ ${EncoderFlag} -eq 1 ]
268+ then
269+ let "UnpassCaseNum++"
270+ echo "1:unpassed! encoder initial failed or crash!"
271+ DiffFlag="1:unpassed! encoder initial failed or crash!"
272+ return 1
273+ fi
274+
275+ if [ ! -s ${BitStreamFile} ]
276+ then
277+ let "UnpassCaseNum++"
278+ echo "2:unpassed! 0 bits--bit stream"
279+ DiffFlag="2:unpassed! 0 bits--bit stream"
280+ return 1
281+ fi
282+ #*******************************************
283+ #*******************************************
284+ echo ""
285+ echo "${BitStreamFile}"
286+ #SHA1
287+ TargetSHA1=`openssl sha1 ${BitStreamFile}`
288+ TargetSHA1=`echo ${TargetSHA1} | awk '{print $2}' `
289+ TargetMD5=`openssl md5 ${BitStreamFile}`
290+ TargetMD5=`echo ${TargetMD5} | awk '{print $2}' `
291+
292+ TargetYUVSHA1=`openssl sha1 ${TestSequencePath}/${TestSequenceName} `
293+ TargetYUVSHA1=`echo ${TargetYUVSHA1} | awk '{print $2}' `
294+ TargetYUVMD5=`openssl md5 ${TestSequencePath}/${TestSequenceName} `
295+ TargetYUVMD5=`echo ${TargetYUVMD5} | awk '{print $2}' `
296+
297+ if [[ "${TargetSHA1}" =~ "${BenchmarkSHA1}" ]]
298+ then
299+ echo "bitstream pass! SHA1--${TargetSHA1} ----- ${BenchmarkSHA1}"
300+ echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
301+ echo "YUV SHA1 info: SHA1--${TargetYUVSHA1} ---- ${BenchmarkYUVSHA1} "
302+ echo "YUV MD5 info: MD5--${TargetYUVMD5} ---- ${BenchmarkYUVMD5}"
303+ DiffFlag="0:passed!"
304+ let "PassCaseNum++"
305+ return 0
306+ else
307+ echo "!!! SHA1 string not match: ${TargetSHA1} ----- ${BenchmarkSHA1} "
308+ echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
309+ echo "YUV SHA1 info: SHA1--${TargetYUVSHA1} ---- ${BenchmarkYUVSHA1} "
310+ echo "YUV MD5 info: MD5--${TargetYUVMD5} ---- ${BenchmarkYUVMD5}"
311+ DiffFlag="3:unpassed!"
312+ let "UnpassCaseNum++"
313+ return 1
314+ fi
311315 }
312−#called by runAllCaseTest
313−#delete temp data files and output single case test result to log file
314−#usage runSingleCasePostAction $CaseData
316+
317+#called by runAllCaseTest
318+#delete temp data files and output single case test result to log file
319+#usage runSingleCasePostAction $CaseData
315320 runSingleCasePostAction()
316321 {
317− if [ $# -lt 1 ]
318− then
319− echo "no parameter!"
320− return 1
321− fi
322− local CaseData=$@
323− CaseInfo=`echo $CaseData | awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s,",$i)} '`
324− PassStatusInfo="${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, ${TargetMD5}, ${BenchmarkMD5},\
325− ${TargetBitstreamSize}, ${BenchmarkBitstreamSize}, ${TargetYUVSize}, ${BenchmarkYUVSize},\
326− ${CaseInfo}, ${EncoderCommand} "
327− echo "${PassStatusInfo}">>${AllCasePassStatusFile}
328− if [ "$DiffFlag" != "0:passed!" ]
329− then
330− echo "${PassStatusInfo}">>${UnpassCaseFile}
331− fi
332− echo "${TargetSHA1}, ${TargetMD5},${TargetBitstreamSize}, ${TargetYUVSize},${CaseInfo}">>${UpdateSHA1TableFile}
333− ./run_SafeDelete.sh ${BitstreamTarget} >>${AllCaseConsoleLogFile}
322+ if [ $# -lt 1 ]
323+ then
324+ echo "no parameter!"
325+ return 1
326+ fi
327+ local CaseData=$@
328+ CaseInfo=`echo $CaseData | awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s,",$i)} '`
329+ PassStatusInfo="${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, ${TargetMD5}, ${BenchmarkMD5},\
330+ ${TargetYUVMD5}, ${BenchmarkYUVMD5}, ${TargetYUVSHA1}, ${BenchmarkYUVSHA1},\
331+ ${CaseInfo}, ${EncoderCommand} "
332+ echo "${PassStatusInfo}">>${AllCasePassStatusFile}
333+ if [ "$DiffFlag" != "0:passed!" ]
334+ then
335+ echo "${PassStatusInfo}">>${UnpassCaseFile}
336+ fi
337+ echo "${TargetSHA1}, ${TargetMD5},${TargetYUVMD5}, ${TargetYUVSHA1},${CaseInfo}">>${UpdateSHA1TableFile}
338+ ./run_SafeDelete.sh ${BitstreamTarget} >>${AllCaseConsoleLogFile}
334339 }
340+
335341 #usage runOutputPassNum
336342 runOutputPassNum()
337343 {
338− # output file locate in ../result
339− echo ""
340− echo "***********************************************************"
341− echo "${TestSequenceName}"
342− echo "total case Num is: ${TotalCaseNum}"
343− echo "pass case Num is: ${PassCaseNum}"
344− echo "unpass case Num is: ${UnpassCaseNum}"
345− echo "***********************************************************"
346− echo ""
344+ # output file locate in ../result
345+ echo ""
346+ echo "***********************************************************"
347+ echo "${TestSequenceName}"
348+ echo "total case Num is: ${TotalCaseNum}"
349+ echo "pass case Num is: ${PassCaseNum}"
350+ echo "unpass case Num is: ${UnpassCaseNum}"
351+ echo "***********************************************************"
352+ echo ""
347353 }
354+
348355 # run all test case based on XXXcase.csv file
349−#usage runAllCaseTest
356+#usage runAllCaseTest
350357 runAllCaseTest()
351358 {
352− local EncoderLogInfo=""
353− while read CaseData
354− do
355− #get case parameter's value
356− if [[ ! $CaseData =~ "SHA" ]]
357− then
358− echo "" >>${AllCaseConsoleLogFile}
359− echo "" >>${AllCaseConsoleLogFile}
360− echo "" >>${AllCaseConsoleLogFile}
361− echo "********************case index is ${TotalCaseNum}**************************************" >>${AllCaseConsoleLogFile}
362− runParseCaseInfo ${CaseData} >>${AllCaseConsoleLogFile}
363− echo "" >>${AllCaseConsoleLogFile}
364− runEncodeOneCase >>${AllCaseConsoleLogFile}
365− cat ${EncoderLogFile}>>${AllCaseConsoleLogFile}
366− runBitStreamVerify >>${AllCaseConsoleLogFile}
367− let "DisplayFlag=TotalCaseNum%100"
368− if [ ${DisplayFlag} -eq 0 ]
369− then
370− if [ "$DiffFlag" = "0:passed!" ]
359+ local EncoderLogInfo=""
360+ while read CaseData
361+ do
362+ #get case parameter's value
363+ if [[ ! $CaseData =~ "SHA" ]]
371364 then
372− echo -e "\033[32m OK! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1}-----${BenchmarkSHA1} \033[0m"
373− echo -e "\033[32m ----MD5 (Current--Benchmark): ${TargetMD5}-----${BenchmarkMD5} \033[0m"
374− echo -e "\033[32m ----BitstreamSize: ${TargetBitstreamSize}, ${BenchmarkBitstreamSize} YUVSize: ${TargetYUVSize}, ${BenchmarkYUVSize} \033[0m"
365+ echo "" >>${AllCaseConsoleLogFile}
366+ echo "" >>${AllCaseConsoleLogFile}
367+ echo "" >>${AllCaseConsoleLogFile}
368+ echo "********************case index is ${TotalCaseNum}**************************************" >>${AllCaseConsoleLogFile}
369+ runParseCaseInfo ${CaseData} >>${AllCaseConsoleLogFile}
370+ echo "" >>${AllCaseConsoleLogFile}
371+ runEncodeOneCase >>${AllCaseConsoleLogFile}
372+ cat ${EncoderLogFile} >>${AllCaseConsoleLogFile}
373+ runBitStreamVerify >>${AllCaseConsoleLogFile}
374+ let "DisplayFlag=TotalCaseNum%100"
375+ if [ ${DisplayFlag} -eq 0 ]
376+ then
377+ if [ "$DiffFlag" = "0:passed!" ]
378+ then
379+ echo -e "\033[32m OK! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1}-----${BenchmarkSHA1} \033[0m"
380+ echo -e "\033[32m ----MD5 (Current--Benchmark): ${TargetMD5}-----${BenchmarkMD5} \033[0m"
381+ echo -e "\033[32m ----YUVMD5: ${TargetYUVMD5}, ${BenchmarkYUVMD5} YUVSHA1: ${TargetYUVSHA1}, ${BenchmarkYUVSHA1} \033[0m"
382+ fi
383+ fi
384+ #******************************************
385+ if [ ! "$DiffFlag" = "0:passed!" ]
386+ then
387+ echo -e "\033[31m Failed! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1}-----${BenchmarkSHA1} \033[0m"
388+ echo -e "\033[31m ----MD5 (Current--Benchmark): ${TargetMD5}-----${BenchmarkMD5} \033[0m"
389+ echo -e "\033[31m ----YUVMD5: ${TargetYUVMD5}, ${BenchmarkYUVMD5} YUVSHA1: ${TargetYUVSHA1}, ${BenchmarkYUVSHA1} \033[0m"
390+ EncoderLogInfo=`cat ${EncoderLogFile}`
391+ echo -e "\033[31m ${EncoderLogInfo} \033[0m"
392+ fi
393+ runSingleCasePostAction ${CaseData}
394+ let "TotalCaseNum++"
375395 fi
376− fi
377− #******************************************
378− if [ ! "$DiffFlag" = "0:passed!" ]
379− then
380− echo -e "\033[31m Failed! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1}-----${BenchmarkSHA1} \033[0m"
381− echo -e "\033[31m ----MD5 (Current--Benchmark): ${TargetMD5}-----${BenchmarkMD5} \033[0m"
382− echo -e "\033[31m ----BitstreamSize: ${TargetBitstreamSize}, ${BenchmarkBitstreamSize} YUVSize: ${TargetYUVSize}, ${BenchmarkYUVSize} \033[0m"
383− EncoderLogInfo=`cat ${EncoderLogFile}`
384− echo -e "\033[31m ${EncoderLogInfo} \033[0m"
385− fi
386− runSingleCasePostAction ${CaseData}
387− let "TotalCaseNum++"
388− fi
389− done <$AllCaseFile
396+ done <$AllCaseFile
390397 }
391398 #***********************************************************
392−# usage: runMain $TestYUV $AllCaseFile
399+# usage: runMain $TestYUV $AllCaseFile
393400 runMain()
394401 {
395− if [ ! $# -eq 2 ]
396− then
397− echo "usage: run_BinarySHA1Comparison.sh \$TestYUV \$AllCaseFile"
398− return 1
399− fi
400− runGlobalVariableDef
401− #for test sequence info
402− TestSequenceName=$1
403− AllCaseFile=$2
404− runGlobalVariableInitial
405− TestFolder=`echo $CurrentDir | awk 'BEGIN {FS="/"} { i=NF; print $i}'`
406− AllCaseConsoleLogFile="${FinalResultPath}/${TestSequenceName}.TestLog"
407− CaseSummaryFile="${FinalResultPath}/${TestSequenceName}.Summary"
408− FlagFile=""
409− #run all cases
410− runAllCaseTest
411− # output file locate in ./result
412− echo "${TestSequenceName}, \
413− ${PassCaseNum} pass!, \
414− ${UnpassCaseNum} unpass!,\
415− detail file located in ../AllTestData/${TestFolder}/result">${CaseSummaryFile}
416− runOutputPassNum
417− #generate All case Flag
418− if [ ! ${UnpassCaseNum} -eq 0 ]
419− then
420− echo ""
421− exit 1
422− else
423− echo ""
424− exit 0
425− fi
402+ if [ ! $# -eq 2 ]
403+ then
404+ echo "usage: run_BinarySHA1Comparison.sh \$TestYUV \$AllCaseFile"
405+ return 1
406+ fi
407+
408+ runGlobalVariableDef
409+
410+ #for test sequence info
411+ TestSequenceName=$1
412+ AllCaseFile=$2
413+ runGlobalVariableInitial
414+ TestFolder=`echo $CurrentDir | awk 'BEGIN {FS="/"} { i=NF; print $i}'`
415+ AllCaseConsoleLogFile="${FinalResultPath}/${TestSequenceName}.TestLog"
416+ CaseSummaryFile="${FinalResultPath}/${TestSequenceName}.Summary"
417+ FlagFile=""
418+
419+ #run all cases
420+ runAllCaseTest
421+
422+ # output file locate in ./result
423+ echo "${TestSequenceName}, \
424+ ${PassCaseNum} pass!, \
425+ ${UnpassCaseNum} unpass!,\
426+ detail file located in ../AllTestData/${TestFolder}/result">${CaseSummaryFile}
427+ runOutputPassNum
428+
429+ #generate All case Flag
430+ if [ ! ${UnpassCaseNum} -eq 0 ]
431+ then
432+ echo ""
433+ exit 1
434+ else
435+ echo ""
436+ exit 0
437+ fi
426438 }
427439 TestYUVName=$1
428440 AllCaseFile=$2
429−runMain ${TestYUVName} ${AllCaseFile}
441+runMain ${TestYUVName} ${AllCaseFile}
430442
test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh+98−93
@@ -1,118 +1,123 @@
11 #!/bin/bash
22 #*******************************************************************************
33 # 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.
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.
99 #
1010 #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}
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}
1717 #
1818 #
19−# date: 10/06/2014 Created
19+# date: 10/06/2014 Created
2020 #*******************************************************************************
21−#usage: run_ParseDecoderLog $Decoder_LogFile
22−#eg: input: run_ParseDecoderLog test.264.log
23−# output 1024 720
21+
22+# usage: run_ParseDecoderLog $Decoder_LogFile
23+# eg: input: run_ParseDecoderLog test.264.log
24+# output 1024 720
2425 run_ParseDecoderLog()
2526 {
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" ]]
27+ if [ ! $# -eq 1 ]
4128 then
42− Height=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`
29+ echo "usage: run_ParseDecoderLog \$Decoder_LogFile"
30+ return 1
4331 fi
44− done < ${LogFile}
45− echo "${Width} ${Height}"
32+ local LogFile=$1
33+ local Width=""
34+ local Height=""
35+ while read line
36+ do
37+ if [[ $line =~ "iWidth" ]]
38+ then
39+ Width=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`
40+ fi
41+ if [[ $line =~ "height" ]]
42+ then
43+ Height=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`
44+ fi
45+ done < ${LogFile}
46+ echo "${Width} ${Height}"
4647 }
47−#usage: run_BitStream2YUV $BitstreamName $OutputYUVName $LogFile
48+
49+#usage: run_BitStream2YUV $BitstreamName $OutputYUVName $LogFile
4850 run_BitStream2YUV()
4951 {
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− if [ ! -f ${BitStreamName} ]
59− then
60− echo "bit stream file does not exist!"
61− echo "detected by run_BitStreamToYUV.sh"
62− return 1
63− fi
64− #decode bitstream
65− ./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
66− return 0
52+ if [ ! $# -eq 3 ]
53+ then
54+ echo "usage: run_BitStream2YUV \$BitstreamName \$OutputYUVName \$LogFile "
55+ return 1
56+ fi
57+ local BitStreamName=$1
58+ local OutputYUVName=$2
59+ local LogFile=$3
60+ if [ ! -f ${BitStreamName} ]
61+ then
62+ echo "bit stream file does not exist!"
63+ echo "detected by run_BitStreamToYUV.sh"
64+ return 1
65+ fi
66+ #decode bitstream
67+ ./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
68+ return 0
6769 }
70+
6871 #usage: run_RegularizeYUVName $BitstreamName $OutputYUVName $LogFile
6972 run_RegularizeYUVName()
7073 {
71− if [ ! $# -eq 3 ]
72− then
73− echo "usage: run_RegularizeYUVName \$BitstreamName \$OutputYUVName \$LogFile "
74− return 1
75− fi
76− local BitStreamName=$1
77− local OrignName=$2
78− local LogFile=$3
79− local RegularizedYUVName=""
80− declare -a aDecodedYUVInfo
81− aDecodedYUVInfo=(`run_ParseDecoderLog ${LogFile}`)
82− BitStreamName=`echo ${BitStreamName} | awk 'BEGIN {FS="/"} {print $NF}'`
83− RegularizedYUVName="${BitStreamName}_${aDecodedYUVInfo[0]}x${aDecodedYUVInfo[1]}.yuv"
84− mv -f ${OrignName} ${RegularizedYUVName}
85− echo ""
86− echo "file: ${OrignName} has been renamed as: ${RegularizedYUVName}"
87− echo ""
88− return 0
74+ if [ ! $# -eq 3 ]
75+ then
76+ echo "usage: run_RegularizeYUVName \$BitstreamName \$OutputYUVName \$LogFile "
77+ return 1
78+ fi
79+ local BitStreamName=$1
80+ local OrignName=$2
81+ local LogFile=$3
82+ local RegularizedYUVName=""
83+ declare -a aDecodedYUVInfo
84+ aDecodedYUVInfo=(`run_ParseDecoderLog ${LogFile}`)
85+ BitStreamName=`echo ${BitStreamName} | awk 'BEGIN {FS="/"} {print $NF}'`
86+ RegularizedYUVName="${BitStreamName}_${aDecodedYUVInfo[0]}x${aDecodedYUVInfo[1]}.yuv"
87+ mv -f ${OrignName} ${RegularizedYUVName}
88+ echo ""
89+ echo "file: ${OrignName} has been renamed as: ${RegularizedYUVName}"
90+ echo ""
91+ return 0
8992 }
90−#usage: runMain ${BitStreamName}
93+
94+#usage: runMain ${BitStreamName}
9195 runMain()
9296 {
93− if [ ! $# -eq 1 ]
94− then
95− echo "usage: runMain \${BitStreamName} "
96− return 1
97− fi
98− local BitStreameFile=$1
99− local BitSteamName=`echo ${BitStreameFile} | awk 'BEGIN {FS="/"} {print $NF}'`
100− local DecoderLogFile="${BitSteamName}_h264dec.log"
101− local DecodedYUVName="${BitSteamName}_dec.yuv"
102− local RegularizedName=""
103− #**********************
104− #decoded test bit stream
105− run_BitStream2YUV ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
106− if [ ! $? -eq 0 ]
107− then
108− echo "bit stream decoded failed!"
109− return 1
110− fi
111− #*********************
112− #regularized YUV name
113− run_RegularizeYUVName ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
114− return 0
97+ if [ ! $# -eq 1 ]
98+ then
99+ echo "usage: runMain \${BitStreamName} "
100+ return 1
101+ fi
102+ local BitStreameFile=$1
103+ local BitSteamName=`echo ${BitStreameFile} | awk 'BEGIN {FS="/"} {print $NF}'`
104+ local DecoderLogFile="${BitSteamName}_h264dec.log"
105+ local DecodedYUVName="${BitSteamName}_dec.yuv"
106+ local RegularizedName=""
107+
108+ #**********************
109+ #decoded test bit stream
110+ run_BitStream2YUV ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
111+ if [ ! $? -eq 0 ]
112+ then
113+ echo "bit stream decoded failed!"
114+ return 1
115+ fi
116+ #*********************
117+ #regularized YUV name
118+ run_RegularizeYUVName ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
119+ return 0
115120 }
116121 BitStreamFile=$1
117−runMain ${BitStreamFile}
122+runMain ${BitStreamFile}
118123
test/encoder_binary_comparison/Scripts/run_ParseYUVInfo.sh+49−49
@@ -1,67 +1,67 @@
11 #!/bin/bash
22 #*******************************************************************************
33 # 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.
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.
99 #
1010 #brief:
11−# -- Parse sequence basic info such as picw pich and fps via name
12−# -- Usage: run_ParseYUVInfo.sh ${TestSequenceName}
11+# -- Parse sequence basic info such as picw pich and fps via name
12+# -- Usage: run_ParseYUVInfo.sh ${TestSequenceName}
1313 #
14−# date: 10/06/2014 Created
14+# date: 10/06/2014 Created
1515 #*******************************************************************************
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
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
2020 runGetYUVInfo()
2121 {
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 ]]
22+ if [ ! $# -eq 1 ]
4623 then
47− PicWidth=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $1}'`
48− PicHeight=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $2}'`
49− break
24+ echo "runGetYUVInfo \$TestSequenceName"
25+ echo "detected by run_ParseYUVInfo.sh"
26+ return 1
5027 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
5154 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 ]]
55+ if [ $Index -le ${#aPicInfo[@]} ]
5856 then
59− FPS=`echo ${aPicInfo[$Index]} | awk 'BEGIN {FS="[a-zA-Z]" } {print $1} '`
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
6061 fi
61− fi
62− echo "$PicWidth $PicHeight $FPS"
62+ echo "$PicWidth $PicHeight $FPS"
6363 }
6464 TestSequenceName=$1
65−runGetYUVInfo ${TestSequenceName}
65+runGetYUVInfo ${TestSequenceName}
6666
6767
test/encoder_binary_comparison/Scripts/run_SafeDelete.sh+213−213
@@ -1,246 +1,246 @@
11 #!/bin/bash
2−#*******************************************************************************
2+#***********************************************************************************************************
33 # 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.
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.
99 #
1010 #brief:
11−# -- Usage: ./run_SafeDelete.sh $DeleteItermPath
12−# eg: 1 ./run_SafeDelete.sh tempdata.info --->delete only one file
13−# eg: 2 ./run_SafeDelete.sh ../TempDataFolder --->delete entire folder
14−# ./run_SafeDelete.sh /opt/TempData/ABC --->delete entire folder ABC
11+# -- Usage: ./run_SafeDelete.sh $DeleteItermPath
12+# eg: 1 ./run_SafeDelete.sh tempdata.info --->delete only one file
13+# eg: 2 ./run_SafeDelete.sh ../TempDataFolder --->delete entire folder
14+# ./run_SafeDelete.sh /opt/TempData/ABC --->delete entire folder ABC
1515 #
16−# date: 10/06/2014 Created
17−#*******************************************************************************
18−#usage: runGetFileName $FilePath
16+# date: 10/06/2014 Created
17+#***********************************************************************************************************
18+#usage: runGetFileName $FilePath
1919 runGetFileName()
2020 {
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
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
4646
4747 }
4848 #******************************************************************************************************
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
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
5454 runGetFileFullPath()
5555 {
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
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
8888 }
8989 #******************************************************************************************************
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
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
9595 runGetFolderFullPath()
9696 {
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
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
131131
132132 }
133133 #******************************************************************************************************
134−#usage: runUserNameCheck $whoami
134+#usage: runUserNameCheck $whoami
135135 runUserNameCheck()
136136 {
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_SafeDelete.sh"
152− return 1
153− else
154− echo ""
155− return 0
156− fi
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_SafeDelete.sh"
152+ return 1
153+ else
154+ echo ""
155+ return 0
156+ fi
157157 }
158158 #******************************************************************************************************
159−#usage: runFolderLocationCheck $FullPath
159+#usage: runFolderLocationCheck $FullPath
160160 runFolderLocationCheck()
161161 {
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_SafeDelete.sh"
181− return 1
182− fi
183−
184− return 0
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_SafeDelete.sh"
181+ return 1
182+ fi
183+
184+ return 0
185185 }
186186 #******************************************************************************************************
187187 #usage runSafeDelete $Pathinfo
188188 runSafeDelete()
189189 {
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 item does not exist"
219− echo "detected by run_SafeDelete.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 ""
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 item does not exist"
219+ echo "detected by run_SafeDelete.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 ""
244244
245245 }
246246 PathInfo=$1

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