Skip to content

Commit 687038a

Browse files
committed
update scripts
1 parent 74bc071 commit 687038a

File tree

5 files changed

+69
-87
lines changed

5 files changed

+69
-87
lines changed

runPattern.rb

+23-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ def grep_msg (msg, log)
1616
# check_yuv
1717
###############################################################################
1818
def check_yuv (binFile)
19+
return if grep_msg("Segmentation fault", "error") == -1
20+
1921
md5 = "#{File.basename(binFile, File.extname(binFile))}.md5"
2022

21-
if $appliIdx == AVCONV_IDX then
23+
if $appliIdx == AVCONV_IDX or $appliIdx == FFMPEG_IDX then
2224
save_md5(md5)
2325
cmd = "grep MD5 #{$appli[$appliIdx]["label"]}/#{md5}"
2426
else
@@ -45,10 +47,7 @@ def check_yuv (binFile)
4547
###############################################################################
4648
def check_error (binFile)
4749
return if grep_msg("Segmentation fault", "error") == -1
48-
if $yuv == true then
49-
check_yuv(binFile)
50-
return
51-
end
50+
5251
cmd = "grep \"Correct\" error"
5352
ret = IO.popen(cmd).readlines
5453
if ret[1] == nil and $appliIdx != HM_IDX then
@@ -96,6 +95,25 @@ def check_error (binFile)
9695

9796
end
9897
###############################################################################
98+
# check_perfs
99+
###############################################################################
100+
def check_perfs (binFile)
101+
if $appliIdx == OPEN_HEVC_IDX then
102+
cmd = "grep frame log"
103+
ret = IO.popen(cmd).readlines
104+
puts " #{ret}"
105+
elsif $appliIdx == HM_IDX then
106+
cmd = "grep POC log"
107+
ret = IO.popen(cmd).readlines
108+
puts sprintf(" frame= #{ret.size} fps= #{(ret.size/$runTime).round} time= %.2f", $runTime )
109+
else
110+
cmd = "grep frame error"
111+
ret = IO.popen(cmd).readlines
112+
val = ret[0].scan(/frame= *([0-9]*)/)[0][0].to_i
113+
puts sprintf(" frame= #{val} fps= #{(val/$runTime).round} time= %.2f", $runTime )
114+
end
115+
end
116+
###############################################################################
99117
# main
100118
###############################################################################
101119
main()

runPatternCommon.rb

+45-17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
OPEN_HEVC_IDX = 1
55
AVCONV_IDX = 2
66
HM_IDX = 3
7+
FFMPEG_IDX = 4
78
###############################################################################
89
# Global
910
###############################################################################
@@ -26,6 +27,11 @@
2627
$appli[HM_IDX]["output"] = ""
2728
$appli[HM_IDX]["label"] = "HM"
2829
#
30+
$appli[FFMPEG_IDX] = {}
31+
$appli[FFMPEG_IDX]["option"] = "-decode-checksum 1 -thread_type \"slice\" -i"
32+
$appli[FFMPEG_IDX]["output"] = "-vsync drop -f null -"
33+
$appli[FFMPEG_IDX]["label"] = "ffmpeg"
34+
#
2935
###############################################################################
3036
# getopts
3137
###############################################################################
@@ -34,6 +40,7 @@ def getopts (argv)
3440
$sourcePattern = nil
3541
$exec = nil
3642
$stop = true
43+
$check = true
3744
$yuv = false
3845
$nbThreads = 1
3946
$FrameBase = false
@@ -43,26 +50,34 @@ def getopts (argv)
4350
when "-dir" : $sourcePattern = argv[i+1]
4451
when "-exec" : $exec = argv[i+1]
4552
when "-noStop" : $stop = false
53+
when "-noCheck" : $check = false
4654
when "-yuv" : $yuv = true
4755
when "-p" : $nbThreads = argv[i+1]
4856
when "-f" : $FrameBase = true
4957
end
5058
end
5159
help() if $sourcePattern == nil or $exec == nil
52-
$appliIdx = if /hevc/ =~ $exec then OPEN_HEVC_IDX elsif /TAppDecoder/ =~ $exec then HM_IDX else AVCONV_IDX end
60+
$appliIdx = if /hevc/ =~ $exec then OPEN_HEVC_IDX
61+
elsif /TAppDecoder/ =~ $exec then HM_IDX
62+
elsif /ffmpeg/ =~ $exec then FFMPEG_IDX
63+
else AVCONV_IDX end
64+
5365
if $appliIdx == OPEN_HEVC_IDX then
5466
if $FrameBase == true then
5567
$appli[$appliIdx]["option"] = "-p #{$nbThreads} -f #{$appli[$appliIdx]["option"]}"
5668
else
5769
$appli[$appliIdx]["option"] = "-p #{$nbThreads} #{$appli[$appliIdx]["option"]}"
5870
end
59-
elsif $appliIdx == AVCONV_IDX then
71+
if $check == false and $yuv == false then
72+
$appli[$appliIdx]["option"] = "-c #{$appli[$appliIdx]["option"]}"
73+
end
74+
elsif $appliIdx == AVCONV_IDX or $appliIdx == FFMPEG_IDX then
6075
if $FrameBase == true then
6176
$appli[$appliIdx]["option"] = "-threads #{$nbThreads} -thread_type \"frame\" -i"
6277
else
6378
$appli[$appliIdx]["option"] = "-threads #{$nbThreads} -thread_type \"slice\" -i"
6479
end
65-
if $yuv == false then
80+
if $check == true and $yuv == false then
6681
$appli[$appliIdx]["option"] = "-decode-checksum 1 #{$appli[$appliIdx]["option"]}"
6782
end
6883
end
@@ -77,6 +92,7 @@ def help ()
7792
puts "== -dir : pattern directory path =="
7893
puts "== -exec : exec path =="
7994
puts "== -noStop : not stop when diff is not ok =="
95+
puts "== -noCheck : no check md5 =="
8096
puts "== -yuv : check yuv md5 =="
8197
puts "== -p : nombre of threads =="
8298
puts "== -f : enable FrameBase =="
@@ -130,12 +146,11 @@ def getMaxSizeFileName (listFile)
130146
# save_md5
131147
###############################################################################
132148
def save_md5(md5)
133-
if $appliIdx == AVCONV_IDX then
149+
if $appliIdx == AVCONV_IDX or $appliIdx == FFMPEG_IDX then
134150
system("cp log #{$appli[$appliIdx]["label"]}/#{md5}")
135151
else
136152
ret = IO.popen("wc -l log").readlines
137-
from = /([0-9]*) */
138-
nbLine = (ret[0].scan(from))[0][0].to_i
153+
nbLine = (ret[0].scan(/([0-9]*) */))[0][0].to_i
139154
if $appliIdx == HM_IDX then
140155
system("head -n #{nbLine - 2} log > log_tmp")
141156
system("tail -n #{nbLine - 4} log_tmp > #{$appli[$appliIdx]["label"]}/#{md5}")
@@ -152,22 +167,32 @@ def run (binFile, idxFile, nbFile, maxSize)
152167
print "= #{idxFile.to_s.rjust(nbFile.to_s.size)}/#{nbFile} = #{binFile.ljust(maxSize)}"
153168

154169
yuv = "#{File.basename(binFile, File.extname(binFile))}.yuv"
155-
if $yuv == true then
156-
if $appliIdx != AVCONV_IDX then
157-
$appli[$appliIdx]["output"] = "-o #{yuv}"
158-
else
170+
if $check == true and $yuv == true then
171+
if $appliIdx == AVCONV_IDX then
159172
$appli[$appliIdx]["output"] = "-f md5 -"
173+
elsif $appliIdx == FFMPEG_IDX then
174+
$appli[$appliIdx]["output"] = "-vsync drop -f md5 -"
175+
else
176+
$appli[$appliIdx]["output"] = "-o #{yuv}"
160177
end
161178
end
162179

163180
cmd = "#{$exec} #{$appli[$appliIdx]["option"]} #{$sourcePattern}/#{binFile} #{$appli[$appliIdx]["output"]} > log 2> error"
164181
timeStart = Time.now
165182
system(cmd)
166183
$runTime = Time.now - timeStart
167-
check_error(binFile)
168184

169-
if $yuv == true then
170-
if $appliIdx != AVCONV_IDX then
185+
if $check == true then
186+
if $yuv == true then
187+
check_yuv(binFile)
188+
else
189+
check_error(binFile)
190+
end
191+
else
192+
check_perfs(binFile)
193+
end
194+
if $check == true and $yuv == true then
195+
if $appliIdx != AVCONV_IDX and $appliIdx != FFMPEG_IDX then
171196
File.delete(yuv)
172197
end
173198
end
@@ -187,13 +212,16 @@ def main ()
187212
listFile = getListFile()
188213
if listFile.length != 0 then
189214
maxSize = getMaxSizeFileName(listFile)
190-
if $yuv == true then
191-
if $appliIdx != AVCONV_IDX then
192-
$appli[$appliIdx]["output"] = "-o yuv"
215+
if $check == true and $yuv == true then
216+
if $appliIdx == AVCONV_IDX then
217+
$appli[$appliIdx]["output"] = "-f md5 -"
218+
elsif $appliIdx == FFMPEG_IDX then
219+
$appli[$appliIdx]["output"] = "-vsync drop -f md5 -"
193220
else
194-
$appli[$appliIdx]["output"] = "-f md5 -"
221+
$appli[$appliIdx]["output"] = "-o yuv"
195222
end
196223
end
224+
197225
cmd = "#{$exec} #{$appli[$appliIdx]["option"]} binFile #{$appli[$appliIdx]["output"]} > log 2> error"
198226
printLine(cmd.size)
199227
puts cmd

testOpenHevc.rb

-23
This file was deleted.

testPerf.rb

-34
This file was deleted.

testPerfMain.rb

+1-8
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@
2121

2222
["i_main", "ld_main", "lp_main", "ra_main"].each do |dir|
2323
for i in 0 .. 1 do
24-
cmd = "./testPerf.rb -exec #{exec[i]} -dir #{pattern}/#{dir} > perf/#{output[i]}_#{dir}.txt"
24+
cmd = "./runPattern.rb -exec #{exec[i]} -dir #{pattern}/#{dir} -noCheck > perf/#{output[i]}_#{dir}.txt"
2525
system(cmd)
2626
end
2727
end
28-
29-
if File.exist?("openHEVC_perf") then
30-
deleteDir("openHEVC_perf")
31-
end
32-
if File.exist?("HM_perf") then
33-
deleteDir("HM_perf")
34-
end

0 commit comments

Comments
 (0)