@@ -7,20 +7,28 @@ import { EncoderResolution, H264Profile, UncloggingMethod } from './encoder/inte
7
7
import { loadInputFile } from './shared/input-files' ;
8
8
9
9
const DEFAULT_FRAMERATE = 30 ;
10
- const TOTAL_TIME_MICROS = 596380000 ;
10
+
11
+ const TOTAL_TIME_MICROS_SAMPLE_FILES = 596380000 ;
12
+ const TOTAL_TIME_MICROS_MAYA_FILES = 187266667 ;
11
13
12
14
const encoderProgressControl = $ ( '#encoder-progress' ) ;
13
15
const exportTimeText = $ ( '#export-time' ) ;
14
16
const outputSizeText = $ ( '#output-size' ) ;
15
17
const decodedFramesText = $ ( '#decoded-frames' ) ;
16
18
const encodedPacketsText = $ ( '#encoded-packets' ) ;
17
19
18
- function setExportProgress ( timestampMicros : number , durationSeconds : number , outputSizeBytes : number , decodedFrames : number , encodedPackets : number ) : void {
19
- encoderProgressControl . css ( 'width' , `${ Math . round ( timestampMicros / TOTAL_TIME_MICROS * 100 ) } %` ) ;
20
- exportTimeText . text ( `${ durationSeconds . toFixed ( 3 ) } ` ) ;
21
- outputSizeText . text ( `${ outputSizeBytes } ` ) ;
22
- decodedFramesText . text ( `${ decodedFrames } ` ) ;
23
- encodedPacketsText . text ( `${ encodedPackets } ` ) ;
20
+ type ExportProgressFunction = ( timestampMicros : number , durationSeconds : number , outputSizeBytes : number , decodedFrames : number , encodedPackets : number ) => void ;
21
+
22
+ function getExportProgressFunction ( inputFileName : string ) : ExportProgressFunction {
23
+ const totalTimeMicros = inputFileName . startsWith ( 'sample' ) ? TOTAL_TIME_MICROS_SAMPLE_FILES : TOTAL_TIME_MICROS_MAYA_FILES ;
24
+
25
+ return ( timestampMicros : number , durationSeconds : number , outputSizeBytes : number , decodedFrames : number , encodedPackets : number ) => {
26
+ encoderProgressControl . css ( 'width' , `${ Math . round ( timestampMicros / totalTimeMicros * 100 ) } %` ) ;
27
+ exportTimeText . text ( `${ durationSeconds . toFixed ( 3 ) } ` ) ;
28
+ outputSizeText . text ( `${ outputSizeBytes } ` ) ;
29
+ decodedFramesText . text ( `${ decodedFrames } ` ) ;
30
+ encodedPacketsText . text ( `${ encodedPackets } ` ) ;
31
+ } ;
24
32
}
25
33
26
34
const loadingProgressControl = $ ( '#loading-progress' ) ;
@@ -44,8 +52,6 @@ $('button#run-benchmark').click(async () => {
44
52
$ ( 'select' ) . attr ( 'disabled' , 'disabled' ) ;
45
53
$ ( 'input' ) . attr ( 'disabled' , 'disabled' ) ;
46
54
47
- setExportProgress ( 0 , 0 , 0 , 0 , 0 ) ;
48
- setLoadingProgress ( 0 , 0 ) ;
49
55
50
56
const inputFileName = $ ( 'select#input-file' ) . val ( ) as string ;
51
57
const decoderAcceleration = $ ( 'select#decoder-acceleration' ) . val ( ) as HardwareAcceleration ;
@@ -63,6 +69,10 @@ $('button#run-benchmark').click(async () => {
63
69
64
70
const showEncodingProgress = $ ( 'input#progress-update:checked' ) . val ( ) === 'on' ;
65
71
72
+ const setExportProgress = getExportProgressFunction ( inputFileName ) ;
73
+
74
+ setExportProgress ( 0 , 0 , 0 , 0 , 0 ) ;
75
+ setLoadingProgress ( 0 , 0 ) ;
66
76
67
77
const inputFile = await loadInputFile ( inputFileName , setLoadingProgress ) ;
68
78
0 commit comments