Skip to content

Commit 347fca3

Browse files
authored
Merge pull request #44 from johnneerdael/feat/native-4k-resolution-option
feat(settings): restore resolution switcher with Auto default
2 parents a9162b6 + f8bc84e commit 347fca3

19 files changed

Lines changed: 816 additions & 160 deletions

File tree

‎AGENTS.md‎

Lines changed: 6 additions & 4 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The engine is designed to preserve the authored look as resolution increases; so
1010
>
1111
> Install *Downloader* by AFTVnews on the TV, open it, enter **4821216** and install the APK it downloads. The code always points to the newest stable release. Details under [Install](#install).
1212
13-
**Based on testing, at least 2 GB of RAM is highly recommended.** This README describes the current source. The APK and published `:core` library use the Native renderer with Standard trails. Resolution is always automatic: the controller targets the selected frame rate, uses live memory headroom, and can reach the panel’s native 4K size.
13+
**Based on testing, at least 2 GB of RAM is highly recommended.** This README describes the current source. The APK and published `:core` library use the Native renderer with Standard trails. Resolution defaults to Auto, which targets the selected frame rate and live memory headroom up to the panel’s native size. Settings › Advanced › Resolution also offers fixed sizes and Native (4K on a 4K panel).
1414

1515
<p align="center">
1616
<img src="docs/screenshots/launch.jpg" alt="ProjectM TV showing a preset, with the playing track's cover, artist and title in the upper left" width="100%">
@@ -50,7 +50,7 @@ The [ProjectM TV user guide](https://johnneerdael.github.io/ProjectM-TV/) covers
5050
- **Offers Chill, Normal and Intense collections.** Open the settings panel and set *Preset mood*. The beta predictor ranks activity from 1 to 100: Chill 1–30, Normal 25–75 and Intense 70–100. The ranges overlap. Automatic changes, Random and Previous stay within your saved collection, subject to existing skip rules. *All* remains the default. Saved Dance selections return to All. [How the predictive collections work](https://johnneerdael.github.io/ProjectM-TV/predictive-collections/).
5151
- **Shows the track that is playing.** The cover, artist and title of the playing track appear in the upper left for as long as it plays (taken from the music app's media session); *Settings › Track display* shows them for 10–60 s per track instead, in the small lower-left pill, or not at all. Covers have only been verified with Spotify and [Milkbeat](https://github.com/johnneerdael/Milkbeat). SoundCloud and SmartTube have been verified to show the artist and title only, without a cover. No other music apps have been verified. This needs *notification access*, see [Track titles](#track-titles) below; without it, nothing is shown. The preset name is in the settings panel.
5252
- **Replaces presets that stay black.** If a preset shows only black for about 7 seconds while music plays, the app moves on. A preset that is black a second time is skipped from then on. Since 1.9.5, the presets that used to be black render; this rule remains as a safety net (details under *Presets* below).
53-
- **Automatic resolution up to native 4K.** The render size follows the target frame rate and live memory headroom. Standard trails keep feedback at an authored canvas while drawing new geometry and the composite at native resolution. Medium and High add more native trail detail when the current render size supports it.
53+
- **Auto resolution by default, up to native 4K.** Auto follows the target frame rate and live memory headroom. Advanced › Resolution also offers supported fixed sizes and Native for full-panel testing, retaining automatic memory protection. Standard trails keep feedback at an authored canvas while drawing new geometry and the composite at native resolution. Medium and High add more native trail detail when the current render size supports it.
5454
- **Budgets memory for playback.** Automatic resolution uses live available memory and estimates the rendering allocations of trails and transitions. It reserves headroom before growth and lowers resolution under memory pressure. Installed RAM does not impose a fixed 1260p cap; Android/vendor process policies can still reclaim background apps.
5555
- **Starts quickly.** The first preset appears a few seconds after launch.
5656
- **Updates itself, if you want.** With *Settings › Advanced › Auto-update* on, the app checks GitHub for a new release at every launch and every 6 hours while it is open, downloads it in the background, and offers to install it: a notice in the lower left, and an *Install* row at the top of the settings panel. Android's installer asks you to confirm. The first time, it asks you to allow installs from ProjectM TV instead; Android then restarts the app, and you select *Install* once more. Off by default; apps installed from F-Droid are updated by F-Droid.
@@ -78,7 +78,7 @@ The main panel shows the current preset and a live audio level (*Listening*, *Ve
7878
<img src="docs/user-guide/images/setup/advanced-settings.png" alt="The advanced settings panel with diagnostics" width="32%">
7979
</p>
8080

81-
These settings captures use an earlier isolated test installation on an Ugoos AM6; the current collection row is named Preset mood. The [setup walkthrough](https://johnneerdael.github.io/ProjectM-TV/getting-started/) shows audio permission and notification access step by step.
81+
Main and Track display captures use an earlier isolated test installation on an Ugoos AM6; the current collection row is named Preset mood. Advanced shows the restored Resolution selector on an isolated TV emulator. The [setup walkthrough](https://johnneerdael.github.io/ProjectM-TV/getting-started/) shows audio permission and notification access step by step.
8282

8383
| Setting | Values | Default |
8484
|---|---|---|
@@ -98,13 +98,14 @@ These settings captures use an earlier isolated test installation on an Ugoos AM
9898

9999
| Setting | What it does | Default |
100100
|---|---|---|
101+
| Resolution | Auto; supported fixed sizes (720p, 1080p, 1440p, 4K); Native follows the physical panel. Memory protection remains active | Auto |
101102
| Frame rate | The TV's refresh rate, half or a quarter of it, at least 24 fps (e.g. 30 or 60 fps at 60 Hz) | Half the refresh rate: 30 fps at 60 Hz, 25 at 50 Hz |
102103
| Detail | Mesh detail for preset motion: Minimal, Low, Medium, High, Ultra | Depends on the device |
103104
| Native trails | Standard, Medium, High; active at supported render sizes above 1330p. Medium and High add sharper trail detail and run the same additional passes | Standard |
104105
| Transition | How long the blend from one preset to the next takes: Instant, 1–10 s | 7 s (2 s on low-end devices) |
105106
| Transitions | *Auto* blends the two running presets and keeps the frame rate up: when the GPU is the limit, both render at a lower resolution during the blend (75% to start, down to 50%, back up when there is headroom); when the CPU is the limit, the outgoing preset renders every second frame. *Classic* always blends at full resolution. *Lightweight* fades a still image of the old preset for at most 3 s. | Auto |
106107
| Cut on loud beats | Lets projectM cut to the next preset on a loud beat, like MilkDrop, instead of only blending | Off |
107-
| Skip slow presets | Skips presets that stay below half the target frame rate even at the lowest resolution, or that a lower resolution does not help (limited by the CPU); such a preset is skipped for good on this TV | On |
108+
| Skip slow presets | In Auto resolution only, skips presets that stay below half the target frame rate even at the lowest resolution, or that a lower resolution does not help (limited by the CPU); such a preset is skipped for good on this TV | On |
108109
| Skip blank presets | Moves on from presets that stay black while music plays; skips them for good the second time | On |
109110
| Auto-update | Checks GitHub for a new release at every launch and every 6 hours while open, and downloads it; an *Install* row then appears at the top of the settings panel. *Via F-Droid* when the app was installed from F-Droid | Off |
110111
| Skipped presets | Shows how many presets are skipped; select it to reset the list | – |
@@ -123,7 +124,7 @@ These settings captures use an earlier isolated test installation on an Ugoos AM
123124
**Picture and performance**
124125
- **A preset change is only smooth when it was prepared.** The next preset, and the ones *Random* and *Previous* on the remote would pick, are prepared in the background, so a switch takes a few hundredths of a second. For 20 seconds after Android reports low memory, and while less than 15% of the memory is free, nothing is prepared; a switch then pauses the picture for up to about half a second.
125126
- **Blending two heavy presets is slow.** A blend renders both presets at once. With presets whose equations run for many points or shapes per frame, the CPU is the limit, and the frame rate drops for the length of the blend.
126-
- **Resolution stays automatic.** The controller lowers or raises resolution for the target frame rate and available memory, up to the panel’s native size. The manual Resolution and Memory limit controls are removed; their saved values no longer force a render size or static RAM cap. Standard keeps authored-scale feedback with native new geometry and composite output. Medium and High retain more native trail detail and require more GPU work and texture memory; Medium is a lower gain, not a cheaper mode.
127+
- **Resolution defaults to Auto.** Settings › Advanced › Resolution offers Auto, 720p, 1080p, 1440p and 4K up to the panel size, plus Native. Native uses the detected physical panel, including 3840×2160 with a 1080p Android UI. Fixed/Native selections ignore FPS-driven downshifts and slow-preset skipping; memory protection can still temporarily lower the actual size. Auto retains its existing FPS and memory adaptation. Old `render_height` and Memory limit preferences stay retired; the new selection is saved separately. Standard keeps authored-scale feedback with native new geometry and composite output. Medium and High retain more native trail detail and require more GPU work and texture memory; Medium is a lower gain, not a cheaper mode.
127128
- **One Native core is published.** `projectM-TV-core.aar` and its versioned filename now contain the Native renderer. The separate capped 1330 AAR is retired. At supported render sizes above 1330p, Native trails replaces the old feedback pre-pass. Smaller render sizes or incompatible canvases retain the existing diffusion path. Driver shader/resource failures use the documented fallback, shown in Diagnostics. Waves and shapes now preserve authored feedback behavior while remaining sharp at native resolution; their equations still run once per frame.
128129
- **Memory protection is automatic.** Resolution growth must leave memory headroom for other apps, and memory pressure lowers the render size and pauses preset prewarming. Available memory and estimated rendering allocations guide this decision; Android/vendor process-killing behavior still varies.
129130
- projectM is a reimplementation of MilkDrop. Some presets look different from MilkDrop on Windows, or still render incorrectly.
@@ -192,7 +193,7 @@ A version you built yourself is signed with your own debug key: uninstall it bef
192193

193194
<a id="track-titles"></a>**No track titles.** Android only shares the playing track with apps that have *notification access* (the app reads no notifications, it needs the access for the media session). Switch it on in the TV's settings under *Apps › Special app access › Notification access › ProjectM TV* (on the NVIDIA SHIELD: *Settings › Device Preferences › Apps › Special app access › Notification access*). Select **Configure** in the startup dialog to open the closest supported Android notification-access page. **Dismiss** permanently hides the automatic reminder. *Settings › Track display › Track info* always reopens setup, and *Diagnostics* shows whether access is granted. See the [screenshot walkthrough](https://johnneerdael.github.io/ProjectM-TV/getting-started/#track-titles).
194195

195-
**The music app closes while the visualizer runs.** Resolution and memory budgeting are always automatic. Use Standard trails and shorter transitions to reduce rendering allocations, and check actual render size and memory status in Diagnostics. Other apps and vendor process policies also affect playback; there is no manual memory-limit switch.
196+
**The music app closes while the visualizer runs.** Memory budgeting is automatic in every resolution mode. Return Resolution to Auto if a fixed size is too demanding. Use Standard trails and shorter transitions to reduce rendering allocations, and check actual render size and memory status in Diagnostics. Other apps and vendor process policies also affect playback; there is no manual memory-limit switch.
196197

197198
**A preset is black.** The app moves on by itself after about 7 seconds of music, as long as *Skip blank presets* is on. To bring back presets skipped earlier, reset *Skipped presets* in *Advanced*.
198199

@@ -231,8 +232,8 @@ AAR as the APK. Separate capped and `core-native` artifacts are retired for new
231232
releases; old releases remain immutable. The legacy `native` build-property
232233
spelling is accepted, while `capped` is rejected.
233234

234-
The shared QualityController always chooses resolution automatically up to the
235-
panel, using target FPS and live memory headroom. Its legacy fixed-resolution and
235+
The shared QualityController defaults to choosing resolution automatically up to the
236+
panel, using target FPS and live memory headroom. Explicit hosts can opt into `setResolutionMode(mode, lastAutoHeight)` (0 Auto, -1 Native, or a height from `resolutionModes(display)`); fixed/Native bypass FPS adaptation and slow-preset skipping while retaining memory checks. Its legacy fixed-resolution and
236237
static-RAM inputs normalize to Auto. Standard trails is the Android core default;
237238
Medium and High add more trail detail with the same extra passes. Managed clients
238239
review trails/transition together with `setRenderAllocationSettings`, publish
@@ -293,7 +294,7 @@ The bundled presets and textures are distributed under CC0 1.0 ([LICENSES/CC0-1.
293294

294295
## Appendix: measurements on the NVIDIA SHIELD
295296

296-
These historical figures were measured before the current always-Auto/live-budget policy; they are not current resource limits. They come from two NVIDIA SHIELD Android TVs with Android 11: the 2019 SHIELD TV (`sif`, 2 GB RAM, runs the app 32-bit) and the 2019 SHIELD TV Pro (`mdarcy`, 3 GB RAM, 64-bit). Other devices differ.
297+
These historical figures were measured before the current default-Auto/live-budget policy and restored Resolution selector; they are not current resource limits. They come from two NVIDIA SHIELD Android TVs with Android 11: the 2019 SHIELD TV (`sif`, 2 GB RAM, runs the app 32-bit) and the 2019 SHIELD TV Pro (`mdarcy`, 3 GB RAM, 64-bit). Other devices differ.
297298

298299
- **Startup:** 3–6 seconds from launch to the first preset.
299300
- **Audio:** the visuals react about 1 second after launch (about 5 seconds the very first time). With Dolby or passthrough output, Android's visualizer on the TV's main output (session 0) and Android's playback capture both hear nothing; the music app's own session does. Details in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#audio-source).

‎app/src/androidTest/java/com/example/projectm/visualizer/MusicCategoryInstrumentation.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ private void awaitCategory(String expected) {
4646
}
4747
@Override public void onStart() {
4848
if (setupCase != null) {
49-
if ("native_trails".equals(setupCase)) NativeTrailsSetupTest.run(this);
49+
if ("resolution_recording".equals(setupCase)) ResolutionSetupTest.record(this);
50+
else if ("resolution".equals(setupCase)) ResolutionSetupTest.run(this);
51+
else if ("native_trails".equals(setupCase)) NativeTrailsSetupTest.run(this);
5052
else TrackAccessSetupTest.run(this, setupCase);
5153
return;
5254
}

‎app/src/androidTest/java/com/example/projectm/visualizer/NativeTrailsSetupTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void run(Instrumentation test) {
5959
prefs.edit().putBoolean("track_access_explained", true).putBoolean("auto_change_enabled", false)
6060
.putBoolean("skip_slow_presets", false).putBoolean("blank_detection_v3", false)
6161
.putBoolean("memory_limit", true).putInt("render_height", -1) // retired settings must not override Auto
62-
.putInt("transition_duration", 0).remove("native_trails").commit();
62+
.putInt("transition_duration", 0).remove("native_trails").remove("resolution_mode").commit();
6363
Intent launch = new Intent(test.getTargetContext(), MainActivity.class)
6464
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
6565
activity = test.startActivitySync(launch);
@@ -96,7 +96,7 @@ static void run(Instrumentation test) {
9696
check(ProjectMJNI.getCompletedRenderBudgetGeneration() > previousGeneration,
9797
"rapid allocation changes did not renew the reviewed generation");
9898
check(test.getTargetContext().getResources().getIdentifier("row_resolution", "id",
99-
test.getTargetContext().getPackageName()) == 0, "manual resolution row remains");
99+
test.getTargetContext().getPackageName()) != 0, "resolution selector missing");
100100
check(test.getTargetContext().getResources().getIdentifier("row_memory_limit", "id",
101101
test.getTargetContext().getPackageName()) == 0, "manual RAM limiter row remains");
102102
test.runOnMainSync(target::finish);
@@ -120,7 +120,7 @@ static void run(Instrumentation test) {
120120
test.getTargetContext().getExternalCacheDir(), "native-trails-advanced.png"))) {
121121
check(screenshot.compress(Bitmap.CompressFormat.PNG, 100, output), "screenshot write failed");
122122
} finally { screenshot.recycle(); }
123-
result.putString("stream", "PASS: Auto-only UI, Standard default, D-pad Medium, High selection, persisted High, retired manual controls absent, diagnostics\n");
123+
result.putString("stream", "PASS: Auto default, Standard default, D-pad Medium, High selection, persisted High, resolution selector, retired RAM control absent, diagnostics\n");
124124
code = Activity.RESULT_OK;
125125
} catch (Throwable failure) {
126126
result.putString("stream", "FAIL: " + failure + "\n");

0 commit comments

Comments
 (0)