Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 46d4af3

Browse files
committed
Add extra test videos
1 parent 0181451 commit 46d4af3

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/index.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ <h3>Decoder settings</h3>
2727
<div class="mb-3">
2828
<label for="input-file" class="form-label">Input file:</label>
2929
<select id="input-file" class="form-select">
30-
<option value="sample_480p_30fps.mp4">sample_480p_30fps.mp4</option>
31-
<option value="sample_720p_30fps.mp4">sample_720p_30fps.mp4</option>
32-
<option selected value="sample_1080p_30fps.mp4">sample_1080p_30fps.mp4</option>
33-
<option value="sample_1440p_30fps.mp4">sample_1440p_30fps.mp4</option>
34-
<option value="sample_4K_30fps.mp4">sample_4K_30fps.mp4</option>
30+
<option value="sample_480p_30fps.mp4">Big Buck Bunny (480p, AVC high, 30 fps)</option>
31+
<option value="sample_720p_30fps.mp4">Big Buck Bunny (720p, AVC high, 30 fps)</option>
32+
<option selected value="sample_1080p_30fps.mp4">Big Buck Bunny (1080p, AVC high, 30 fps)</option>
33+
<option value="sample_1440p_30fps.mp4">Big Buck Bunny (1440p, AVC high, 30 fps)</option>
34+
<option value="sample_4K_30fps.mp4">Big Buck Bunny (2160p, AVC high, 30 fps)</option>
35+
<option value="maya_pyramid_1080p.mp4">Maya Pyramid (1080p, AVC constrained baseline, 30 fps)</option>
36+
<option value="maya_pyramid_4K.mp4">Maya Pyramid (2160p, AVC high, 30 fps)</option>
3537
</select>
3638
</div>
3739

src/index.ts

+19-9
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ import { EncoderResolution, H264Profile, UncloggingMethod } from './encoder/inte
77
import { loadInputFile } from './shared/input-files';
88

99
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;
1113

1214
const encoderProgressControl = $('#encoder-progress');
1315
const exportTimeText = $('#export-time');
1416
const outputSizeText = $('#output-size');
1517
const decodedFramesText = $('#decoded-frames');
1618
const encodedPacketsText = $('#encoded-packets');
1719

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+
};
2432
}
2533

2634
const loadingProgressControl = $('#loading-progress');
@@ -44,8 +52,6 @@ $('button#run-benchmark').click(async () => {
4452
$('select').attr('disabled', 'disabled');
4553
$('input').attr('disabled', 'disabled');
4654

47-
setExportProgress(0, 0, 0, 0, 0);
48-
setLoadingProgress(0, 0);
4955

5056
const inputFileName = $('select#input-file').val() as string;
5157
const decoderAcceleration = $('select#decoder-acceleration').val() as HardwareAcceleration;
@@ -63,6 +69,10 @@ $('button#run-benchmark').click(async () => {
6369

6470
const showEncodingProgress = $('input#progress-update:checked').val() === 'on';
6571

72+
const setExportProgress = getExportProgressFunction(inputFileName);
73+
74+
setExportProgress(0, 0, 0, 0, 0);
75+
setLoadingProgress(0, 0);
6676

6777
const inputFile = await loadInputFile(inputFileName, setLoadingProgress);
6878

0 commit comments

Comments
 (0)