Shaders: Anime4K at full precision on OpenGL ES; sharp video renders the fitted picture

Colours and grid: media_kit renders through OpenGL ES, where mpv's
mediump samplers made Anime4K's networks compute at half precision
(fp16 on NVIDIA); the VL networks of HQ overflow and round there,
strongest once the upscalers run at screen size. The extracted copies
route every network read through a highp identity function; on GLES the
result now equals desktop OpenGL's.

Resize: the output is the picture fitted in the view (no bars, centred
on whole pixels), so Flutter scales the last texture to the new view
without the shrink-then-jump; the resize wait is 120 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-18 17:33:31 +03:00
1 parent 4c8ddeb034
commit ad53b6822a
8 files changed
+184 -22

No files matched your search

+22 -1
View File
@@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:starsync/src/platform/ports/player_host.dart' show RenderMode;
import 'package:starsync/src/platform/ports/player_host.dart' show RenderMode, fitOutputSize;
import 'package:starsync/src/screens/home/ui.dart' show devToolsFor;
import 'package:starsync/src/shell/video_view.dart';
@@ -23,6 +23,27 @@ void main() {
});
});
group('fitOutputSize', () {
test('the picture fitted in the view, no bars', () {
expect(fitOutputSize((1920, 1080), (1280, 720)), (1920, 1080));
// 16:9 on a 2560x1080 screen: pillarboxed, full height.
expect(fitOutputSize((2560, 1080), (1280, 720)), (1920, 1080));
// The chat panel narrows the view: letterboxed, full width.
expect(fitOutputSize((880, 720), (1280, 720)), (880, 494));
expect(fitOutputSize((1280, 720), null), (1280, 720));
expect(fitOutputSize((1280, 720), (0, 0)), (1280, 720));
});
test('the bars split evenly: the picture sits on whole pixels', () {
for (final (view, video) in [((881, 720), (1280, 720)), ((1000, 999), (1920, 800)), ((1366, 768), (720, 576))]) {
final (w, h) = fitOutputSize(view, video);
expect(w <= view.$1 && h <= view.$2, isTrue);
expect((view.$1 - w).isEven && (view.$2 - h).isEven, isTrue, reason: '$view $video -> ($w, $h)');
expect(w == view.$1 || h == view.$2, isTrue, reason: 'one side fills the view');
}
});
});
group('subtitleLiftPos', () {
test('a picture filling the view lifts by the controls', () {
// 108 px of controls + 8 px gap in a 1080 px picture: 10.74 %.