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 @@
1#!/bin/bash1#!/bin/bash
2#*******************************************************************************2#***************************************************************************************************************
3# Encoder binary comparison test model3# Encoder binary comparison test model
4# -- Compared with Benchmark version using SHA-1 string4# -- Compared with Benchmark version using SHA-1 string
5# -- Test bit stream under folder openh264/res5# -- Test bit stream under folder openh264/res
6# -- SHA-1 string of Benchmark version for all cases of all bit streams6# -- SHA-1 string of Benchmark version for all cases of all bit streams
7# under folder openh264/test/encoder_binary_comparion/SHA1Table7# under folder openh264/test/encoder_binary_comparion/SHA1Table
8# -- For more detail,please refer to file AboutTest?¡ê8# -- For more detail,please refer to file AboutTest?¡ê
9#brief:9#brief:
10# -- Test all cases in SHA1TableFile10# -- Test all cases in SHA1TableFile
11# 1) Generate SHA1 string for each case11# 1) Generate SHA1 string for each case
12# 2) Compare with benchmark SHA1 string12# 2) Compare with benchmark SHA1 string
13# 3) If the SHA1 string are the same with benchmark version, test case is marked as passed13# 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: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 change15# --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 right16# --there may be some bugs in encoder and bit stream is not right
17# -- Usage: ./run_BinarySHA1Comparison.sh ${TestYUVName} ${AllCaseSHA1TaleFile}17# -- Usage: ./run_BinarySHA1Comparison.sh ${TestYUVName} ${AllCaseSHA1TaleFile}
18#18#
19# date: 10/06/2014 Created19# date: 10/06/2014 Created
20#*******************************************************************************20#***************************************************************************************************************
21#global variable definition21#global variable definition
22#usage runGlobalVariableDef22#usage runGlobalVariableDef
23runGlobalVariableDef()23runGlobalVariableDef()
24{24{
25 WorkingDirDir=""25 WorkingDirDir=""
26 #test data space26 #test data space
27 FinalResultPath=""27 FinalResultPath=""
28 IssueDataPath=""28 IssueDataPath=""
29 TempDataPath=""29 TempDataPath=""
30 #for test sequence info30 #for test sequence info
31 TestSequenceName=""31 TestSequenceName=""
32 PicW=""32 PicW=""
33 PicH=""33 PicH=""
34 #test cfg file and test info output file34 #test cfg file and test info output file
35 ConfigureFile=""35 ConfigureFile=""
36 AllCaseFile=""36 AllCaseFile=""
37 #xxx.csv37 #xxx.csv
38 AllCasePassStatusFile=""38 AllCasePassStatusFile=""
39 #for encoder command39 #for encoder command
40 declare -a aEncoderCommandSet40 declare -a aEncoderCommandSet
41 declare -a aEncoderCommandName41 declare -a aEncoderCommandName
42 declare -a aEncoderCommandValue42 declare -a aEncoderCommandValue
43 declare -a aRecYUVFileList43 declare -a aRecYUVFileList
44 #encoder parameters change based on the case info44 #encoder parameters change based on the case info
45 let "EncoderFlag = 0"45 let "EncoderFlag = 0"
46 CaseInfo=""46 CaseInfo=""
47 BitStreamFile=""47 BitStreamFile=""
48 DiffFlag=""48 DiffFlag=""
49 #pass number49 #pass number
50 TotalCaseNum=""50 TotalCaseNum=""
51 PassCaseNum=""51 PassCaseNum=""
52 UnpassCaseNum=""52 UnpassCaseNum=""
53}53}
54#called by runGlobalVariableInitial54#called by runGlobalVariableInitial
55#usage runEncoderCommandInital55#usage runEncoderCommandInital
56runEncoderCommandInital()56runEncoderCommandInital()
57{57{
58 aEncoderCommandSet=( -utype -frms -numl -numtl \58
59 -sw -sh "-dw 0" "-dh 0" "-dw 1" "-dh 1" "-dw 2" "-dh 2" "-dw 3" "-dh 3" \59 aEncoderCommandSet=( -utype -frms -numl -numtl \
60 "-frout 0" "-frout 1" "-frout 2" "-frout 3" \60 -sw -sh "-dw 0" "-dh 0" "-dw 1" "-dh 1" "-dw 2" "-dh 2" "-dw 3" "-dh 3" \
61 "-lqp 0" "-lqp 1" "-lqp 2" "-lqp 3" \61 "-frout 0" "-frout 1" "-frout 2" "-frout 3" \
62 -rc -tarb "-ltarb 0" "-ltarb 1" "-ltarb 2" "-ltarb 3" \62 "-lqp 0" "-lqp 1" "-lqp 2" "-lqp 3" \
63 "-slcmd 0" "-slcnum 0" "-slcmd 1" "-slcnum 1"\63 -rc -fs -tarb "-ltarb 0" "-ltarb 1" "-ltarb 2" "-ltarb 3" \
64 "-slcmd 2" "-slcnum 2" "-slcmd 3" "-slcnum 3"\64 "-slcmd 0" "-slcnum 0" "-slcmd 1" "-slcnum 1"\
65 -nalsize \65 "-slcmd 2" "-slcnum 2" "-slcmd 3" "-slcnum 3"\
66 -iper -thread -ltr \66 -nalsize \
67 -db -denois -scene -bgd -aq )67 -iper -thread -ltr \
68 aEncoderCommandName=(usagetype frms numl numtl \68 -db -denois -scene -bgd -aq )
69 sw sh dw0 dh0 dw1 dh1 dw2 dh2 dw3 dh3 \69
70 frout0 frout1 frout2 frout3 \70 aEncoderCommandName=(usagetype frms numl numtl \
71 lqp0 lqp1 lqp2 lqp3 \71 sw sh dw0 dh0 dw1 dh1 dw2 dh2 dw3 dh3 \
72 rc tarb ltarb0 ltarb1 ltarb2 ltarb3 \72 frout0 frout1 frout2 frout3 \
73 slcmd0 slcnum0 slcmd1 slcnum1 \73 lqp0 lqp1 lqp2 lqp3 \
74 slcmd2 slcnum2 slcmd3 slcnum3 \74 rc FrSkip tarb ltarb0 ltarb1 ltarb2 ltarb3 \
75 MaxNalSZ \75 slcmd0 slcnum0 slcmd1 slcnum1 \
76 iper thread ltr \76 slcmd2 slcnum2 slcmd3 slcnum3 \
77 db denois scene bgd aq )77 MaxNalSZ \
78 NumParameter=${#aEncoderCommandSet[@]}78 iper thread ltr \
79 for ((i=0;i<NumParameter; i++))79 db denois scene bgd aq )
80 do80
81 aEncoderCommandValue[$i]=081
82 done82 NumParameter=${#aEncoderCommandSet[@]}
83 for ((i=0;i<NumParameter; i++))
84 do
85 aEncoderCommandValue[$i]=0
86 done
83 87
84}88}
85runGlobalVariableInitial()89runGlobalVariableInitial()
86{90{
87 #TestSpaceDir=../AllTestData CurrentDir=../AllTestData/TestSetXXX/***.264 eg ../AllTestData/TestSetCIF/BA1_MWD.26491 #TestSpaceDir=../AllTestData CurrentDir=../AllTestData/TestSetXXX/***.264 eg ../AllTestData/TestSetCIF/BA1_MWD.264
88 CurrentDir=`pwd`92 CurrentDir=`pwd`
89 #test data space93 #test data space
90 FinalResultPath="${CurrentDir}/result"94 FinalResultPath="${CurrentDir}/result"
91 IssueDataPath="${CurrentDir}/issue"95 IssueDataPath="${CurrentDir}/issue"
92 TempDataPath="TempData"96 TempDataPath="TempData"
93 TestSequencePath="${CurrentDir}"97 TestSequencePath="${CurrentDir}"
94 #get YUV detail info $picW $picH $FPS98 #get YUV detail info $picW $picH $FPS
95 declare -a aYUVInfo99 declare -a aYUVInfo
96 aYUVInfo=(`./run_ParseYUVInfo.sh ${TestSequenceName}`)100 aYUVInfo=(`./run_ParseYUVInfo.sh ${TestSequenceName}`)
97 PicW=${aYUVInfo[0]}101 PicW=${aYUVInfo[0]}
98 PicH=${aYUVInfo[1]}102 PicH=${aYUVInfo[1]}
99 #test cfg file and test info output file103 #test cfg file and test info output file
100 ConfigureFile=welsenc.cfg104 ConfigureFile=welsenc.cfg
101 AllCasePassStatusFile="${FinalResultPath}/${TestSequenceName}_AllCaseOutput.csv"105 AllCasePassStatusFile="${FinalResultPath}/${TestSequenceName}_AllCaseOutput.csv"
102 UnpassCaseFile="${FinalResultPath}/${TestSequenceName}_unpassCaseOutput.csv"106 UnpassCaseFile="${FinalResultPath}/${TestSequenceName}_unpassCaseOutput.csv"
103 UpdateSHA1TableFile="${FinalResultPath}/${TestSequenceName}_UpdateSHA1Table.csv"107 UpdateSHA1TableFile="${FinalResultPath}/${TestSequenceName}_UpdateSHA1Table.csv"
104 HeadLine1="BitMatched Status, SHA-1-Target, SHA-1-Benchmark, MD5-Target, MD5-Benchmark,\108
105 Bitstream-Target,Bitstream-Benchmark,YUV-Target,YUV-Benchmark,\109 HeadLine1="EncoderFlag, DecoderFlag, FPS, BitSreamSHA1, BitSreamMD5, InputYUVSHA1, InputYUVMD5,\
106 -utype, -frms, -numl, -numtl, -sw, -sh,\110 -utype, -frms, -numl, -numtl, -sw, -sh,\
107 -dw 0, -dh 0, -dw 1, -dh 1, -dw 2, -dh 2, -dw 3, -dh 3,\111 -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,\112 -frout 0, -frout 1, -frout 2, -frout 3,\
109 -lqp 0, -lqp 1, -lqp 2, -lqp 3,\113 -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
110 -rc, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\114 -rc,-fs, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
111 -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\115 -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
112 -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\116 -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
113 -nalsize,\117 -nalsize,\
114 -iper, -thread, -ltr, -db, -denois,\118 -iper, -thread, -ltr, -db, -denois,\
115 -scene, -bgd , -aq, "119 -scene, -bgd , -aq, "
116 HeadLine2="SHA-1 Value, MD5String, BitStreamSize, YUVSize, \120
117 -utype, -frms, -numl, -numtl, -sw, -sh,\121 HeadLine2="BitSreamSHA1, BitSreamMD5, InputYUVSHA1, InputYUVMD5,\
118 -dw 0, -dh 0, -dw 1, -dh 1,-dw 2, -dh 2, -dw 3, -dh 3,\122 -utype, -frms, -numl, -numtl, -sw, -sh,\
119 -frout 0, -frout 1, -frout 2, -frout 3,\123 -dw 0, -dh 0, -dw 1, -dh 1,-dw 2, -dh 2, -dw 3, -dh 3,\
120 -lqp 0, -lqp 1, -lqp 2, -lqp 3,\124 -frout 0, -frout 1, -frout 2, -frout 3,\
121 -rc, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\125 -lqp 0, -lqp 1, -lqp 2, -lqp 3,\
122 -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\126 -rc, -fs, -tarb, -ltarb 0, -ltarb 1, -ltarb 2, -ltarb 3,\
123 -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\127 -slcmd 0, -slcnum 0, -slcmd 1, -slcnum 1,\
124 -nalsize,\128 -slcmd 2, -slcnum 2, -slcmd 3, -slcnum 3,\
125 -iper, -thread, -ltr, -db, -denois,\129 -nalsize,\
126 -scene , bgd , -aq "130 -iper, -thread, -ltr, -db, -denois,\
127 echo ${HeadLine1}>${AllCasePassStatusFile}131 -scene , bgd , -aq "
128 echo ${HeadLine1}>${UnpassCaseFile}132
129 echo ${HeadLine2}>${UpdateSHA1TableFile}133
130 134
131 #intial Commandline parameters135 echo ${HeadLine1}>${AllCasePassStatusFile}
132 runEncoderCommandInital136 echo ${HeadLine1}>${UnpassCaseFile}
133 let "TotalCaseNum=0"137 echo ${HeadLine2}>${UpdateSHA1TableFile}
134 let "PassCaseNum=0"138
135 let "UnpassCaseNum=0"139 #intial Commandline parameters
136 EncoderCommand=""140 runEncoderCommandInital
137 EncoderLogFile="${TempDataPath}/Encoder.log"141 let "TotalCaseNum=0"
138 TargetSHA1=""142 let "PassCaseNum=0"
139 TargetMD5=""143 let "UnpassCaseNum=0"
140 TargetYUVSize=""144 EncoderCommand=""
141 TargetBitstreamSize=""145 EncoderLogFile="${TempDataPath}/Encoder.log"
142 BenchmarkSHA1=""146 TargetSHA1=""
143 BenchmarkMD5=""147 TargetMD5=""
144 BenchmarkYUVSize=""148 TargetYUVSHA1=""
145 BenchmarkBitstreamSize=""149 TargetYUVMD5=""
150 BenchmarkSHA1=""
151 BenchmarkMD5=""
152 BenchmarkYUVSHA1=""
153 BenchmarkYUVMD5=""
146}154}
147#***********************************************************155#***********************************************************
148#called by runAllCaseTest156#called by runAllCaseTest
149# parse case info --encoder preprocess157# parse case info --encoder preprocess
150#usage runParseCaseInfo $CaseData158#usage runParseCaseInfo $CaseData
151runParseCaseInfo()159runParseCaseInfo()
152{160{
153 if [ $# -lt 1 ]161 if [ $# -lt 1 ]
154 then162 then
155 echo "no parameter!"163 echo "no parameter!"
156 return 1164 return 1
157 fi165 fi
158 local TempData=""166 local TempData=""
159 local CaseData=$@167 local CaseData=$@
160 local BitstreamPrefix=""168 local BitstreamPrefix=""
161 BenchmarkSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $1} ' `169 BenchmarkSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $1} ' `
162 BenchmarkMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $2} ' `170 BenchmarkMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $2} ' `
163 BenchmarkYUVSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $4} ' `171 BenchmarkYUVSHA1=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $3} ' `
164 BenchmarkBitstreamSize=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $3} ' `172 BenchmarkYUVMD5=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {print $4} ' `
165 173
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 )174
167 TempData=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s",$i)} ' `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 )
168 aEncoderCommandValue=(${TempData})176 TempData=`echo $CaseData |awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s",$i)} ' `
169 let "TempParamFlag=0"177 aEncoderCommandValue=(${TempData})
170 for((i=0; i<$NumParameter; i++))178 let "TempParamFlag=0"
171 do179
180 for((i=0; i<$NumParameter; i++))
181 do
172 for ParnmIndex in ${aTempParamIndex[@]}182 for ParnmIndex in ${aTempParamIndex[@]}
173 do183 do
174 if [ $i -eq ${ParnmIndex} ]184 if [ $i -eq ${ParnmIndex} ]
175 then185 then
176 let "TempParamFlag=1"186 let "TempParamFlag=1"
177 fi187 fi
178 done188 done
189
179 if [ ${TempParamFlag} -eq 0 ]190 if [ ${TempParamFlag} -eq 0 ]
180 then191 then
181 BitstreamPrefix=${BitstreamPrefix}_${aEncoderCommandName[$i]}_${aEncoderCommandValue[$i]}192 BitstreamPrefix=${BitstreamPrefix}_${aEncoderCommandName[$i]}_${aEncoderCommandValue[$i]}
182 fi193 fi
183 let "TempParamFlag=0"194 let "TempParamFlag=0"
184 done195 done
185 196
186 BitstreamTarget=${TempDataPath}/${TestSequenceName}_${BitstreamPrefix}_codec_target.264197 BitstreamTarget=${TempDataPath}/${TestSequenceName}_${BitstreamPrefix}_codec_target.264
187 echo ""198 echo ""
188 echo "BitstreamPrefix is ${BitstreamPrefix}"199 echo "BitstreamPrefix is ${BitstreamPrefix}"
189 echo ""200 echo ""
190}201}
202
191runEncodeOneCase()203runEncodeOneCase()
192{204{
193 local ParamCommand=""205 local ParamCommand=""
194 BitStreamFile=${BitstreamTarget}206 BitStreamFile=${BitstreamTarget}
195 207
196 for ((i=4; i<${NumParameter}; i++))208 for ((i=4; i<${NumParameter}; i++))
197 do209 do
198 ParamCommand="${ParamCommand} ${aEncoderCommandSet[$i]} ${aEncoderCommandValue[$i]} "210 ParamCommand="${ParamCommand} ${aEncoderCommandSet[$i]} ${aEncoderCommandValue[$i]} "
199 done211 done
200 for((i=0;i<4;i++))212
201 do213 for((i=0;i<4;i++))
214 do
202 aRecYUVFileList[$i]="${TempDataPath}/${TestYUVName}_rec${i}.yuv"215 aRecYUVFileList[$i]="${TempDataPath}/${TestYUVName}_rec${i}.yuv"
203 done216 done
204 ParamCommand="${aEncoderCommandSet[0]} ${aEncoderCommandValue[0]} ${aEncoderCommandSet[1]} ${aEncoderCommandValue[1]} \217
205 ${aEncoderCommandSet[2]} ${aEncoderCommandValue[2]} \218 ParamCommand="${aEncoderCommandSet[0]} ${aEncoderCommandValue[0]} ${aEncoderCommandSet[1]} ${aEncoderCommandValue[1]} \
206 -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \219 ${aEncoderCommandSet[2]} ${aEncoderCommandValue[2]} \
207 ${aEncoderCommandSet[3]} ${aEncoderCommandValue[3]} \220 -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
208 ${ParamCommand}"221 ${aEncoderCommandSet[3]} ${aEncoderCommandValue[3]} \
209 echo ""222 ${ParamCommand}"
210 echo "---------------Encode One Case-------------------------------------------"223 echo ""
211 echo "case line is :"224 echo "---------------Encode One Case-------------------------------------------"
212 EncoderCommand="./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \225 echo "case line is :"
213 -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \226 EncoderCommand="./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
214 -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \227 -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
215 -org ${TestSequencePath}/${TestSequenceName}"228 -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
216 echo ${EncoderCommand}229 -org ${TestSequencePath}/${TestSequenceName}"
217 echo -e "\n\n"230 echo ${EncoderCommand}
218 ./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \231 echo -e "\n\n"
219 -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \232 ./h264enc welsenc.cfg ${ParamCommand} -bf ${BitStreamFile} \
220 -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \233 -drec 0 ${aRecYUVFileList[0]} -drec 1 ${aRecYUVFileList[1]} \
221 -org ${TestSequencePath}/${TestSequenceName} 2>${EncoderLogFile}234 -drec 2 ${aRecYUVFileList[2]} -drec 3 ${aRecYUVFileList[3]} \
222 if [ $? -eq 0 ]235 -org ${TestSequencePath}/${TestSequenceName} 2>${EncoderLogFile}
223 then236 if [ $? -eq 0 ]
237 then
224 let "EncoderFlag=0"238 let "EncoderFlag=0"
225 else239 else
226 let "EncoderFlag=1"240 let "EncoderFlag=1"
227 fi241 fi
228 242
229 #delete the core down file as core down files for disk space limitation243 #delete the core down file as core down files for disk space limitation
230 for file in ./core*244 for file in ./core*
231 do245 do
232 if [ -e ${file} ]246 if [ -e ${file} ]
233 then247 then
234 ./run_SafeDelete.sh ${file}248 ./run_SafeDelete.sh ${file}
235 fi249 fi
236 done250 done
237 return 0251 return 0
238}
239#usage? runGetFileSize $FileName
240runGetFileSize()
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
253}252}
254#called by runAllCaseTest253
255#usage runJSVMVerify254#called by runAllCaseTest
255#usage runJSVMVerify
256runBitStreamVerify()256runBitStreamVerify()
257{257{
258 echo ""258 echo ""
259 echo "******************************************"259 echo "******************************************"
260 echo "Bit streamSHA1 value comparison.... "260 echo "Bit streamSHA1 value comparison.... "
261 #*******************************************261 #*******************************************
262 TargetSHA1="NULL"262 TargetSHA1="NULL"
263 TargetMD5="NULL"263 TargetMD5="NULL"
264 TargetYUVSize="NULL"264 TargetYUVSHA1="NULL"
265 TargetBitstreamSize="NULL"265 TargetYUVMD5="NULL"
266 266
267 if [ ${EncoderFlag} -eq 1 ]267 if [ ${EncoderFlag} -eq 1 ]
268 then268 then
269 let "UnpassCaseNum++"269 let "UnpassCaseNum++"
270 echo "1:unpassed! encoder initial failed or crash!"270 echo "1:unpassed! encoder initial failed or crash!"
271 DiffFlag="1:unpassed! encoder initial failed or crash!"271 DiffFlag="1:unpassed! encoder initial failed or crash!"
272 return 1272 return 1
273 fi273 fi
274 274
275 if [ ! -s ${BitStreamFile} ]275 if [ ! -s ${BitStreamFile} ]
276 then276 then
277 let "UnpassCaseNum++"277 let "UnpassCaseNum++"
278 echo "2:unpassed! 0 bits--bit stream"278 echo "2:unpassed! 0 bits--bit stream"
279 DiffFlag="2:unpassed! 0 bits--bit stream"279 DiffFlag="2:unpassed! 0 bits--bit stream"
280 return 1280 return 1
281 fi281 fi
282 #*******************************************282 #*******************************************
283 #*******************************************283 #*******************************************
284 echo ""284 echo ""
285 echo "${BitStreamFile}"285 echo "${BitStreamFile}"
286 #SHA1286 #SHA1
287 TargetSHA1=`openssl sha1 ${BitStreamFile}`287 TargetSHA1=`openssl sha1 ${BitStreamFile}`
288 TargetSHA1=`echo ${TargetSHA1} | awk '{print $2}' `288 TargetSHA1=`echo ${TargetSHA1} | awk '{print $2}' `
289 TargetMD5=`openssl md5 ${BitStreamFile}`289 TargetMD5=`openssl md5 ${BitStreamFile}`
290 TargetMD5=`echo ${TargetMD5} | awk '{print $2}' `290 TargetMD5=`echo ${TargetMD5} | awk '{print $2}' `
291 TargetYUVSize=`runGetFileSize ${TestSequencePath}/${TestSequenceName} `291
292 TargetBitstreamSize=`runGetFileSize ${BitStreamFile}`292 TargetYUVSHA1=`openssl sha1 ${TestSequencePath}/${TestSequenceName} `
293 if [[ "${TargetSHA1}" =~ "${BenchmarkSHA1}" ]]293 TargetYUVSHA1=`echo ${TargetYUVSHA1} | awk '{print $2}' `
294 then294 TargetYUVMD5=`openssl md5 ${TestSequencePath}/${TestSequenceName} `
295 echo "bitstream pass! SHA1--${TargetSHA1} ----- ${BenchmarkSHA1}"295 TargetYUVMD5=`echo ${TargetYUVMD5} | awk '{print $2}' `
296 echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"296
297 echo "YUV size info: size--${TargetYUVSize} ---- ${BenchmarkYUVSize} "297 if [[ "${TargetSHA1}" =~ "${BenchmarkSHA1}" ]]
298 echo "BitStreamSize info: size--${TargetBitstreamSize} ---- ${BenchmarkBitstreamSize}"298 then
299 DiffFlag="0:passed!"299 echo "bitstream pass! SHA1--${TargetSHA1} ----- ${BenchmarkSHA1}"
300 let "PassCaseNum++"300 echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
301 return 0301 echo "YUV SHA1 info: SHA1--${TargetYUVSHA1} ---- ${BenchmarkYUVSHA1} "
302 else302 echo "YUV MD5 info: MD5--${TargetYUVMD5} ---- ${BenchmarkYUVMD5}"
303 echo "!!! SHA1 string not match: ${TargetSHA1} ----- ${BenchmarkSHA1} "303 DiffFlag="0:passed!"
304 echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"304 let "PassCaseNum++"
305 echo "YUV size info: size--${TargetYUVSize} ---- ${BenchmarkYUVSize} "305 return 0
306 echo "BitStreamSize info: size--${TargetBitstreamSize} ---- ${BenchmarkBitstreamSize}"306 else
307 DiffFlag="3:unpassed!"307 echo "!!! SHA1 string not match: ${TargetSHA1} ----- ${BenchmarkSHA1} "
308 let "UnpassCaseNum++"308 echo "MD5 info: MD5--${TargetMD5} ----- ${BenchmarkMD5}"
309 return 1309 echo "YUV SHA1 info: SHA1--${TargetYUVSHA1} ---- ${BenchmarkYUVSHA1} "
310 fi310 echo "YUV MD5 info: MD5--${TargetYUVMD5} ---- ${BenchmarkYUVMD5}"
311 DiffFlag="3:unpassed!"
312 let "UnpassCaseNum++"
313 return 1
314 fi
311}315}
312#called by runAllCaseTest316
313#delete temp data files and output single case test result to log file317#called by runAllCaseTest
314#usage runSingleCasePostAction $CaseData318#delete temp data files and output single case test result to log file
319#usage runSingleCasePostAction $CaseData
315runSingleCasePostAction()320runSingleCasePostAction()
316{321{
317 if [ $# -lt 1 ]322 if [ $# -lt 1 ]
318 then323 then
319 echo "no parameter!"324 echo "no parameter!"
320 return 1325 return 1
321 fi326 fi
322 local CaseData=$@327 local CaseData=$@
323 CaseInfo=`echo $CaseData | awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s,",$i)} '`328 CaseInfo=`echo $CaseData | awk 'BEGIN {FS="[,\r]"} {for(i=5;i<=NF;i++) printf(" %s,",$i)} '`
324 PassStatusInfo="${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, ${TargetMD5}, ${BenchmarkMD5},\329 PassStatusInfo="${DiffFlag}, ${TargetSHA1}, ${BenchmarkSHA1}, ${TargetMD5}, ${BenchmarkMD5},\
325 ${TargetBitstreamSize}, ${BenchmarkBitstreamSize}, ${TargetYUVSize}, ${BenchmarkYUVSize},\330 ${TargetYUVMD5}, ${BenchmarkYUVMD5}, ${TargetYUVSHA1}, ${BenchmarkYUVSHA1},\
326 ${CaseInfo}, ${EncoderCommand} "331 ${CaseInfo}, ${EncoderCommand} "
327 echo "${PassStatusInfo}">>${AllCasePassStatusFile}332 echo "${PassStatusInfo}">>${AllCasePassStatusFile}
328 if [ "$DiffFlag" != "0:passed!" ]333 if [ "$DiffFlag" != "0:passed!" ]
329 then334 then
330 echo "${PassStatusInfo}">>${UnpassCaseFile}335 echo "${PassStatusInfo}">>${UnpassCaseFile}
331 fi336 fi
332 echo "${TargetSHA1}, ${TargetMD5},${TargetBitstreamSize}, ${TargetYUVSize},${CaseInfo}">>${UpdateSHA1TableFile}337 echo "${TargetSHA1}, ${TargetMD5},${TargetYUVMD5}, ${TargetYUVSHA1},${CaseInfo}">>${UpdateSHA1TableFile}
333 ./run_SafeDelete.sh ${BitstreamTarget} >>${AllCaseConsoleLogFile}338 ./run_SafeDelete.sh ${BitstreamTarget} >>${AllCaseConsoleLogFile}
334}339}
340
335#usage runOutputPassNum341#usage runOutputPassNum
336runOutputPassNum()342runOutputPassNum()
337{343{
338 # output file locate in ../result344 # output file locate in ../result
339 echo ""345 echo ""
340 echo "***********************************************************"346 echo "***********************************************************"
341 echo "${TestSequenceName}"347 echo "${TestSequenceName}"
342 echo "total case Num is: ${TotalCaseNum}"348 echo "total case Num is: ${TotalCaseNum}"
343 echo "pass case Num is: ${PassCaseNum}"349 echo "pass case Num is: ${PassCaseNum}"
344 echo "unpass case Num is: ${UnpassCaseNum}"350 echo "unpass case Num is: ${UnpassCaseNum}"
345 echo "***********************************************************"351 echo "***********************************************************"
346 echo ""352 echo ""
347}353}
354
348# run all test case based on XXXcase.csv file355# run all test case based on XXXcase.csv file
349#usage runAllCaseTest356#usage runAllCaseTest
350runAllCaseTest()357runAllCaseTest()
351{358{
352 local EncoderLogInfo=""359 local EncoderLogInfo=""
353 while read CaseData360 while read CaseData
354 do361 do
355 #get case parameter's value362 #get case parameter's value
356 if [[ ! $CaseData =~ "SHA" ]]363 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!" ]
371 then364 then
372 echo -e "\033[32m OK! ${TestSequenceName} Case Index ${TotalCaseNum}:SHA-1(Current--Benchmark): ${TargetSHA1}-----${BenchmarkSHA1} \033[0m"365 echo "" >>${AllCaseConsoleLogFile}
373 echo -e "\033[32m ----MD5 (Current--Benchmark): ${TargetMD5}-----${BenchmarkMD5} \033[0m"366 echo "" >>${AllCaseConsoleLogFile}
374 echo -e "\033[32m ----BitstreamSize: ${TargetBitstreamSize}, ${BenchmarkBitstreamSize} YUVSize: ${TargetYUVSize}, ${BenchmarkYUVSize} \033[0m"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++"
375 fi395 fi
376 fi396 done <$AllCaseFile
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
390}397}
391#***********************************************************398#***********************************************************
392# usage: runMain $TestYUV $AllCaseFile399# usage: runMain $TestYUV $AllCaseFile
393runMain()400runMain()
394{401{
395 if [ ! $# -eq 2 ]402 if [ ! $# -eq 2 ]
396 then403 then
397 echo "usage: run_BinarySHA1Comparison.sh \$TestYUV \$AllCaseFile"404 echo "usage: run_BinarySHA1Comparison.sh \$TestYUV \$AllCaseFile"
398 return 1405 return 1
399 fi406 fi
400 runGlobalVariableDef407
401 #for test sequence info408 runGlobalVariableDef
402 TestSequenceName=$1409
403 AllCaseFile=$2410 #for test sequence info
404 runGlobalVariableInitial411 TestSequenceName=$1
405 TestFolder=`echo $CurrentDir | awk 'BEGIN {FS="/"} { i=NF; print $i}'`412 AllCaseFile=$2
406 AllCaseConsoleLogFile="${FinalResultPath}/${TestSequenceName}.TestLog"413 runGlobalVariableInitial
407 CaseSummaryFile="${FinalResultPath}/${TestSequenceName}.Summary"414 TestFolder=`echo $CurrentDir | awk 'BEGIN {FS="/"} { i=NF; print $i}'`
408 FlagFile=""415 AllCaseConsoleLogFile="${FinalResultPath}/${TestSequenceName}.TestLog"
409 #run all cases416 CaseSummaryFile="${FinalResultPath}/${TestSequenceName}.Summary"
410 runAllCaseTest417 FlagFile=""
411 # output file locate in ./result418
412 echo "${TestSequenceName}, \419 #run all cases
413 ${PassCaseNum} pass!, \420 runAllCaseTest
414 ${UnpassCaseNum} unpass!,\421
415 detail file located in ../AllTestData/${TestFolder}/result">${CaseSummaryFile}422 # output file locate in ./result
416 runOutputPassNum423 echo "${TestSequenceName}, \
417 #generate All case Flag424 ${PassCaseNum} pass!, \
418 if [ ! ${UnpassCaseNum} -eq 0 ]425 ${UnpassCaseNum} unpass!,\
419 then426 detail file located in ../AllTestData/${TestFolder}/result">${CaseSummaryFile}
420 echo ""427 runOutputPassNum
421 exit 1428
422 else429 #generate All case Flag
423 echo ""430 if [ ! ${UnpassCaseNum} -eq 0 ]
424 exit 0431 then
425 fi432 echo ""
433 exit 1
434 else
435 echo ""
436 exit 0
437 fi
426}438}
427TestYUVName=$1439TestYUVName=$1
428AllCaseFile=$2440AllCaseFile=$2
429runMain ${TestYUVName} ${AllCaseFile}441runMain ${TestYUVName} ${AllCaseFile}
430 442
test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh+98−93
@@ -1,118 +1,123 @@
1#!/bin/bash1#!/bin/bash
2#*******************************************************************************2#*******************************************************************************
3# Encoder binary comparison test model3# Encoder binary comparison test model
4# -- Compared with benchmark version using SHA-1 string4# -- Compared with benchmark version using SHA-1 string
5# -- Test bit stream under folder openh264/res5# -- Test bit stream under folder openh264/res
6# -- SHA-1 string of benchmark version for all cases of all bit streams6# -- SHA-1 string of benchmark version for all cases of all bit streams
7# under folder openh264/test/encoder_binary_comparion/SHA1Table7# under folder openh264/test/encoder_binary_comparion/SHA1Table
8# -- For more detail,please refer to file AboutTest.8# -- For more detail,please refer to file AboutTest.
9#9#
10#brief:10#brief:
11# -- Transform test bit stream into YUV as test sequence,11# -- Transform test bit stream into YUV as test sequence,
12# 1) Called by run_OneBitStream.sh before testing all cases12# 1) Called by run_OneBitStream.sh before testing all cases
13# 2) eg:13# 2) eg:
14# -- input: ./run_BitStreamToYUV.sh TestABC.26414# -- input: ./run_BitStreamToYUV.sh TestABC.264
15# -- output: TestABC.264_382X288.yuv15# -- output: TestABC.264_382X288.yuv
16# -- Usage: run_BitStreamToYUV.sh ${BitStreamFile}16# -- Usage: run_BitStreamToYUV.sh ${BitStreamFile}
17#17#
18#18#
19# date: 10/06/2014 Created19# date: 10/06/2014 Created
20#*******************************************************************************20#*******************************************************************************
21#usage: run_ParseDecoderLog $Decoder_LogFile21
22#eg: input: run_ParseDecoderLog test.264.log22# usage: run_ParseDecoderLog $Decoder_LogFile
23# output 1024 72023# eg: input: run_ParseDecoderLog test.264.log
24# output 1024 720
24run_ParseDecoderLog()25run_ParseDecoderLog()
25{26{
26 if [ ! $# -eq 1 ]27 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 then28 then
42 Height=`echo $line | awk 'BEGIN {FS="[:\n]"} {print $2}'`29 echo "usage: run_ParseDecoderLog \$Decoder_LogFile"
30 return 1
43 fi31 fi
44 done < ${LogFile}32 local LogFile=$1
45 echo "${Width} ${Height}"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}"
46}47}
47#usage: run_BitStream2YUV $BitstreamName $OutputYUVName $LogFile48
49#usage: run_BitStream2YUV $BitstreamName $OutputYUVName $LogFile
48run_BitStream2YUV()50run_BitStream2YUV()
49{51{
50 if [ ! $# -eq 3 ]52 if [ ! $# -eq 3 ]
51 then53 then
52 echo "usage: run_BitStream2YUV \$BitstreamName \$OutputYUVName \$LogFile "54 echo "usage: run_BitStream2YUV \$BitstreamName \$OutputYUVName \$LogFile "
53 return 155 return 1
54 fi56 fi
55 local BitStreamName=$157 local BitStreamName=$1
56 local OutputYUVName=$258 local OutputYUVName=$2
57 local LogFile=$359 local LogFile=$3
58 if [ ! -f ${BitStreamName} ]60 if [ ! -f ${BitStreamName} ]
59 then61 then
60 echo "bit stream file does not exist!"62 echo "bit stream file does not exist!"
61 echo "detected by run_BitStreamToYUV.sh"63 echo "detected by run_BitStreamToYUV.sh"
62 return 164 return 1
63 fi65 fi
64 #decode bitstream66 #decode bitstream
65 ./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}67 ./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
66 return 068 return 0
67}69}
70
68#usage: run_RegularizeYUVName $BitstreamName $OutputYUVName $LogFile71#usage: run_RegularizeYUVName $BitstreamName $OutputYUVName $LogFile
69run_RegularizeYUVName()72run_RegularizeYUVName()
70{73{
71 if [ ! $# -eq 3 ]74 if [ ! $# -eq 3 ]
72 then75 then
73 echo "usage: run_RegularizeYUVName \$BitstreamName \$OutputYUVName \$LogFile "76 echo "usage: run_RegularizeYUVName \$BitstreamName \$OutputYUVName \$LogFile "
74 return 177 return 1
75 fi78 fi
76 local BitStreamName=$179 local BitStreamName=$1
77 local OrignName=$280 local OrignName=$2
78 local LogFile=$381 local LogFile=$3
79 local RegularizedYUVName=""82 local RegularizedYUVName=""
80 declare -a aDecodedYUVInfo83 declare -a aDecodedYUVInfo
81 aDecodedYUVInfo=(`run_ParseDecoderLog ${LogFile}`)84 aDecodedYUVInfo=(`run_ParseDecoderLog ${LogFile}`)
82 BitStreamName=`echo ${BitStreamName} | awk 'BEGIN {FS="/"} {print $NF}'`85 BitStreamName=`echo ${BitStreamName} | awk 'BEGIN {FS="/"} {print $NF}'`
83 RegularizedYUVName="${BitStreamName}_${aDecodedYUVInfo[0]}x${aDecodedYUVInfo[1]}.yuv"86 RegularizedYUVName="${BitStreamName}_${aDecodedYUVInfo[0]}x${aDecodedYUVInfo[1]}.yuv"
84 mv -f ${OrignName} ${RegularizedYUVName}87 mv -f ${OrignName} ${RegularizedYUVName}
85 echo ""88 echo ""
86 echo "file: ${OrignName} has been renamed as: ${RegularizedYUVName}"89 echo "file: ${OrignName} has been renamed as: ${RegularizedYUVName}"
87 echo ""90 echo ""
88 return 091 return 0
89}92}
90#usage: runMain ${BitStreamName}93
94#usage: runMain ${BitStreamName}
91runMain()95runMain()
92{96{
93 if [ ! $# -eq 1 ]97 if [ ! $# -eq 1 ]
94 then98 then
95 echo "usage: runMain \${BitStreamName} "99 echo "usage: runMain \${BitStreamName} "
96 return 1100 return 1
97 fi101 fi
98 local BitStreameFile=$1102 local BitStreameFile=$1
99 local BitSteamName=`echo ${BitStreameFile} | awk 'BEGIN {FS="/"} {print $NF}'`103 local BitSteamName=`echo ${BitStreameFile} | awk 'BEGIN {FS="/"} {print $NF}'`
100 local DecoderLogFile="${BitSteamName}_h264dec.log"104 local DecoderLogFile="${BitSteamName}_h264dec.log"
101 local DecodedYUVName="${BitSteamName}_dec.yuv"105 local DecodedYUVName="${BitSteamName}_dec.yuv"
102 local RegularizedName=""106 local RegularizedName=""
103 #**********************107
104 #decoded test bit stream108 #**********************
105 run_BitStream2YUV ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}109 #decoded test bit stream
106 if [ ! $? -eq 0 ]110 run_BitStream2YUV ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
107 then111 if [ ! $? -eq 0 ]
108 echo "bit stream decoded failed!"112 then
109 return 1113 echo "bit stream decoded failed!"
110 fi114 return 1
111 #*********************115 fi
112 #regularized YUV name116 #*********************
113 run_RegularizeYUVName ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}117 #regularized YUV name
114 return 0118 run_RegularizeYUVName ${BitStreameFile} ${DecodedYUVName} ${DecoderLogFile}
119 return 0
115}120}
116BitStreamFile=$1121BitStreamFile=$1
117runMain ${BitStreamFile}122runMain ${BitStreamFile}
118 123
test/encoder_binary_comparison/Scripts/run_ParseYUVInfo.sh+49−49
@@ -1,67 +1,67 @@
1#!/bin/bash1#!/bin/bash
2#*******************************************************************************2#*******************************************************************************
3# Encoder binary comparison test model3# Encoder binary comparison test model
4# -- Compared with benchmark version using SHA-1 string4# -- Compared with benchmark version using SHA-1 string
5# -- Test bit stream under folder openh264/res5# -- Test bit stream under folder openh264/res
6# -- SHA-1 string of benchmark version for all cases of all bit streams6# -- SHA-1 string of benchmark version for all cases of all bit streams
7# under folder openh264/test/encoder_binary_comparion/SHA1Table7# under folder openh264/test/encoder_binary_comparion/SHA1Table
8# -- For more detail,please refer to file AboutTest.8# -- For more detail,please refer to file AboutTest.
9#9#
10#brief:10#brief:
11# -- Parse sequence basic info such as picw pich and fps via name11# -- Parse sequence basic info such as picw pich and fps via name
12# -- Usage: run_ParseYUVInfo.sh ${TestSequenceName}12# -- Usage: run_ParseYUVInfo.sh ${TestSequenceName}
13#13#
14# date: 10/06/2014 Created14# date: 10/06/2014 Created
15#*******************************************************************************15#*******************************************************************************
16#usage runGetYUVInfo $TestSequenceName16#usage runGetYUVInfo $TestSequenceName
17#eg. input: ABC_1920X1080_30fps_XXX.yuv output: 1920 1080 3017#eg. input: ABC_1920X1080_30fps_XXX.yuv output: 1920 1080 30
18#eg. input: ABC_1920X1080_XXX.yuv output: 1920 1080 018#eg. input: ABC_1920X1080_XXX.yuv output: 1920 1080 0
19#eg. input: ABC_XXX.yuv output: 0 0 019#eg. input: ABC_XXX.yuv output: 0 0 0
20runGetYUVInfo()20runGetYUVInfo()
21{21{
22 if [ ! $# -eq 1 ]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 then23 then
47 PicWidth=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $1}'`24 echo "runGetYUVInfo \$TestSequenceName"
48 PicHeight=`echo $Iterm | awk 'BEGIN {FS="[xX]"} {print $2}'`25 echo "detected by run_ParseYUVInfo.sh"
49 break26 return 1
50 fi27 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
51 let "Index++"54 let "Index++"
52 done55 if [ $Index -le ${#aPicInfo[@]} ]
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 then56 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
60 fi61 fi
61 fi62 echo "$PicWidth $PicHeight $FPS"
62 echo "$PicWidth $PicHeight $FPS"
63}63}
64TestSequenceName=$164TestSequenceName=$1
65runGetYUVInfo ${TestSequenceName}65runGetYUVInfo ${TestSequenceName}
66 66
67 67
test/encoder_binary_comparison/Scripts/run_SafeDelete.sh+213−213
@@ -1,246 +1,246 @@
1#!/bin/bash1#!/bin/bash
2#*******************************************************************************2#***********************************************************************************************************
3# Encoder binary comparison test model3# Encoder binary comparison test model
4# -- Compared with benchmark version using SHA-1 string4# -- Compared with benchmark version using SHA-1 string
5# -- Test bit stream under folder openh264/res5# -- Test bit stream under folder openh264/res
6# -- SHA-1 string of benchmark version for all cases of all bit streams6# -- SHA-1 string of benchmark version for all cases of all bit streams
7# under folder openh264/test/encoder_binary_comparion/SHA1Table7# under folder openh264/test/encoder_binary_comparion/SHA1Table
8# -- For more detail,please refer to file AboutTest.8# -- For more detail,please refer to file AboutTest.
9#9#
10#brief:10#brief:
11# -- Usage: ./run_SafeDelete.sh $DeleteItermPath11# -- Usage: ./run_SafeDelete.sh $DeleteItermPath
12# eg: 1 ./run_SafeDelete.sh tempdata.info --->delete only one file12# eg: 1 ./run_SafeDelete.sh tempdata.info --->delete only one file
13# eg: 2 ./run_SafeDelete.sh ../TempDataFolder --->delete entire folder13# eg: 2 ./run_SafeDelete.sh ../TempDataFolder --->delete entire folder
14# ./run_SafeDelete.sh /opt/TempData/ABC --->delete entire folder ABC14# ./run_SafeDelete.sh /opt/TempData/ABC --->delete entire folder ABC
15#15#
16# date: 10/06/2014 Created16# date: 10/06/2014 Created
17#*******************************************************************************17#***********************************************************************************************************
18#usage: runGetFileName $FilePath18#usage: runGetFileName $FilePath
19runGetFileName()19runGetFileName()
20{20{
21 #parameter check!21 #parameter check!
22 if [ ! $# -eq 1 ]22 if [ ! $# -eq 1 ]
23 then23 then
24 echo "usage: runGetFileName \$FilePath"24 echo "usage: runGetFileName \$FilePath"
25 return 125 return 1
26 fi26 fi
27 27
28 local PathInfo=$128 local PathInfo=$1
29 local FileName=""29 local FileName=""
30 30
31 if [[ $PathInfo =~ ^"/" ]]31 if [[ $PathInfo =~ ^"/" ]]
32 then32 then
33 FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`33 FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`
34 echo "${FileName}"34 echo "${FileName}"
35 return 035 return 0
36 elif [[ $PathInfo =~ ^".." ]]36 elif [[ $PathInfo =~ ^".." ]]
37 then37 then
38 FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`38 FileName=` echo ${PathInfo} | awk 'BEGIN {FS="/"}; {print $NF}'`
39 echo "${FileName}"39 echo "${FileName}"
40 return 040 return 0
41 else41 else
42 FileName=${PathInfo}42 FileName=${PathInfo}
43 echo "${FileName}"43 echo "${FileName}"
44 return 044 return 0
45 fi45 fi
46 46
47}47}
48#******************************************************************************************************48#******************************************************************************************************
49#usage: runGetFileFullPath $FilePathInfo49#usage: runGetFileFullPath $FilePathInfo
50#eg: current path is /opt/VideoTest/openh264/ABC50#eg: current path is /opt/VideoTest/openh264/ABC
51# runGetFileFullPath abc.txt --->/opt/VideoTest/openh264/ABC51# runGetFileFullPath abc.txt --->/opt/VideoTest/openh264/ABC
52# runGetFileFullPath ../123.txt --->/opt/VideoTest/openh26452# runGetFileFullPath ../123.txt --->/opt/VideoTest/openh264
53# runGetFileFullPath /opt/VieoTest/456.txt --->/opt/VieoTest53# runGetFileFullPath /opt/VieoTest/456.txt --->/opt/VieoTest
54runGetFileFullPath()54runGetFileFullPath()
55{55{
56 #parameter check!56 #parameter check!
57 if [ ! $# -eq 1 ]57 if [ ! $# -eq 1 ]
58 then58 then
59 echo "usage: runGetFileFullPath \$FilePathInfo "59 echo "usage: runGetFileFullPath \$FilePathInfo "
60 return 160 return 1
61 fi61 fi
62 62
63 local PathInfo=$163 local PathInfo=$1
64 local FullPath=""64 local FullPath=""
65 local CurrentDir=`pwd`65 local CurrentDir=`pwd`
66 66
67 if [[ $PathInfo =~ ^"/" ]]67 if [[ $PathInfo =~ ^"/" ]]
68 then68 then
69 FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`69 FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`
70 cd ${FullPath}70 cd ${FullPath}
71 FullPath=`pwd`71 FullPath=`pwd`
72 cd ${CurrentDir}72 cd ${CurrentDir}
73 echo "${FullPath}"73 echo "${FullPath}"
74 return 074 return 0
75 elif [[ $PathInfo =~ ^".." ]]75 elif [[ $PathInfo =~ ^".." ]]
76 then76 then
77 FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`77 FullPath=`echo ${PathInfo} |awk 'BEGIN {FS="/"} {for (i=1;i<NF;i++) printf("%s/",$i)}'`
78 cd ${FullPath}78 cd ${FullPath}
79 FullPath=`pwd`79 FullPath=`pwd`
80 cd ${CurrentDir}80 cd ${CurrentDir}
81 echo "${FullPath}"81 echo "${FullPath}"
82 return 082 return 0
83 else83 else
84 FullPath=${CurrentDir}84 FullPath=${CurrentDir}
85 echo "${FullPath}"85 echo "${FullPath}"
86 return 086 return 0
87 fi87 fi
88}88}
89#******************************************************************************************************89#******************************************************************************************************
90#usage: runGetFolderFullPath $FolderPathInfo90#usage: runGetFolderFullPath $FolderPathInfo
91#eg: current path is /opt/VideoTest/openh264/ABC91#eg: current path is /opt/VideoTest/openh264/ABC
92# runGetFolderFullPat SubFolder --->/opt/VideoTest/openh264/ABC/ SubFolder92# runGetFolderFullPat SubFolder --->/opt/VideoTest/openh264/ABC/ SubFolder
93# runGetFolderFullPat ../EFG --->/opt/VideoTest/openh264/EFG93# runGetFolderFullPat ../EFG --->/opt/VideoTest/openh264/EFG
94# runGetFolderFullPat /opt/VieoTest/MyFolder --->/opt/VieoTest/MyFolder94# runGetFolderFullPat /opt/VieoTest/MyFolder --->/opt/VieoTest/MyFolder
95runGetFolderFullPath()95runGetFolderFullPath()
96{96{
97 #parameter check!97 #parameter check!
98 if [ ! $# -eq 1 ]98 if [ ! $# -eq 1 ]
99 then99 then
100 echo "usage: runGetFolderFullPath \$FolderPathInfo "100 echo "usage: runGetFolderFullPath \$FolderPathInfo "
101 return 1101 return 1
102 fi102 fi
103 103
104 local PathInfo=$1104 local PathInfo=$1
105 local FullPath=""105 local FullPath=""
106 local CurrentDir=`pwd`106 local CurrentDir=`pwd`
107 107
108 if [[ $PathInfo =~ ^"/" ]]108 if [[ $PathInfo =~ ^"/" ]]
109 then109 then
110 FullPath=${PathInfo}110 FullPath=${PathInfo}
111 cd ${FullPath}111 cd ${FullPath}
112 FullPath=`pwd`112 FullPath=`pwd`
113 cd ${CurrentDir}113 cd ${CurrentDir}
114 echo "${FullPath}"114 echo "${FullPath}"
115 return 0115 return 0
116 elif [[ $PathInfo =~ ^".." ]]116 elif [[ $PathInfo =~ ^".." ]]
117 then117 then
118 cd ${PathInfo}118 cd ${PathInfo}
119 FullPath=`pwd`119 FullPath=`pwd`
120 cd ${CurrentDir}120 cd ${CurrentDir}
121 echo "${FullPath}"121 echo "${FullPath}"
122 return 0122 return 0
123 else123 else
124 FullPath="${CurrentDir}/${PathInfo}"124 FullPath="${CurrentDir}/${PathInfo}"
125 cd ${FullPath}125 cd ${FullPath}
126 FullPath=`pwd`126 FullPath=`pwd`
127 cd ${CurrentDir}127 cd ${CurrentDir}
128 echo "${FullPath}"128 echo "${FullPath}"
129 return 0129 return 0
130 fi130 fi
131 131
132}132}
133#******************************************************************************************************133#******************************************************************************************************
134#usage: runUserNameCheck $whoami134#usage: runUserNameCheck $whoami
135runUserNameCheck()135runUserNameCheck()
136{136{
137 #parameter check!137 #parameter check!
138 if [ ! $# -eq 1 ]138 if [ ! $# -eq 1 ]
139 then139 then
140 echo "usage: runUserNameCheck \$whoami"140 echo "usage: runUserNameCheck \$whoami"
141 return 1141 return 1
142 fi142 fi
143 143
144 local UserName=$1144 local UserName=$1
145 145
146 if [ ${UserName} = "root" ]146 if [ ${UserName} = "root" ]
147 then147 then
148 echo ""148 echo ""
149 echo "*********************************************"149 echo "*********************************************"
150 echo "delete files under root is not allowed"150 echo "delete files under root is not allowed"
151 echo "detected by run_SafeDelete.sh"151 echo "detected by run_SafeDelete.sh"
152 return 1152 return 1
153 else153 else
154 echo ""154 echo ""
155 return 0155 return 0
156 fi156 fi
157}157}
158#******************************************************************************************************158#******************************************************************************************************
159#usage: runFolderLocationCheck $FullPath159#usage: runFolderLocationCheck $FullPath
160runFolderLocationCheck()160runFolderLocationCheck()
161{161{
162 #parameter check!162 #parameter check!
163 if [ ! $# -eq 1 ]163 if [ ! $# -eq 1 ]
164 then164 then
165 echo "usage: runFolderLocationCheck \$FullPath"165 echo "usage: runFolderLocationCheck \$FullPath"
166 return 1166 return 1
167 fi167 fi
168 168
169 local Location=$1169 local Location=$1
170 local FileDirDepth=`echo ${Location} | awk 'BEGIN {FS="/"} {print NF}'`170 local FileDirDepth=`echo ${Location} | awk 'BEGIN {FS="/"} {print NF}'`
171 171
172 #for other non-project folder data protection172 #for other non-project folder data protection
173 #eg /opt/VideoTest/DeletedItem depth=4173 #eg /opt/VideoTest/DeletedItem depth=4
174 if [ $FileDirDepth -lt 5 ]174 if [ $FileDirDepth -lt 5 ]
175 then175 then
176 echo ""176 echo ""
177 echo "*********************************************"177 echo "*********************************************"
178 echo "FileDepth is $FileDirDepth, and it is less thab the minimum depth(5)"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"179 echo "unsafe delete! try to delete non-project related files: $FileDir"
180 echo "detected by run_SafeDelete.sh"180 echo "detected by run_SafeDelete.sh"
181 return 1181 return 1
182 fi182 fi
183 183
184 return 0184 return 0
185}185}
186#******************************************************************************************************186#******************************************************************************************************
187#usage runSafeDelete $Pathinfo187#usage runSafeDelete $Pathinfo
188runSafeDelete()188runSafeDelete()
189{189{
190 #parameter check!190 #parameter check!
191 if [ ! $# -eq 1 ]191 if [ ! $# -eq 1 ]
192 then192 then
193 echo "usage runSafeDelete \$FileFullPath"193 echo "usage runSafeDelete \$FileFullPath"
194 return 1194 return 1
195 fi195 fi
196 196
197 local PathInfo=$1197 local PathInfo=$1
198 local UserName=`whoami`198 local UserName=`whoami`
199 local FullPath=""199 local FullPath=""
200 local DeleteIterm=""200 local DeleteIterm=""
201 local FileName=""201 local FileName=""
202 202
203 #user validity check203 #user validity check
204 runUserNameCheck ${UserName}204 runUserNameCheck ${UserName}
205 if [ ! $? -eq 0 ]205 if [ ! $? -eq 0 ]
206 then206 then
207 return 1207 return 1
208 fi208 fi
209 209
210 #get full path210 #get full path
211 if [ -d $PathInfo ]211 if [ -d $PathInfo ]
212 then212 then
213 FullPath=`runGetFolderFullPath ${PathInfo} `213 FullPath=`runGetFolderFullPath ${PathInfo} `
214 elif [ -f $PathInfo ]214 elif [ -f $PathInfo ]
215 then215 then
216 FullPath=`runGetFileFullPath ${PathInfo} `216 FullPath=`runGetFileFullPath ${PathInfo} `
217 else217 else
218 echo "delete item does not exist"218 echo "delete item does not exist"
219 echo "detected by run_SafeDelete.sh"219 echo "detected by run_SafeDelete.sh"
220 return 1220 return 1
221 fi221 fi
222 222
223 #location validity check223 #location validity check
224 runFolderLocationCheck ${FullPath}224 runFolderLocationCheck ${FullPath}
225 if [ ! $? -eq 0 ]225 if [ ! $? -eq 0 ]
226 then226 then
227 return 1227 return 1
228 fi228 fi
229 229
230 #delete file/folder230 #delete file/folder
231 if [ -d $PathInfo ]231 if [ -d $PathInfo ]
232 then232 then
233 DeleteIterm=${FullPath}233 DeleteIterm=${FullPath}
234 echo "deleted folder is: $DeleteIterm"234 echo "deleted folder is: $DeleteIterm"
235 rm -rf ${DeleteIterm}235 rm -rf ${DeleteIterm}
236 elif [ -f $PathInfo ]236 elif [ -f $PathInfo ]
237 then237 then
238 FileName=`runGetFileName ${PathInfo}`238 FileName=`runGetFileName ${PathInfo}`
239 DeleteIterm="${FullPath}/${FileName}"239 DeleteIterm="${FullPath}/${FileName}"
240 echo "deleted file is: $DeleteIterm"240 echo "deleted file is: $DeleteIterm"
241 rm ${DeleteIterm}241 rm ${DeleteIterm}
242 fi242 fi
243 echo ""243 echo ""
244 244
245}245}
246PathInfo=$1246PathInfo=$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