Remove GPU path for alpha merger/splitter, add worker pool for merger, allow concurrent merging for better performance

This commit is contained in:
Vanilagy
2026-06-30 18:23:59 +02:00
parent 6f4a40ff4e
commit a4884184e9
3 changed files with 128 additions and 611 deletions
+2 -20
View File
@@ -2,11 +2,11 @@ import { expect, test } from 'vitest';
import { Input } from '../../src/input.js';
import { BufferSource, UrlSource } from '../../src/source.js';
import { ALL_FORMATS } from '../../src/input-format.js';
import { CanvasSink, ColorAlphaMerger, EncodedPacketSink, VideoSampleSink } from '../../src/media-sink.js';
import { CanvasSink, EncodedPacketSink, VideoSampleSink } from '../../src/media-sink.js';
import { Output } from '../../src/output.js';
import { WebMOutputFormat } from '../../src/output-format.js';
import { BufferTarget } from '../../src/target.js';
import { CanvasSource, ColorAlphaSplitter, VideoSampleSource } from '../../src/media-source.js';
import { CanvasSource, VideoSampleSource } from '../../src/media-source.js';
import { canEncodeVideo, QUALITY_HIGH } from '../../src/encode.js';
import { VideoSample } from '../../src/sample.js';
import { Conversion } from '../../src/conversion.js';
@@ -39,15 +39,6 @@ test('Can decode transparent video', async () => {
await decodeTransparentVideoTest();
});
test('Can decode transparent video, forced CPU path', async () => {
try {
ColorAlphaMerger.forceCpu = true;
await decodeTransparentVideoTest();
} finally {
ColorAlphaMerger.forceCpu = false;
}
});
test('Can decode faulty transparent video and behaves gracefully', async () => {
using input = new Input({
source: new UrlSource('/transparency-faulty.webm'),
@@ -192,15 +183,6 @@ test('Can encode transparent video', async () => {
await encodeTransparentVideoTest();
});
test('Can encode transparent video, forced CPU path', async () => {
try {
ColorAlphaSplitter.forceCpu = true;
await encodeTransparentVideoTest();
} finally {
ColorAlphaSplitter.forceCpu = false;
}
});
test('Can encode video with alternating transparency', async () => {
// This test is already brutal when it comes to finding async race conditions, so run it thrice to be MORE brutal
for (let j = 0; j < 3; j++) {