4
4
OPEN_HEVC_IDX = 1
5
5
AVCONV_IDX = 2
6
6
HM_IDX = 3
7
+ FFMPEG_IDX = 4
7
8
###############################################################################
8
9
# Global
9
10
###############################################################################
26
27
$appli[ HM_IDX ] [ "output" ] = ""
27
28
$appli[ HM_IDX ] [ "label" ] = "HM"
28
29
#
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
+ #
29
35
###############################################################################
30
36
# getopts
31
37
###############################################################################
@@ -34,6 +40,7 @@ def getopts (argv)
34
40
$sourcePattern = nil
35
41
$exec = nil
36
42
$stop = true
43
+ $check = true
37
44
$yuv = false
38
45
$nbThreads = 1
39
46
$FrameBase = false
@@ -43,26 +50,34 @@ def getopts (argv)
43
50
when "-dir" : $sourcePattern = argv [ i +1 ]
44
51
when "-exec" : $exec = argv [ i +1 ]
45
52
when "-noStop" : $stop = false
53
+ when "-noCheck" : $check = false
46
54
when "-yuv" : $yuv = true
47
55
when "-p" : $nbThreads = argv [ i +1 ]
48
56
when "-f" : $FrameBase = true
49
57
end
50
58
end
51
59
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
+
53
65
if $appliIdx == OPEN_HEVC_IDX then
54
66
if $FrameBase == true then
55
67
$appli[ $appliIdx] [ "option" ] = "-p #{ $nbThreads} -f #{ $appli[ $appliIdx] [ "option" ] } "
56
68
else
57
69
$appli[ $appliIdx] [ "option" ] = "-p #{ $nbThreads} #{ $appli[ $appliIdx] [ "option" ] } "
58
70
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
60
75
if $FrameBase == true then
61
76
$appli[ $appliIdx] [ "option" ] = "-threads #{ $nbThreads} -thread_type \" frame\" -i"
62
77
else
63
78
$appli[ $appliIdx] [ "option" ] = "-threads #{ $nbThreads} -thread_type \" slice\" -i"
64
79
end
65
- if $yuv == false then
80
+ if $check == true and $ yuv == false then
66
81
$appli[ $appliIdx] [ "option" ] = "-decode-checksum 1 #{ $appli[ $appliIdx] [ "option" ] } "
67
82
end
68
83
end
@@ -77,6 +92,7 @@ def help ()
77
92
puts "== -dir : pattern directory path =="
78
93
puts "== -exec : exec path =="
79
94
puts "== -noStop : not stop when diff is not ok =="
95
+ puts "== -noCheck : no check md5 =="
80
96
puts "== -yuv : check yuv md5 =="
81
97
puts "== -p : nombre of threads =="
82
98
puts "== -f : enable FrameBase =="
@@ -130,12 +146,11 @@ def getMaxSizeFileName (listFile)
130
146
# save_md5
131
147
###############################################################################
132
148
def save_md5 ( md5 )
133
- if $appliIdx == AVCONV_IDX then
149
+ if $appliIdx == AVCONV_IDX or $appliIdx == FFMPEG_IDX then
134
150
system ( "cp log #{ $appli[ $appliIdx] [ "label" ] } /#{ md5 } " )
135
151
else
136
152
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
139
154
if $appliIdx == HM_IDX then
140
155
system ( "head -n #{ nbLine - 2 } log > log_tmp" )
141
156
system ( "tail -n #{ nbLine - 4 } log_tmp > #{ $appli[ $appliIdx] [ "label" ] } /#{ md5 } " )
@@ -152,22 +167,32 @@ def run (binFile, idxFile, nbFile, maxSize)
152
167
print "= #{ idxFile . to_s . rjust ( nbFile . to_s . size ) } /#{ nbFile } = #{ binFile . ljust ( maxSize ) } "
153
168
154
169
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
159
172
$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 } "
160
177
end
161
178
end
162
179
163
180
cmd = "#{ $exec} #{ $appli[ $appliIdx] [ "option" ] } #{ $sourcePattern} /#{ binFile } #{ $appli[ $appliIdx] [ "output" ] } > log 2> error"
164
181
timeStart = Time . now
165
182
system ( cmd )
166
183
$runTime = Time . now - timeStart
167
- check_error ( binFile )
168
184
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
171
196
File . delete ( yuv )
172
197
end
173
198
end
@@ -187,13 +212,16 @@ def main ()
187
212
listFile = getListFile ( )
188
213
if listFile . length != 0 then
189
214
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 -"
193
220
else
194
- $appli[ $appliIdx] [ "output" ] = "-f md5 - "
221
+ $appli[ $appliIdx] [ "output" ] = "-o yuv "
195
222
end
196
223
end
224
+
197
225
cmd = "#{ $exec} #{ $appli[ $appliIdx] [ "option" ] } binFile #{ $appli[ $appliIdx] [ "output" ] } > log 2> error"
198
226
printLine ( cmd . size )
199
227
puts cmd
0 commit comments