Compare commits

..

8 Commits

Author SHA1 Message Date
Keaton
5616522160 Merge e9928f8681 into d1da937fce 2025-02-05 23:29:40 -03:00
Evan Husted
e9928f8681 Merge branch 'master' into VP9-loop-filtering 2025-02-01 02:23:42 -06:00
Evan Husted
a002202d42 Merge branch 'master' into VP9-loop-filtering 2025-01-26 16:03:14 -06:00
Evan Husted
428b1e5cea Merge branch 'master' into VP9-loop-filtering 2025-01-23 01:09:44 -06:00
TSR Berry
e6f7d6e1d5 Remove duplicate BitUtils methods 2025-01-20 11:03:50 -06:00
TSR Berry
0ad5def417 Adjust docstrings for CodecError.cs 2025-01-20 11:03:50 -06:00
gdkchan
f012c3fbef Initialize loop filter parameters 2025-01-20 11:03:49 -06:00
gdkchan
b69b432b4c Implement VP9 loop filtering 2025-01-20 11:03:49 -06:00
120 changed files with 4026 additions and 5931 deletions

View File

@@ -29,7 +29,7 @@ env:
jobs: jobs:
tag: tag:
name: Create tag name: Create tag
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- name: Get version info - name: Get version info
id: version_info id: version_info
@@ -202,7 +202,7 @@ jobs:
macos_release: macos_release:
name: Release MacOS universal name: Release MacOS universal
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -18,7 +18,7 @@ env:
jobs: jobs:
tag: tag:
name: Create tag name: Create tag
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- name: Get version info - name: Get version info
id: version_info id: version_info
@@ -183,7 +183,7 @@ jobs:
macos_release: macos_release:
name: Release MacOS universal name: Release MacOS universal
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -42,7 +42,7 @@
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" /> <PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" />
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" /> <PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" /> <PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
<PackageVersion Include="Gommon" Version="2.7.1.1" /> <PackageVersion Include="Gommon" Version="2.7.1" />
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" /> <PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
<PackageVersion Include="Sep" Version="0.6.0" /> <PackageVersion Include="Sep" Version="0.6.0" />
<PackageVersion Include="shaderc.net" Version="0.1.0" /> <PackageVersion Include="shaderc.net" Version="0.1.0" />

View File

@@ -39,12 +39,12 @@
<p align="center"> <p align="center">
Click below to join the Discord: Click below to join the Discord:
<br> <br>
<a href="https://discord.gg/PEuzjrFXUA"> <a href="https://discord.gg/dHPrkBkkyA">
<img src="https://img.shields.io/discord/1294443224030511104?color=5865F2&label=Ryubing&logo=discord&logoColor=white" alt="Discord"> <img src="https://img.shields.io/discord/1294443224030511104?color=5865F2&label=Ryubing&logo=discord&logoColor=white" alt="Discord">
</a> </a>
<br> <br>
<br> <br>
<img src="https://raw.githubusercontent.com/Ryubing/Ryujinx/refs/heads/master/docs/shell.png"> <img src="https://raw.githubusercontent.com/GreemDev/Ryujinx/refs/heads/master/docs/shell.png">
</p> </p>
## Usage ## Usage

View File

@@ -332,7 +332,6 @@
0100E680149DC000,"Arcaea",,playable,2023-03-16 19:31:21 0100E680149DC000,"Arcaea",,playable,2023-03-16 19:31:21
01003C2010C78000,"Archaica: The Path Of Light",crash,nothing,2020-10-16 13:22:26 01003C2010C78000,"Archaica: The Path Of Light",crash,nothing,2020-10-16 13:22:26
01004DA012976000,"Area 86",,playable,2020-12-16 16:45:52 01004DA012976000,"Area 86",,playable,2020-12-16 16:45:52
01008d8006a6a000,"Arena of Valor",crash,boots,2025-02-03 22:19:34
0100691013C46000,"ARIA CHRONICLE",,playable,2022-11-16 13:50:55 0100691013C46000,"ARIA CHRONICLE",,playable,2022-11-16 13:50:55
0100D4A00B284000,"ARK: Survival Evolved",gpu;nvdec;online-broken;UE4;ldn-untested,ingame,2024-04-16 00:53:56 0100D4A00B284000,"ARK: Survival Evolved",gpu;nvdec;online-broken;UE4;ldn-untested,ingame,2024-04-16 00:53:56
0100C56012C96000,"Arkanoid vs. Space Invaders",services,ingame,2021-01-21 12:50:30 0100C56012C96000,"Arkanoid vs. Space Invaders",services,ingame,2021-01-21 12:50:30
@@ -427,7 +426,6 @@
0100E48013A34000,"Balan Wonderworld Demo",gpu;services;UE4;demo,ingame,2023-02-16 20:05:07 0100E48013A34000,"Balan Wonderworld Demo",gpu;services;UE4;demo,ingame,2023-02-16 20:05:07
0100CD801CE5E000,"Balatro",,ingame,2024-04-21 02:01:53 0100CD801CE5E000,"Balatro",,ingame,2024-04-21 02:01:53
010010A00DA48000,"Baldur's Gate and Baldur's Gate II: Enhanced Editions",32-bit,playable,2022-09-12 23:52:15 010010A00DA48000,"Baldur's Gate and Baldur's Gate II: Enhanced Editions",32-bit,playable,2022-09-12 23:52:15
0100fd1014726000,"Baldur's Gate: Dark Alliance",ldn-untested,ingame,2025-02-03 22:21:00
0100BC400FB64000,"Balthazar's Dream",,playable,2022-09-13 00:13:22 0100BC400FB64000,"Balthazar's Dream",,playable,2022-09-13 00:13:22
01008D30128E0000,"Bamerang",,playable,2022-10-26 00:29:39 01008D30128E0000,"Bamerang",,playable,2022-10-26 00:29:39
010013C010C5C000,"Banner of the Maid",,playable,2021-06-14 15:23:37 010013C010C5C000,"Banner of the Maid",,playable,2021-06-14 15:23:37
@@ -530,7 +528,6 @@
01005950022EC000,"Blade Strangers",nvdec,playable,2022-07-17 19:02:43 01005950022EC000,"Blade Strangers",nvdec,playable,2022-07-17 19:02:43
0100DF0011A6A000,"Bladed Fury",,playable,2022-10-26 11:36:26 0100DF0011A6A000,"Bladed Fury",,playable,2022-10-26 11:36:26
0100CFA00CC74000,"Blades of Time",deadlock;online,boots,2022-07-17 19:19:58 0100CFA00CC74000,"Blades of Time",deadlock;online,boots,2022-07-17 19:19:58
01003d700dd8a000,"Blades",,boots,2025-02-03 22:22:00
01006CC01182C000,"Blair Witch",nvdec;UE4,playable,2022-10-01 14:06:16 01006CC01182C000,"Blair Witch",nvdec;UE4,playable,2022-10-01 14:06:16
010039501405E000,"Blanc",gpu;slow,ingame,2023-02-22 14:00:13 010039501405E000,"Blanc",gpu;slow,ingame,2023-02-22 14:00:13
0100698009C6E000,"Blasphemous",nvdec,playable,2021-03-01 12:15:31 0100698009C6E000,"Blasphemous",nvdec,playable,2021-03-01 12:15:31
@@ -958,7 +955,7 @@
010012800EBAE000,"Disney TSUM TSUM FESTIVAL",crash,menus,2020-07-14 14:05:28 010012800EBAE000,"Disney TSUM TSUM FESTIVAL",crash,menus,2020-07-14 14:05:28
01009740120FE000,"DISTRAINT 2",,playable,2020-09-03 16:08:12 01009740120FE000,"DISTRAINT 2",,playable,2020-09-03 16:08:12
010075B004DD2000,"DISTRAINT: Deluxe Edition",,playable,2020-06-15 23:42:24 010075B004DD2000,"DISTRAINT: Deluxe Edition",,playable,2020-06-15 23:42:24
010027400CDC6000,"Divinity: Original Sin 2 - Definitive Edition",services;crash;online-broken;regression,ingame,2025-02-03 22:12:30 010027400CDC6000,"Divinity: Original Sin 2 - Definitive Edition",services;crash;online-broken;regression,menus,2023-08-13 17:20:03
01001770115C8000,"Dodo Peak",nvdec;UE4,playable,2022-10-04 16:13:05 01001770115C8000,"Dodo Peak",nvdec;UE4,playable,2022-10-04 16:13:05
010077B0100DA000,"Dogurai",,playable,2020-10-04 02:40:16 010077B0100DA000,"Dogurai",,playable,2020-10-04 02:40:16
010048100D51A000,"Dokapon Up! Mugen no Roulette",gpu;Needs Update,menus,2022-12-08 19:39:10 010048100D51A000,"Dokapon Up! Mugen no Roulette",gpu;Needs Update,menus,2022-12-08 19:39:10
@@ -969,7 +966,6 @@
0100751007ADA000,"Don't Starve: Nintendo Switch Edition",nvdec,playable,2022-02-05 20:43:34 0100751007ADA000,"Don't Starve: Nintendo Switch Edition",nvdec,playable,2022-02-05 20:43:34
010088B010DD2000,"Dongo Adventure",,playable,2022-10-04 16:22:26 010088B010DD2000,"Dongo Adventure",,playable,2022-10-04 16:22:26
0100C1F0051B6000,"Donkey Kong Country™: Tropical Freeze",,playable,2024-08-05 16:46:10 0100C1F0051B6000,"Donkey Kong Country™: Tropical Freeze",,playable,2024-08-05 16:46:10
01009D901BC56000,"Donkey Kong Country™: Returns HD",gpu,ingame,2025-02-16 13:44:12
0100F2C00F060000,"Doodle Derby",,boots,2020-12-04 22:51:48 0100F2C00F060000,"Doodle Derby",,boots,2020-12-04 22:51:48
0100416004C00000,"DOOM",gpu;slow;nvdec;online-broken,ingame,2024-09-23 15:40:07 0100416004C00000,"DOOM",gpu;slow;nvdec;online-broken,ingame,2024-09-23 15:40:07
010018900DD00000,"DOOM (1993)",nvdec;online-broken,menus,2022-09-06 13:32:19 010018900DD00000,"DOOM (1993)",nvdec;online-broken,menus,2022-09-06 13:32:19
@@ -1159,7 +1155,7 @@
010095600AA36000,"Fill-a-Pix: Phil's Epic Adventure",,playable,2020-12-22 13:48:22 010095600AA36000,"Fill-a-Pix: Phil's Epic Adventure",,playable,2020-12-22 13:48:22
0100C3A00BB76000,"Fimbul",nvdec,playable,2022-07-26 13:31:47 0100C3A00BB76000,"Fimbul",nvdec,playable,2022-07-26 13:31:47
0100C8200E942000,"Fin and the Ancient Mystery",nvdec,playable,2020-12-17 16:40:39 0100C8200E942000,"Fin and the Ancient Mystery",nvdec,playable,2020-12-17 16:40:39
01000EA014150000,"FINAL FANTASY",,playable,2025-02-16 21:27:30 01000EA014150000,"FINAL FANTASY",crash,nothing,2024-09-05 20:55:30
01006B7014156000,"FINAL FANTASY II",crash,nothing,2024-04-13 19:18:04 01006B7014156000,"FINAL FANTASY II",crash,nothing,2024-04-13 19:18:04
01006F000B056000,"FINAL FANTASY IX",audout;nvdec,playable,2021-06-05 11:35:00 01006F000B056000,"FINAL FANTASY IX",audout;nvdec,playable,2021-06-05 11:35:00
0100AA201415C000,"FINAL FANTASY V",,playable,2023-04-26 01:11:55 0100AA201415C000,"FINAL FANTASY V",,playable,2023-04-26 01:11:55
@@ -1250,7 +1246,7 @@
0100A6B00D4EC000,"Furwind",,playable,2021-02-19 19:44:08 0100A6B00D4EC000,"Furwind",,playable,2021-02-19 19:44:08
0100ECE00C0C4000,"Fury Unleashed",crash;services,ingame,2020-10-18 11:52:40 0100ECE00C0C4000,"Fury Unleashed",crash;services,ingame,2020-10-18 11:52:40
010070000ED9E000,"Fury Unleashed Demo",,playable,2020-10-08 20:09:21 010070000ED9E000,"Fury Unleashed Demo",,playable,2020-10-08 20:09:21
0100E1F013674000,"FUSER™",nvdec;UE4;slow;gpu,ingame,2025-02-12 16:03:00 0100E1F013674000,"FUSER™",nvdec;UE4,playable,2022-10-17 20:58:32
0100A7A015E4C000,"Fushigi no Gensokyo Lotus Labyrinth",Needs Update;audio;gpu;nvdec,ingame,2021-01-20 15:30:02 0100A7A015E4C000,"Fushigi no Gensokyo Lotus Labyrinth",Needs Update;audio;gpu;nvdec,ingame,2021-01-20 15:30:02
01003C300B274000,"Futari de! Nyanko Daisensou",,playable,2024-01-05 22:26:52 01003C300B274000,"Futari de! Nyanko Daisensou",,playable,2024-01-05 22:26:52
010055801134E000,"FUZE Player",online-broken;vulkan-backend-bug,ingame,2022-10-18 12:23:53 010055801134E000,"FUZE Player",online-broken;vulkan-backend-bug,ingame,2022-10-18 12:23:53
@@ -1436,7 +1432,7 @@
010083A018262000,"Hitman: Blood Money — Reprisal",deadlock,ingame,2024-09-28 16:28:50 010083A018262000,"Hitman: Blood Money — Reprisal",deadlock,ingame,2024-09-28 16:28:50
01004B100A5CC000,"Hob: The Definitive Edition",,playable,2021-01-13 09:39:19 01004B100A5CC000,"Hob: The Definitive Edition",,playable,2021-01-13 09:39:19
0100F7300ED2C000,"Hoggy2",,playable,2022-10-10 13:53:35 0100F7300ED2C000,"Hoggy2",,playable,2022-10-10 13:53:35
0100F7E00C70E000,"Hogwarts Legacy",UE4;slow,ingame,2024-09-03 19:53:58 0100F7E00C70E000,"Hogwarts Legacy",slow,ingame,2024-09-03 19:53:58
0100633007D48000,"Hollow Knight",nvdec,playable,2023-01-16 15:44:56 0100633007D48000,"Hollow Knight",nvdec,playable,2023-01-16 15:44:56
0100F2100061E800,"Hollow0",UE4;gpu,ingame,2021-03-03 23:42:56 0100F2100061E800,"Hollow0",UE4;gpu,ingame,2021-03-03 23:42:56
0100342009E16000,"Holy Potatoes! What The Hell?!",,playable,2020-07-03 10:48:56 0100342009E16000,"Holy Potatoes! What The Hell?!",,playable,2020-07-03 10:48:56
@@ -1658,7 +1654,7 @@
0100A73006E74000,"Legendary Eleven",,playable,2021-06-08 12:09:03 0100A73006E74000,"Legendary Eleven",,playable,2021-06-08 12:09:03
0100A7700B46C000,"Legendary Fishing",online,playable,2021-04-14 15:08:46 0100A7700B46C000,"Legendary Fishing",online,playable,2021-04-14 15:08:46
0100739018020000,"LEGO® 2K Drive",gpu;ldn-works,ingame,2024-04-09 02:05:12 0100739018020000,"LEGO® 2K Drive",gpu;ldn-works,ingame,2024-04-09 02:05:12
010085500130a000,"LEGO® CITY Undercover",nvdec,playable,2024-09-30 08:44:27 01003A30012C0000,"LEGO® CITY Undercover",nvdec,playable,2024-09-30 08:44:27
010070D009FEC000,"LEGO® DC Super-Villains",,playable,2021-05-27 18:10:37 010070D009FEC000,"LEGO® DC Super-Villains",,playable,2021-05-27 18:10:37
010052A00B5D2000,"LEGO® Harry Potter™ Collection",crash,ingame,2024-01-31 10:28:07 010052A00B5D2000,"LEGO® Harry Potter™ Collection",crash,ingame,2024-01-31 10:28:07
010073C01AF34000,"LEGO® Horizon Adventures™",vulkan-backend-bug;opengl-backend-bug;UE4,ingame,2025-01-07 04:24:56 010073C01AF34000,"LEGO® Horizon Adventures™",vulkan-backend-bug;opengl-backend-bug;UE4,ingame,2025-01-07 04:24:56
@@ -1800,7 +1796,6 @@
010005A00B312000,"Megaton Rainfall",gpu;opengl,boots,2022-08-04 18:29:43 010005A00B312000,"Megaton Rainfall",gpu;opengl,boots,2022-08-04 18:29:43
0100EA100DF92000,"Meiji Katsugeki Haikara Ryuuseigumi - Seibai Shimaseu, Yonaoshi Kagyou",32-bit;nvdec,playable,2022-12-05 13:19:12 0100EA100DF92000,"Meiji Katsugeki Haikara Ryuuseigumi - Seibai Shimaseu, Yonaoshi Kagyou",32-bit;nvdec,playable,2022-12-05 13:19:12
0100B360068B2000,"Mekorama",gpu,boots,2021-06-17 16:37:21 0100B360068B2000,"Mekorama",gpu,boots,2021-06-17 16:37:21
010012301932A000,"Melatonin",,playable,2025-02-16 04:08:17
01000FA010340000,"Melbits World",nvdec;online,menus,2021-11-26 13:51:22 01000FA010340000,"Melbits World",nvdec;online,menus,2021-11-26 13:51:22
0100F68019636000,"Melon Journey",,playable,2023-04-23 21:20:01 0100F68019636000,"Melon Journey",,playable,2023-04-23 21:20:01
010079C012896000,"Memories Off -Innocent Fille- for Dearest",,playable,2020-08-04 07:31:22 010079C012896000,"Memories Off -Innocent Fille- for Dearest",,playable,2020-08-04 07:31:22
@@ -1918,7 +1913,6 @@
010073E008E6E000,"Mugsters",,playable,2021-01-28 17:57:17 010073E008E6E000,"Mugsters",,playable,2021-01-28 17:57:17
0100A8400471A000,"MUJO",,playable,2020-05-08 16:31:04 0100A8400471A000,"MUJO",,playable,2020-05-08 16:31:04
0100211005E94000,"Mulaka",,playable,2021-01-28 18:07:20 0100211005E94000,"Mulaka",,playable,2021-01-28 18:07:20
01008e2013fb4000,"Multi Quiz",ldn-untested,ingame,2025-02-03 22:26:00
010038B00B9AE000,"Mummy Pinball",,playable,2022-08-05 16:08:11 010038B00B9AE000,"Mummy Pinball",,playable,2022-08-05 16:08:11
01008E200C5C2000,"Muse Dash",,playable,2020-06-06 14:41:29 01008E200C5C2000,"Muse Dash",,playable,2020-06-06 14:41:29
010035901046C000,"Mushroom Quest",,playable,2020-05-17 13:07:08 010035901046C000,"Mushroom Quest",,playable,2020-05-17 13:07:08
@@ -2034,7 +2028,6 @@
010003C00B868000,"Ninjin: Clash of Carrots",online-broken,playable,2024-07-10 05:12:26 010003C00B868000,"Ninjin: Clash of Carrots",online-broken,playable,2024-07-10 05:12:26
0100746010E4C000,"NinNinDays",,playable,2022-11-20 15:17:29 0100746010E4C000,"NinNinDays",,playable,2022-11-20 15:17:29
0100C9A00ECE6000,"Nintendo 64™ Nintendo Switch Online",gpu;vulkan,ingame,2024-04-23 20:21:07 0100C9A00ECE6000,"Nintendo 64™ Nintendo Switch Online",gpu;vulkan,ingame,2024-04-23 20:21:07
0100e0601c632000,"Nintendo 64™ Nintendo Switch Online: MATURE 17+",,ingame,2025-02-03 22:27:00
0100D870045B6000,"Nintendo Entertainment System™ - Nintendo Switch Online",online,playable,2022-07-01 15:45:06 0100D870045B6000,"Nintendo Entertainment System™ - Nintendo Switch Online",online,playable,2022-07-01 15:45:06
0100C4B0034B2000,"Nintendo Labo Toy-Con 01 Variety Kit",gpu,ingame,2022-08-07 12:56:07 0100C4B0034B2000,"Nintendo Labo Toy-Con 01 Variety Kit",gpu,ingame,2022-08-07 12:56:07
01001E9003502000,"Nintendo Labo Toy-Con 03 Vehicle Kit",services;crash,menus,2022-08-03 17:20:11 01001E9003502000,"Nintendo Labo Toy-Con 03 Vehicle Kit",services;crash,menus,2022-08-03 17:20:11
@@ -2065,7 +2058,7 @@
010002700C34C000,"Numbala",,playable,2020-05-11 12:01:07 010002700C34C000,"Numbala",,playable,2020-05-11 12:01:07
010020500C8C8000,"Number Place 10000",gpu,menus,2021-11-24 09:14:23 010020500C8C8000,"Number Place 10000",gpu,menus,2021-11-24 09:14:23
010003701002C000,"Nurse Love Syndrome",,playable,2022-10-13 10:05:22 010003701002C000,"Nurse Love Syndrome",,playable,2022-10-13 10:05:22
,"nx-hbmenu",Needs Update;homebrew,boots,2024-04-06 22:05:32 0000000000000000,"nx-hbmenu",Needs Update;homebrew,boots,2024-04-06 22:05:32
,"nxquake2",services;crash;homebrew,nothing,2022-08-04 23:14:04 ,"nxquake2",services;crash;homebrew,nothing,2022-08-04 23:14:04
010049F00EC30000,"Nyan Cat: Lost in Space",online,playable,2021-06-12 13:22:03 010049F00EC30000,"Nyan Cat: Lost in Space",online,playable,2021-06-12 13:22:03
01002E6014FC4000,"O---O",,playable,2022-10-29 12:12:14 01002E6014FC4000,"O---O",,playable,2022-10-29 12:12:14
@@ -2473,7 +2466,7 @@
0100AFE00DDAC000,"Royal Roads",,playable,2020-11-17 12:54:38 0100AFE00DDAC000,"Royal Roads",,playable,2020-11-17 12:54:38
0100E2C00B414000,"RPG Maker MV",nvdec,playable,2021-01-05 20:12:01 0100E2C00B414000,"RPG Maker MV",nvdec,playable,2021-01-05 20:12:01
01005CD015986000,"rRootage Reloaded",,playable,2022-08-05 23:20:18 01005CD015986000,"rRootage Reloaded",,playable,2022-08-05 23:20:18
,"RSDKv5u",homebrew,ingame,2024-04-01 16:25:34 0000000000000000,"RSDKv5u",homebrew,ingame,2024-04-01 16:25:34
010009B00D33C000,"Rugby Challenge 4",slow;online-broken;UE4,playable,2022-10-06 12:45:53 010009B00D33C000,"Rugby Challenge 4",slow;online-broken;UE4,playable,2022-10-06 12:45:53
01006EC00F2CC000,"RUINER",UE4,playable,2022-10-03 14:11:33 01006EC00F2CC000,"RUINER",UE4,playable,2022-10-03 14:11:33
010074F00DE4A000,"Run the Fan",,playable,2021-02-27 13:36:28 010074F00DE4A000,"Run the Fan",,playable,2021-02-27 13:36:28
@@ -2482,7 +2475,6 @@
010081C0191D8000,"Rune Factory 3 Special",,playable,2023-10-15 08:32:49 010081C0191D8000,"Rune Factory 3 Special",,playable,2023-10-15 08:32:49
010051D00E3A4000,"Rune Factory 4 Special",32-bit;crash;nvdec,ingame,2023-05-06 08:49:17 010051D00E3A4000,"Rune Factory 4 Special",32-bit;crash;nvdec,ingame,2023-05-06 08:49:17
010014D01216E000,"Rune Factory 5 (JP)",gpu,ingame,2021-06-01 12:00:36 010014D01216E000,"Rune Factory 5 (JP)",gpu,ingame,2021-06-01 12:00:36
010071E0145F8000,"Rustler",,playable,2025-02-10 20:17:12
0100E21013908000,"RWBY: Grimm Eclipse - Definitive Edition",online-broken,playable,2022-11-03 10:44:01 0100E21013908000,"RWBY: Grimm Eclipse - Definitive Edition",online-broken,playable,2022-11-03 10:44:01
010012C0060F0000,"RXN -Raijin-",nvdec,playable,2021-01-10 16:05:43 010012C0060F0000,"RXN -Raijin-",nvdec,playable,2021-01-10 16:05:43
0100B8B012ECA000,"S.N.I.P.E.R. - Hunter Scope",,playable,2021-04-19 15:58:09 0100B8B012ECA000,"S.N.I.P.E.R. - Hunter Scope",,playable,2021-04-19 15:58:09
@@ -2540,7 +2532,7 @@
0100C3E00B700000,"SEGA AGES Space Harrier",,playable,2021-01-11 12:57:40 0100C3E00B700000,"SEGA AGES Space Harrier",,playable,2021-01-11 12:57:40
010054400D2E6000,"SEGA AGES Virtua Racing",online-broken,playable,2023-01-29 17:08:39 010054400D2E6000,"SEGA AGES Virtua Racing",online-broken,playable,2023-01-29 17:08:39
01001E700AC60000,"SEGA AGES Wonder Boy: Monster Land",online,playable,2021-05-05 16:28:25 01001E700AC60000,"SEGA AGES Wonder Boy: Monster Land",online,playable,2021-05-05 16:28:25
0100B3C014BDA000,"SEGA Genesis™ Nintendo Switch Online",crash;regression,ingame,2025-02-03 22:13:30 0100B3C014BDA000,"SEGA Genesis™ Nintendo Switch Online",crash;regression,nothing,2022-04-11 07:27:21
0100F7300B24E000,"SEGA Mega Drive Classics",online,playable,2021-01-05 11:08:00 0100F7300B24E000,"SEGA Mega Drive Classics",online,playable,2021-01-05 11:08:00
01009840046BC000,"Semispheres",,playable,2021-01-06 23:08:31 01009840046BC000,"Semispheres",,playable,2021-01-06 23:08:31
0100D1800D902000,"SENRAN KAGURA Peach Ball",,playable,2021-06-03 15:12:10 0100D1800D902000,"SENRAN KAGURA Peach Ball",,playable,2021-06-03 15:12:10
@@ -2676,10 +2668,10 @@
01004F401BEBE000,"Song of Nunu: A League of Legends Story",,ingame,2024-07-12 18:53:44 01004F401BEBE000,"Song of Nunu: A League of Legends Story",,ingame,2024-07-12 18:53:44
0100E5400BF94000,"Songbird Symphony",,playable,2021-02-27 02:44:04 0100E5400BF94000,"Songbird Symphony",,playable,2021-02-27 02:44:04
010031D00A604000,"Songbringer",,playable,2020-06-22 10:42:02 010031D00A604000,"Songbringer",,playable,2020-06-22 10:42:02
,"Sonic 1 (2013)",crash;homebrew,ingame,2024-04-06 18:31:20 0000000000000000,"Sonic 1 (2013)",crash;homebrew,ingame,2024-04-06 18:31:20
,"Sonic 2 (2013)",crash;homebrew,ingame,2024-04-01 16:25:30 0000000000000000,"Sonic 2 (2013)",crash;homebrew,ingame,2024-04-01 16:25:30
,"Sonic A.I.R",homebrew,ingame,2024-04-01 16:25:32 0000000000000000,"Sonic A.I.R",homebrew,ingame,2024-04-01 16:25:32
,"Sonic CD",crash;homebrew,ingame,2024-04-01 16:25:31 0000000000000000,"Sonic CD",crash;homebrew,ingame,2024-04-01 16:25:31
010040E0116B8000,"Sonic Colors: Ultimate",,playable,2022-11-12 21:24:26 010040E0116B8000,"Sonic Colors: Ultimate",,playable,2022-11-12 21:24:26
01001270012B6000,"SONIC FORCES™",,playable,2024-07-28 13:11:21 01001270012B6000,"SONIC FORCES™",,playable,2024-07-28 13:11:21
01004AD014BF0000,"Sonic Frontiers",gpu;deadlock;amd-vendor-bug;intel-vendor-bug,ingame,2024-09-05 09:18:53 01004AD014BF0000,"Sonic Frontiers",gpu;deadlock;amd-vendor-bug;intel-vendor-bug,ingame,2024-09-05 09:18:53
@@ -2696,7 +2688,7 @@
0100707011722000,"Space Elite Force",,playable,2020-11-27 15:21:05 0100707011722000,"Space Elite Force",,playable,2020-11-27 15:21:05
010047B010260000,"Space Pioneer",,playable,2022-10-20 12:24:37 010047B010260000,"Space Pioneer",,playable,2022-10-20 12:24:37
010010A009830000,"Space Ribbon",,playable,2022-08-15 17:17:10 010010A009830000,"Space Ribbon",,playable,2022-08-15 17:17:10
,"SpaceCadetPinball",homebrew,ingame,2024-04-18 19:30:04 0000000000000000,"SpaceCadetPinball",homebrew,ingame,2024-04-18 19:30:04
0100D9B0041CE000,"Spacecats with Lasers",,playable,2022-08-15 17:22:44 0100D9B0041CE000,"Spacecats with Lasers",,playable,2022-08-15 17:22:44
010034800FB60000,"Spaceland",,playable,2020-11-01 14:31:56 010034800FB60000,"Spaceland",,playable,2020-11-01 14:31:56
010028D0045CE000,"Sparkle 2",,playable,2020-10-19 11:51:39 010028D0045CE000,"Sparkle 2",,playable,2020-10-19 11:51:39
@@ -2840,9 +2832,8 @@
01009B90006DC000,"Super Mario Maker™ 2",online-broken;ldn-broken,playable,2024-08-25 11:05:19 01009B90006DC000,"Super Mario Maker™ 2",online-broken;ldn-broken,playable,2024-08-25 11:05:19
0100000000010000,"Super Mario Odyssey™",nvdec;intel-vendor-bug;mac-bug,playable,2024-08-25 01:32:34 0100000000010000,"Super Mario Odyssey™",nvdec;intel-vendor-bug;mac-bug,playable,2024-08-25 01:32:34
010036B0034E4000,"Super Mario Party™",gpu;Needs Update;ldn-works,ingame,2024-06-21 05:10:16 010036B0034E4000,"Super Mario Party™",gpu;Needs Update;ldn-works,ingame,2024-06-21 05:10:16
0100965017338000,"Super Mario Party Jamboree",mac-bug;gpu,ingame,2025-02-17 02:09:20
0100BC0018138000,"Super Mario RPG™",gpu;audio;nvdec,ingame,2024-06-19 17:43:42 0100BC0018138000,"Super Mario RPG™",gpu;audio;nvdec,ingame,2024-06-19 17:43:42
,"Super Mario World",homebrew,boots,2024-06-13 01:40:31 0000000000000000,"Super Mario World",homebrew,boots,2024-06-13 01:40:31
010049900F546000,"Super Mario™ 3D All-Stars",services-horizon;slow;vulkan;amd-vendor-bug,ingame,2024-05-07 02:38:16 010049900F546000,"Super Mario™ 3D All-Stars",services-horizon;slow;vulkan;amd-vendor-bug,ingame,2024-05-07 02:38:16
010028600EBDA000,"Super Mario™ 3D World + Bowsers Fury",ldn-works,playable,2024-07-31 10:45:37 010028600EBDA000,"Super Mario™ 3D World + Bowsers Fury",ldn-works,playable,2024-07-31 10:45:37
01004F8006A78000,"Super Meat Boy",services,playable,2020-04-02 23:10:07 01004F8006A78000,"Super Meat Boy",services,playable,2020-04-02 23:10:07
@@ -2973,7 +2964,6 @@
0100C38004DCC000,"The Flame In The Flood: Complete Edition",gpu;nvdec;UE4,ingame,2022-08-22 16:23:49 0100C38004DCC000,"The Flame In The Flood: Complete Edition",gpu;nvdec;UE4,ingame,2022-08-22 16:23:49
010007700D4AC000,"The Forbidden Arts",,playable,2021-01-26 16:26:24 010007700D4AC000,"The Forbidden Arts",,playable,2021-01-26 16:26:24
010030700CBBC000,"The friends of Ringo Ishikawa",,playable,2022-08-22 16:33:17 010030700CBBC000,"The friends of Ringo Ishikawa",,playable,2022-08-22 16:33:17
0100b620139d8000,"The Game of Life 2",ldn-untested,ingame,2025-02-03 22:30:00
01006350148DA000,"The Gardener and the Wild Vines",gpu,ingame,2024-04-29 16:32:10 01006350148DA000,"The Gardener and the Wild Vines",gpu,ingame,2024-04-29 16:32:10
0100B13007A6A000,"The Gardens Between",,playable,2021-01-29 16:16:53 0100B13007A6A000,"The Gardens Between",,playable,2021-01-29 16:16:53
010036E00FB20000,"The Great Ace Attorney Chronicles",,playable,2023-06-22 21:26:29 010036E00FB20000,"The Great Ace Attorney Chronicles",,playable,2023-06-22 21:26:29
@@ -2991,8 +2981,6 @@
010015D003EE4000,"The Jackbox Party Pack 2",online-working,playable,2022-08-22 18:23:40 010015D003EE4000,"The Jackbox Party Pack 2",online-working,playable,2022-08-22 18:23:40
0100CC80013D6000,"The Jackbox Party Pack 3",slow;online-working,playable,2022-08-22 18:41:06 0100CC80013D6000,"The Jackbox Party Pack 3",slow;online-working,playable,2022-08-22 18:41:06
0100E1F003EE8000,"The Jackbox Party Pack 4",online-working,playable,2022-08-22 18:56:34 0100E1F003EE8000,"The Jackbox Party Pack 4",online-working,playable,2022-08-22 18:56:34
01006fe0096ac000,"The Jackbox Party Pack 5",slow;online-working,ingame,2025-02-14 05:32:00
01005a400db52000,"The Jackbox Party Pack 6",slow;online-working,ingame,2025-02-14 05:26:00
010052C00B184000,"The Journey Down: Chapter One",nvdec,playable,2021-02-24 13:32:41 010052C00B184000,"The Journey Down: Chapter One",nvdec,playable,2021-02-24 13:32:41
01006BC00B188000,"The Journey Down: Chapter Three",nvdec,playable,2021-02-24 13:45:27 01006BC00B188000,"The Journey Down: Chapter Three",nvdec,playable,2021-02-24 13:45:27
01009AB00B186000,"The Journey Down: Chapter Two",nvdec,playable,2021-02-24 13:32:13 01009AB00B186000,"The Journey Down: Chapter Two",nvdec,playable,2021-02-24 13:32:13
@@ -3171,7 +3159,6 @@
010055E00CA68000,"Trine 4: The Nightmare Prince",gpu,nothing,2025-01-07 05:47:46 010055E00CA68000,"Trine 4: The Nightmare Prince",gpu,nothing,2025-01-07 05:47:46
0100D9000A930000,"Trine Enchanted Edition",ldn-untested;nvdec,playable,2021-06-03 11:28:15 0100D9000A930000,"Trine Enchanted Edition",ldn-untested;nvdec,playable,2021-06-03 11:28:15
01002D7010A54000,"Trinity Trigger",crash,ingame,2023-03-03 03:09:09 01002D7010A54000,"Trinity Trigger",crash,ingame,2023-03-03 03:09:09
010020700a5e0000,"TRIVIAL PURSUIT Live!",ldn-untested,ingame,2025-02-03 22:35:00
0100868013FFC000,"TRIVIAL PURSUIT Live! 2",,boots,2022-12-19 00:04:33 0100868013FFC000,"TRIVIAL PURSUIT Live! 2",,boots,2022-12-19 00:04:33
0100F78002040000,"Troll and I™",gpu;nvdec,ingame,2021-06-04 16:58:50 0100F78002040000,"Troll and I™",gpu;nvdec,ingame,2021-06-04 16:58:50
0100145011008000,"Trollhunters: Defenders of Arcadia",gpu;nvdec,ingame,2020-11-30 13:27:09 0100145011008000,"Trollhunters: Defenders of Arcadia",gpu;nvdec,ingame,2020-11-30 13:27:09
@@ -3221,7 +3208,6 @@
0100AB2010B4C000,"Unlock The King",,playable,2020-09-01 13:58:27 0100AB2010B4C000,"Unlock The King",,playable,2020-09-01 13:58:27
0100A3E011CB0000,"Unlock the King 2",,playable,2021-06-15 20:43:55 0100A3E011CB0000,"Unlock the King 2",,playable,2021-06-15 20:43:55
01005AA00372A000,"UNO® for Nintendo Switch",nvdec;ldn-untested,playable,2022-07-28 14:49:47 01005AA00372A000,"UNO® for Nintendo Switch",nvdec;ldn-untested,playable,2022-07-28 14:49:47
0100b6e012ebe000,"UNO",ldn-untested,ingame,2025-02-03 22:40:00
0100E5D00CC0C000,"Unravel Two",nvdec,playable,2024-05-23 15:45:05 0100E5D00CC0C000,"Unravel Two",nvdec,playable,2024-05-23 15:45:05
010001300CC4A000,"Unruly Heroes",,playable,2021-01-07 18:09:31 010001300CC4A000,"Unruly Heroes",,playable,2021-01-07 18:09:31
0100B410138C0000,"Unspottable",,playable,2022-10-25 19:28:49 0100B410138C0000,"Unspottable",,playable,2022-10-25 19:28:49
@@ -3386,7 +3372,6 @@
0100F47016F26000,"Yomawari 3",,playable,2022-05-10 08:26:51 0100F47016F26000,"Yomawari 3",,playable,2022-05-10 08:26:51
010012F00B6F2000,"Yomawari: The Long Night Collection",,playable,2022-09-03 14:36:59 010012F00B6F2000,"Yomawari: The Long Night Collection",,playable,2022-09-03 14:36:59
0100CC600ABB2000,"Yonder: The Cloud Catcher Chronicles (Retail Only)",,playable,2021-01-28 14:06:25 0100CC600ABB2000,"Yonder: The Cloud Catcher Chronicles (Retail Only)",,playable,2021-01-28 14:06:25
0100534009ff2000,"Yonder: The Cloud Catcher Chronicles",,playable,2025-02-03 22:19:13
0100BE50042F6000,"Yono and the Celestial Elephants",,playable,2021-01-28 18:23:58 0100BE50042F6000,"Yono and the Celestial Elephants",,playable,2021-01-28 18:23:58
0100F110029C8000,"Yooka-Laylee",,playable,2021-01-28 14:21:45 0100F110029C8000,"Yooka-Laylee",,playable,2021-01-28 14:21:45
010022F00DA66000,"Yooka-Laylee and the Impossible Lair",,playable,2021-03-05 17:32:21 010022F00DA66000,"Yooka-Laylee and the Impossible Lair",,playable,2021-03-05 17:32:21
1 title_id game_name labels status last_updated
332 0100E680149DC000 Arcaea playable 2023-03-16 19:31:21
333 01003C2010C78000 Archaica: The Path Of Light crash nothing 2020-10-16 13:22:26
334 01004DA012976000 Area 86 playable 2020-12-16 16:45:52
01008d8006a6a000 Arena of Valor crash boots 2025-02-03 22:19:34
335 0100691013C46000 ARIA CHRONICLE playable 2022-11-16 13:50:55
336 0100D4A00B284000 ARK: Survival Evolved gpu;nvdec;online-broken;UE4;ldn-untested ingame 2024-04-16 00:53:56
337 0100C56012C96000 Arkanoid vs. Space Invaders services ingame 2021-01-21 12:50:30
426 0100E48013A34000 Balan Wonderworld Demo gpu;services;UE4;demo ingame 2023-02-16 20:05:07
427 0100CD801CE5E000 Balatro ingame 2024-04-21 02:01:53
428 010010A00DA48000 Baldur's Gate and Baldur's Gate II: Enhanced Editions 32-bit playable 2022-09-12 23:52:15
0100fd1014726000 Baldur's Gate: Dark Alliance ldn-untested ingame 2025-02-03 22:21:00
429 0100BC400FB64000 Balthazar's Dream playable 2022-09-13 00:13:22
430 01008D30128E0000 Bamerang playable 2022-10-26 00:29:39
431 010013C010C5C000 Banner of the Maid playable 2021-06-14 15:23:37
528 01005950022EC000 Blade Strangers nvdec playable 2022-07-17 19:02:43
529 0100DF0011A6A000 Bladed Fury playable 2022-10-26 11:36:26
530 0100CFA00CC74000 Blades of Time deadlock;online boots 2022-07-17 19:19:58
01003d700dd8a000 Blades boots 2025-02-03 22:22:00
531 01006CC01182C000 Blair Witch nvdec;UE4 playable 2022-10-01 14:06:16
532 010039501405E000 Blanc gpu;slow ingame 2023-02-22 14:00:13
533 0100698009C6E000 Blasphemous nvdec playable 2021-03-01 12:15:31
955 010012800EBAE000 Disney TSUM TSUM FESTIVAL crash menus 2020-07-14 14:05:28
956 01009740120FE000 DISTRAINT 2 playable 2020-09-03 16:08:12
957 010075B004DD2000 DISTRAINT: Deluxe Edition playable 2020-06-15 23:42:24
958 010027400CDC6000 Divinity: Original Sin 2 - Definitive Edition services;crash;online-broken;regression ingame menus 2025-02-03 22:12:30 2023-08-13 17:20:03
959 01001770115C8000 Dodo Peak nvdec;UE4 playable 2022-10-04 16:13:05
960 010077B0100DA000 Dogurai playable 2020-10-04 02:40:16
961 010048100D51A000 Dokapon Up! Mugen no Roulette gpu;Needs Update menus 2022-12-08 19:39:10
966 0100751007ADA000 Don't Starve: Nintendo Switch Edition nvdec playable 2022-02-05 20:43:34
967 010088B010DD2000 Dongo Adventure playable 2022-10-04 16:22:26
968 0100C1F0051B6000 Donkey Kong Country™: Tropical Freeze playable 2024-08-05 16:46:10
01009D901BC56000 Donkey Kong Country™: Returns HD gpu ingame 2025-02-16 13:44:12
969 0100F2C00F060000 Doodle Derby boots 2020-12-04 22:51:48
970 0100416004C00000 DOOM gpu;slow;nvdec;online-broken ingame 2024-09-23 15:40:07
971 010018900DD00000 DOOM (1993) nvdec;online-broken menus 2022-09-06 13:32:19
1155 010095600AA36000 Fill-a-Pix: Phil's Epic Adventure playable 2020-12-22 13:48:22
1156 0100C3A00BB76000 Fimbul nvdec playable 2022-07-26 13:31:47
1157 0100C8200E942000 Fin and the Ancient Mystery nvdec playable 2020-12-17 16:40:39
1158 01000EA014150000 FINAL FANTASY crash playable nothing 2025-02-16 21:27:30 2024-09-05 20:55:30
1159 01006B7014156000 FINAL FANTASY II crash nothing 2024-04-13 19:18:04
1160 01006F000B056000 FINAL FANTASY IX audout;nvdec playable 2021-06-05 11:35:00
1161 0100AA201415C000 FINAL FANTASY V playable 2023-04-26 01:11:55
1246 0100A6B00D4EC000 Furwind playable 2021-02-19 19:44:08
1247 0100ECE00C0C4000 Fury Unleashed crash;services ingame 2020-10-18 11:52:40
1248 010070000ED9E000 Fury Unleashed Demo playable 2020-10-08 20:09:21
1249 0100E1F013674000 FUSER™ nvdec;UE4;slow;gpu nvdec;UE4 ingame playable 2025-02-12 16:03:00 2022-10-17 20:58:32
1250 0100A7A015E4C000 Fushigi no Gensokyo Lotus Labyrinth Needs Update;audio;gpu;nvdec ingame 2021-01-20 15:30:02
1251 01003C300B274000 Futari de! Nyanko Daisensou playable 2024-01-05 22:26:52
1252 010055801134E000 FUZE Player online-broken;vulkan-backend-bug ingame 2022-10-18 12:23:53
1432 010083A018262000 Hitman: Blood Money — Reprisal deadlock ingame 2024-09-28 16:28:50
1433 01004B100A5CC000 Hob: The Definitive Edition playable 2021-01-13 09:39:19
1434 0100F7300ED2C000 Hoggy2 playable 2022-10-10 13:53:35
1435 0100F7E00C70E000 Hogwarts Legacy UE4;slow slow ingame 2024-09-03 19:53:58
1436 0100633007D48000 Hollow Knight nvdec playable 2023-01-16 15:44:56
1437 0100F2100061E800 Hollow0 UE4;gpu ingame 2021-03-03 23:42:56
1438 0100342009E16000 Holy Potatoes! What The Hell?! playable 2020-07-03 10:48:56
1654 0100A73006E74000 Legendary Eleven playable 2021-06-08 12:09:03
1655 0100A7700B46C000 Legendary Fishing online playable 2021-04-14 15:08:46
1656 0100739018020000 LEGO® 2K Drive gpu;ldn-works ingame 2024-04-09 02:05:12
1657 010085500130a000 01003A30012C0000 LEGO® CITY Undercover nvdec playable 2024-09-30 08:44:27
1658 010070D009FEC000 LEGO® DC Super-Villains playable 2021-05-27 18:10:37
1659 010052A00B5D2000 LEGO® Harry Potter™ Collection crash ingame 2024-01-31 10:28:07
1660 010073C01AF34000 LEGO® Horizon Adventures™ vulkan-backend-bug;opengl-backend-bug;UE4 ingame 2025-01-07 04:24:56
1796 010005A00B312000 Megaton Rainfall gpu;opengl boots 2022-08-04 18:29:43
1797 0100EA100DF92000 Meiji Katsugeki Haikara Ryuuseigumi - Seibai Shimaseu, Yonaoshi Kagyou 32-bit;nvdec playable 2022-12-05 13:19:12
1798 0100B360068B2000 Mekorama gpu boots 2021-06-17 16:37:21
010012301932A000 Melatonin playable 2025-02-16 04:08:17
1799 01000FA010340000 Melbits World nvdec;online menus 2021-11-26 13:51:22
1800 0100F68019636000 Melon Journey playable 2023-04-23 21:20:01
1801 010079C012896000 Memories Off -Innocent Fille- for Dearest playable 2020-08-04 07:31:22
1913 010073E008E6E000 Mugsters playable 2021-01-28 17:57:17
1914 0100A8400471A000 MUJO playable 2020-05-08 16:31:04
1915 0100211005E94000 Mulaka playable 2021-01-28 18:07:20
01008e2013fb4000 Multi Quiz ldn-untested ingame 2025-02-03 22:26:00
1916 010038B00B9AE000 Mummy Pinball playable 2022-08-05 16:08:11
1917 01008E200C5C2000 Muse Dash playable 2020-06-06 14:41:29
1918 010035901046C000 Mushroom Quest playable 2020-05-17 13:07:08
2028 010003C00B868000 Ninjin: Clash of Carrots online-broken playable 2024-07-10 05:12:26
2029 0100746010E4C000 NinNinDays playable 2022-11-20 15:17:29
2030 0100C9A00ECE6000 Nintendo 64™ – Nintendo Switch Online gpu;vulkan ingame 2024-04-23 20:21:07
0100e0601c632000 Nintendo 64™ – Nintendo Switch Online: MATURE 17+ ingame 2025-02-03 22:27:00
2031 0100D870045B6000 Nintendo Entertainment System™ - Nintendo Switch Online online playable 2022-07-01 15:45:06
2032 0100C4B0034B2000 Nintendo Labo Toy-Con 01 Variety Kit gpu ingame 2022-08-07 12:56:07
2033 01001E9003502000 Nintendo Labo Toy-Con 03 Vehicle Kit services;crash menus 2022-08-03 17:20:11
2058 010002700C34C000 Numbala playable 2020-05-11 12:01:07
2059 010020500C8C8000 Number Place 10000 gpu menus 2021-11-24 09:14:23
2060 010003701002C000 Nurse Love Syndrome playable 2022-10-13 10:05:22
2061 0000000000000000 nx-hbmenu Needs Update;homebrew boots 2024-04-06 22:05:32
2062 nxquake2 services;crash;homebrew nothing 2022-08-04 23:14:04
2063 010049F00EC30000 Nyan Cat: Lost in Space online playable 2021-06-12 13:22:03
2064 01002E6014FC4000 O---O playable 2022-10-29 12:12:14
2466 0100AFE00DDAC000 Royal Roads playable 2020-11-17 12:54:38
2467 0100E2C00B414000 RPG Maker MV nvdec playable 2021-01-05 20:12:01
2468 01005CD015986000 rRootage Reloaded playable 2022-08-05 23:20:18
2469 0000000000000000 RSDKv5u homebrew ingame 2024-04-01 16:25:34
2470 010009B00D33C000 Rugby Challenge 4 slow;online-broken;UE4 playable 2022-10-06 12:45:53
2471 01006EC00F2CC000 RUINER UE4 playable 2022-10-03 14:11:33
2472 010074F00DE4A000 Run the Fan playable 2021-02-27 13:36:28
2475 010081C0191D8000 Rune Factory 3 Special playable 2023-10-15 08:32:49
2476 010051D00E3A4000 Rune Factory 4 Special 32-bit;crash;nvdec ingame 2023-05-06 08:49:17
2477 010014D01216E000 Rune Factory 5 (JP) gpu ingame 2021-06-01 12:00:36
010071E0145F8000 Rustler playable 2025-02-10 20:17:12
2478 0100E21013908000 RWBY: Grimm Eclipse - Definitive Edition online-broken playable 2022-11-03 10:44:01
2479 010012C0060F0000 RXN -Raijin- nvdec playable 2021-01-10 16:05:43
2480 0100B8B012ECA000 S.N.I.P.E.R. - Hunter Scope playable 2021-04-19 15:58:09
2532 0100C3E00B700000 SEGA AGES Space Harrier playable 2021-01-11 12:57:40
2533 010054400D2E6000 SEGA AGES Virtua Racing online-broken playable 2023-01-29 17:08:39
2534 01001E700AC60000 SEGA AGES Wonder Boy: Monster Land online playable 2021-05-05 16:28:25
2535 0100B3C014BDA000 SEGA Genesis™ – Nintendo Switch Online crash;regression ingame nothing 2025-02-03 22:13:30 2022-04-11 07:27:21
2536 0100F7300B24E000 SEGA Mega Drive Classics online playable 2021-01-05 11:08:00
2537 01009840046BC000 Semispheres playable 2021-01-06 23:08:31
2538 0100D1800D902000 SENRAN KAGURA Peach Ball playable 2021-06-03 15:12:10
2668 01004F401BEBE000 Song of Nunu: A League of Legends Story ingame 2024-07-12 18:53:44
2669 0100E5400BF94000 Songbird Symphony playable 2021-02-27 02:44:04
2670 010031D00A604000 Songbringer playable 2020-06-22 10:42:02
2671 0000000000000000 Sonic 1 (2013) crash;homebrew ingame 2024-04-06 18:31:20
2672 0000000000000000 Sonic 2 (2013) crash;homebrew ingame 2024-04-01 16:25:30
2673 0000000000000000 Sonic A.I.R homebrew ingame 2024-04-01 16:25:32
2674 0000000000000000 Sonic CD crash;homebrew ingame 2024-04-01 16:25:31
2675 010040E0116B8000 Sonic Colors: Ultimate playable 2022-11-12 21:24:26
2676 01001270012B6000 SONIC FORCES™ playable 2024-07-28 13:11:21
2677 01004AD014BF0000 Sonic Frontiers gpu;deadlock;amd-vendor-bug;intel-vendor-bug ingame 2024-09-05 09:18:53
2688 0100707011722000 Space Elite Force playable 2020-11-27 15:21:05
2689 010047B010260000 Space Pioneer playable 2022-10-20 12:24:37
2690 010010A009830000 Space Ribbon playable 2022-08-15 17:17:10
2691 0000000000000000 SpaceCadetPinball homebrew ingame 2024-04-18 19:30:04
2692 0100D9B0041CE000 Spacecats with Lasers playable 2022-08-15 17:22:44
2693 010034800FB60000 Spaceland playable 2020-11-01 14:31:56
2694 010028D0045CE000 Sparkle 2 playable 2020-10-19 11:51:39
2832 01009B90006DC000 Super Mario Maker™ 2 online-broken;ldn-broken playable 2024-08-25 11:05:19
2833 0100000000010000 Super Mario Odyssey™ nvdec;intel-vendor-bug;mac-bug playable 2024-08-25 01:32:34
2834 010036B0034E4000 Super Mario Party™ gpu;Needs Update;ldn-works ingame 2024-06-21 05:10:16
0100965017338000 Super Mario Party Jamboree mac-bug;gpu ingame 2025-02-17 02:09:20
2835 0100BC0018138000 Super Mario RPG™ gpu;audio;nvdec ingame 2024-06-19 17:43:42
2836 0000000000000000 Super Mario World homebrew boots 2024-06-13 01:40:31
2837 010049900F546000 Super Mario™ 3D All-Stars services-horizon;slow;vulkan;amd-vendor-bug ingame 2024-05-07 02:38:16
2838 010028600EBDA000 Super Mario™ 3D World + Bowser’s Fury ldn-works playable 2024-07-31 10:45:37
2839 01004F8006A78000 Super Meat Boy services playable 2020-04-02 23:10:07
2964 0100C38004DCC000 The Flame In The Flood: Complete Edition gpu;nvdec;UE4 ingame 2022-08-22 16:23:49
2965 010007700D4AC000 The Forbidden Arts playable 2021-01-26 16:26:24
2966 010030700CBBC000 The friends of Ringo Ishikawa playable 2022-08-22 16:33:17
0100b620139d8000 The Game of Life 2 ldn-untested ingame 2025-02-03 22:30:00
2967 01006350148DA000 The Gardener and the Wild Vines gpu ingame 2024-04-29 16:32:10
2968 0100B13007A6A000 The Gardens Between playable 2021-01-29 16:16:53
2969 010036E00FB20000 The Great Ace Attorney Chronicles playable 2023-06-22 21:26:29
2981 010015D003EE4000 The Jackbox Party Pack 2 online-working playable 2022-08-22 18:23:40
2982 0100CC80013D6000 The Jackbox Party Pack 3 slow;online-working playable 2022-08-22 18:41:06
2983 0100E1F003EE8000 The Jackbox Party Pack 4 online-working playable 2022-08-22 18:56:34
01006fe0096ac000 The Jackbox Party Pack 5 slow;online-working ingame 2025-02-14 05:32:00
01005a400db52000 The Jackbox Party Pack 6 slow;online-working ingame 2025-02-14 05:26:00
2984 010052C00B184000 The Journey Down: Chapter One nvdec playable 2021-02-24 13:32:41
2985 01006BC00B188000 The Journey Down: Chapter Three nvdec playable 2021-02-24 13:45:27
2986 01009AB00B186000 The Journey Down: Chapter Two nvdec playable 2021-02-24 13:32:13
3159 010055E00CA68000 Trine 4: The Nightmare Prince gpu nothing 2025-01-07 05:47:46
3160 0100D9000A930000 Trine Enchanted Edition ldn-untested;nvdec playable 2021-06-03 11:28:15
3161 01002D7010A54000 Trinity Trigger crash ingame 2023-03-03 03:09:09
010020700a5e0000 TRIVIAL PURSUIT Live! ldn-untested ingame 2025-02-03 22:35:00
3162 0100868013FFC000 TRIVIAL PURSUIT Live! 2 boots 2022-12-19 00:04:33
3163 0100F78002040000 Troll and I™ gpu;nvdec ingame 2021-06-04 16:58:50
3164 0100145011008000 Trollhunters: Defenders of Arcadia gpu;nvdec ingame 2020-11-30 13:27:09
3208 0100AB2010B4C000 Unlock The King playable 2020-09-01 13:58:27
3209 0100A3E011CB0000 Unlock the King 2 playable 2021-06-15 20:43:55
3210 01005AA00372A000 UNO® for Nintendo Switch nvdec;ldn-untested playable 2022-07-28 14:49:47
0100b6e012ebe000 UNO ldn-untested ingame 2025-02-03 22:40:00
3211 0100E5D00CC0C000 Unravel Two nvdec playable 2024-05-23 15:45:05
3212 010001300CC4A000 Unruly Heroes playable 2021-01-07 18:09:31
3213 0100B410138C0000 Unspottable playable 2022-10-25 19:28:49
3372 0100F47016F26000 Yomawari 3 playable 2022-05-10 08:26:51
3373 010012F00B6F2000 Yomawari: The Long Night Collection playable 2022-09-03 14:36:59
3374 0100CC600ABB2000 Yonder: The Cloud Catcher Chronicles (Retail Only) playable 2021-01-28 14:06:25
0100534009ff2000 Yonder: The Cloud Catcher Chronicles playable 2025-02-03 22:19:13
3375 0100BE50042F6000 Yono and the Celestial Elephants playable 2021-01-28 18:23:58
3376 0100F110029C8000 Yooka-Laylee playable 2021-01-28 14:21:45
3377 010022F00DA66000 Yooka-Laylee and the Impossible Lair playable 2021-03-05 17:32:21

View File

@@ -7,7 +7,6 @@ namespace ARMeilleure.Memory
public const int DefaultGranularity = 65536; // Mapping granularity in Windows. public const int DefaultGranularity = 65536; // Mapping granularity in Windows.
public IJitMemoryBlock Block { get; } public IJitMemoryBlock Block { get; }
public IJitMemoryAllocator Allocator { get; }
public nint Pointer => Block.Pointer; public nint Pointer => Block.Pointer;
@@ -22,7 +21,6 @@ namespace ARMeilleure.Memory
granularity = DefaultGranularity; granularity = DefaultGranularity;
} }
Allocator = allocator;
Block = allocator.Reserve(maxSize); Block = allocator.Reserve(maxSize);
_maxSize = maxSize; _maxSize = maxSize;
_sizeGranularity = granularity; _sizeGranularity = granularity;

View File

@@ -2,8 +2,6 @@ using ARMeilleure.CodeGen;
using ARMeilleure.CodeGen.Unwinding; using ARMeilleure.CodeGen.Unwinding;
using ARMeilleure.Memory; using ARMeilleure.Memory;
using ARMeilleure.Native; using ARMeilleure.Native;
using Humanizer;
using Ryujinx.Common.Logging;
using Ryujinx.Memory; using Ryujinx.Memory;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -20,8 +18,9 @@ namespace ARMeilleure.Translation.Cache
private static readonly int _pageMask = _pageSize - 1; private static readonly int _pageMask = _pageSize - 1;
private const int CodeAlignment = 4; // Bytes. private const int CodeAlignment = 4; // Bytes.
private const int CacheSize = 256 * 1024 * 1024; private const int CacheSize = 2047 * 1024 * 1024;
private static ReservedRegion _jitRegion;
private static JitCacheInvalidation _jitCacheInvalidator; private static JitCacheInvalidation _jitCacheInvalidator;
private static CacheMemoryAllocator _cacheAllocator; private static CacheMemoryAllocator _cacheAllocator;
@@ -31,9 +30,6 @@ namespace ARMeilleure.Translation.Cache
private static readonly Lock _lock = new(); private static readonly Lock _lock = new();
private static bool _initialized; private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
[LibraryImport("kernel32.dll", SetLastError = true)] [LibraryImport("kernel32.dll", SetLastError = true)]
public static partial nint FlushInstructionCache(nint hProcess, nint lpAddress, nuint dwSize); public static partial nint FlushInstructionCache(nint hProcess, nint lpAddress, nuint dwSize);
@@ -52,9 +48,7 @@ namespace ARMeilleure.Translation.Cache
return; return;
} }
ReservedRegion firstRegion = new(allocator, CacheSize); _jitRegion = new ReservedRegion(allocator, CacheSize);
_jitRegions.Add(firstRegion);
_activeRegionIndex = 0;
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS()) if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
{ {
@@ -65,9 +59,7 @@ namespace ARMeilleure.Translation.Cache
if (OperatingSystem.IsWindows()) if (OperatingSystem.IsWindows())
{ {
JitUnwindWindows.InstallFunctionTableHandler( JitUnwindWindows.InstallFunctionTableHandler(_jitRegion.Pointer, CacheSize, _jitRegion.Pointer + Allocate(_pageSize));
firstRegion.Pointer, CacheSize, firstRegion.Pointer + Allocate(_pageSize)
);
} }
_initialized = true; _initialized = true;
@@ -83,8 +75,8 @@ namespace ARMeilleure.Translation.Cache
Debug.Assert(_initialized); Debug.Assert(_initialized);
int funcOffset = Allocate(code.Length); int funcOffset = Allocate(code.Length);
ReservedRegion targetRegion = _jitRegions[_activeRegionIndex];
nint funcPtr = targetRegion.Pointer + funcOffset; nint funcPtr = _jitRegion.Pointer + funcOffset;
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64) if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{ {
@@ -98,9 +90,9 @@ namespace ARMeilleure.Translation.Cache
} }
else else
{ {
ReprotectAsWritable(targetRegion, funcOffset, code.Length); ReprotectAsWritable(funcOffset, code.Length);
Marshal.Copy(code, 0, funcPtr, code.Length); Marshal.Copy(code, 0, funcPtr, code.Length);
ReprotectAsExecutable(targetRegion, funcOffset, code.Length); ReprotectAsExecutable(funcOffset, code.Length);
if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64) if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{ {
@@ -124,83 +116,52 @@ namespace ARMeilleure.Translation.Cache
{ {
Debug.Assert(_initialized); Debug.Assert(_initialized);
foreach (ReservedRegion region in _jitRegions) int funcOffset = (int)(pointer.ToInt64() - _jitRegion.Pointer.ToInt64());
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
{ {
if (pointer.ToInt64() < region.Pointer.ToInt64() || _cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64()) _cacheEntries.RemoveAt(entryIndex);
{
continue;
}
int funcOffset = (int)(pointer.ToInt64() - region.Pointer.ToInt64());
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
{
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
_cacheEntries.RemoveAt(entryIndex);
}
return;
} }
} }
} }
private static void ReprotectAsWritable(ReservedRegion region, int offset, int size) private static void ReprotectAsWritable(int offset, int size)
{ {
int endOffs = offset + size; int endOffs = offset + size;
int regionStart = offset & ~_pageMask; int regionStart = offset & ~_pageMask;
int regionEnd = (endOffs + _pageMask) & ~_pageMask; int regionEnd = (endOffs + _pageMask) & ~_pageMask;
region.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart)); _jitRegion.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
} }
private static void ReprotectAsExecutable(ReservedRegion region, int offset, int size) private static void ReprotectAsExecutable(int offset, int size)
{ {
int endOffs = offset + size; int endOffs = offset + size;
int regionStart = offset & ~_pageMask; int regionStart = offset & ~_pageMask;
int regionEnd = (endOffs + _pageMask) & ~_pageMask; int regionEnd = (endOffs + _pageMask) & ~_pageMask;
region.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart)); _jitRegion.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
} }
private static int Allocate(int codeSize) private static int Allocate(int codeSize)
{ {
codeSize = AlignCodeSize(codeSize); codeSize = AlignCodeSize(codeSize);
for (int i = _activeRegionIndex; i < _jitRegions.Count; i++) int allocOffset = _cacheAllocator.Allocate(codeSize);
{
int allocOffset = _cacheAllocator.Allocate(codeSize);
if (allocOffset >= 0) if (allocOffset < 0)
{ {
_jitRegions[i].ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize); throw new OutOfMemoryException("JIT Cache exhausted.");
_activeRegionIndex = i;
return allocOffset;
}
} }
int exhaustedRegion = _activeRegionIndex; _jitRegion.ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
ReservedRegion newRegion = new(_jitRegions[0].Allocator, CacheSize);
_jitRegions.Add(newRegion);
_activeRegionIndex = _jitRegions.Count - 1;
int newRegionNumber = _activeRegionIndex; return allocOffset;
Logger.Warning?.Print(LogClass.Cpu, $"JIT Cache Region {exhaustedRegion} exhausted, creating new Cache Region {newRegionNumber} ({((long)(newRegionNumber + 1) * CacheSize).Bytes()} Total Allocation).");
_cacheAllocator = new CacheMemoryAllocator(CacheSize);
int allocOffsetNew = _cacheAllocator.Allocate(codeSize);
if (allocOffsetNew < 0)
{
throw new OutOfMemoryException("Failed to allocate in new Cache Region!");
}
newRegion.ExpandIfNeeded((ulong)allocOffsetNew + (ulong)codeSize);
return allocOffsetNew;
} }
private static int AlignCodeSize(int codeSize) private static int AlignCodeSize(int codeSize)
{ {
return checked(codeSize + (CodeAlignment - 1)) & ~(CodeAlignment - 1); return checked(codeSize + (CodeAlignment - 1)) & ~(CodeAlignment - 1);
@@ -224,21 +185,18 @@ namespace ARMeilleure.Translation.Cache
{ {
lock (_lock) lock (_lock)
{ {
foreach (ReservedRegion _ in _jitRegions) int index = _cacheEntries.BinarySearch(new CacheEntry(offset, 0, default));
if (index < 0)
{ {
int index = _cacheEntries.BinarySearch(new CacheEntry(offset, 0, default)); index = ~index - 1;
}
if (index < 0) if (index >= 0)
{ {
index = ~index - 1; entry = _cacheEntries[index];
} entryIndex = index;
return true;
if (index >= 0)
{
entry = _cacheEntries[index];
entryIndex = index;
return true;
}
} }
} }

View File

@@ -144,15 +144,17 @@ namespace ARMeilleure.Translation.PTC
public List<ulong> GetBlacklistedFunctions() public List<ulong> GetBlacklistedFunctions()
{ {
List<ulong> funcs = []; List<ulong> funcs = new List<ulong>();
foreach ((ulong ptr, FuncProfile funcProfile) in ProfiledFuncs) foreach (var profiledFunc in ProfiledFuncs)
{ {
if (!funcProfile.Blacklist) if (profiledFunc.Value.Blacklist)
continue; {
if (!funcs.Contains(profiledFunc.Key))
if (!funcs.Contains(ptr)) {
funcs.Add(ptr); funcs.Add(profiledFunc.Key);
}
}
} }
return funcs; return funcs;

View File

@@ -1,9 +0,0 @@
namespace Ryujinx.Common
{
public static class SharedConstants
{
public const string DefaultLanPlayHost = "ryuldn.vudjun.com";
public const short LanPlayPort = 30456;
public const string DefaultLanPlayWebHost = "ryuldnweb.vudjun.com";
}
}

View File

@@ -53,9 +53,10 @@ namespace Ryujinx.Common
"0100000000010000", // Super Mario Odyssey "0100000000010000", // Super Mario Odyssey
// Further testing is appreciated, I did not test the entire game: // Further testing is appreciated, I did not test the entire game:
//"010076f0049a2000", // Bayonetta "01007300020fa000", // Astral Chain
//"0100cf5010fec000", // Bayonetta Origins: Cereza and the Lost Demon "010076f0049a2000", // Bayonetta
//"0100f4300bf2c000", // New Pokemon Snap "0100cf5010fec000", // Bayonetta Origins: Cereza and the Lost Demon
"0100f4300bf2c000", // New Pokemon Snap
]; ];
public static string GetDiscordGameAsset(string titleId) public static string GetDiscordGameAsset(string titleId)
@@ -163,16 +164,15 @@ namespace Ryujinx.Common
"0100ba0018500000", // Splatoon 3: Splatfest World Premiere "0100ba0018500000", // Splatoon 3: Splatfest World Premiere
//NSO Membership games //NSO Membership games
"0100ccf019c8c000", // F-ZERO 99
"0100c62011050000", // GB - Nintendo Switch Online "0100c62011050000", // GB - Nintendo Switch Online
"010012f017576000", // GBA - Nintendo Switch Online "010012f017576000", // GBA - Nintendo Switch Online
"0100c9a00ece6000", // N64 - Nintendo Switch Online "0100c9a00ece6000", // N64 - Nintendo Switch Online
"0100e0601c632000", // N64 - Nintendo Switch Online 18+ "0100e0601c632000", // N64 - Nintendo Switch Online 18+
"0100d870045b6000", // NES - Nintendo Switch Online "0100d870045b6000", // NES - Nintendo Switch Online
"0100b3c014bda000", // SEGA Genesis - Nintendo Switch Online
"01008d300c50c000", // SNES - Nintendo Switch Online
"0100ccf019c8c000", // F-ZERO 99
"0100ad9012510000", // PAC-MAN 99 "0100ad9012510000", // PAC-MAN 99
"010040600c5ce000", // Tetris 99 "010040600c5ce000", // Tetris 99
"01008d300c50c000", // SNES - Nintendo Switch Online
"0100277011f1a000", // Super Mario Bros. 35 "0100277011f1a000", // Super Mario Bros. 35
//Misc Nintendo 1st party games //Misc Nintendo 1st party games
@@ -218,7 +218,6 @@ namespace Ryujinx.Common
//Misc Games //Misc Games
"010056e00853a000", // A Hat in Time "010056e00853a000", // A Hat in Time
"0100fd1014726000", // Baldurs Gate: Dark Alliance "0100fd1014726000", // Baldurs Gate: Dark Alliance
"01008c2019598000", // Bluey: The Video Game
"0100c6800b934000", // Brawlhalla "0100c6800b934000", // Brawlhalla
"0100dbf01000a000", // Burnout Paradise Remastered "0100dbf01000a000", // Burnout Paradise Remastered
"0100744001588000", // Cars 3: Driven to Win "0100744001588000", // Cars 3: Driven to Win
@@ -229,7 +228,6 @@ namespace Ryujinx.Common
"01008c8012920000", // Dying Light Platinum Edition "01008c8012920000", // Dying Light Platinum Edition
"01001cc01b2d4000", // Goat Simulator 3 "01001cc01b2d4000", // Goat Simulator 3
"01003620068ea000", // Hand of Fate 2 "01003620068ea000", // Hand of Fate 2
"0100f7e00c70e000", // Hogwarts Legacy
"010085500130a000", // Lego City: Undercover "010085500130a000", // Lego City: Undercover
"010073c01af34000", // LEGO Horizon Adventures "010073c01af34000", // LEGO Horizon Adventures
"0100d71004694000", // Minecraft "0100d71004694000", // Minecraft

View File

@@ -1,6 +1,4 @@
using ARMeilleure.Memory; using ARMeilleure.Memory;
using Humanizer;
using Ryujinx.Common.Logging;
using Ryujinx.Memory; using Ryujinx.Memory;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -17,8 +15,9 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private static readonly int _pageMask = _pageSize - 1; private static readonly int _pageMask = _pageSize - 1;
private const int CodeAlignment = 4; // Bytes. private const int CodeAlignment = 4; // Bytes.
private const int CacheSize = 256 * 1024 * 1024; private const int CacheSize = 2047 * 1024 * 1024;
private static ReservedRegion _jitRegion;
private static JitCacheInvalidation _jitCacheInvalidator; private static JitCacheInvalidation _jitCacheInvalidator;
private static CacheMemoryAllocator _cacheAllocator; private static CacheMemoryAllocator _cacheAllocator;
@@ -27,8 +26,6 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private static readonly Lock _lock = new(); private static readonly Lock _lock = new();
private static bool _initialized; private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
[LibraryImport("kernel32.dll", SetLastError = true)] [LibraryImport("kernel32.dll", SetLastError = true)]
@@ -48,9 +45,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
return; return;
} }
ReservedRegion firstRegion = new(allocator, CacheSize); _jitRegion = new ReservedRegion(allocator, CacheSize);
_jitRegions.Add(firstRegion);
_activeRegionIndex = 0;
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS()) if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
{ {
@@ -70,8 +65,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
Debug.Assert(_initialized); Debug.Assert(_initialized);
int funcOffset = Allocate(code.Length); int funcOffset = Allocate(code.Length);
ReservedRegion targetRegion = _jitRegions[_activeRegionIndex];
nint funcPtr = targetRegion.Pointer + funcOffset; nint funcPtr = _jitRegion.Pointer + funcOffset;
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64) if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{ {
@@ -85,11 +80,18 @@ namespace Ryujinx.Cpu.LightningJit.Cache
} }
else else
{ {
ReprotectAsWritable(targetRegion, funcOffset, code.Length); ReprotectAsWritable(funcOffset, code.Length);
Marshal.Copy(code.ToArray(), 0, funcPtr, code.Length); code.CopyTo(new Span<byte>((void*)funcPtr, code.Length));
ReprotectAsExecutable(targetRegion, funcOffset, code.Length); ReprotectAsExecutable(funcOffset, code.Length);
_jitCacheInvalidator?.Invalidate(funcPtr, (ulong)code.Length); if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
FlushInstructionCache(Process.GetCurrentProcess().Handle, funcPtr, (nuint)code.Length);
}
else
{
_jitCacheInvalidator?.Invalidate(funcPtr, (ulong)code.Length);
}
} }
Add(funcOffset, code.Length); Add(funcOffset, code.Length);
@@ -104,80 +106,50 @@ namespace Ryujinx.Cpu.LightningJit.Cache
{ {
Debug.Assert(_initialized); Debug.Assert(_initialized);
foreach (ReservedRegion region in _jitRegions) int funcOffset = (int)(pointer.ToInt64() - _jitRegion.Pointer.ToInt64());
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
{ {
if (pointer.ToInt64() < region.Pointer.ToInt64() || _cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64()) _cacheEntries.RemoveAt(entryIndex);
{
continue;
}
int funcOffset = (int)(pointer.ToInt64() - region.Pointer.ToInt64());
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
{
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
_cacheEntries.RemoveAt(entryIndex);
}
return;
} }
} }
} }
private static void ReprotectAsWritable(ReservedRegion region, int offset, int size) private static void ReprotectAsWritable(int offset, int size)
{ {
int endOffs = offset + size; int endOffs = offset + size;
int regionStart = offset & ~_pageMask; int regionStart = offset & ~_pageMask;
int regionEnd = (endOffs + _pageMask) & ~_pageMask; int regionEnd = (endOffs + _pageMask) & ~_pageMask;
region.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart)); _jitRegion.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
} }
private static void ReprotectAsExecutable(ReservedRegion region, int offset, int size) private static void ReprotectAsExecutable(int offset, int size)
{ {
int endOffs = offset + size; int endOffs = offset + size;
int regionStart = offset & ~_pageMask; int regionStart = offset & ~_pageMask;
int regionEnd = (endOffs + _pageMask) & ~_pageMask; int regionEnd = (endOffs + _pageMask) & ~_pageMask;
region.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart)); _jitRegion.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
} }
private static int Allocate(int codeSize) private static int Allocate(int codeSize)
{ {
codeSize = AlignCodeSize(codeSize); codeSize = AlignCodeSize(codeSize);
for (int i = _activeRegionIndex; i < _jitRegions.Count; i++) int allocOffset = _cacheAllocator.Allocate(codeSize);
{
int allocOffset = _cacheAllocator.Allocate(codeSize);
if (allocOffset >= 0) if (allocOffset < 0)
{ {
_jitRegions[i].ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize); throw new OutOfMemoryException("JIT Cache exhausted.");
_activeRegionIndex = i;
return allocOffset;
}
} }
int exhaustedRegion = _activeRegionIndex; _jitRegion.ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
ReservedRegion newRegion = new(_jitRegions[0].Allocator, CacheSize);
_jitRegions.Add(newRegion);
_activeRegionIndex = _jitRegions.Count - 1;
int newRegionNumber = _activeRegionIndex; return allocOffset;
Logger.Warning?.Print(LogClass.Cpu, $"JIT Cache Region {exhaustedRegion} exhausted, creating new Cache Region {newRegionNumber} ({((long)(newRegionNumber + 1) * CacheSize).Bytes()} Total Allocation).");
_cacheAllocator = new CacheMemoryAllocator(CacheSize);
int allocOffsetNew = _cacheAllocator.Allocate(codeSize);
if (allocOffsetNew < 0)
{
throw new OutOfMemoryException("Failed to allocate in new Cache Region!");
}
newRegion.ExpandIfNeeded((ulong)allocOffsetNew + (ulong)codeSize);
return allocOffsetNew;
} }
private static int AlignCodeSize(int codeSize) private static int AlignCodeSize(int codeSize)

View File

@@ -12,7 +12,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
{ {
private const int CodeAlignment = 4; // Bytes. private const int CodeAlignment = 4; // Bytes.
private const int SharedCacheSize = 2047 * 1024 * 1024; private const int SharedCacheSize = 2047 * 1024 * 1024;
private const int LocalCacheSize = 256 * 1024 * 1024; private const int LocalCacheSize = 128 * 1024 * 1024;
// How many calls to the same function we allow until we pad the shared cache to force the function to become available there // How many calls to the same function we allow until we pad the shared cache to force the function to become available there
// and allow the guest to take the fast path. // and allow the guest to take the fast path.

View File

@@ -913,7 +913,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Span<Rectangle<int>> scissors = Span<Rectangle<int>> scissors =
[ [
new(scissorX, scissorY, scissorW, scissorH) new Rectangle<int>(scissorX, scissorY, scissorW, scissorH)
]; ];
_context.Renderer.Pipeline.SetScissors(scissors); _context.Renderer.Pipeline.SetScissors(scissors);

View File

@@ -729,7 +729,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
ShaderProgram program = translatorContext.Translate(); ShaderProgram program = translatorContext.Translate();
CachedShaderStage[] shaders = [new(program.Info, shader.Code, shader.Cb1Data)]; CachedShaderStage[] shaders = [new CachedShaderStage(program.Info, shader.Code, shader.Cb1Data)];
_compilationQueue.Enqueue(new ProgramCompilation([program], shaders, newSpecState, programIndex, isCompute: true)); _compilationQueue.Enqueue(new ProgramCompilation([program], shaders, newSpecState, programIndex, isCompute: true));
} }

View File

@@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
} }
} }
ArrayPtr<T> allocation = new(ptr, length); ArrayPtr<T> allocation = new ArrayPtr<T>(ptr, length);
allocation.AsSpan().Fill(default); allocation.AsSpan().Fill(default);

View File

@@ -14,8 +14,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
return (v & 1) != 0 ? m - ((v + 1) >> 1) : m + (v >> 1); return (v & 1) != 0 ? m - ((v + 1) >> 1) : m + (v >> 1);
} }
private static readonly byte[] _invMapTable = private static readonly byte[] InvMapTable =
[ {
7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189, 202, 215, 228, 241, 254, 1, 2, 3, 4, 7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189, 202, 215, 228, 241, 254, 1, 2, 3, 4,
5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62,
@@ -28,13 +28,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
206, 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 206, 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250,
251, 252, 253, 253 251, 252, 253, 253
]; };
public static int InvRemapProb(int v, int m) public static int InvRemapProb(int v, int m)
{ {
Debug.Assert(v < _invMapTable.Length / sizeof(byte)); Debug.Assert(v < InvMapTable.Length / sizeof(byte));
v = _invMapTable[v]; v = InvMapTable[v];
m--; m--;
if (m << 1 <= Prob.MaxProb) if (m << 1 <= Prob.MaxProb)
{ {

View File

@@ -111,23 +111,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<ushort> dst16 = MemoryMarshal.Cast<byte, ushort>(dst); Span<ushort> dst16 = MemoryMarshal.Cast<byte, ushort>(dst);
if (xd.Lossless) if (xd.Lossless)
{ {
Idct.HighbdIwht4X4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIwht4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
} }
else else
{ {
switch (txSize) switch (txSize)
{ {
case TxSize.Tx4X4: case TxSize.Tx4x4:
Idct.HighbdIdct4X4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIdct4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx8X8: case TxSize.Tx8x8:
Idct.HighbdIdct8X8Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIdct8x8Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx16X16: case TxSize.Tx16x16:
Idct.HighbdIdct16X16Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIdct16x16Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx32X32: case TxSize.Tx32x32:
Idct.HighbdIdct32X32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIdct32x32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
default: default:
Debug.Assert(false, "Invalid transform size"); Debug.Assert(false, "Invalid transform size");
@@ -139,23 +139,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
if (xd.Lossless) if (xd.Lossless)
{ {
Idct.Iwht4X4Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Iwht4x4Add(dqcoeff.AsSpan(), dst, stride, eob);
} }
else else
{ {
switch (txSize) switch (txSize)
{ {
case TxSize.Tx4X4: case TxSize.Tx4x4:
Idct.Idct4X4Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Idct4x4Add(dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx8X8: case TxSize.Tx8x8:
Idct.Idct8X8Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Idct8x8Add(dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx16X16: case TxSize.Tx16x16:
Idct.Idct16X16Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Idct16x16Add(dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx32X32: case TxSize.Tx32x32:
Idct.Idct32X32Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Idct32x32Add(dqcoeff.AsSpan(), dst, stride, eob);
break; break;
default: default:
Debug.Assert(false, "Invalid transform size"); Debug.Assert(false, "Invalid transform size");
@@ -170,11 +170,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
else else
{ {
if (txSize <= TxSize.Tx16X16 && eob <= 10) if (txSize <= TxSize.Tx16x16 && eob <= 10)
{ {
dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear(); dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear();
} }
else if (txSize == TxSize.Tx32X32 && eob <= 34) else if (txSize == TxSize.Tx32x32 && eob <= 34)
{ {
dqcoeff.AsSpan().Slice(0, 256).Clear(); dqcoeff.AsSpan().Slice(0, 256).Clear();
} }
@@ -202,23 +202,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<ushort> dst16 = MemoryMarshal.Cast<byte, ushort>(dst); Span<ushort> dst16 = MemoryMarshal.Cast<byte, ushort>(dst);
if (xd.Lossless) if (xd.Lossless)
{ {
Idct.HighbdIwht4X4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIwht4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
} }
else else
{ {
switch (txSize) switch (txSize)
{ {
case TxSize.Tx4X4: case TxSize.Tx4x4:
Idct.HighbdIht4X4Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIht4x4Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx8X8: case TxSize.Tx8x8:
Idct.HighbdIht8X8Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIht8x8Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx16X16: case TxSize.Tx16x16:
Idct.HighbdIht16X16Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIht16x16Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
case TxSize.Tx32X32: case TxSize.Tx32x32:
Idct.HighbdIdct32X32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); Idct.HighbdIdct32x32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd);
break; break;
default: default:
Debug.Assert(false, "Invalid transform size"); Debug.Assert(false, "Invalid transform size");
@@ -230,23 +230,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
if (xd.Lossless) if (xd.Lossless)
{ {
Idct.Iwht4X4Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Iwht4x4Add(dqcoeff.AsSpan(), dst, stride, eob);
} }
else else
{ {
switch (txSize) switch (txSize)
{ {
case TxSize.Tx4X4: case TxSize.Tx4x4:
Idct.Iht4X4Add(txType, dqcoeff.AsSpan(), dst, stride, eob); Idct.Iht4x4Add(txType, dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx8X8: case TxSize.Tx8x8:
Idct.Iht8X8Add(txType, dqcoeff.AsSpan(), dst, stride, eob); Idct.Iht8x8Add(txType, dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx16X16: case TxSize.Tx16x16:
Idct.Iht16X16Add(txType, dqcoeff.AsSpan(), dst, stride, eob); Idct.Iht16x16Add(txType, dqcoeff.AsSpan(), dst, stride, eob);
break; break;
case TxSize.Tx32X32: case TxSize.Tx32x32:
Idct.Idct32X32Add(dqcoeff.AsSpan(), dst, stride, eob); Idct.Idct32x32Add(dqcoeff.AsSpan(), dst, stride, eob);
break; break;
default: default:
Debug.Assert(false, "Invalid transform size"); Debug.Assert(false, "Invalid transform size");
@@ -261,11 +261,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
else else
{ {
if (txType == TxType.DctDct && txSize <= TxSize.Tx16X16 && eob <= 10) if (txType == TxType.DctDct && txSize <= TxSize.Tx16x16 && eob <= 10)
{ {
dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear(); dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear();
} }
else if (txSize == TxSize.Tx32X32 && eob <= 34) else if (txSize == TxSize.Tx32x32 && eob <= 34)
{ {
dqcoeff.AsSpan().Slice(0, 256).Clear(); dqcoeff.AsSpan().Slice(0, 256).Clear();
} }
@@ -291,7 +291,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
byte* dst = &pd.Dst.Buf.ToPointer()[dstOffset]; byte* dst = &pd.Dst.Buf.ToPointer()[dstOffset];
Span<byte> dstSpan = pd.Dst.Buf.AsSpan().Slice(dstOffset); Span<byte> dstSpan = pd.Dst.Buf.AsSpan().Slice(dstOffset);
if (mi.SbType < BlockSize.Block8X8) if (mi.SbType < BlockSize.Block8x8)
{ {
if (plane == 0) if (plane == 0)
{ {
@@ -769,21 +769,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
isScaled ? new Ptr<ScaleFactors>(ref sf) : Ptr<ScaleFactors>.Null); isScaled ? new Ptr<ScaleFactors>(ref sf) : Ptr<ScaleFactors>.Null);
xd.BlockRefs[refr] = new Ptr<RefBuffer>(ref refBuf); xd.BlockRefs[refr] = new Ptr<RefBuffer>(ref refBuf);
if (sbType < BlockSize.Block8X8) if (sbType < BlockSize.Block8x8)
{ {
for (plane = 0; plane < Constants.MaxMbPlane; ++plane) for (plane = 0; plane < Constants.MaxMbPlane; ++plane)
{ {
ref MacroBlockDPlane pd = ref xd.Plane[plane]; ref MacroBlockDPlane pd = ref xd.Plane[plane];
ref Buf2D dstBuf = ref pd.Dst; ref Buf2D dstBuf = ref pd.Dst;
int num4X4W = pd.N4W; int num4x4W = pd.N4W;
int num4X4H = pd.N4H; int num4x4H = pd.N4H;
int n4Wx4 = 4 * num4X4W; int n4Wx4 = 4 * num4x4W;
int n4Hx4 = 4 * num4X4H; int n4Hx4 = 4 * num4x4H;
ref Buf2D preBuf = ref pd.Pre[refr]; ref Buf2D preBuf = ref pd.Pre[refr];
int i = 0; int i = 0;
for (int y = 0; y < num4X4H; ++y) for (int y = 0; y < num4x4H; ++y)
{ {
for (int x = 0; x < num4X4W; ++x) for (int x = 0; x < num4x4W; ++x)
{ {
Mv mv = ReconInter.AverageSplitMvs(ref pd, ref mi, refr, i++); Mv mv = ReconInter.AverageSplitMvs(ref pd, ref mi, refr, i++);
DecBuildInterPredictors( DecBuildInterPredictors(
@@ -816,10 +816,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
ref MacroBlockDPlane pd = ref xd.Plane[plane]; ref MacroBlockDPlane pd = ref xd.Plane[plane];
ref Buf2D dstBuf = ref pd.Dst; ref Buf2D dstBuf = ref pd.Dst;
int num4X4W = pd.N4W; int num4x4W = pd.N4W;
int num4X4H = pd.N4H; int num4x4H = pd.N4H;
int n4Wx4 = 4 * num4X4W; int n4Wx4 = 4 * num4x4W;
int n4Hx4 = 4 * num4X4H; int n4Hx4 = 4 * num4x4H;
ref Buf2D preBuf = ref pd.Pre[refr]; ref Buf2D preBuf = ref pd.Pre[refr];
DecBuildInterPredictors( DecBuildInterPredictors(
ref xd, ref xd,
@@ -905,7 +905,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
int bwl, int bwl,
int bhl) int bhl)
{ {
bool less8X8 = bsize < BlockSize.Block8X8; bool less8x8 = bsize < BlockSize.Block8x8;
int bw = 1 << (bwl - 1); int bw = 1 << (bwl - 1);
int bh = 1 << (bhl - 1); int bh = 1 << (bhl - 1);
int xMis = Math.Min(bw, cm.MiCols - miCol); int xMis = Math.Min(bw, cm.MiCols - miCol);
@@ -915,7 +915,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
ref ModeInfo mi = ref SetOffsets(ref cm, ref xd, bsize, miRow, miCol, bw, bh, xMis, yMis, bwl, bhl); ref ModeInfo mi = ref SetOffsets(ref cm, ref xd, bsize, miRow, miCol, bw, bh, xMis, yMis, bwl, bhl);
if (bsize >= BlockSize.Block8X8 && (cm.SubsamplingX != 0 || cm.SubsamplingY != 0)) if (bsize >= BlockSize.Block8x8 && (cm.SubsamplingX != 0 || cm.SubsamplingY != 0))
{ {
BlockSize uvSubsize = Luts.SsSizeLookup[(int)bsize][cm.SubsamplingX][cm.SubsamplingY]; BlockSize uvSubsize = Luts.SsSizeLookup[(int)bsize][cm.SubsamplingX][cm.SubsamplingY];
if (uvSubsize == BlockSize.BlockInvalid) if (uvSubsize == BlockSize.BlockInvalid)
@@ -938,14 +938,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
ref MacroBlockDPlane pd = ref xd.Plane[plane]; ref MacroBlockDPlane pd = ref xd.Plane[plane];
TxSize txSize = plane != 0 ? mi.GetUvTxSize(ref pd) : mi.TxSize; TxSize txSize = plane != 0 ? mi.GetUvTxSize(ref pd) : mi.TxSize;
int num4X4W = pd.N4W; int num4x4W = pd.N4W;
int num4X4H = pd.N4H; int num4x4H = pd.N4H;
int step = 1 << (int)txSize; int step = 1 << (int)txSize;
int row, col; int row, col;
int maxBlocksWide = int maxBlocksWide =
num4X4W + (xd.MbToRightEdge >= 0 ? 0 : xd.MbToRightEdge >> (5 + pd.SubsamplingX)); num4x4W + (xd.MbToRightEdge >= 0 ? 0 : xd.MbToRightEdge >> (5 + pd.SubsamplingX));
int maxBlocksHigh = int maxBlocksHigh =
num4X4H + (xd.MbToBottomEdge >= 0 ? 0 : xd.MbToBottomEdge >> (5 + pd.SubsamplingY)); num4x4H + (xd.MbToBottomEdge >= 0 ? 0 : xd.MbToBottomEdge >> (5 + pd.SubsamplingY));
xd.MaxBlocksWide = (uint)(xd.MbToRightEdge >= 0 ? 0 : maxBlocksWide); xd.MaxBlocksWide = (uint)(xd.MbToRightEdge >= 0 ? 0 : maxBlocksWide);
xd.MaxBlocksHigh = (uint)(xd.MbToBottomEdge >= 0 ? 0 : maxBlocksHigh); xd.MaxBlocksHigh = (uint)(xd.MbToBottomEdge >= 0 ? 0 : maxBlocksHigh);
@@ -974,13 +974,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
ref MacroBlockDPlane pd = ref xd.Plane[plane]; ref MacroBlockDPlane pd = ref xd.Plane[plane];
TxSize txSize = plane != 0 ? mi.GetUvTxSize(ref pd) : mi.TxSize; TxSize txSize = plane != 0 ? mi.GetUvTxSize(ref pd) : mi.TxSize;
int num4X4W = pd.N4W; int num4x4W = pd.N4W;
int num4X4H = pd.N4H; int num4x4H = pd.N4H;
int step = 1 << (int)txSize; int step = 1 << (int)txSize;
int row, col; int row, col;
int maxBlocksWide = int maxBlocksWide =
num4X4W + (xd.MbToRightEdge >= 0 ? 0 : xd.MbToRightEdge >> (5 + pd.SubsamplingX)); num4x4W + (xd.MbToRightEdge >= 0 ? 0 : xd.MbToRightEdge >> (5 + pd.SubsamplingX));
int maxBlocksHigh = num4X4H + int maxBlocksHigh = num4x4H +
(xd.MbToBottomEdge >= 0 ? 0 : xd.MbToBottomEdge >> (5 + pd.SubsamplingY)); (xd.MbToBottomEdge >= 0 ? 0 : xd.MbToBottomEdge >> (5 + pd.SubsamplingY));
xd.MaxBlocksWide = (uint)(xd.MbToRightEdge >= 0 ? 0 : maxBlocksWide); xd.MaxBlocksWide = (uint)(xd.MbToRightEdge >= 0 ? 0 : maxBlocksWide);
@@ -995,7 +995,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
if (!less8X8 && eobtotal == 0) if (!less8x8 && eobtotal == 0)
{ {
mi.Skip = 1; // Skip loopfilter mi.Skip = 1; // Skip loopfilter
} }
@@ -1072,11 +1072,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
int miRow, int miRow,
int miCol, int miCol,
BlockSize bsize, BlockSize bsize,
int n4X4L2) int n4x4L2)
{ {
int n8X8L2 = n4X4L2 - 1; int n8x8L2 = n4x4L2 - 1;
int num8X8Wh = 1 << n8X8L2; int num8x8Wh = 1 << n8x8L2;
int hbs = num8X8Wh >> 1; int hbs = num8x8Wh >> 1;
PartitionType partition; PartitionType partition;
BlockSize subsize; BlockSize subsize;
bool hasRows = miRow + hbs < cm.MiRows; bool hasRows = miRow + hbs < cm.MiRows;
@@ -1088,7 +1088,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
return; return;
} }
partition = ReadPartition(ref twd, miRow, miCol, hasRows ? 1 : 0, hasCols ? 1 : 0, n8X8L2); partition = ReadPartition(ref twd, miRow, miCol, hasRows ? 1 : 0, hasCols ? 1 : 0, n8x8L2);
subsize = Luts.SubsizeLookup[(int)partition][(int)bsize]; subsize = Luts.SubsizeLookup[(int)partition][(int)bsize];
if (hbs == 0) if (hbs == 0)
{ {
@@ -1102,29 +1102,29 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
switch (partition) switch (partition)
{ {
case PartitionType.PartitionNone: case PartitionType.PartitionNone:
DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n4X4L2, n4X4L2); DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n4x4L2, n4x4L2);
break; break;
case PartitionType.PartitionHorz: case PartitionType.PartitionHorz:
DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n4X4L2, n8X8L2); DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n4x4L2, n8x8L2);
if (hasRows) if (hasRows)
{ {
DecodeBlock(ref twd, ref cm, miRow + hbs, miCol, subsize, n4X4L2, n8X8L2); DecodeBlock(ref twd, ref cm, miRow + hbs, miCol, subsize, n4x4L2, n8x8L2);
} }
break; break;
case PartitionType.PartitionVert: case PartitionType.PartitionVert:
DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n8X8L2, n4X4L2); DecodeBlock(ref twd, ref cm, miRow, miCol, subsize, n8x8L2, n4x4L2);
if (hasCols) if (hasCols)
{ {
DecodeBlock(ref twd, ref cm, miRow, miCol + hbs, subsize, n8X8L2, n4X4L2); DecodeBlock(ref twd, ref cm, miRow, miCol + hbs, subsize, n8x8L2, n4x4L2);
} }
break; break;
case PartitionType.PartitionSplit: case PartitionType.PartitionSplit:
DecodePartition(ref twd, ref cm, miRow, miCol, subsize, n8X8L2); DecodePartition(ref twd, ref cm, miRow, miCol, subsize, n8x8L2);
DecodePartition(ref twd, ref cm, miRow, miCol + hbs, subsize, n8X8L2); DecodePartition(ref twd, ref cm, miRow, miCol + hbs, subsize, n8x8L2);
DecodePartition(ref twd, ref cm, miRow + hbs, miCol, subsize, n8X8L2); DecodePartition(ref twd, ref cm, miRow + hbs, miCol, subsize, n8x8L2);
DecodePartition(ref twd, ref cm, miRow + hbs, miCol + hbs, subsize, n8X8L2); DecodePartition(ref twd, ref cm, miRow + hbs, miCol + hbs, subsize, n8x8L2);
break; break;
default: default:
Debug.Assert(false, "Invalid partition type"); Debug.Assert(false, "Invalid partition type");
@@ -1133,10 +1133,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
// Update partition context // Update partition context
if (bsize >= BlockSize.Block8X8 && if (bsize >= BlockSize.Block8x8 &&
(bsize == BlockSize.Block8X8 || partition != PartitionType.PartitionSplit)) (bsize == BlockSize.Block8x8 || partition != PartitionType.PartitionSplit))
{ {
DecUpdatePartitionContext(ref twd, miRow, miCol, subsize, num8X8Wh); DecUpdatePartitionContext(ref twd, miRow, miCol, subsize, num8x8Wh);
} }
} }
@@ -1186,7 +1186,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
private static void ReadCoefProbs(ref Vp9EntropyProbs fc, TxMode txMode, ref Reader r) private static void ReadCoefProbs(ref Vp9EntropyProbs fc, TxMode txMode, ref Reader r)
{ {
int maxTxSize = (int)Luts.TxModeToBiggestTxSize[(int)txMode]; int maxTxSize = (int)Luts.TxModeToBiggestTxSize[(int)txMode];
for (int txSize = (int)TxSize.Tx4X4; txSize <= maxTxSize; ++txSize) for (int txSize = (int)TxSize.Tx4x4; txSize <= maxTxSize; ++txSize)
{ {
ReadCoefProbsCommon(ref fc.CoefProbs[txSize], ref r, txSize); ReadCoefProbsCommon(ref fc.CoefProbs[txSize], ref r, txSize);
} }
@@ -1238,16 +1238,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
xd.Bd = (int)cm.BitDepth; xd.Bd = (int)cm.BitDepth;
} }
private static readonly byte[] _literalToFilter = private static readonly byte[] LiteralToFilter =
[ {
Constants.EightTapSmooth, Constants.EightTap, Constants.EightTapSharp, Constants.Bilinear Constants.EightTapSmooth, Constants.EightTap, Constants.EightTapSharp, Constants.Bilinear
]; };
private static byte ReadInterpFilter(ref ReadBitBuffer rb) private static byte ReadInterpFilter(ref ReadBitBuffer rb)
{ {
return rb.ReadBit() != 0 return rb.ReadBit() != 0
? (byte)Constants.Switchable ? (byte)Constants.Switchable
: _literalToFilter[rb.ReadLiteral(2)]; : LiteralToFilter[rb.ReadLiteral(2)];
} }
private static void SetupRenderSize(ref Vp9Common cm, ref ReadBitBuffer rb) private static void SetupRenderSize(ref Vp9Common cm, ref ReadBitBuffer rb)
@@ -1519,7 +1519,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tileData.Xd.LeftSegContext = new Array8<sbyte>(); tileData.Xd.LeftSegContext = new Array8<sbyte>();
for (miCol = tile.MiColStart; miCol < tile.MiColEnd; miCol += Constants.MiBlockSize) for (miCol = tile.MiColStart; miCol < tile.MiColEnd; miCol += Constants.MiBlockSize)
{ {
DecodePartition(ref tileData, ref cm, miRow, miCol, BlockSize.Block64X64, 4); DecodePartition(ref tileData, ref cm, miRow, miCol, BlockSize.Block64x64, 4);
} }
cm.Mb.Corrupted |= tileData.Xd.Corrupted; cm.Mb.Corrupted |= tileData.Xd.Corrupted;
@@ -1563,7 +1563,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tileData.Xd.LeftSegContext = new Array8<sbyte>(); tileData.Xd.LeftSegContext = new Array8<sbyte>();
for (int miCol = tile.MiColStart; miCol < tile.MiColEnd; miCol += Constants.MiBlockSize) for (int miCol = tile.MiColStart; miCol < tile.MiColEnd; miCol += Constants.MiBlockSize)
{ {
DecodePartition(ref tileData, ref cm, miRow, miCol, BlockSize.Block64X64, 4); DecodePartition(ref tileData, ref cm, miRow, miCol, BlockSize.Block64x64, 4);
} }
} }
@@ -1990,7 +1990,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
cm.Error.InternalError(CodecErr.MemError, "Failed to allocate bool decoder 0"); cm.Error.InternalError(CodecErr.MemError, "Failed to allocate bool decoder 0");
} }
cm.TxMode = xd.Lossless ? TxMode.Only4X4 : r.ReadTxMode(); cm.TxMode = xd.Lossless ? TxMode.Only4x4 : r.ReadTxMode();
if (cm.TxMode == TxMode.TxModeSelect) if (cm.TxMode == TxMode.TxModeSelect)
{ {
ReadTxModeProbs(ref fc, ref r); ReadTxModeProbs(ref fc, ref r);

View File

@@ -59,9 +59,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
switch (maxTxSize) switch (maxTxSize)
{ {
case TxSize.Tx8X8: return fc.Tx8x8Prob[ctx].AsSpan(); case TxSize.Tx8x8: return fc.Tx8x8Prob[ctx].AsSpan();
case TxSize.Tx16X16: return fc.Tx16x16Prob[ctx].AsSpan(); case TxSize.Tx16x16: return fc.Tx16x16Prob[ctx].AsSpan();
case TxSize.Tx32X32: return fc.Tx32x32Prob[ctx].AsSpan(); case TxSize.Tx32x32: return fc.Tx32x32Prob[ctx].AsSpan();
default: default:
Debug.Assert(false, "Invalid maxTxSize."); Debug.Assert(false, "Invalid maxTxSize.");
return ReadOnlySpan<byte>.Empty; return ReadOnlySpan<byte>.Empty;
@@ -72,9 +72,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
switch (maxTxSize) switch (maxTxSize)
{ {
case TxSize.Tx8X8: return counts.Tx8x8[ctx].AsSpan(); case TxSize.Tx8x8: return counts.Tx8x8[ctx].AsSpan();
case TxSize.Tx16X16: return counts.Tx16x16[ctx].AsSpan(); case TxSize.Tx16x16: return counts.Tx16x16[ctx].AsSpan();
case TxSize.Tx32X32: return counts.Tx32x32[ctx].AsSpan(); case TxSize.Tx32x32: return counts.Tx32x32[ctx].AsSpan();
default: default:
Debug.Assert(false, "Invalid maxTxSize."); Debug.Assert(false, "Invalid maxTxSize.");
return Span<uint>.Empty; return Span<uint>.Empty;
@@ -86,10 +86,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
int ctx = xd.GetTxSizeContext(); int ctx = xd.GetTxSizeContext();
ReadOnlySpan<byte> txProbs = GetTxProbs(ref cm.Fc.Value, maxTxSize, ctx); ReadOnlySpan<byte> txProbs = GetTxProbs(ref cm.Fc.Value, maxTxSize, ctx);
TxSize txSize = (TxSize)r.Read(txProbs[0]); TxSize txSize = (TxSize)r.Read(txProbs[0]);
if (txSize != TxSize.Tx4X4 && maxTxSize >= TxSize.Tx16X16) if (txSize != TxSize.Tx4x4 && maxTxSize >= TxSize.Tx16x16)
{ {
txSize += r.Read(txProbs[1]); txSize += r.Read(txProbs[1]);
if (txSize != TxSize.Tx8X8 && maxTxSize >= TxSize.Tx32X32) if (txSize != TxSize.Tx8x8 && maxTxSize >= TxSize.Tx32x32)
{ {
txSize += r.Read(txProbs[2]); txSize += r.Read(txProbs[2]);
} }
@@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
TxMode txMode = cm.TxMode; TxMode txMode = cm.TxMode;
BlockSize bsize = xd.Mi[0].Value.SbType; BlockSize bsize = xd.Mi[0].Value.SbType;
TxSize maxTxSize = Luts.MaxTxSizeLookup[(int)bsize]; TxSize maxTxSize = Luts.MaxTxSizeLookup[(int)bsize];
if (allowSelect && txMode == TxMode.TxModeSelect && bsize >= BlockSize.Block8X8) if (allowSelect && txMode == TxMode.TxModeSelect && bsize >= BlockSize.Block8x8)
{ {
return ReadSelectedTxSize(ref cm, ref xd, maxTxSize, ref r); return ReadSelectedTxSize(ref cm, ref xd, maxTxSize, ref r);
} }
@@ -276,7 +276,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
// Fractional part // Fractional part
fr = r.ReadTree(Luts.MvFpTree, class0 ? fc.Class0Fp[mvcomp][d].AsSpan() : fc.Fp[mvcomp].AsSpan()); fr = r.ReadTree(Luts.MvFPTree, class0 ? fc.Class0Fp[mvcomp][d].AsSpan() : fc.Fp[mvcomp].AsSpan());
// High precision part (if hp is not used, the default value of the hp is 1) // High precision part (if hp is not used, the default value of the hp is 1)
hp = usehp ? r.Read(class0 ? fc.Class0Hp[mvcomp] : fc.Hp[mvcomp]) : 1; hp = usehp ? r.Read(class0 ? fc.Class0Hp[mvcomp] : fc.Hp[mvcomp]) : 1;
@@ -415,7 +415,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
switch (bsize) switch (bsize)
{ {
case BlockSize.Block4X4: case BlockSize.Block4x4:
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
mi.Bmi[i].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0); mi.Bmi[i].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0);
@@ -423,11 +423,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
mi.Mode = mi.Bmi[3].Mode; mi.Mode = mi.Bmi[3].Mode;
break; break;
case BlockSize.Block4X8: case BlockSize.Block4x8:
mi.Bmi[0].Mode = mi.Bmi[2].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0); mi.Bmi[0].Mode = mi.Bmi[2].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0);
mi.Bmi[1].Mode = mi.Bmi[3].Mode = mi.Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0); mi.Bmi[1].Mode = mi.Bmi[3].Mode = mi.Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0);
break; break;
case BlockSize.Block8X4: case BlockSize.Block8x4:
mi.Bmi[0].Mode = mi.Bmi[1].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0); mi.Bmi[0].Mode = mi.Bmi[1].Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0);
mi.Bmi[2].Mode = mi.Bmi[3].Mode = mi.Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0); mi.Bmi[2].Mode = mi.Bmi[3].Mode = mi.Mode = ReadIntraModeY(ref cm, ref xd, ref r, 0);
break; break;
@@ -595,7 +595,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
int miRow, int miRow,
int miCol, int miCol,
int block, int block,
int isSub8X8) int isSub8x8)
{ {
ref Array4<sbyte> refSignBias = ref cm.RefFrameSignBias; ref Array4<sbyte> refSignBias = ref cm.RefFrameSignBias;
int i, refmvCount = 0; int i, refmvCount = 0;
@@ -612,7 +612,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
mvRefList.Slice(0, Constants.MaxMvRefCandidates).Fill(new Mv()); mvRefList.Slice(0, Constants.MaxMvRefCandidates).Fill(new Mv());
i = 0; i = 0;
if (isSub8X8 != 0) if (isSub8x8 != 0)
{ {
// If the size < 8x8 we get the mv from the bmi substructure for the // If the size < 8x8 we get the mv from the bmi substructure for the
// nearest two blocks. // nearest two blocks.
@@ -770,7 +770,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
return refmvCount; return refmvCount;
} }
private static void AppendSub8X8ForIdx( private static void AppendSub8x8ForIdx(
ref Vp9Common cm, ref Vp9Common cm,
ref MacroBlockD xd, ref MacroBlockD xd,
Span<Position> mvRefSearch, Span<Position> mvRefSearch,
@@ -779,7 +779,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
int refr, int refr,
int miRow, int miRow,
int miCol, int miCol,
ref Mv bestSub8X8) ref Mv bestSub8x8)
{ {
Span<Mv> mvList = stackalloc Mv[Constants.MaxMvRefCandidates]; Span<Mv> mvList = stackalloc Mv[Constants.MaxMvRefCandidates];
ref ModeInfo mi = ref xd.Mi[0].Value; ref ModeInfo mi = ref xd.Mi[0].Value;
@@ -794,22 +794,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
switch (block) switch (block)
{ {
case 0: case 0:
bestSub8X8 = mvList[refmvCount - 1]; bestSub8x8 = mvList[refmvCount - 1];
break; break;
case 1: case 1:
case 2: case 2:
if (bMode == PredictionMode.NearestMv) if (bMode == PredictionMode.NearestMv)
{ {
bestSub8X8 = bmi[0].Mv[refr]; bestSub8x8 = bmi[0].Mv[refr];
} }
else else
{ {
bestSub8X8 = new Mv(); bestSub8x8 = new Mv();
for (int n = 0; n < refmvCount; ++n) for (int n = 0; n < refmvCount; ++n)
{ {
if (Unsafe.As<Mv, int>(ref bmi[0].Mv[refr]) != Unsafe.As<Mv, int>(ref mvList[n])) if (Unsafe.As<Mv, int>(ref bmi[0].Mv[refr]) != Unsafe.As<Mv, int>(ref mvList[n]))
{ {
bestSub8X8 = mvList[n]; bestSub8x8 = mvList[n];
break; break;
} }
} }
@@ -819,7 +819,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
case 3: case 3:
if (bMode == PredictionMode.NearestMv) if (bMode == PredictionMode.NearestMv)
{ {
bestSub8X8 = bmi[2].Mv[refr]; bestSub8x8 = bmi[2].Mv[refr];
} }
else else
{ {
@@ -828,12 +828,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
candidates[1] = bmi[0].Mv[refr]; candidates[1] = bmi[0].Mv[refr];
candidates[2] = mvList[0]; candidates[2] = mvList[0];
candidates[3] = mvList[1]; candidates[3] = mvList[1];
bestSub8X8 = new Mv(); bestSub8x8 = new Mv();
for (int n = 0; n < 2 + Constants.MaxMvRefCandidates; ++n) for (int n = 0; n < 2 + Constants.MaxMvRefCandidates; ++n)
{ {
if (Unsafe.As<Mv, int>(ref bmi[2].Mv[refr]) != Unsafe.As<Mv, int>(ref candidates[n])) if (Unsafe.As<Mv, int>(ref bmi[2].Mv[refr]) != Unsafe.As<Mv, int>(ref candidates[n]))
{ {
bestSub8X8 = candidates[n]; bestSub8x8 = candidates[n];
break; break;
} }
} }
@@ -889,7 +889,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
if (cm.Seg.IsSegFeatureActive(mi.SegmentId, SegLvlFeatures.Skip) != 0) if (cm.Seg.IsSegFeatureActive(mi.SegmentId, SegLvlFeatures.Skip) != 0)
{ {
mi.Mode = PredictionMode.ZeroMv; mi.Mode = PredictionMode.ZeroMv;
if (bsize < BlockSize.Block8X8) if (bsize < BlockSize.Block8x8)
{ {
xd.ErrorInfo.Value.InternalError(CodecErr.UnsupBitstream, xd.ErrorInfo.Value.InternalError(CodecErr.UnsupBitstream,
"Invalid usage of segement feature on small blocks"); "Invalid usage of segement feature on small blocks");
@@ -898,7 +898,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
else else
{ {
if (bsize >= BlockSize.Block8X8) if (bsize >= BlockSize.Block8x8)
{ {
mi.Mode = ReadInterMode(ref cm, ref xd, ref r, interModeCtx); mi.Mode = ReadInterMode(ref cm, ref xd, ref r, interModeCtx);
} }
@@ -932,20 +932,20 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
? ReadSwitchableInterpFilter(ref cm, ref xd, ref r) ? ReadSwitchableInterpFilter(ref cm, ref xd, ref r)
: cm.InterpFilter; : cm.InterpFilter;
if (bsize < BlockSize.Block8X8) if (bsize < BlockSize.Block8x8)
{ {
int num4X4W = 1 << xd.BmodeBlocksWl; int num4x4W = 1 << xd.BmodeBlocksWl;
int num4X4H = 1 << xd.BmodeBlocksHl; int num4x4H = 1 << xd.BmodeBlocksHl;
int idx, idy; int idx, idy;
PredictionMode bMode = 0; PredictionMode bMode = 0;
Array2<Mv> bestSub8X8 = new(); Array2<Mv> bestSub8x8 = new();
const uint InvalidMv = 0x80008000; const uint invalidMv = 0x80008000;
// Initialize the 2nd element as even though it won't be used meaningfully // Initialize the 2nd element as even though it won't be used meaningfully
// if isCompound is false. // if isCompound is false.
Unsafe.As<Mv, uint>(ref bestSub8X8[1]) = InvalidMv; Unsafe.As<Mv, uint>(ref bestSub8x8[1]) = invalidMv;
for (idy = 0; idy < 2; idy += num4X4H) for (idy = 0; idy < 2; idy += num4x4H)
{ {
for (idx = 0; idx < 2; idx += num4X4W) for (idx = 0; idx < 2; idx += num4x4W)
{ {
int j = (idy * 2) + idx; int j = (idy * 2) + idx;
bMode = ReadInterMode(ref cm, ref xd, ref r, interModeCtx); bMode = ReadInterMode(ref cm, ref xd, ref r, interModeCtx);
@@ -954,24 +954,24 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
for (refr = 0; refr < 1 + isCompound; ++refr) for (refr = 0; refr < 1 + isCompound; ++refr)
{ {
AppendSub8X8ForIdx(ref cm, ref xd, mvRefSearch, bMode, j, refr, miRow, miCol, AppendSub8x8ForIdx(ref cm, ref xd, mvRefSearch, bMode, j, refr, miRow, miCol,
ref bestSub8X8[refr]); ref bestSub8x8[refr]);
} }
} }
if (!Assign(ref cm, ref xd, bMode, ref mi.Bmi[j].Mv, ref bestRefMvs, ref bestSub8X8, if (!Assign(ref cm, ref xd, bMode, ref mi.Bmi[j].Mv, ref bestRefMvs, ref bestSub8x8,
isCompound, allowHp, ref r)) isCompound, allowHp, ref r))
{ {
xd.Corrupted |= true; xd.Corrupted |= true;
break; break;
} }
if (num4X4H == 2) if (num4x4H == 2)
{ {
mi.Bmi[j + 2] = mi.Bmi[j]; mi.Bmi[j + 2] = mi.Bmi[j];
} }
if (num4X4W == 2) if (num4x4W == 2)
{ {
mi.Bmi[j + 1] = mi.Bmi[j]; mi.Bmi[j + 1] = mi.Bmi[j];
} }
@@ -1084,7 +1084,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
switch (bsize) switch (bsize)
{ {
case BlockSize.Block4X4: case BlockSize.Block4x4:
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
mi.Value.Bmi[i].Mode = mi.Value.Bmi[i].Mode =
@@ -1093,13 +1093,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
mi.Value.Mode = mi.Value.Bmi[3].Mode; mi.Value.Mode = mi.Value.Bmi[3].Mode;
break; break;
case BlockSize.Block4X8: case BlockSize.Block4x8:
mi.Value.Bmi[0].Mode = mi.Value.Bmi[2].Mode = mi.Value.Bmi[0].Mode = mi.Value.Bmi[2].Mode =
ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 0)); ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 0));
mi.Value.Bmi[1].Mode = mi.Value.Bmi[3].Mode = mi.Value.Mode = mi.Value.Bmi[1].Mode = mi.Value.Bmi[3].Mode = mi.Value.Mode =
ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 1)); ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 1));
break; break;
case BlockSize.Block8X4: case BlockSize.Block8x4:
mi.Value.Bmi[0].Mode = mi.Value.Bmi[1].Mode = mi.Value.Bmi[0].Mode = mi.Value.Bmi[1].Mode =
ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 0)); ReadIntraMode(ref r, GetYModeProbs(ref cm.Fc.Value, mi, aboveMi, leftMi, 0));
mi.Value.Bmi[2].Mode = mi.Value.Bmi[3].Mode = mi.Value.Mode = mi.Value.Bmi[2].Mode = mi.Value.Bmi[3].Mode = mi.Value.Mode =

View File

@@ -17,10 +17,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
return new Surface(width, height); return new Surface(width, height);
} }
private static ReadOnlySpan<byte> LiteralToFilter => private static ReadOnlySpan<byte> LiteralToFilter => new byte[]
[ {
Constants.EightTapSmooth, Constants.EightTap, Constants.EightTapSharp, Constants.Bilinear Constants.EightTapSmooth, Constants.EightTap, Constants.EightTapSharp, Constants.Bilinear
]; };
public unsafe bool Decode( public unsafe bool Decode(
ref Vp9PictureInfo pictureInfo, ref Vp9PictureInfo pictureInfo,

View File

@@ -17,10 +17,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
private static int GetCoefContext(ReadOnlySpan<short> neighbors, ReadOnlySpan<byte> tokenCache, int c) private static int GetCoefContext(ReadOnlySpan<short> neighbors, ReadOnlySpan<byte> tokenCache, int c)
{ {
const int MaxNeighbors = 2; const int maxNeighbors = 2;
return (1 + tokenCache[neighbors[(MaxNeighbors * c) + 0]] + return (1 + tokenCache[neighbors[(maxNeighbors * c) + 0]] +
tokenCache[neighbors[(MaxNeighbors * c) + 1]]) >> 1; tokenCache[neighbors[(maxNeighbors * c) + 1]]) >> 1;
} }
private static int DecodeCoefs( private static int DecodeCoefs(
@@ -42,7 +42,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
ref Array6<Array6<Array3<byte>>> coefProbs = ref fc.CoefProbs[(int)txSize][(int)type][refr]; ref Array6<Array6<Array3<byte>>> coefProbs = ref fc.CoefProbs[(int)txSize][(int)type][refr];
Span<byte> tokenCache = stackalloc byte[32 * 32]; Span<byte> tokenCache = stackalloc byte[32 * 32];
ReadOnlySpan<byte> bandTranslate = Luts.GetBandTranslate(txSize); ReadOnlySpan<byte> bandTranslate = Luts.GetBandTranslate(txSize);
int dqShift = txSize == TxSize.Tx32X32 ? 1 : 0; int dqShift = txSize == TxSize.Tx32x32 ? 1 : 0;
int v; int v;
short dqv = dq[0]; short dqv = dq[0];
ReadOnlySpan<byte> cat6Prob = xd.Bd == 12 ReadOnlySpan<byte> cat6Prob = xd.Bd == 12
@@ -242,7 +242,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
switch (txSize) switch (txSize)
{ {
case TxSize.Tx4X4: case TxSize.Tx4x4:
ctx = a[0] != 0 ? 1 : 0; ctx = a[0] != 0 ? 1 : 0;
ctx += l[0] != 0 ? 1 : 0; ctx += l[0] != 0 ? 1 : 0;
eob = DecodeCoefs( eob = DecodeCoefs(
@@ -257,8 +257,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
ref r); ref r);
a[0] = l[0] = (sbyte)(eob > 0 ? 1 : 0); a[0] = l[0] = (sbyte)(eob > 0 ? 1 : 0);
break; break;
case TxSize.Tx8X8: case TxSize.Tx8x8:
GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx8X8); GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx8x8);
ctx = MemoryMarshal.Cast<sbyte, ushort>(a)[0] != 0 ? 1 : 0; ctx = MemoryMarshal.Cast<sbyte, ushort>(a)[0] != 0 ? 1 : 0;
ctx += MemoryMarshal.Cast<sbyte, ushort>(l)[0] != 0 ? 1 : 0; ctx += MemoryMarshal.Cast<sbyte, ushort>(l)[0] != 0 ? 1 : 0;
eob = DecodeCoefs( eob = DecodeCoefs(
@@ -274,8 +274,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
MemoryMarshal.Cast<sbyte, ushort>(a)[0] = (ushort)((eob > 0 ? 0x0101 : 0) >> ctxShiftA); MemoryMarshal.Cast<sbyte, ushort>(a)[0] = (ushort)((eob > 0 ? 0x0101 : 0) >> ctxShiftA);
MemoryMarshal.Cast<sbyte, ushort>(l)[0] = (ushort)((eob > 0 ? 0x0101 : 0) >> ctxShiftL); MemoryMarshal.Cast<sbyte, ushort>(l)[0] = (ushort)((eob > 0 ? 0x0101 : 0) >> ctxShiftL);
break; break;
case TxSize.Tx16X16: case TxSize.Tx16x16:
GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx16X16); GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx16x16);
ctx = MemoryMarshal.Cast<sbyte, uint>(a)[0] != 0 ? 1 : 0; ctx = MemoryMarshal.Cast<sbyte, uint>(a)[0] != 0 ? 1 : 0;
ctx += MemoryMarshal.Cast<sbyte, uint>(l)[0] != 0 ? 1 : 0; ctx += MemoryMarshal.Cast<sbyte, uint>(l)[0] != 0 ? 1 : 0;
eob = DecodeCoefs( eob = DecodeCoefs(
@@ -291,8 +291,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
MemoryMarshal.Cast<sbyte, uint>(a)[0] = (uint)((eob > 0 ? 0x01010101 : 0) >> ctxShiftA); MemoryMarshal.Cast<sbyte, uint>(a)[0] = (uint)((eob > 0 ? 0x01010101 : 0) >> ctxShiftA);
MemoryMarshal.Cast<sbyte, uint>(l)[0] = (uint)((eob > 0 ? 0x01010101 : 0) >> ctxShiftL); MemoryMarshal.Cast<sbyte, uint>(l)[0] = (uint)((eob > 0 ? 0x01010101 : 0) >> ctxShiftL);
break; break;
case TxSize.Tx32X32: case TxSize.Tx32x32:
GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx32X32); GetCtxShift(ref xd, ref ctxShiftA, ref ctxShiftL, x, y, 1 << (int)TxSize.Tx32x32);
// NOTE: Casting to ulong here is safe because the default memory // NOTE: Casting to ulong here is safe because the default memory
// alignment is at least 8 bytes and the Tx32x32 is aligned on 8 byte // alignment is at least 8 bytes and the Tx32x32 is aligned on 8 byte
// boundaries. // boundaries.

View File

@@ -34,17 +34,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
return (ushort)((a + b + 1) >> 1); return (ushort)((a + b + 1) >> 1);
} }
public static unsafe void D207Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D207Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D207Predictor(dst, stride, 8, above, left); D207Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D207Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D207Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D207Predictor(dst, stride, 16, above, left); D207Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D207Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D207Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D207Predictor(dst, stride, 32, above, left); D207Predictor(dst, stride, 32, above, left);
} }
@@ -85,17 +85,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void D63Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D63Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D63Predictor(dst, stride, 8, above, left); D63Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D63Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D63Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D63Predictor(dst, stride, 16, above, left); D63Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D63Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D63Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D63Predictor(dst, stride, 32, above, left); D63Predictor(dst, stride, 32, above, left);
} }
@@ -117,17 +117,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void D45Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D45Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D45Predictor(dst, stride, 8, above, left); D45Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D45Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D45Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D45Predictor(dst, stride, 16, above, left); D45Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D45Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D45Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D45Predictor(dst, stride, 32, above, left); D45Predictor(dst, stride, 32, above, left);
} }
@@ -152,17 +152,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void D117Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D117Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D117Predictor(dst, stride, 8, above, left); D117Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D117Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D117Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D117Predictor(dst, stride, 16, above, left); D117Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D117Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D117Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D117Predictor(dst, stride, 32, above, left); D117Predictor(dst, stride, 32, above, left);
} }
@@ -205,17 +205,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void D135Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D135Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D135Predictor(dst, stride, 8, above, left); D135Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D135Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D135Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D135Predictor(dst, stride, 16, above, left); D135Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D135Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D135Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D135Predictor(dst, stride, 32, above, left); D135Predictor(dst, stride, 32, above, left);
} }
@@ -245,17 +245,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void D153Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void D153Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
D153Predictor(dst, stride, 8, above, left); D153Predictor(dst, stride, 8, above, left);
} }
public static unsafe void D153Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void D153Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
D153Predictor(dst, stride, 16, above, left); D153Predictor(dst, stride, 16, above, left);
} }
public static unsafe void D153Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void D153Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
D153Predictor(dst, stride, 32, above, left); D153Predictor(dst, stride, 32, above, left);
} }
@@ -297,22 +297,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void VPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void VPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
VPredictor(dst, stride, 4, above, left); VPredictor(dst, stride, 4, above, left);
} }
public static unsafe void VPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void VPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
VPredictor(dst, stride, 8, above, left); VPredictor(dst, stride, 8, above, left);
} }
public static unsafe void VPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void VPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
VPredictor(dst, stride, 16, above, left); VPredictor(dst, stride, 16, above, left);
} }
public static unsafe void VPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void VPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
VPredictor(dst, stride, 32, above, left); VPredictor(dst, stride, 32, above, left);
} }
@@ -326,22 +326,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void HPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
HPredictor(dst, stride, 4, above, left); HPredictor(dst, stride, 4, above, left);
} }
public static unsafe void HPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void HPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
HPredictor(dst, stride, 8, above, left); HPredictor(dst, stride, 8, above, left);
} }
public static unsafe void HPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void HPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
HPredictor(dst, stride, 16, above, left); HPredictor(dst, stride, 16, above, left);
} }
public static unsafe void HPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void HPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
HPredictor(dst, stride, 32, above, left); HPredictor(dst, stride, 32, above, left);
} }
@@ -355,22 +355,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void TmPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void TmPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
TmPredictor(dst, stride, 4, above, left); TmPredictor(dst, stride, 4, above, left);
} }
public static unsafe void TmPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void TmPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
TmPredictor(dst, stride, 8, above, left); TmPredictor(dst, stride, 8, above, left);
} }
public static unsafe void TmPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void TmPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
TmPredictor(dst, stride, 16, above, left); TmPredictor(dst, stride, 16, above, left);
} }
public static unsafe void TmPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void TmPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
TmPredictor(dst, stride, 32, above, left); TmPredictor(dst, stride, 32, above, left);
} }
@@ -390,22 +390,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void Dc128Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void Dc128Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
Dc128Predictor(dst, stride, 4, above, left); Dc128Predictor(dst, stride, 4, above, left);
} }
public static unsafe void Dc128Predictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void Dc128Predictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
Dc128Predictor(dst, stride, 8, above, left); Dc128Predictor(dst, stride, 8, above, left);
} }
public static unsafe void Dc128Predictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void Dc128Predictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
Dc128Predictor(dst, stride, 16, above, left); Dc128Predictor(dst, stride, 16, above, left);
} }
public static unsafe void Dc128Predictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void Dc128Predictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
Dc128Predictor(dst, stride, 32, above, left); Dc128Predictor(dst, stride, 32, above, left);
} }
@@ -419,36 +419,36 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void DcLeftPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcLeftPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
DcLeftPredictor(dst, stride, 4, above, left); DcLeftPredictor(dst, stride, 4, above, left);
} }
public static unsafe void DcLeftPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcLeftPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
DcLeftPredictor(dst, stride, 8, above, left); DcLeftPredictor(dst, stride, 8, above, left);
} }
public static unsafe void DcLeftPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcLeftPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
DcLeftPredictor(dst, stride, 16, above, left); DcLeftPredictor(dst, stride, 16, above, left);
} }
public static unsafe void DcLeftPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcLeftPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
DcLeftPredictor(dst, stride, 32, above, left); DcLeftPredictor(dst, stride, 32, above, left);
} }
private static unsafe void DcLeftPredictor(byte* dst, int stride, int bs, byte* above, byte* left) private static unsafe void DcLeftPredictor(byte* dst, int stride, int bs, byte* above, byte* left)
{ {
int sum = 0; int expectedDc, sum = 0;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
{ {
sum += left[i]; sum += left[i];
} }
int expectedDc = (sum + (bs >> 1)) / bs; expectedDc = (sum + (bs >> 1)) / bs;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -457,36 +457,36 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void DcTopPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcTopPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
DcTopPredictor(dst, stride, 4, above, left); DcTopPredictor(dst, stride, 4, above, left);
} }
public static unsafe void DcTopPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcTopPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
DcTopPredictor(dst, stride, 8, above, left); DcTopPredictor(dst, stride, 8, above, left);
} }
public static unsafe void DcTopPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcTopPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
DcTopPredictor(dst, stride, 16, above, left); DcTopPredictor(dst, stride, 16, above, left);
} }
public static unsafe void DcTopPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcTopPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
DcTopPredictor(dst, stride, 32, above, left); DcTopPredictor(dst, stride, 32, above, left);
} }
private static unsafe void DcTopPredictor(byte* dst, int stride, int bs, byte* above, byte* left) private static unsafe void DcTopPredictor(byte* dst, int stride, int bs, byte* above, byte* left)
{ {
int sum = 0; int expectedDc, sum = 0;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
{ {
sum += above[i]; sum += above[i];
} }
int expectedDc = (sum + (bs >> 1)) / bs; expectedDc = (sum + (bs >> 1)) / bs;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -495,29 +495,29 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void DcPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
DcPredictor(dst, stride, 4, above, left); DcPredictor(dst, stride, 4, above, left);
} }
public static unsafe void DcPredictor8X8(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcPredictor8x8(byte* dst, int stride, byte* above, byte* left)
{ {
DcPredictor(dst, stride, 8, above, left); DcPredictor(dst, stride, 8, above, left);
} }
public static unsafe void DcPredictor16X16(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcPredictor16x16(byte* dst, int stride, byte* above, byte* left)
{ {
DcPredictor(dst, stride, 16, above, left); DcPredictor(dst, stride, 16, above, left);
} }
public static unsafe void DcPredictor32X32(byte* dst, int stride, byte* above, byte* left) public static unsafe void DcPredictor32x32(byte* dst, int stride, byte* above, byte* left)
{ {
DcPredictor(dst, stride, 32, above, left); DcPredictor(dst, stride, 32, above, left);
} }
private static unsafe void DcPredictor(byte* dst, int stride, int bs, byte* above, byte* left) private static unsafe void DcPredictor(byte* dst, int stride, int bs, byte* above, byte* left)
{ {
int sum = 0; int expectedDc, sum = 0;
int count = 2 * bs; int count = 2 * bs;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
@@ -526,7 +526,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
sum += left[i]; sum += left[i];
} }
int expectedDc = (sum + (count >> 1)) / count; expectedDc = (sum + (count >> 1)) / count;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -535,31 +535,31 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HePredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void HePredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte h = above[-1]; byte h = above[-1];
byte i = left[0]; byte I = left[0];
byte j = left[1]; byte j = left[1];
byte k = left[2]; byte k = left[2];
byte l = left[3]; byte l = left[3];
MemoryUtil.Fill(dst + (stride * 0), Avg3(h, i, j), 4); MemoryUtil.Fill(dst + (stride * 0), Avg3(h, I, j), 4);
MemoryUtil.Fill(dst + (stride * 1), Avg3(i, j, k), 4); MemoryUtil.Fill(dst + (stride * 1), Avg3(I, j, k), 4);
MemoryUtil.Fill(dst + (stride * 2), Avg3(j, k, l), 4); MemoryUtil.Fill(dst + (stride * 2), Avg3(j, k, l), 4);
MemoryUtil.Fill(dst + (stride * 3), Avg3(k, l, l), 4); MemoryUtil.Fill(dst + (stride * 3), Avg3(k, l, l), 4);
} }
public static unsafe void VePredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void VePredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte h = above[-1]; byte h = above[-1];
byte i = above[0]; byte I = above[0];
byte j = above[1]; byte j = above[1];
byte k = above[2]; byte k = above[2];
byte l = above[3]; byte l = above[3];
byte m = above[4]; byte m = above[4];
dst[0] = Avg3(h, i, j); dst[0] = Avg3(h, I, j);
dst[1] = Avg3(i, j, k); dst[1] = Avg3(I, j, k);
dst[2] = Avg3(j, k, l); dst[2] = Avg3(j, k, l);
dst[3] = Avg3(k, l, m); dst[3] = Avg3(k, l, m);
MemoryUtil.Copy(dst + (stride * 1), dst, 4); MemoryUtil.Copy(dst + (stride * 1), dst, 4);
@@ -567,23 +567,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
MemoryUtil.Copy(dst + (stride * 3), dst, 4); MemoryUtil.Copy(dst + (stride * 3), dst, 4);
} }
public static unsafe void D207Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D207Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte i = left[0]; byte I = left[0];
byte j = left[1]; byte j = left[1];
byte k = left[2]; byte k = left[2];
byte l = left[3]; byte l = left[3];
Dst(dst, stride, 0, 0) = Avg2(i, j); Dst(dst, stride, 0, 0) = Avg2(I, j);
Dst(dst, stride, 2, 0) = Dst(dst, stride, 0, 1) = Avg2(j, k); Dst(dst, stride, 2, 0) = Dst(dst, stride, 0, 1) = Avg2(j, k);
Dst(dst, stride, 2, 1) = Dst(dst, stride, 0, 2) = Avg2(k, l); Dst(dst, stride, 2, 1) = Dst(dst, stride, 0, 2) = Avg2(k, l);
Dst(dst, stride, 1, 0) = Avg3(i, j, k); Dst(dst, stride, 1, 0) = Avg3(I, j, k);
Dst(dst, stride, 3, 0) = Dst(dst, stride, 1, 1) = Avg3(j, k, l); Dst(dst, stride, 3, 0) = Dst(dst, stride, 1, 1) = Avg3(j, k, l);
Dst(dst, stride, 3, 1) = Dst(dst, stride, 1, 2) = Avg3(k, l, l); Dst(dst, stride, 3, 1) = Dst(dst, stride, 1, 2) = Avg3(k, l, l);
Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 2) = Dst(dst, stride, 0, 3) = Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 2) = Dst(dst, stride, 0, 3) =
Dst(dst, stride, 1, 3) = Dst(dst, stride, 2, 3) = Dst(dst, stride, 3, 3) = l; Dst(dst, stride, 1, 3) = Dst(dst, stride, 2, 3) = Dst(dst, stride, 3, 3) = l;
} }
public static unsafe void D63Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D63Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte a = above[0]; byte a = above[0];
byte b = above[1]; byte b = above[1];
@@ -605,7 +605,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = Avg3(e, f, g); // Differs from vp8 Dst(dst, stride, 3, 3) = Avg3(e, f, g); // Differs from vp8
} }
public static unsafe void D63EPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D63EPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte a = above[0]; byte a = above[0];
byte b = above[1]; byte b = above[1];
@@ -628,7 +628,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = Avg3(f, g, h); Dst(dst, stride, 3, 3) = Avg3(f, g, h);
} }
public static unsafe void D45Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D45Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte a = above[0]; byte a = above[0];
byte b = above[1]; byte b = above[1];
@@ -648,7 +648,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = h; // differs from vp8 Dst(dst, stride, 3, 3) = h; // differs from vp8
} }
public static unsafe void D45EPredictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D45EPredictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte a = above[0]; byte a = above[0];
byte b = above[1]; byte b = above[1];
@@ -668,9 +668,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = Avg3(g, h, h); Dst(dst, stride, 3, 3) = Avg3(g, h, h);
} }
public static unsafe void D117Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D117Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte i = left[0]; byte I = left[0];
byte j = left[1]; byte j = left[1];
byte k = left[2]; byte k = left[2];
byte x = above[-1]; byte x = above[-1];
@@ -683,17 +683,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 2, 0) = Dst(dst, stride, 3, 2) = Avg2(b, c); Dst(dst, stride, 2, 0) = Dst(dst, stride, 3, 2) = Avg2(b, c);
Dst(dst, stride, 3, 0) = Avg2(c, d); Dst(dst, stride, 3, 0) = Avg2(c, d);
Dst(dst, stride, 0, 3) = Avg3(k, j, i); Dst(dst, stride, 0, 3) = Avg3(k, j, I);
Dst(dst, stride, 0, 2) = Avg3(j, i, x); Dst(dst, stride, 0, 2) = Avg3(j, I, x);
Dst(dst, stride, 0, 1) = Dst(dst, stride, 1, 3) = Avg3(i, x, a); Dst(dst, stride, 0, 1) = Dst(dst, stride, 1, 3) = Avg3(I, x, a);
Dst(dst, stride, 1, 1) = Dst(dst, stride, 2, 3) = Avg3(x, a, b); Dst(dst, stride, 1, 1) = Dst(dst, stride, 2, 3) = Avg3(x, a, b);
Dst(dst, stride, 2, 1) = Dst(dst, stride, 3, 3) = Avg3(a, b, c); Dst(dst, stride, 2, 1) = Dst(dst, stride, 3, 3) = Avg3(a, b, c);
Dst(dst, stride, 3, 1) = Avg3(b, c, d); Dst(dst, stride, 3, 1) = Avg3(b, c, d);
} }
public static unsafe void D135Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D135Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte i = left[0]; byte I = left[0];
byte j = left[1]; byte j = left[1];
byte k = left[2]; byte k = left[2];
byte l = left[3]; byte l = left[3];
@@ -703,18 +703,18 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
byte c = above[2]; byte c = above[2];
byte d = above[3]; byte d = above[3];
Dst(dst, stride, 0, 3) = Avg3(j, k, l); Dst(dst, stride, 0, 3) = Avg3(j, k, l);
Dst(dst, stride, 1, 3) = Dst(dst, stride, 0, 2) = Avg3(i, j, k); Dst(dst, stride, 1, 3) = Dst(dst, stride, 0, 2) = Avg3(I, j, k);
Dst(dst, stride, 2, 3) = Dst(dst, stride, 1, 2) = Dst(dst, stride, 0, 1) = Avg3(x, i, j); Dst(dst, stride, 2, 3) = Dst(dst, stride, 1, 2) = Dst(dst, stride, 0, 1) = Avg3(x, I, j);
Dst(dst, stride, 3, 3) = Dst(dst, stride, 3, 3) =
Dst(dst, stride, 2, 2) = Dst(dst, stride, 1, 1) = Dst(dst, stride, 0, 0) = Avg3(a, x, i); Dst(dst, stride, 2, 2) = Dst(dst, stride, 1, 1) = Dst(dst, stride, 0, 0) = Avg3(a, x, I);
Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 1) = Dst(dst, stride, 1, 0) = Avg3(b, a, x); Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 1) = Dst(dst, stride, 1, 0) = Avg3(b, a, x);
Dst(dst, stride, 3, 1) = Dst(dst, stride, 2, 0) = Avg3(c, b, a); Dst(dst, stride, 3, 1) = Dst(dst, stride, 2, 0) = Avg3(c, b, a);
Dst(dst, stride, 3, 0) = Avg3(d, c, b); Dst(dst, stride, 3, 0) = Avg3(d, c, b);
} }
public static unsafe void D153Predictor4X4(byte* dst, int stride, byte* above, byte* left) public static unsafe void D153Predictor4x4(byte* dst, int stride, byte* above, byte* left)
{ {
byte i = left[0]; byte I = left[0];
byte j = left[1]; byte j = left[1];
byte k = left[2]; byte k = left[2];
byte l = left[3]; byte l = left[3];
@@ -722,30 +722,30 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
byte a = above[0]; byte a = above[0];
byte b = above[1]; byte b = above[1];
byte c = above[2]; byte c = above[2];
Dst(dst, stride, 0, 0) = Dst(dst, stride, 2, 1) = Avg2(i, x); Dst(dst, stride, 0, 0) = Dst(dst, stride, 2, 1) = Avg2(I, x);
Dst(dst, stride, 0, 1) = Dst(dst, stride, 2, 2) = Avg2(j, i); Dst(dst, stride, 0, 1) = Dst(dst, stride, 2, 2) = Avg2(j, I);
Dst(dst, stride, 0, 2) = Dst(dst, stride, 2, 3) = Avg2(k, j); Dst(dst, stride, 0, 2) = Dst(dst, stride, 2, 3) = Avg2(k, j);
Dst(dst, stride, 0, 3) = Avg2(l, k); Dst(dst, stride, 0, 3) = Avg2(l, k);
Dst(dst, stride, 3, 0) = Avg3(a, b, c); Dst(dst, stride, 3, 0) = Avg3(a, b, c);
Dst(dst, stride, 2, 0) = Avg3(x, a, b); Dst(dst, stride, 2, 0) = Avg3(x, a, b);
Dst(dst, stride, 1, 0) = Dst(dst, stride, 3, 1) = Avg3(i, x, a); Dst(dst, stride, 1, 0) = Dst(dst, stride, 3, 1) = Avg3(I, x, a);
Dst(dst, stride, 1, 1) = Dst(dst, stride, 3, 2) = Avg3(j, i, x); Dst(dst, stride, 1, 1) = Dst(dst, stride, 3, 2) = Avg3(j, I, x);
Dst(dst, stride, 1, 2) = Dst(dst, stride, 3, 3) = Avg3(k, j, i); Dst(dst, stride, 1, 2) = Dst(dst, stride, 3, 3) = Avg3(k, j, I);
Dst(dst, stride, 1, 3) = Avg3(l, k, j); Dst(dst, stride, 1, 3) = Avg3(l, k, j);
} }
public static unsafe void HighbdD207Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD207Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD207Predictor(dst, stride, 8, above, left, bd); HighbdD207Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD207Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD207Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD207Predictor(dst, stride, 16, above, left, bd); HighbdD207Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD207Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD207Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD207Predictor(dst, stride, 32, above, left, bd); HighbdD207Predictor(dst, stride, 32, above, left, bd);
} }
@@ -787,17 +787,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD63Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD63Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD63Predictor(dst, stride, 8, above, left, bd); HighbdD63Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD63Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD63Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD63Predictor(dst, stride, 16, above, left, bd); HighbdD63Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD63Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD63Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD63Predictor(dst, stride, 32, above, left, bd); HighbdD63Predictor(dst, stride, 32, above, left, bd);
} }
@@ -820,17 +820,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD45Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD45Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD45Predictor(dst, stride, 8, above, left, bd); HighbdD45Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD45Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD45Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD45Predictor(dst, stride, 16, above, left, bd); HighbdD45Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD45Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD45Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD45Predictor(dst, stride, 32, above, left, bd); HighbdD45Predictor(dst, stride, 32, above, left, bd);
} }
@@ -856,17 +856,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD117Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD117Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD117Predictor(dst, stride, 8, above, left, bd); HighbdD117Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD117Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD117Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD117Predictor(dst, stride, 16, above, left, bd); HighbdD117Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD117Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD117Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD117Predictor(dst, stride, 32, above, left, bd); HighbdD117Predictor(dst, stride, 32, above, left, bd);
} }
@@ -910,17 +910,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD135Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD135Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD135Predictor(dst, stride, 8, above, left, bd); HighbdD135Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD135Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD135Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD135Predictor(dst, stride, 16, above, left, bd); HighbdD135Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD135Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD135Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD135Predictor(dst, stride, 32, above, left, bd); HighbdD135Predictor(dst, stride, 32, above, left, bd);
} }
@@ -951,17 +951,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD153Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD153Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD153Predictor(dst, stride, 8, above, left, bd); HighbdD153Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdD153Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD153Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD153Predictor(dst, stride, 16, above, left, bd); HighbdD153Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdD153Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD153Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdD153Predictor(dst, stride, 32, above, left, bd); HighbdD153Predictor(dst, stride, 32, above, left, bd);
} }
@@ -1004,22 +1004,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdVPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdVPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdVPredictor(dst, stride, 4, above, left, bd); HighbdVPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdVPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdVPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdVPredictor(dst, stride, 8, above, left, bd); HighbdVPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdVPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdVPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdVPredictor(dst, stride, 16, above, left, bd); HighbdVPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdVPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdVPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdVPredictor(dst, stride, 32, above, left, bd); HighbdVPredictor(dst, stride, 32, above, left, bd);
} }
@@ -1034,22 +1034,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdHPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdHPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdHPredictor(dst, stride, 4, above, left, bd); HighbdHPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdHPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdHPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdHPredictor(dst, stride, 8, above, left, bd); HighbdHPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdHPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdHPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdHPredictor(dst, stride, 16, above, left, bd); HighbdHPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdHPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdHPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdHPredictor(dst, stride, 32, above, left, bd); HighbdHPredictor(dst, stride, 32, above, left, bd);
} }
@@ -1064,22 +1064,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdTmPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdTmPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdTmPredictor(dst, stride, 4, above, left, bd); HighbdTmPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdTmPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdTmPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdTmPredictor(dst, stride, 8, above, left, bd); HighbdTmPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdTmPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdTmPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdTmPredictor(dst, stride, 16, above, left, bd); HighbdTmPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdTmPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdTmPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdTmPredictor(dst, stride, 32, above, left, bd); HighbdTmPredictor(dst, stride, 32, above, left, bd);
} }
@@ -1100,23 +1100,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdDc128Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDc128Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDc128Predictor(dst, stride, 4, above, left, bd); HighbdDc128Predictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdDc128Predictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDc128Predictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDc128Predictor(dst, stride, 8, above, left, bd); HighbdDc128Predictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdDc128Predictor16X16(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDc128Predictor16x16(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDc128Predictor(dst, stride, 16, above, left, bd); HighbdDc128Predictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdDc128Predictor32X32(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDc128Predictor32x32(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDc128Predictor(dst, stride, 32, above, left, bd); HighbdDc128Predictor(dst, stride, 32, above, left, bd);
@@ -1132,23 +1132,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdDcLeftPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcLeftPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcLeftPredictor(dst, stride, 4, above, left, bd); HighbdDcLeftPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdDcLeftPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcLeftPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcLeftPredictor(dst, stride, 8, above, left, bd); HighbdDcLeftPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdDcLeftPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDcLeftPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDcLeftPredictor(dst, stride, 16, above, left, bd); HighbdDcLeftPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdDcLeftPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDcLeftPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDcLeftPredictor(dst, stride, 32, above, left, bd); HighbdDcLeftPredictor(dst, stride, 32, above, left, bd);
@@ -1157,14 +1157,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
private static unsafe void HighbdDcLeftPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left, private static unsafe void HighbdDcLeftPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left,
int bd) int bd)
{ {
int sum = 0; int expectedDc, sum = 0;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
{ {
sum += left[i]; sum += left[i];
} }
int expectedDc = (sum + (bs >> 1)) / bs; expectedDc = (sum + (bs >> 1)) / bs;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -1173,23 +1173,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdDcTopPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcTopPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcTopPredictor(dst, stride, 4, above, left, bd); HighbdDcTopPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdDcTopPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcTopPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcTopPredictor(dst, stride, 8, above, left, bd); HighbdDcTopPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdDcTopPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDcTopPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDcTopPredictor(dst, stride, 16, above, left, bd); HighbdDcTopPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdDcTopPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, public static unsafe void HighbdDcTopPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left,
int bd) int bd)
{ {
HighbdDcTopPredictor(dst, stride, 32, above, left, bd); HighbdDcTopPredictor(dst, stride, 32, above, left, bd);
@@ -1198,14 +1198,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
private static unsafe void HighbdDcTopPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left, private static unsafe void HighbdDcTopPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left,
int bd) int bd)
{ {
int sum = 0; int expectedDc, sum = 0;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
{ {
sum += above[i]; sum += above[i];
} }
int expectedDc = (sum + (bs >> 1)) / bs; expectedDc = (sum + (bs >> 1)) / bs;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -1214,22 +1214,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdDcPredictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcPredictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcPredictor(dst, stride, 4, above, left, bd); HighbdDcPredictor(dst, stride, 4, above, left, bd);
} }
public static unsafe void HighbdDcPredictor8X8(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcPredictor8x8(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcPredictor(dst, stride, 8, above, left, bd); HighbdDcPredictor(dst, stride, 8, above, left, bd);
} }
public static unsafe void HighbdDcPredictor16X16(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcPredictor16x16(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcPredictor(dst, stride, 16, above, left, bd); HighbdDcPredictor(dst, stride, 16, above, left, bd);
} }
public static unsafe void HighbdDcPredictor32X32(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdDcPredictor32x32(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
HighbdDcPredictor(dst, stride, 32, above, left, bd); HighbdDcPredictor(dst, stride, 32, above, left, bd);
} }
@@ -1237,7 +1237,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
private static unsafe void HighbdDcPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left, private static unsafe void HighbdDcPredictor(ushort* dst, int stride, int bs, ushort* above, ushort* left,
int bd) int bd)
{ {
int sum = 0; int expectedDc, sum = 0;
int count = 2 * bs; int count = 2 * bs;
for (int i = 0; i < bs; i++) for (int i = 0; i < bs; i++)
@@ -1246,7 +1246,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
sum += left[i]; sum += left[i];
} }
int expectedDc = (sum + (count >> 1)) / count; expectedDc = (sum + (count >> 1)) / count;
for (int r = 0; r < bs; r++) for (int r = 0; r < bs; r++)
{ {
@@ -1255,23 +1255,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static unsafe void HighbdD207Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD207Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort i = left[0]; ushort I = left[0];
ushort j = left[1]; ushort j = left[1];
ushort k = left[2]; ushort k = left[2];
ushort l = left[3]; ushort l = left[3];
Dst(dst, stride, 0, 0) = Avg2(i, j); Dst(dst, stride, 0, 0) = Avg2(I, j);
Dst(dst, stride, 2, 0) = Dst(dst, stride, 0, 1) = Avg2(j, k); Dst(dst, stride, 2, 0) = Dst(dst, stride, 0, 1) = Avg2(j, k);
Dst(dst, stride, 2, 1) = Dst(dst, stride, 0, 2) = Avg2(k, l); Dst(dst, stride, 2, 1) = Dst(dst, stride, 0, 2) = Avg2(k, l);
Dst(dst, stride, 1, 0) = Avg3(i, j, k); Dst(dst, stride, 1, 0) = Avg3(I, j, k);
Dst(dst, stride, 3, 0) = Dst(dst, stride, 1, 1) = Avg3(j, k, l); Dst(dst, stride, 3, 0) = Dst(dst, stride, 1, 1) = Avg3(j, k, l);
Dst(dst, stride, 3, 1) = Dst(dst, stride, 1, 2) = Avg3(k, l, l); Dst(dst, stride, 3, 1) = Dst(dst, stride, 1, 2) = Avg3(k, l, l);
Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 2) = Dst(dst, stride, 0, 3) = Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 2) = Dst(dst, stride, 0, 3) =
Dst(dst, stride, 1, 3) = Dst(dst, stride, 2, 3) = Dst(dst, stride, 3, 3) = l; Dst(dst, stride, 1, 3) = Dst(dst, stride, 2, 3) = Dst(dst, stride, 3, 3) = l;
} }
public static unsafe void HighbdD63Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD63Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort a = above[0]; ushort a = above[0];
ushort b = above[1]; ushort b = above[1];
@@ -1293,7 +1293,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = Avg3(e, f, g); // Differs from vp8 Dst(dst, stride, 3, 3) = Avg3(e, f, g); // Differs from vp8
} }
public static unsafe void HighbdD45Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD45Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort a = above[0]; ushort a = above[0];
ushort b = above[1]; ushort b = above[1];
@@ -1313,9 +1313,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 3, 3) = h; // Differs from vp8 Dst(dst, stride, 3, 3) = h; // Differs from vp8
} }
public static unsafe void HighbdD117Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD117Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort i = left[0]; ushort I = left[0];
ushort j = left[1]; ushort j = left[1];
ushort k = left[2]; ushort k = left[2];
ushort x = above[-1]; ushort x = above[-1];
@@ -1328,17 +1328,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Dst(dst, stride, 2, 0) = Dst(dst, stride, 3, 2) = Avg2(b, c); Dst(dst, stride, 2, 0) = Dst(dst, stride, 3, 2) = Avg2(b, c);
Dst(dst, stride, 3, 0) = Avg2(c, d); Dst(dst, stride, 3, 0) = Avg2(c, d);
Dst(dst, stride, 0, 3) = Avg3(k, j, i); Dst(dst, stride, 0, 3) = Avg3(k, j, I);
Dst(dst, stride, 0, 2) = Avg3(j, i, x); Dst(dst, stride, 0, 2) = Avg3(j, I, x);
Dst(dst, stride, 0, 1) = Dst(dst, stride, 1, 3) = Avg3(i, x, a); Dst(dst, stride, 0, 1) = Dst(dst, stride, 1, 3) = Avg3(I, x, a);
Dst(dst, stride, 1, 1) = Dst(dst, stride, 2, 3) = Avg3(x, a, b); Dst(dst, stride, 1, 1) = Dst(dst, stride, 2, 3) = Avg3(x, a, b);
Dst(dst, stride, 2, 1) = Dst(dst, stride, 3, 3) = Avg3(a, b, c); Dst(dst, stride, 2, 1) = Dst(dst, stride, 3, 3) = Avg3(a, b, c);
Dst(dst, stride, 3, 1) = Avg3(b, c, d); Dst(dst, stride, 3, 1) = Avg3(b, c, d);
} }
public static unsafe void HighbdD135Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD135Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort i = left[0]; ushort I = left[0];
ushort j = left[1]; ushort j = left[1];
ushort k = left[2]; ushort k = left[2];
ushort l = left[3]; ushort l = left[3];
@@ -1348,18 +1348,18 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
ushort c = above[2]; ushort c = above[2];
ushort d = above[3]; ushort d = above[3];
Dst(dst, stride, 0, 3) = Avg3(j, k, l); Dst(dst, stride, 0, 3) = Avg3(j, k, l);
Dst(dst, stride, 1, 3) = Dst(dst, stride, 0, 2) = Avg3(i, j, k); Dst(dst, stride, 1, 3) = Dst(dst, stride, 0, 2) = Avg3(I, j, k);
Dst(dst, stride, 2, 3) = Dst(dst, stride, 1, 2) = Dst(dst, stride, 0, 1) = Avg3(x, i, j); Dst(dst, stride, 2, 3) = Dst(dst, stride, 1, 2) = Dst(dst, stride, 0, 1) = Avg3(x, I, j);
Dst(dst, stride, 3, 3) = Dst(dst, stride, 3, 3) =
Dst(dst, stride, 2, 2) = Dst(dst, stride, 1, 1) = Dst(dst, stride, 0, 0) = Avg3(a, x, i); Dst(dst, stride, 2, 2) = Dst(dst, stride, 1, 1) = Dst(dst, stride, 0, 0) = Avg3(a, x, I);
Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 1) = Dst(dst, stride, 1, 0) = Avg3(b, a, x); Dst(dst, stride, 3, 2) = Dst(dst, stride, 2, 1) = Dst(dst, stride, 1, 0) = Avg3(b, a, x);
Dst(dst, stride, 3, 1) = Dst(dst, stride, 2, 0) = Avg3(c, b, a); Dst(dst, stride, 3, 1) = Dst(dst, stride, 2, 0) = Avg3(c, b, a);
Dst(dst, stride, 3, 0) = Avg3(d, c, b); Dst(dst, stride, 3, 0) = Avg3(d, c, b);
} }
public static unsafe void HighbdD153Predictor4X4(ushort* dst, int stride, ushort* above, ushort* left, int bd) public static unsafe void HighbdD153Predictor4x4(ushort* dst, int stride, ushort* above, ushort* left, int bd)
{ {
ushort i = left[0]; ushort I = left[0];
ushort j = left[1]; ushort j = left[1];
ushort k = left[2]; ushort k = left[2];
ushort l = left[3]; ushort l = left[3];
@@ -1368,16 +1368,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
ushort b = above[1]; ushort b = above[1];
ushort c = above[2]; ushort c = above[2];
Dst(dst, stride, 0, 0) = Dst(dst, stride, 2, 1) = Avg2(i, x); Dst(dst, stride, 0, 0) = Dst(dst, stride, 2, 1) = Avg2(I, x);
Dst(dst, stride, 0, 1) = Dst(dst, stride, 2, 2) = Avg2(j, i); Dst(dst, stride, 0, 1) = Dst(dst, stride, 2, 2) = Avg2(j, I);
Dst(dst, stride, 0, 2) = Dst(dst, stride, 2, 3) = Avg2(k, j); Dst(dst, stride, 0, 2) = Dst(dst, stride, 2, 3) = Avg2(k, j);
Dst(dst, stride, 0, 3) = Avg2(l, k); Dst(dst, stride, 0, 3) = Avg2(l, k);
Dst(dst, stride, 3, 0) = Avg3(a, b, c); Dst(dst, stride, 3, 0) = Avg3(a, b, c);
Dst(dst, stride, 2, 0) = Avg3(x, a, b); Dst(dst, stride, 2, 0) = Avg3(x, a, b);
Dst(dst, stride, 1, 0) = Dst(dst, stride, 3, 1) = Avg3(i, x, a); Dst(dst, stride, 1, 0) = Dst(dst, stride, 3, 1) = Avg3(I, x, a);
Dst(dst, stride, 1, 1) = Dst(dst, stride, 3, 2) = Avg3(j, i, x); Dst(dst, stride, 1, 1) = Dst(dst, stride, 3, 2) = Avg3(j, I, x);
Dst(dst, stride, 1, 2) = Dst(dst, stride, 3, 3) = Avg3(k, j, i); Dst(dst, stride, 1, 2) = Dst(dst, stride, 3, 3) = Avg3(k, j, I);
Dst(dst, stride, 1, 3) = Avg3(l, k, j); Dst(dst, stride, 1, 3) = Avg3(l, k, j);
} }
} }

View File

@@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Iwht4X416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Iwht4x416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
0.5 shifts per pixel. */ 0.5 shifts per pixel. */
@@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Iwht4X41Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Iwht4x41Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
long a1, e1; long a1, e1;
Span<int> tmp = stackalloc int[4]; Span<int> tmp = stackalloc int[4];
@@ -233,7 +233,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct4X416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct4x416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[4 * 4]; Span<int> output = stackalloc int[4 * 4];
Span<int> outptr = output; Span<int> outptr = output;
@@ -265,7 +265,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void Idct4X41Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct4x41Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
long a1; long a1;
int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664)); int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664));
@@ -419,7 +419,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct8X864Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct8x864Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
@@ -452,7 +452,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct8X812Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct8x812Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
@@ -487,7 +487,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void Idct8X81Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct8x81Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
long a1; long a1;
int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664)); int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664));
@@ -843,7 +843,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct16X16256Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct16x16256Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -876,7 +876,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct16X1638Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct16x1638Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -912,7 +912,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct16X1610Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct16x1610Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -947,7 +947,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void Idct16X161Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct16x161Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
long a1; long a1;
int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664)); int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664));
@@ -1336,7 +1336,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct32X321024Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct32x321024Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1383,7 +1383,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct32X32135Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct32x32135Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1419,7 +1419,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void Idct32X3234Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct32x3234Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1454,7 +1454,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void Idct32X321Add(ReadOnlySpan<int> input, Span<byte> dest, int stride) public static void Idct32x321Add(ReadOnlySpan<int> input, Span<byte> dest, int stride)
{ {
long a1; long a1;
int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664)); int output = WrapLow(DctConstRoundShift((short)input[0] * CosPi1664));
@@ -1474,7 +1474,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIwht4X416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIwht4x416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
0.5 shifts per pixel. */ 0.5 shifts per pixel. */
@@ -1530,7 +1530,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIwht4X41Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIwht4x41Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
long a1, e1; long a1, e1;
Span<int> tmp = stackalloc int[4]; Span<int> tmp = stackalloc int[4];
@@ -1633,7 +1633,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct4X416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct4x416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[4 * 4]; Span<int> output = stackalloc int[4 * 4];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1665,7 +1665,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void HighbdIdct4X41Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct4x41Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
long a1; long a1;
int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd); int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd);
@@ -1824,7 +1824,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct8X864Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct8x864Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1857,7 +1857,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct8X812Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct8x812Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
@@ -1892,7 +1892,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void VpxHighbdidct8X81AddC(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void VpxHighbdidct8x81AddC(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
long a1; long a1;
int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd); int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd);
@@ -2261,7 +2261,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct16X16256Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct16x16256Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2294,7 +2294,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct16X1638Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct16x1638Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2331,7 +2331,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct16X1610Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct16x1610Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2366,7 +2366,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void HighbdIdct16X161Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct16x161Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
long a1; long a1;
int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd); int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd);
@@ -2762,7 +2762,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct32X321024Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct32x321024Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2809,7 +2809,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct32X32135Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct32x32135Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2846,7 +2846,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
[SkipLocalsInit] [SkipLocalsInit]
public static void HighbdIdct32X3234Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct32x3234Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
Span<int> output = stackalloc int[32 * 32]; Span<int> output = stackalloc int[32 * 32];
Span<int> outptr = output; Span<int> outptr = output;
@@ -2881,7 +2881,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
public static void HighbdIdct32X321Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd) public static void HighbdIdct32x321Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int bd)
{ {
int a1; int a1;
int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd); int output = HighbdWrapLow(DctConstRoundShift(input[0] * (long)CosPi1664), bd);

View File

@@ -1553,7 +1553,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
} }
private static unsafe void Transpose8X16( private static unsafe void Transpose8x16(
ArrayPtr<byte> in0, ArrayPtr<byte> in0,
ArrayPtr<byte> in1, ArrayPtr<byte> in1,
int inP, int inP,
@@ -1633,15 +1633,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
int inP, int inP,
ReadOnlySpan<ArrayPtr<byte>> dst, ReadOnlySpan<ArrayPtr<byte>> dst,
int outP, int outP,
int num8X8ToTranspose) int num8x8ToTranspose)
{ {
int idx8X8 = 0; int idx8x8 = 0;
Vector128<byte> x0, x1, x2, x3, x4, x5, x6, x7; Vector128<byte> x0, x1, x2, x3, x4, x5, x6, x7;
do do
{ {
ArrayPtr<byte> input = src[idx8X8]; ArrayPtr<byte> input = src[idx8x8];
ArrayPtr<byte> output = dst[idx8X8]; ArrayPtr<byte> output = dst[idx8x8];
x0 = Sse2.LoadScalarVector128((long*)(input.ToPointer() + (0 * inP))) x0 = Sse2.LoadScalarVector128((long*)(input.ToPointer() + (0 * inP)))
.AsByte(); // 00 01 02 03 04 05 06 07 .AsByte(); // 00 01 02 03 04 05 06 07
@@ -1697,7 +1697,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Sse2.StoreScalar((long*)(output.ToPointer() + (6 * outP)), x7.AsInt64()); // 06 16 26 36 46 56 66 76 Sse2.StoreScalar((long*)(output.ToPointer() + (6 * outP)), x7.AsInt64()); // 06 16 26 36 46 56 66 76
Sse2.StoreHigh((double*)(output.ToPointer() + (7 * outP)), x7.AsDouble()); // 07 17 27 37 47 57 67 77 Sse2.StoreHigh((double*)(output.ToPointer() + (7 * outP)), x7.AsDouble()); // 07 17 27 37 47 57 67 77
} while (++idx8X8 < num8X8ToTranspose); } while (++idx8x8 < num8x8ToTranspose);
} }
public static unsafe void LpfVertical4Dual( public static unsafe void LpfVertical4Dual(
@@ -1716,7 +1716,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Span<ArrayPtr<byte>> dst = stackalloc ArrayPtr<byte>[2]; Span<ArrayPtr<byte>> dst = stackalloc ArrayPtr<byte>[2];
// Transpose 8x16 // Transpose 8x16
Transpose8X16(s.Slice(-4), s.Slice(-4 + (pitch * 8)), pitch, tDst, 16); Transpose8x16(s.Slice(-4), s.Slice(-4 + (pitch * 8)), pitch, tDst, 16);
// Loop filtering // Loop filtering
LpfHorizontal4Dual(tDst.Slice(4 * 16), 16, blimit0, limit0, thresh0, blimit1, limit1, thresh1); LpfHorizontal4Dual(tDst.Slice(4 * 16), 16, blimit0, limit0, thresh0, blimit1, limit1, thresh1);
@@ -1770,7 +1770,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
Span<ArrayPtr<byte>> dst = stackalloc ArrayPtr<byte>[2]; Span<ArrayPtr<byte>> dst = stackalloc ArrayPtr<byte>[2];
// Transpose 8x16 // Transpose 8x16
Transpose8X16(s.Slice(-4), s.Slice(-4 + (pitch * 8)), pitch, tDst, 16); Transpose8x16(s.Slice(-4), s.Slice(-4 + (pitch * 8)), pitch, tDst, 16);
// Loop filtering // Loop filtering
LpfHorizontal8Dual(tDst.Slice(4 * 16), 16, blimit0, limit0, thresh0, blimit1, limit1, thresh1); LpfHorizontal8Dual(tDst.Slice(4 * 16), 16, blimit0, limit0, thresh0, blimit1, limit1, thresh1);
@@ -1823,15 +1823,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
ArrayPtr<byte> tDst = new((byte*)tDstStorage, 256); ArrayPtr<byte> tDst = new((byte*)tDstStorage, 256);
// Transpose 16x16 // Transpose 16x16
Transpose8X16(s.Slice(-8), s.Slice(-8 + (8 * pitch)), pitch, tDst, 16); Transpose8x16(s.Slice(-8), s.Slice(-8 + (8 * pitch)), pitch, tDst, 16);
Transpose8X16(s, s.Slice(8 * pitch), pitch, tDst.Slice(8 * 16), 16); Transpose8x16(s, s.Slice(8 * pitch), pitch, tDst.Slice(8 * 16), 16);
// Loop filtering // Loop filtering
LpfHorizontal16Dual(tDst.Slice(8 * 16), 16, blimit, limit, thresh); LpfHorizontal16Dual(tDst.Slice(8 * 16), 16, blimit, limit, thresh);
// Transpose back // Transpose back
Transpose8X16(tDst, tDst.Slice(8 * 16), 16, s.Slice(-8), pitch); Transpose8x16(tDst, tDst.Slice(8 * 16), 16, s.Slice(-8), pitch);
Transpose8X16(tDst.Slice(8), tDst.Slice(8 + (8 * 16)), 16, s.Slice(-8 + (8 * pitch)), pitch); Transpose8x16(tDst.Slice(8), tDst.Slice(8 + (8 * 16)), 16, s.Slice(-8 + (8 * pitch)), pitch);
} }
} }
} }

View File

@@ -26,10 +26,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
// MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT; // MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT;
private static readonly uint[] _countToUpdateFactor = private static readonly uint[] CountToUpdateFactor =
[ {
0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, 70, 76, 83, 89, 96, 102, 108, 115, 121, 128 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, 70, 76, 83, 89, 96, 102, 108, 115, 121, 128
]; };
private const int ModeMvCountSat = 20; private const int ModeMvCountSat = 20;
@@ -42,7 +42,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
uint count = Math.Min(den, ModeMvCountSat); uint count = Math.Min(den, ModeMvCountSat);
uint factor = _countToUpdateFactor[(int)count]; uint factor = CountToUpdateFactor[(int)count];
byte prob = GetProb(ct0, den); byte prob = GetProb(ct0, den);
return WeightedProb(preProb, prob, (int)factor); return WeightedProb(preProb, prob, (int)factor);
} }

View File

@@ -7,8 +7,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
{ {
internal struct Reader internal struct Reader
{ {
private static readonly byte[] _norm = private static readonly byte[] Norm =
[ {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]; };
private const int BdValueSize = sizeof(ulong) * 8; private const int BdValueSize = sizeof(ulong) * 8;
@@ -144,7 +144,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
} }
{ {
int shift = _norm[range]; int shift = Norm[range];
range <<= shift; range <<= shift;
value <<= shift; value <<= shift;
count -= shift; count -= shift;
@@ -203,7 +203,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
range = range - split; range = range - split;
value = value - bigsplit; value = value - bigsplit;
{ {
int shift = _norm[range]; int shift = Norm[range];
range <<= shift; range <<= shift;
value <<= shift; value <<= shift;
count -= shift; count -= shift;
@@ -213,7 +213,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
range = split; range = split;
{ {
int shift = _norm[range]; int shift = Norm[range];
range <<= shift; range <<= shift;
value <<= shift; value <<= shift;
count -= shift; count -= shift;
@@ -235,10 +235,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
private int DecodeUniform() private int DecodeUniform()
{ {
const int L = 8; const int l = 8;
const int M = (1 << L) - 191; const int m = (1 << l) - 191;
int v = ReadLiteral(L - 1); int v = ReadLiteral(l - 1);
return v < M ? v : (v << 1) - M + ReadBit(); return v < m ? v : (v << 1) - m + ReadBit();
} }
public int DecodeTermSubexp() public int DecodeTermSubexp()
@@ -264,7 +264,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
public TxMode ReadTxMode() public TxMode ReadTxMode()
{ {
TxMode txMode = (TxMode)ReadLiteral(2); TxMode txMode = (TxMode)ReadLiteral(2);
if (txMode == TxMode.Allow32X32) if (txMode == TxMode.Allow32x32)
{ {
txMode += ReadBit(); txMode += ReadBit();
} }

View File

@@ -64,26 +64,26 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
public const int Cat5MinVal = 35; public const int Cat5MinVal = 35;
public const int Cat6MinVal = 67; public const int Cat6MinVal = 67;
public static readonly byte[] Cat1Prob = [159]; public static readonly byte[] Cat1Prob = { 159 };
public static readonly byte[] Cat2Prob = [165, 145]; public static readonly byte[] Cat2Prob = { 165, 145 };
public static readonly byte[] Cat3Prob = [173, 148, 140]; public static readonly byte[] Cat3Prob = { 173, 148, 140 };
public static readonly byte[] Cat4Prob = [176, 155, 140, 135]; public static readonly byte[] Cat4Prob = { 176, 155, 140, 135 };
public static readonly byte[] Cat5Prob = [180, 157, 141, 134, 130]; public static readonly byte[] Cat5Prob = { 180, 157, 141, 134, 130 };
public static readonly byte[] Cat6Prob = public static readonly byte[] Cat6Prob =
[ {
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
]; };
public static readonly byte[] Cat6ProbHigh12 = public static readonly byte[] Cat6ProbHigh12 =
[ {
255, 255, 255, 255, 254, 254, 54, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129 255, 255, 255, 255, 254, 254, 54, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
]; };
public const int EobModelToken = 3; public const int EobModelToken = 3;
private static readonly byte[] _coefbandTrans8X8Plus = private static readonly byte[] CoefbandTrans8x8Plus =
[ {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
// beyond MAXBAND_INDEX+1 all values are filled as 5 // beyond MAXBAND_INDEX+1 all values are filled as 5
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
@@ -114,260 +114,260 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
]; };
private static readonly byte[] _coefbandTrans4X4 = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5]; private static readonly byte[] CoefbandTrans4x4 = { 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5 };
public static readonly byte[][] Pareto8Full = public static readonly byte[][] Pareto8Full =
[ {
[3, 86, 128, 6, 86, 23, 88, 29], [6, 86, 128, 11, 87, 42, 91, 52], new byte[] { 3, 86, 128, 6, 86, 23, 88, 29 }, new byte[] { 6, 86, 128, 11, 87, 42, 91, 52 },
[9, 86, 129, 17, 88, 61, 94, 76], [12, 86, 129, 22, 88, 77, 97, 93], new byte[] { 9, 86, 129, 17, 88, 61, 94, 76 }, new byte[] { 12, 86, 129, 22, 88, 77, 97, 93 },
[15, 87, 129, 28, 89, 93, 100, 110], [17, 87, 129, 33, 90, 105, 103, 123], new byte[] { 15, 87, 129, 28, 89, 93, 100, 110 }, new byte[] { 17, 87, 129, 33, 90, 105, 103, 123 },
[20, 88, 130, 38, 91, 118, 106, 136], [23, 88, 130, 43, 91, 128, 108, 146], new byte[] { 20, 88, 130, 38, 91, 118, 106, 136 }, new byte[] { 23, 88, 130, 43, 91, 128, 108, 146 },
[26, 89, 131, 48, 92, 139, 111, 156], [28, 89, 131, 53, 93, 147, 114, 163], new byte[] { 26, 89, 131, 48, 92, 139, 111, 156 }, new byte[] { 28, 89, 131, 53, 93, 147, 114, 163 },
[31, 90, 131, 58, 94, 156, 117, 171], [34, 90, 131, 62, 94, 163, 119, 177], new byte[] { 31, 90, 131, 58, 94, 156, 117, 171 }, new byte[] { 34, 90, 131, 62, 94, 163, 119, 177 },
[37, 90, 132, 66, 95, 171, 122, 184], [39, 90, 132, 70, 96, 177, 124, 189], new byte[] { 37, 90, 132, 66, 95, 171, 122, 184 }, new byte[] { 39, 90, 132, 70, 96, 177, 124, 189 },
[42, 91, 132, 75, 97, 183, 127, 194], [44, 91, 132, 79, 97, 188, 129, 198], new byte[] { 42, 91, 132, 75, 97, 183, 127, 194 }, new byte[] { 44, 91, 132, 79, 97, 188, 129, 198 },
[47, 92, 133, 83, 98, 193, 132, 202], [49, 92, 133, 86, 99, 197, 134, 205], new byte[] { 47, 92, 133, 83, 98, 193, 132, 202 }, new byte[] { 49, 92, 133, 86, 99, 197, 134, 205 },
[52, 93, 133, 90, 100, 201, 137, 208], [54, 93, 133, 94, 100, 204, 139, 211], new byte[] { 52, 93, 133, 90, 100, 201, 137, 208 }, new byte[] { 54, 93, 133, 94, 100, 204, 139, 211 },
[57, 94, 134, 98, 101, 208, 142, 214], [59, 94, 134, 101, 102, 211, 144, 216], new byte[] { 57, 94, 134, 98, 101, 208, 142, 214 }, new byte[] { 59, 94, 134, 101, 102, 211, 144, 216 },
[62, 94, 135, 105, 103, 214, 146, 218], new byte[] { 62, 94, 135, 105, 103, 214, 146, 218 },
[64, 94, 135, 108, 103, 216, 148, 220], new byte[] { 64, 94, 135, 108, 103, 216, 148, 220 },
[66, 95, 135, 111, 104, 219, 151, 222], new byte[] { 66, 95, 135, 111, 104, 219, 151, 222 },
[68, 95, 135, 114, 105, 221, 153, 223], new byte[] { 68, 95, 135, 114, 105, 221, 153, 223 },
[71, 96, 136, 117, 106, 224, 155, 225], new byte[] { 71, 96, 136, 117, 106, 224, 155, 225 },
[73, 96, 136, 120, 106, 225, 157, 226], new byte[] { 73, 96, 136, 120, 106, 225, 157, 226 },
[76, 97, 136, 123, 107, 227, 159, 228], new byte[] { 76, 97, 136, 123, 107, 227, 159, 228 },
[78, 97, 136, 126, 108, 229, 160, 229], new byte[] { 78, 97, 136, 126, 108, 229, 160, 229 },
[80, 98, 137, 129, 109, 231, 162, 231], new byte[] { 80, 98, 137, 129, 109, 231, 162, 231 },
[82, 98, 137, 131, 109, 232, 164, 232], new byte[] { 82, 98, 137, 131, 109, 232, 164, 232 },
[84, 98, 138, 134, 110, 234, 166, 233], new byte[] { 84, 98, 138, 134, 110, 234, 166, 233 },
[86, 98, 138, 137, 111, 235, 168, 234], new byte[] { 86, 98, 138, 137, 111, 235, 168, 234 },
[89, 99, 138, 140, 112, 236, 170, 235], new byte[] { 89, 99, 138, 140, 112, 236, 170, 235 },
[91, 99, 138, 142, 112, 237, 171, 235], new byte[] { 91, 99, 138, 142, 112, 237, 171, 235 },
[93, 100, 139, 145, 113, 238, 173, 236], new byte[] { 93, 100, 139, 145, 113, 238, 173, 236 },
[95, 100, 139, 147, 114, 239, 174, 237], new byte[] { 95, 100, 139, 147, 114, 239, 174, 237 },
[97, 101, 140, 149, 115, 240, 176, 238], new byte[] { 97, 101, 140, 149, 115, 240, 176, 238 },
[99, 101, 140, 151, 115, 241, 177, 238], new byte[] { 99, 101, 140, 151, 115, 241, 177, 238 },
[101, 102, 140, 154, 116, 242, 179, 239], new byte[] { 101, 102, 140, 154, 116, 242, 179, 239 },
[103, 102, 140, 156, 117, 242, 180, 239], new byte[] { 103, 102, 140, 156, 117, 242, 180, 239 },
[105, 103, 141, 158, 118, 243, 182, 240], new byte[] { 105, 103, 141, 158, 118, 243, 182, 240 },
[107, 103, 141, 160, 118, 243, 183, 240], new byte[] { 107, 103, 141, 160, 118, 243, 183, 240 },
[109, 104, 141, 162, 119, 244, 185, 241], new byte[] { 109, 104, 141, 162, 119, 244, 185, 241 },
[111, 104, 141, 164, 119, 244, 186, 241], new byte[] { 111, 104, 141, 164, 119, 244, 186, 241 },
[113, 104, 142, 166, 120, 245, 187, 242], new byte[] { 113, 104, 142, 166, 120, 245, 187, 242 },
[114, 104, 142, 168, 121, 245, 188, 242], new byte[] { 114, 104, 142, 168, 121, 245, 188, 242 },
[116, 105, 143, 170, 122, 246, 190, 243], new byte[] { 116, 105, 143, 170, 122, 246, 190, 243 },
[118, 105, 143, 171, 122, 246, 191, 243], new byte[] { 118, 105, 143, 171, 122, 246, 191, 243 },
[120, 106, 143, 173, 123, 247, 192, 244], new byte[] { 120, 106, 143, 173, 123, 247, 192, 244 },
[121, 106, 143, 175, 124, 247, 193, 244], new byte[] { 121, 106, 143, 175, 124, 247, 193, 244 },
[123, 107, 144, 177, 125, 248, 195, 244], new byte[] { 123, 107, 144, 177, 125, 248, 195, 244 },
[125, 107, 144, 178, 125, 248, 196, 244], new byte[] { 125, 107, 144, 178, 125, 248, 196, 244 },
[127, 108, 145, 180, 126, 249, 197, 245], new byte[] { 127, 108, 145, 180, 126, 249, 197, 245 },
[128, 108, 145, 181, 127, 249, 198, 245], new byte[] { 128, 108, 145, 181, 127, 249, 198, 245 },
[130, 109, 145, 183, 128, 249, 199, 245], new byte[] { 130, 109, 145, 183, 128, 249, 199, 245 },
[132, 109, 145, 184, 128, 249, 200, 245], new byte[] { 132, 109, 145, 184, 128, 249, 200, 245 },
[134, 110, 146, 186, 129, 250, 201, 246], new byte[] { 134, 110, 146, 186, 129, 250, 201, 246 },
[135, 110, 146, 187, 130, 250, 202, 246], new byte[] { 135, 110, 146, 187, 130, 250, 202, 246 },
[137, 111, 147, 189, 131, 251, 203, 246], new byte[] { 137, 111, 147, 189, 131, 251, 203, 246 },
[138, 111, 147, 190, 131, 251, 204, 246], new byte[] { 138, 111, 147, 190, 131, 251, 204, 246 },
[140, 112, 147, 192, 132, 251, 205, 247], new byte[] { 140, 112, 147, 192, 132, 251, 205, 247 },
[141, 112, 147, 193, 132, 251, 206, 247], new byte[] { 141, 112, 147, 193, 132, 251, 206, 247 },
[143, 113, 148, 194, 133, 251, 207, 247], new byte[] { 143, 113, 148, 194, 133, 251, 207, 247 },
[144, 113, 148, 195, 134, 251, 207, 247], new byte[] { 144, 113, 148, 195, 134, 251, 207, 247 },
[146, 114, 149, 197, 135, 252, 208, 248], new byte[] { 146, 114, 149, 197, 135, 252, 208, 248 },
[147, 114, 149, 198, 135, 252, 209, 248], new byte[] { 147, 114, 149, 198, 135, 252, 209, 248 },
[149, 115, 149, 199, 136, 252, 210, 248], new byte[] { 149, 115, 149, 199, 136, 252, 210, 248 },
[150, 115, 149, 200, 137, 252, 210, 248], new byte[] { 150, 115, 149, 200, 137, 252, 210, 248 },
[152, 115, 150, 201, 138, 252, 211, 248], new byte[] { 152, 115, 150, 201, 138, 252, 211, 248 },
[153, 115, 150, 202, 138, 252, 212, 248], new byte[] { 153, 115, 150, 202, 138, 252, 212, 248 },
[155, 116, 151, 204, 139, 253, 213, 249], new byte[] { 155, 116, 151, 204, 139, 253, 213, 249 },
[156, 116, 151, 205, 139, 253, 213, 249], new byte[] { 156, 116, 151, 205, 139, 253, 213, 249 },
[158, 117, 151, 206, 140, 253, 214, 249], new byte[] { 158, 117, 151, 206, 140, 253, 214, 249 },
[159, 117, 151, 207, 141, 253, 215, 249], new byte[] { 159, 117, 151, 207, 141, 253, 215, 249 },
[161, 118, 152, 208, 142, 253, 216, 249], new byte[] { 161, 118, 152, 208, 142, 253, 216, 249 },
[162, 118, 152, 209, 142, 253, 216, 249], new byte[] { 162, 118, 152, 209, 142, 253, 216, 249 },
[163, 119, 153, 210, 143, 253, 217, 249], new byte[] { 163, 119, 153, 210, 143, 253, 217, 249 },
[164, 119, 153, 211, 143, 253, 217, 249], new byte[] { 164, 119, 153, 211, 143, 253, 217, 249 },
[166, 120, 153, 212, 144, 254, 218, 250], new byte[] { 166, 120, 153, 212, 144, 254, 218, 250 },
[167, 120, 153, 212, 145, 254, 219, 250], new byte[] { 167, 120, 153, 212, 145, 254, 219, 250 },
[168, 121, 154, 213, 146, 254, 220, 250], new byte[] { 168, 121, 154, 213, 146, 254, 220, 250 },
[169, 121, 154, 214, 146, 254, 220, 250], new byte[] { 169, 121, 154, 214, 146, 254, 220, 250 },
[171, 122, 155, 215, 147, 254, 221, 250], new byte[] { 171, 122, 155, 215, 147, 254, 221, 250 },
[172, 122, 155, 216, 147, 254, 221, 250], new byte[] { 172, 122, 155, 216, 147, 254, 221, 250 },
[173, 123, 155, 217, 148, 254, 222, 250], new byte[] { 173, 123, 155, 217, 148, 254, 222, 250 },
[174, 123, 155, 217, 149, 254, 222, 250], new byte[] { 174, 123, 155, 217, 149, 254, 222, 250 },
[176, 124, 156, 218, 150, 254, 223, 250], new byte[] { 176, 124, 156, 218, 150, 254, 223, 250 },
[177, 124, 156, 219, 150, 254, 223, 250], new byte[] { 177, 124, 156, 219, 150, 254, 223, 250 },
[178, 125, 157, 220, 151, 254, 224, 251], new byte[] { 178, 125, 157, 220, 151, 254, 224, 251 },
[179, 125, 157, 220, 151, 254, 224, 251], new byte[] { 179, 125, 157, 220, 151, 254, 224, 251 },
[180, 126, 157, 221, 152, 254, 225, 251], new byte[] { 180, 126, 157, 221, 152, 254, 225, 251 },
[181, 126, 157, 221, 152, 254, 225, 251], new byte[] { 181, 126, 157, 221, 152, 254, 225, 251 },
[183, 127, 158, 222, 153, 254, 226, 251], new byte[] { 183, 127, 158, 222, 153, 254, 226, 251 },
[184, 127, 158, 223, 154, 254, 226, 251], new byte[] { 184, 127, 158, 223, 154, 254, 226, 251 },
[185, 128, 159, 224, 155, 255, 227, 251], new byte[] { 185, 128, 159, 224, 155, 255, 227, 251 },
[186, 128, 159, 224, 155, 255, 227, 251], new byte[] { 186, 128, 159, 224, 155, 255, 227, 251 },
[187, 129, 160, 225, 156, 255, 228, 251], new byte[] { 187, 129, 160, 225, 156, 255, 228, 251 },
[188, 130, 160, 225, 156, 255, 228, 251], new byte[] { 188, 130, 160, 225, 156, 255, 228, 251 },
[189, 131, 160, 226, 157, 255, 228, 251], new byte[] { 189, 131, 160, 226, 157, 255, 228, 251 },
[190, 131, 160, 226, 158, 255, 228, 251], new byte[] { 190, 131, 160, 226, 158, 255, 228, 251 },
[191, 132, 161, 227, 159, 255, 229, 251], new byte[] { 191, 132, 161, 227, 159, 255, 229, 251 },
[192, 132, 161, 227, 159, 255, 229, 251], new byte[] { 192, 132, 161, 227, 159, 255, 229, 251 },
[193, 133, 162, 228, 160, 255, 230, 252], new byte[] { 193, 133, 162, 228, 160, 255, 230, 252 },
[194, 133, 162, 229, 160, 255, 230, 252], new byte[] { 194, 133, 162, 229, 160, 255, 230, 252 },
[195, 134, 163, 230, 161, 255, 231, 252], new byte[] { 195, 134, 163, 230, 161, 255, 231, 252 },
[196, 134, 163, 230, 161, 255, 231, 252], new byte[] { 196, 134, 163, 230, 161, 255, 231, 252 },
[197, 135, 163, 231, 162, 255, 231, 252], new byte[] { 197, 135, 163, 231, 162, 255, 231, 252 },
[198, 135, 163, 231, 162, 255, 231, 252], new byte[] { 198, 135, 163, 231, 162, 255, 231, 252 },
[199, 136, 164, 232, 163, 255, 232, 252], new byte[] { 199, 136, 164, 232, 163, 255, 232, 252 },
[200, 136, 164, 232, 164, 255, 232, 252], new byte[] { 200, 136, 164, 232, 164, 255, 232, 252 },
[201, 137, 165, 233, 165, 255, 233, 252], new byte[] { 201, 137, 165, 233, 165, 255, 233, 252 },
[201, 137, 165, 233, 165, 255, 233, 252], new byte[] { 201, 137, 165, 233, 165, 255, 233, 252 },
[202, 138, 166, 233, 166, 255, 233, 252], new byte[] { 202, 138, 166, 233, 166, 255, 233, 252 },
[203, 138, 166, 233, 166, 255, 233, 252], new byte[] { 203, 138, 166, 233, 166, 255, 233, 252 },
[204, 139, 166, 234, 167, 255, 234, 252], new byte[] { 204, 139, 166, 234, 167, 255, 234, 252 },
[205, 139, 166, 234, 167, 255, 234, 252], new byte[] { 205, 139, 166, 234, 167, 255, 234, 252 },
[206, 140, 167, 235, 168, 255, 235, 252], new byte[] { 206, 140, 167, 235, 168, 255, 235, 252 },
[206, 140, 167, 235, 168, 255, 235, 252], new byte[] { 206, 140, 167, 235, 168, 255, 235, 252 },
[207, 141, 168, 236, 169, 255, 235, 252], new byte[] { 207, 141, 168, 236, 169, 255, 235, 252 },
[208, 141, 168, 236, 170, 255, 235, 252], new byte[] { 208, 141, 168, 236, 170, 255, 235, 252 },
[209, 142, 169, 237, 171, 255, 236, 252], new byte[] { 209, 142, 169, 237, 171, 255, 236, 252 },
[209, 143, 169, 237, 171, 255, 236, 252], new byte[] { 209, 143, 169, 237, 171, 255, 236, 252 },
[210, 144, 169, 237, 172, 255, 236, 252], new byte[] { 210, 144, 169, 237, 172, 255, 236, 252 },
[211, 144, 169, 237, 172, 255, 236, 252], new byte[] { 211, 144, 169, 237, 172, 255, 236, 252 },
[212, 145, 170, 238, 173, 255, 237, 252], new byte[] { 212, 145, 170, 238, 173, 255, 237, 252 },
[213, 145, 170, 238, 173, 255, 237, 252], new byte[] { 213, 145, 170, 238, 173, 255, 237, 252 },
[214, 146, 171, 239, 174, 255, 237, 253], new byte[] { 214, 146, 171, 239, 174, 255, 237, 253 },
[214, 146, 171, 239, 174, 255, 237, 253], new byte[] { 214, 146, 171, 239, 174, 255, 237, 253 },
[215, 147, 172, 240, 175, 255, 238, 253], new byte[] { 215, 147, 172, 240, 175, 255, 238, 253 },
[215, 147, 172, 240, 175, 255, 238, 253], new byte[] { 215, 147, 172, 240, 175, 255, 238, 253 },
[216, 148, 173, 240, 176, 255, 238, 253], new byte[] { 216, 148, 173, 240, 176, 255, 238, 253 },
[217, 148, 173, 240, 176, 255, 238, 253], new byte[] { 217, 148, 173, 240, 176, 255, 238, 253 },
[218, 149, 173, 241, 177, 255, 239, 253], new byte[] { 218, 149, 173, 241, 177, 255, 239, 253 },
[218, 149, 173, 241, 178, 255, 239, 253], new byte[] { 218, 149, 173, 241, 178, 255, 239, 253 },
[219, 150, 174, 241, 179, 255, 239, 253], new byte[] { 219, 150, 174, 241, 179, 255, 239, 253 },
[219, 151, 174, 241, 179, 255, 239, 253], new byte[] { 219, 151, 174, 241, 179, 255, 239, 253 },
[220, 152, 175, 242, 180, 255, 240, 253], new byte[] { 220, 152, 175, 242, 180, 255, 240, 253 },
[221, 152, 175, 242, 180, 255, 240, 253], new byte[] { 221, 152, 175, 242, 180, 255, 240, 253 },
[222, 153, 176, 242, 181, 255, 240, 253], new byte[] { 222, 153, 176, 242, 181, 255, 240, 253 },
[222, 153, 176, 242, 181, 255, 240, 253], new byte[] { 222, 153, 176, 242, 181, 255, 240, 253 },
[223, 154, 177, 243, 182, 255, 240, 253], new byte[] { 223, 154, 177, 243, 182, 255, 240, 253 },
[223, 154, 177, 243, 182, 255, 240, 253], new byte[] { 223, 154, 177, 243, 182, 255, 240, 253 },
[224, 155, 178, 244, 183, 255, 241, 253], new byte[] { 224, 155, 178, 244, 183, 255, 241, 253 },
[224, 155, 178, 244, 183, 255, 241, 253], new byte[] { 224, 155, 178, 244, 183, 255, 241, 253 },
[225, 156, 178, 244, 184, 255, 241, 253], new byte[] { 225, 156, 178, 244, 184, 255, 241, 253 },
[225, 157, 178, 244, 184, 255, 241, 253], new byte[] { 225, 157, 178, 244, 184, 255, 241, 253 },
[226, 158, 179, 244, 185, 255, 242, 253], new byte[] { 226, 158, 179, 244, 185, 255, 242, 253 },
[227, 158, 179, 244, 185, 255, 242, 253], new byte[] { 227, 158, 179, 244, 185, 255, 242, 253 },
[228, 159, 180, 245, 186, 255, 242, 253], new byte[] { 228, 159, 180, 245, 186, 255, 242, 253 },
[228, 159, 180, 245, 186, 255, 242, 253], new byte[] { 228, 159, 180, 245, 186, 255, 242, 253 },
[229, 160, 181, 245, 187, 255, 242, 253], new byte[] { 229, 160, 181, 245, 187, 255, 242, 253 },
[229, 160, 181, 245, 187, 255, 242, 253], new byte[] { 229, 160, 181, 245, 187, 255, 242, 253 },
[230, 161, 182, 246, 188, 255, 243, 253], new byte[] { 230, 161, 182, 246, 188, 255, 243, 253 },
[230, 162, 182, 246, 188, 255, 243, 253], new byte[] { 230, 162, 182, 246, 188, 255, 243, 253 },
[231, 163, 183, 246, 189, 255, 243, 253], new byte[] { 231, 163, 183, 246, 189, 255, 243, 253 },
[231, 163, 183, 246, 189, 255, 243, 253], new byte[] { 231, 163, 183, 246, 189, 255, 243, 253 },
[232, 164, 184, 247, 190, 255, 243, 253], new byte[] { 232, 164, 184, 247, 190, 255, 243, 253 },
[232, 164, 184, 247, 190, 255, 243, 253], new byte[] { 232, 164, 184, 247, 190, 255, 243, 253 },
[233, 165, 185, 247, 191, 255, 244, 253], new byte[] { 233, 165, 185, 247, 191, 255, 244, 253 },
[233, 165, 185, 247, 191, 255, 244, 253], new byte[] { 233, 165, 185, 247, 191, 255, 244, 253 },
[234, 166, 185, 247, 192, 255, 244, 253], new byte[] { 234, 166, 185, 247, 192, 255, 244, 253 },
[234, 167, 185, 247, 192, 255, 244, 253], new byte[] { 234, 167, 185, 247, 192, 255, 244, 253 },
[235, 168, 186, 248, 193, 255, 244, 253], new byte[] { 235, 168, 186, 248, 193, 255, 244, 253 },
[235, 168, 186, 248, 193, 255, 244, 253], new byte[] { 235, 168, 186, 248, 193, 255, 244, 253 },
[236, 169, 187, 248, 194, 255, 244, 253], new byte[] { 236, 169, 187, 248, 194, 255, 244, 253 },
[236, 169, 187, 248, 194, 255, 244, 253], new byte[] { 236, 169, 187, 248, 194, 255, 244, 253 },
[236, 170, 188, 248, 195, 255, 245, 253], new byte[] { 236, 170, 188, 248, 195, 255, 245, 253 },
[236, 170, 188, 248, 195, 255, 245, 253], new byte[] { 236, 170, 188, 248, 195, 255, 245, 253 },
[237, 171, 189, 249, 196, 255, 245, 254], new byte[] { 237, 171, 189, 249, 196, 255, 245, 254 },
[237, 172, 189, 249, 196, 255, 245, 254], new byte[] { 237, 172, 189, 249, 196, 255, 245, 254 },
[238, 173, 190, 249, 197, 255, 245, 254], new byte[] { 238, 173, 190, 249, 197, 255, 245, 254 },
[238, 173, 190, 249, 197, 255, 245, 254], new byte[] { 238, 173, 190, 249, 197, 255, 245, 254 },
[239, 174, 191, 249, 198, 255, 245, 254], new byte[] { 239, 174, 191, 249, 198, 255, 245, 254 },
[239, 174, 191, 249, 198, 255, 245, 254], new byte[] { 239, 174, 191, 249, 198, 255, 245, 254 },
[240, 175, 192, 249, 199, 255, 246, 254], new byte[] { 240, 175, 192, 249, 199, 255, 246, 254 },
[240, 176, 192, 249, 199, 255, 246, 254], new byte[] { 240, 176, 192, 249, 199, 255, 246, 254 },
[240, 177, 193, 250, 200, 255, 246, 254], new byte[] { 240, 177, 193, 250, 200, 255, 246, 254 },
[240, 177, 193, 250, 200, 255, 246, 254], new byte[] { 240, 177, 193, 250, 200, 255, 246, 254 },
[241, 178, 194, 250, 201, 255, 246, 254], new byte[] { 241, 178, 194, 250, 201, 255, 246, 254 },
[241, 178, 194, 250, 201, 255, 246, 254], new byte[] { 241, 178, 194, 250, 201, 255, 246, 254 },
[242, 179, 195, 250, 202, 255, 246, 254], new byte[] { 242, 179, 195, 250, 202, 255, 246, 254 },
[242, 180, 195, 250, 202, 255, 246, 254], new byte[] { 242, 180, 195, 250, 202, 255, 246, 254 },
[242, 181, 196, 250, 203, 255, 247, 254], new byte[] { 242, 181, 196, 250, 203, 255, 247, 254 },
[242, 181, 196, 250, 203, 255, 247, 254], new byte[] { 242, 181, 196, 250, 203, 255, 247, 254 },
[243, 182, 197, 251, 204, 255, 247, 254], new byte[] { 243, 182, 197, 251, 204, 255, 247, 254 },
[243, 183, 197, 251, 204, 255, 247, 254], new byte[] { 243, 183, 197, 251, 204, 255, 247, 254 },
[244, 184, 198, 251, 205, 255, 247, 254], new byte[] { 244, 184, 198, 251, 205, 255, 247, 254 },
[244, 184, 198, 251, 205, 255, 247, 254], new byte[] { 244, 184, 198, 251, 205, 255, 247, 254 },
[244, 185, 199, 251, 206, 255, 247, 254], new byte[] { 244, 185, 199, 251, 206, 255, 247, 254 },
[244, 185, 199, 251, 206, 255, 247, 254], new byte[] { 244, 185, 199, 251, 206, 255, 247, 254 },
[245, 186, 200, 251, 207, 255, 247, 254], new byte[] { 245, 186, 200, 251, 207, 255, 247, 254 },
[245, 187, 200, 251, 207, 255, 247, 254], new byte[] { 245, 187, 200, 251, 207, 255, 247, 254 },
[246, 188, 201, 252, 207, 255, 248, 254], new byte[] { 246, 188, 201, 252, 207, 255, 248, 254 },
[246, 188, 201, 252, 207, 255, 248, 254], new byte[] { 246, 188, 201, 252, 207, 255, 248, 254 },
[246, 189, 202, 252, 208, 255, 248, 254], new byte[] { 246, 189, 202, 252, 208, 255, 248, 254 },
[246, 190, 202, 252, 208, 255, 248, 254], new byte[] { 246, 190, 202, 252, 208, 255, 248, 254 },
[247, 191, 203, 252, 209, 255, 248, 254], new byte[] { 247, 191, 203, 252, 209, 255, 248, 254 },
[247, 191, 203, 252, 209, 255, 248, 254], new byte[] { 247, 191, 203, 252, 209, 255, 248, 254 },
[247, 192, 204, 252, 210, 255, 248, 254], new byte[] { 247, 192, 204, 252, 210, 255, 248, 254 },
[247, 193, 204, 252, 210, 255, 248, 254], new byte[] { 247, 193, 204, 252, 210, 255, 248, 254 },
[248, 194, 205, 252, 211, 255, 248, 254], new byte[] { 248, 194, 205, 252, 211, 255, 248, 254 },
[248, 194, 205, 252, 211, 255, 248, 254], new byte[] { 248, 194, 205, 252, 211, 255, 248, 254 },
[248, 195, 206, 252, 212, 255, 249, 254], new byte[] { 248, 195, 206, 252, 212, 255, 249, 254 },
[248, 196, 206, 252, 212, 255, 249, 254], new byte[] { 248, 196, 206, 252, 212, 255, 249, 254 },
[249, 197, 207, 253, 213, 255, 249, 254], new byte[] { 249, 197, 207, 253, 213, 255, 249, 254 },
[249, 197, 207, 253, 213, 255, 249, 254], new byte[] { 249, 197, 207, 253, 213, 255, 249, 254 },
[249, 198, 208, 253, 214, 255, 249, 254], new byte[] { 249, 198, 208, 253, 214, 255, 249, 254 },
[249, 199, 209, 253, 214, 255, 249, 254], new byte[] { 249, 199, 209, 253, 214, 255, 249, 254 },
[250, 200, 210, 253, 215, 255, 249, 254], new byte[] { 250, 200, 210, 253, 215, 255, 249, 254 },
[250, 200, 210, 253, 215, 255, 249, 254], new byte[] { 250, 200, 210, 253, 215, 255, 249, 254 },
[250, 201, 211, 253, 215, 255, 249, 254], new byte[] { 250, 201, 211, 253, 215, 255, 249, 254 },
[250, 202, 211, 253, 215, 255, 249, 254], new byte[] { 250, 202, 211, 253, 215, 255, 249, 254 },
[250, 203, 212, 253, 216, 255, 249, 254], new byte[] { 250, 203, 212, 253, 216, 255, 249, 254 },
[250, 203, 212, 253, 216, 255, 249, 254], new byte[] { 250, 203, 212, 253, 216, 255, 249, 254 },
[251, 204, 213, 253, 217, 255, 250, 254], new byte[] { 251, 204, 213, 253, 217, 255, 250, 254 },
[251, 205, 213, 253, 217, 255, 250, 254], new byte[] { 251, 205, 213, 253, 217, 255, 250, 254 },
[251, 206, 214, 254, 218, 255, 250, 254], new byte[] { 251, 206, 214, 254, 218, 255, 250, 254 },
[251, 206, 215, 254, 218, 255, 250, 254], new byte[] { 251, 206, 215, 254, 218, 255, 250, 254 },
[252, 207, 216, 254, 219, 255, 250, 254], new byte[] { 252, 207, 216, 254, 219, 255, 250, 254 },
[252, 208, 216, 254, 219, 255, 250, 254], new byte[] { 252, 208, 216, 254, 219, 255, 250, 254 },
[252, 209, 217, 254, 220, 255, 250, 254], new byte[] { 252, 209, 217, 254, 220, 255, 250, 254 },
[252, 210, 217, 254, 220, 255, 250, 254], new byte[] { 252, 210, 217, 254, 220, 255, 250, 254 },
[252, 211, 218, 254, 221, 255, 250, 254], new byte[] { 252, 211, 218, 254, 221, 255, 250, 254 },
[252, 212, 218, 254, 221, 255, 250, 254], new byte[] { 252, 212, 218, 254, 221, 255, 250, 254 },
[253, 213, 219, 254, 222, 255, 250, 254], new byte[] { 253, 213, 219, 254, 222, 255, 250, 254 },
[253, 213, 220, 254, 222, 255, 250, 254], new byte[] { 253, 213, 220, 254, 222, 255, 250, 254 },
[253, 214, 221, 254, 223, 255, 250, 254], new byte[] { 253, 214, 221, 254, 223, 255, 250, 254 },
[253, 215, 221, 254, 223, 255, 250, 254], new byte[] { 253, 215, 221, 254, 223, 255, 250, 254 },
[253, 216, 222, 254, 224, 255, 251, 254], new byte[] { 253, 216, 222, 254, 224, 255, 251, 254 },
[253, 217, 223, 254, 224, 255, 251, 254], new byte[] { 253, 217, 223, 254, 224, 255, 251, 254 },
[253, 218, 224, 254, 225, 255, 251, 254], new byte[] { 253, 218, 224, 254, 225, 255, 251, 254 },
[253, 219, 224, 254, 225, 255, 251, 254], new byte[] { 253, 219, 224, 254, 225, 255, 251, 254 },
[254, 220, 225, 254, 225, 255, 251, 254], new byte[] { 254, 220, 225, 254, 225, 255, 251, 254 },
[254, 221, 226, 254, 225, 255, 251, 254], new byte[] { 254, 221, 226, 254, 225, 255, 251, 254 },
[254, 222, 227, 255, 226, 255, 251, 254], new byte[] { 254, 222, 227, 255, 226, 255, 251, 254 },
[254, 223, 227, 255, 226, 255, 251, 254], new byte[] { 254, 223, 227, 255, 226, 255, 251, 254 },
[254, 224, 228, 255, 227, 255, 251, 254], new byte[] { 254, 224, 228, 255, 227, 255, 251, 254 },
[254, 225, 229, 255, 227, 255, 251, 254], new byte[] { 254, 225, 229, 255, 227, 255, 251, 254 },
[254, 226, 230, 255, 228, 255, 251, 254], new byte[] { 254, 226, 230, 255, 228, 255, 251, 254 },
[254, 227, 230, 255, 229, 255, 251, 254], new byte[] { 254, 227, 230, 255, 229, 255, 251, 254 },
[255, 228, 231, 255, 230, 255, 251, 254], new byte[] { 255, 228, 231, 255, 230, 255, 251, 254 },
[255, 229, 232, 255, 230, 255, 251, 254], new byte[] { 255, 229, 232, 255, 230, 255, 251, 254 },
[255, 230, 233, 255, 231, 255, 252, 254], new byte[] { 255, 230, 233, 255, 231, 255, 252, 254 },
[255, 231, 234, 255, 231, 255, 252, 254], new byte[] { 255, 231, 234, 255, 231, 255, 252, 254 },
[255, 232, 235, 255, 232, 255, 252, 254], new byte[] { 255, 232, 235, 255, 232, 255, 252, 254 },
[255, 233, 236, 255, 232, 255, 252, 254], new byte[] { 255, 233, 236, 255, 232, 255, 252, 254 },
[255, 235, 237, 255, 233, 255, 252, 254], new byte[] { 255, 235, 237, 255, 233, 255, 252, 254 },
[255, 236, 238, 255, 234, 255, 252, 254], new byte[] { 255, 236, 238, 255, 234, 255, 252, 254 },
[255, 238, 240, 255, 235, 255, 252, 255], new byte[] { 255, 238, 240, 255, 235, 255, 252, 255 },
[255, 239, 241, 255, 235, 255, 252, 254], new byte[] { 255, 239, 241, 255, 235, 255, 252, 254 },
[255, 241, 243, 255, 236, 255, 252, 254], new byte[] { 255, 241, 243, 255, 236, 255, 252, 254 },
[255, 243, 245, 255, 237, 255, 252, 254], new byte[] { 255, 243, 245, 255, 237, 255, 252, 254 },
[255, 246, 247, 255, 239, 255, 253, 255] new byte[] { 255, 246, 247, 255, 239, 255, 253, 255 }
]; };
internal static readonly byte[] DefaultCoefProbs4X4 = internal static readonly byte[] DefaultCoefProbs4x4 =
[ {
// Y plane // Y plane
// Intra // Intra
// Band 0 // Band 0
@@ -422,10 +422,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
127, 145, 243, 71, 129, 228, 17, 93, 177, 3, 61, 124, 1, 41, 84, 1, 21, 52, 127, 145, 243, 71, 129, 228, 17, 93, 177, 3, 61, 124, 1, 41, 84, 1, 21, 52,
// Band 5 // Band 5
157, 78, 244, 140, 72, 231, 69, 58, 184, 31, 44, 137, 14, 38, 105, 8, 23, 61 157, 78, 244, 140, 72, 231, 69, 58, 184, 31, 44, 137, 14, 38, 105, 8, 23, 61
]; };
internal static readonly byte[] DefaultCoefProbs8X8 = internal static readonly byte[] DefaultCoefProbs8x8 =
[ {
// Y plane // Y plane
// Intra // Intra
// Band 0 // Band 0
@@ -480,10 +480,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
62, 190, 238, 21, 159, 222, 2, 107, 172, 1, 72, 122, 1, 40, 71, 1, 18, 32, 62, 190, 238, 21, 159, 222, 2, 107, 172, 1, 72, 122, 1, 40, 71, 1, 18, 32,
// Band 5 // Band 5
61, 199, 240, 27, 161, 226, 4, 113, 180, 1, 76, 129, 1, 46, 80, 1, 23, 41 61, 199, 240, 27, 161, 226, 4, 113, 180, 1, 76, 129, 1, 46, 80, 1, 23, 41
]; };
internal static readonly byte[] DefaultCoefProbs16X16 = internal static readonly byte[] DefaultCoefProbs16x16 =
[ {
// Y plane // Y plane
// Intra // Intra
// Band 0 // Band 0
@@ -538,10 +538,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
40, 194, 227, 8, 147, 204, 1, 94, 155, 1, 65, 112, 1, 39, 66, 1, 14, 26, 40, 194, 227, 8, 147, 204, 1, 94, 155, 1, 65, 112, 1, 39, 66, 1, 14, 26,
// Band 5 // Band 5
16, 208, 228, 3, 151, 207, 1, 98, 160, 1, 67, 117, 1, 41, 74, 1, 17, 31 16, 208, 228, 3, 151, 207, 1, 98, 160, 1, 67, 117, 1, 41, 74, 1, 17, 31
]; };
internal static readonly byte[] DefaultCoefProbs32X32 = internal static readonly byte[] DefaultCoefProbs32x32 =
[ {
// Y plane // Y plane
// Intra // Intra
// Band 0 // Band 0
@@ -596,11 +596,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
84, 220, 246, 31, 177, 231, 2, 115, 180, 1, 79, 134, 1, 55, 77, 1, 60, 79, 84, 220, 246, 31, 177, 231, 2, 115, 180, 1, 79, 134, 1, 55, 77, 1, 60, 79,
// Band 5 // Band 5
43, 243, 240, 8, 180, 217, 1, 115, 166, 1, 84, 121, 1, 51, 67, 1, 16, 6 43, 243, 240, 8, 180, 217, 1, 115, 166, 1, 84, 121, 1, 51, 67, 1, 16, 6
]; };
public static byte[] GetBandTranslate(int txSize) public static byte[] GetBandTranslate(int txSize)
{ {
return txSize == (int)TxSize.Tx4X4 ? _coefbandTrans4X4 : _coefbandTrans8X8Plus; return txSize == (int)TxSize.Tx4x4 ? CoefbandTrans4x4 : CoefbandTrans8x8Plus;
} }
public static void CopyProbs<T>(ref T dest, ReadOnlySpan<byte> probs) where T : unmanaged public static void CopyProbs<T>(ref T dest, ReadOnlySpan<byte> probs) where T : unmanaged

View File

@@ -13,163 +13,173 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
public const int TxSizeContexts = 2; public const int TxSizeContexts = 2;
public static readonly byte[][][] KfYModeProb = public static readonly byte[][][] KfYModeProb =
[ {
[ new[]
{
// above = dc // above = dc
[137, 30, 42, 148, 151, 207, 70, 52, 91], // left = dc new byte[] { 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc
[92, 45, 102, 136, 116, 180, 74, 90, 100], // left = v new byte[] { 92, 45, 102, 136, 116, 180, 74, 90, 100 }, // left = v
[73, 32, 19, 187, 222, 215, 46, 34, 100], // left = h new byte[] { 73, 32, 19, 187, 222, 215, 46, 34, 100 }, // left = h
[91, 30, 32, 116, 121, 186, 93, 86, 94], // left = d45 new byte[] { 91, 30, 32, 116, 121, 186, 93, 86, 94 }, // left = d45
[72, 35, 36, 149, 68, 206, 68, 63, 105], // left = d135 new byte[] { 72, 35, 36, 149, 68, 206, 68, 63, 105 }, // left = d135
[73, 31, 28, 138, 57, 124, 55, 122, 151], // left = d117 new byte[] { 73, 31, 28, 138, 57, 124, 55, 122, 151 }, // left = d117
[67, 23, 21, 140, 126, 197, 40, 37, 171], // left = d153 new byte[] { 67, 23, 21, 140, 126, 197, 40, 37, 171 }, // left = d153
[86, 27, 28, 128, 154, 212, 45, 43, 53], // left = d207 new byte[] { 86, 27, 28, 128, 154, 212, 45, 43, 53 }, // left = d207
[74, 32, 27, 107, 86, 160, 63, 134, 102], // left = d63 new byte[] { 74, 32, 27, 107, 86, 160, 63, 134, 102 }, // left = d63
[59, 67, 44, 140, 161, 202, 78, 67, 119] // left = tm new byte[] { 59, 67, 44, 140, 161, 202, 78, 67, 119 } // left = tm
], },
[ new[]
{
// above = v // above = v
[63, 36, 126, 146, 123, 158, 60, 90, 96], // left = dc new byte[] { 63, 36, 126, 146, 123, 158, 60, 90, 96 }, // left = dc
[43, 46, 168, 134, 107, 128, 69, 142, 92], // left = v new byte[] { 43, 46, 168, 134, 107, 128, 69, 142, 92 }, // left = v
[44, 29, 68, 159, 201, 177, 50, 57, 77], // left = h new byte[] { 44, 29, 68, 159, 201, 177, 50, 57, 77 }, // left = h
[58, 38, 76, 114, 97, 172, 78, 133, 92], // left = d45 new byte[] { 58, 38, 76, 114, 97, 172, 78, 133, 92 }, // left = d45
[46, 41, 76, 140, 63, 184, 69, 112, 57], // left = d135 new byte[] { 46, 41, 76, 140, 63, 184, 69, 112, 57 }, // left = d135
[38, 32, 85, 140, 46, 112, 54, 151, 133], // left = d117 new byte[] { 38, 32, 85, 140, 46, 112, 54, 151, 133 }, // left = d117
[39, 27, 61, 131, 110, 175, 44, 75, 136], // left = d153 new byte[] { 39, 27, 61, 131, 110, 175, 44, 75, 136 }, // left = d153
[52, 30, 74, 113, 130, 175, 51, 64, 58], // left = d207 new byte[] { 52, 30, 74, 113, 130, 175, 51, 64, 58 }, // left = d207
[47, 35, 80, 100, 74, 143, 64, 163, 74], // left = d63 new byte[] { 47, 35, 80, 100, 74, 143, 64, 163, 74 }, // left = d63
[36, 61, 116, 114, 128, 162, 80, 125, 82] // left = tm new byte[] { 36, 61, 116, 114, 128, 162, 80, 125, 82 } // left = tm
], },
[ new[]
{
// above = h // above = h
[82, 26, 26, 171, 208, 204, 44, 32, 105], // left = dc new byte[] { 82, 26, 26, 171, 208, 204, 44, 32, 105 }, // left = dc
[55, 44, 68, 166, 179, 192, 57, 57, 108], // left = v new byte[] { 55, 44, 68, 166, 179, 192, 57, 57, 108 }, // left = v
[42, 26, 11, 199, 241, 228, 23, 15, 85], // left = h new byte[] { 42, 26, 11, 199, 241, 228, 23, 15, 85 }, // left = h
[68, 42, 19, 131, 160, 199, 55, 52, 83], // left = d45 new byte[] { 68, 42, 19, 131, 160, 199, 55, 52, 83 }, // left = d45
[58, 50, 25, 139, 115, 232, 39, 52, 118], // left = d135 new byte[] { 58, 50, 25, 139, 115, 232, 39, 52, 118 }, // left = d135
[50, 35, 33, 153, 104, 162, 64, 59, 131], // left = d117 new byte[] { 50, 35, 33, 153, 104, 162, 64, 59, 131 }, // left = d117
[44, 24, 16, 150, 177, 202, 33, 19, 156], // left = d153 new byte[] { 44, 24, 16, 150, 177, 202, 33, 19, 156 }, // left = d153
[55, 27, 12, 153, 203, 218, 26, 27, 49], // left = d207 new byte[] { 55, 27, 12, 153, 203, 218, 26, 27, 49 }, // left = d207
[53, 49, 21, 110, 116, 168, 59, 80, 76], // left = d63 new byte[] { 53, 49, 21, 110, 116, 168, 59, 80, 76 }, // left = d63
[38, 72, 19, 168, 203, 212, 50, 50, 107] // left = tm new byte[] { 38, 72, 19, 168, 203, 212, 50, 50, 107 } // left = tm
], },
[ new[]
{
// above = d45 // above = d45
[103, 26, 36, 129, 132, 201, 83, 80, 93], // left = dc new byte[] { 103, 26, 36, 129, 132, 201, 83, 80, 93 }, // left = dc
[59, 38, 83, 112, 103, 162, 98, 136, 90], // left = v new byte[] { 59, 38, 83, 112, 103, 162, 98, 136, 90 }, // left = v
[62, 30, 23, 158, 200, 207, 59, 57, 50], // left = h new byte[] { 62, 30, 23, 158, 200, 207, 59, 57, 50 }, // left = h
[67, 30, 29, 84, 86, 191, 102, 91, 59], // left = d45 new byte[] { 67, 30, 29, 84, 86, 191, 102, 91, 59 }, // left = d45
[60, 32, 33, 112, 71, 220, 64, 89, 104], // left = d135 new byte[] { 60, 32, 33, 112, 71, 220, 64, 89, 104 }, // left = d135
[53, 26, 34, 130, 56, 149, 84, 120, 103], // left = d117 new byte[] { 53, 26, 34, 130, 56, 149, 84, 120, 103 }, // left = d117
[53, 21, 23, 133, 109, 210, 56, 77, 172], // left = d153 new byte[] { 53, 21, 23, 133, 109, 210, 56, 77, 172 }, // left = d153
[77, 19, 29, 112, 142, 228, 55, 66, 36], // left = d207 new byte[] { 77, 19, 29, 112, 142, 228, 55, 66, 36 }, // left = d207
[61, 29, 29, 93, 97, 165, 83, 175, 162], // left = d63 new byte[] { 61, 29, 29, 93, 97, 165, 83, 175, 162 }, // left = d63
[47, 47, 43, 114, 137, 181, 100, 99, 95] // left = tm new byte[] { 47, 47, 43, 114, 137, 181, 100, 99, 95 } // left = tm
], },
[ new[]
{
// above = d135 // above = d135
[69, 23, 29, 128, 83, 199, 46, 44, 101], // left = dc new byte[] { 69, 23, 29, 128, 83, 199, 46, 44, 101 }, // left = dc
[53, 40, 55, 139, 69, 183, 61, 80, 110], // left = v new byte[] { 53, 40, 55, 139, 69, 183, 61, 80, 110 }, // left = v
[40, 29, 19, 161, 180, 207, 43, 24, 91], // left = h new byte[] { 40, 29, 19, 161, 180, 207, 43, 24, 91 }, // left = h
[60, 34, 19, 105, 61, 198, 53, 64, 89], // left = d45 new byte[] { 60, 34, 19, 105, 61, 198, 53, 64, 89 }, // left = d45
[52, 31, 22, 158, 40, 209, 58, 62, 89], // left = d135 new byte[] { 52, 31, 22, 158, 40, 209, 58, 62, 89 }, // left = d135
[44, 31, 29, 147, 46, 158, 56, 102, 198], // left = d117 new byte[] { 44, 31, 29, 147, 46, 158, 56, 102, 198 }, // left = d117
[35, 19, 12, 135, 87, 209, 41, 45, 167], // left = d153 new byte[] { 35, 19, 12, 135, 87, 209, 41, 45, 167 }, // left = d153
[55, 25, 21, 118, 95, 215, 38, 39, 66], // left = d207 new byte[] { 55, 25, 21, 118, 95, 215, 38, 39, 66 }, // left = d207
[51, 38, 25, 113, 58, 164, 70, 93, 97], // left = d63 new byte[] { 51, 38, 25, 113, 58, 164, 70, 93, 97 }, // left = d63
[47, 54, 34, 146, 108, 203, 72, 103, 151] // left = tm new byte[] { 47, 54, 34, 146, 108, 203, 72, 103, 151 } // left = tm
], },
[ new[]
{
// above = d117 // above = d117
[64, 19, 37, 156, 66, 138, 49, 95, 133], // left = dc new byte[] { 64, 19, 37, 156, 66, 138, 49, 95, 133 }, // left = dc
[46, 27, 80, 150, 55, 124, 55, 121, 135], // left = v new byte[] { 46, 27, 80, 150, 55, 124, 55, 121, 135 }, // left = v
[36, 23, 27, 165, 149, 166, 54, 64, 118], // left = h new byte[] { 36, 23, 27, 165, 149, 166, 54, 64, 118 }, // left = h
[53, 21, 36, 131, 63, 163, 60, 109, 81], // left = d45 new byte[] { 53, 21, 36, 131, 63, 163, 60, 109, 81 }, // left = d45
[40, 26, 35, 154, 40, 185, 51, 97, 123], // left = d135 new byte[] { 40, 26, 35, 154, 40, 185, 51, 97, 123 }, // left = d135
[35, 19, 34, 179, 19, 97, 48, 129, 124], // left = d117 new byte[] { 35, 19, 34, 179, 19, 97, 48, 129, 124 }, // left = d117
[36, 20, 26, 136, 62, 164, 33, 77, 154], // left = d153 new byte[] { 36, 20, 26, 136, 62, 164, 33, 77, 154 }, // left = d153
[45, 18, 32, 130, 90, 157, 40, 79, 91], // left = d207 new byte[] { 45, 18, 32, 130, 90, 157, 40, 79, 91 }, // left = d207
[45, 26, 28, 129, 45, 129, 49, 147, 123], // left = d63 new byte[] { 45, 26, 28, 129, 45, 129, 49, 147, 123 }, // left = d63
[38, 44, 51, 136, 74, 162, 57, 97, 121] // left = tm new byte[] { 38, 44, 51, 136, 74, 162, 57, 97, 121 } // left = tm
], },
[ new[]
{
// above = d153 // above = d153
[75, 17, 22, 136, 138, 185, 32, 34, 166], // left = dc new byte[] { 75, 17, 22, 136, 138, 185, 32, 34, 166 }, // left = dc
[56, 39, 58, 133, 117, 173, 48, 53, 187], // left = v new byte[] { 56, 39, 58, 133, 117, 173, 48, 53, 187 }, // left = v
[35, 21, 12, 161, 212, 207, 20, 23, 145], // left = h new byte[] { 35, 21, 12, 161, 212, 207, 20, 23, 145 }, // left = h
[56, 29, 19, 117, 109, 181, 55, 68, 112], // left = d45 new byte[] { 56, 29, 19, 117, 109, 181, 55, 68, 112 }, // left = d45
[47, 29, 17, 153, 64, 220, 59, 51, 114], // left = d135 new byte[] { 47, 29, 17, 153, 64, 220, 59, 51, 114 }, // left = d135
[46, 16, 24, 136, 76, 147, 41, 64, 172], // left = d117 new byte[] { 46, 16, 24, 136, 76, 147, 41, 64, 172 }, // left = d117
[34, 17, 11, 108, 152, 187, 13, 15, 209], // left = d153 new byte[] { 34, 17, 11, 108, 152, 187, 13, 15, 209 }, // left = d153
[51, 24, 14, 115, 133, 209, 32, 26, 104], // left = d207 new byte[] { 51, 24, 14, 115, 133, 209, 32, 26, 104 }, // left = d207
[55, 30, 18, 122, 79, 179, 44, 88, 116], // left = d63 new byte[] { 55, 30, 18, 122, 79, 179, 44, 88, 116 }, // left = d63
[37, 49, 25, 129, 168, 164, 41, 54, 148] // left = tm new byte[] { 37, 49, 25, 129, 168, 164, 41, 54, 148 } // left = tm
], },
[ new[]
{
// above = d207 // above = d207
[82, 22, 32, 127, 143, 213, 39, 41, 70], // left = dc new byte[] { 82, 22, 32, 127, 143, 213, 39, 41, 70 }, // left = dc
[62, 44, 61, 123, 105, 189, 48, 57, 64], // left = v new byte[] { 62, 44, 61, 123, 105, 189, 48, 57, 64 }, // left = v
[47, 25, 17, 175, 222, 220, 24, 30, 86], // left = h new byte[] { 47, 25, 17, 175, 222, 220, 24, 30, 86 }, // left = h
[68, 36, 17, 106, 102, 206, 59, 74, 74], // left = d45 new byte[] { 68, 36, 17, 106, 102, 206, 59, 74, 74 }, // left = d45
[57, 39, 23, 151, 68, 216, 55, 63, 58], // left = d135 new byte[] { 57, 39, 23, 151, 68, 216, 55, 63, 58 }, // left = d135
[49, 30, 35, 141, 70, 168, 82, 40, 115], // left = d117 new byte[] { 49, 30, 35, 141, 70, 168, 82, 40, 115 }, // left = d117
[51, 25, 15, 136, 129, 202, 38, 35, 139], // left = d153 new byte[] { 51, 25, 15, 136, 129, 202, 38, 35, 139 }, // left = d153
[68, 26, 16, 111, 141, 215, 29, 28, 28], // left = d207 new byte[] { 68, 26, 16, 111, 141, 215, 29, 28, 28 }, // left = d207
[59, 39, 19, 114, 75, 180, 77, 104, 42], // left = d63 new byte[] { 59, 39, 19, 114, 75, 180, 77, 104, 42 }, // left = d63
[40, 61, 26, 126, 152, 206, 61, 59, 93] // left = tm new byte[] { 40, 61, 26, 126, 152, 206, 61, 59, 93 } // left = tm
], },
[ new[]
{
// above = d63 // above = d63
[78, 23, 39, 111, 117, 170, 74, 124, 94], // left = dc new byte[] { 78, 23, 39, 111, 117, 170, 74, 124, 94 }, // left = dc
[48, 34, 86, 101, 92, 146, 78, 179, 134], // left = v new byte[] { 48, 34, 86, 101, 92, 146, 78, 179, 134 }, // left = v
[47, 22, 24, 138, 187, 178, 68, 69, 59], // left = h new byte[] { 47, 22, 24, 138, 187, 178, 68, 69, 59 }, // left = h
[56, 25, 33, 105, 112, 187, 95, 177, 129], // left = d45 new byte[] { 56, 25, 33, 105, 112, 187, 95, 177, 129 }, // left = d45
[48, 31, 27, 114, 63, 183, 82, 116, 56], // left = d135 new byte[] { 48, 31, 27, 114, 63, 183, 82, 116, 56 }, // left = d135
[43, 28, 37, 121, 63, 123, 61, 192, 169], // left = d117 new byte[] { 43, 28, 37, 121, 63, 123, 61, 192, 169 }, // left = d117
[42, 17, 24, 109, 97, 177, 56, 76, 122], // left = d153 new byte[] { 42, 17, 24, 109, 97, 177, 56, 76, 122 }, // left = d153
[58, 18, 28, 105, 139, 182, 70, 92, 63], // left = d207 new byte[] { 58, 18, 28, 105, 139, 182, 70, 92, 63 }, // left = d207
[46, 23, 32, 74, 86, 150, 67, 183, 88], // left = d63 new byte[] { 46, 23, 32, 74, 86, 150, 67, 183, 88 }, // left = d63
[36, 38, 48, 92, 122, 165, 88, 137, 91] // left = tm new byte[] { 36, 38, 48, 92, 122, 165, 88, 137, 91 } // left = tm
], },
[ new[]
{
// above = tm // above = tm
[65, 70, 60, 155, 159, 199, 61, 60, 81], // left = dc new byte[] { 65, 70, 60, 155, 159, 199, 61, 60, 81 }, // left = dc
[44, 78, 115, 132, 119, 173, 71, 112, 93], // left = v new byte[] { 44, 78, 115, 132, 119, 173, 71, 112, 93 }, // left = v
[39, 38, 21, 184, 227, 206, 42, 32, 64], // left = h new byte[] { 39, 38, 21, 184, 227, 206, 42, 32, 64 }, // left = h
[58, 47, 36, 124, 137, 193, 80, 82, 78], // left = d45 new byte[] { 58, 47, 36, 124, 137, 193, 80, 82, 78 }, // left = d45
[49, 50, 35, 144, 95, 205, 63, 78, 59], // left = d135 new byte[] { 49, 50, 35, 144, 95, 205, 63, 78, 59 }, // left = d135
[41, 53, 52, 148, 71, 142, 65, 128, 51], // left = d117 new byte[] { 41, 53, 52, 148, 71, 142, 65, 128, 51 }, // left = d117
[40, 36, 28, 143, 143, 202, 40, 55, 137], // left = d153 new byte[] { 40, 36, 28, 143, 143, 202, 40, 55, 137 }, // left = d153
[52, 34, 29, 129, 183, 227, 42, 35, 43], // left = d207 new byte[] { 52, 34, 29, 129, 183, 227, 42, 35, 43 }, // left = d207
[42, 44, 44, 104, 105, 164, 64, 130, 80], // left = d63 new byte[] { 42, 44, 44, 104, 105, 164, 64, 130, 80 }, // left = d63
[43, 81, 53, 140, 169, 204, 68, 84, 72] // left = tm new byte[] { 43, 81, 53, 140, 169, 204, 68, 84, 72 } // left = tm
] }
]; };
public static readonly byte[][] KfUvModeProb = public static readonly byte[][] KfUvModeProb =
[ {
[144, 11, 54, 157, 195, 130, 46, 58, 108], // y = dc new byte[] { 144, 11, 54, 157, 195, 130, 46, 58, 108 }, // y = dc
[118, 15, 123, 148, 131, 101, 44, 93, 131], // y = v new byte[] { 118, 15, 123, 148, 131, 101, 44, 93, 131 }, // y = v
[113, 12, 23, 188, 226, 142, 26, 32, 125], // y = h new byte[] { 113, 12, 23, 188, 226, 142, 26, 32, 125 }, // y = h
[120, 11, 50, 123, 163, 135, 64, 77, 103], // y = d45 new byte[] { 120, 11, 50, 123, 163, 135, 64, 77, 103 }, // y = d45
[113, 9, 36, 155, 111, 157, 32, 44, 161], // y = d135 new byte[] { 113, 9, 36, 155, 111, 157, 32, 44, 161 }, // y = d135
[116, 9, 55, 176, 76, 96, 37, 61, 149], // y = d117 new byte[] { 116, 9, 55, 176, 76, 96, 37, 61, 149 }, // y = d117
[115, 9, 28, 141, 161, 167, 21, 25, 193], // y = d153 new byte[] { 115, 9, 28, 141, 161, 167, 21, 25, 193 }, // y = d153
[120, 12, 32, 145, 195, 142, 32, 38, 86], // y = d207 new byte[] { 120, 12, 32, 145, 195, 142, 32, 38, 86 }, // y = d207
[116, 12, 64, 120, 140, 125, 49, 115, 121], // y = d63 new byte[] { 116, 12, 64, 120, 140, 125, 49, 115, 121 }, // y = d63
[102, 19, 66, 162, 182, 122, 35, 59, 128] // y = tm new byte[] { 102, 19, 66, 162, 182, 122, 35, 59, 128 } // y = tm
]; };
private static readonly byte[] _defaultIfYProbs = private static readonly byte[] DefaultIfYProbs =
[ {
65, 32, 18, 144, 162, 194, 41, 51, 98, // block_size < 8x8 65, 32, 18, 144, 162, 194, 41, 51, 98, // block_size < 8x8
132, 68, 18, 165, 217, 196, 45, 40, 78, // block_size < 16x16 132, 68, 18, 165, 217, 196, 45, 40, 78, // block_size < 16x16
173, 80, 19, 176, 240, 193, 64, 35, 46, // block_size < 32x32 173, 80, 19, 176, 240, 193, 64, 35, 46, // block_size < 32x32
221, 135, 38, 194, 248, 121, 96, 85, 29 // block_size >= 32x32 221, 135, 38, 194, 248, 121, 96, 85, 29 // block_size >= 32x32
]; };
private static readonly byte[] _defaultIfUvProbs = private static readonly byte[] DefaultIfUvProbs =
[ {
120, 7, 76, 176, 208, 126, 28, 54, 103, // y = dc 120, 7, 76, 176, 208, 126, 28, 54, 103, // y = dc
48, 12, 154, 155, 139, 90, 34, 117, 119, // y = v 48, 12, 154, 155, 139, 90, 34, 117, 119, // y = v
67, 6, 25, 204, 243, 158, 13, 21, 96, // y = h 67, 6, 25, 204, 243, 158, 13, 21, 96, // y = h
@@ -180,10 +190,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
85, 5, 32, 156, 216, 148, 19, 29, 73, // y = d207 85, 5, 32, 156, 216, 148, 19, 29, 73, // y = d207
77, 7, 64, 116, 132, 122, 37, 126, 120, // y = d63 77, 7, 64, 116, 132, 122, 37, 126, 120, // y = d63
101, 21, 107, 181, 192, 103, 19, 67, 125 // y = tm 101, 21, 107, 181, 192, 103, 19, 67, 125 // y = tm
]; };
private static readonly byte[] _defaultPartitionProbs = private static readonly byte[] DefaultPartitionProbs =
[ {
// 8x8 . 4x4 // 8x8 . 4x4
199, 122, 141, // a/l both not split 199, 122, 141, // a/l both not split
147, 63, 159, // a split, l not split 147, 63, 159, // a split, l not split
@@ -204,10 +214,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
72, 16, 44, // a split, l not split 72, 16, 44, // a split, l not split
58, 32, 12, // l split, a not split 58, 32, 12, // l split, a not split
10, 7, 6 // a/l both split 10, 7, 6 // a/l both split
]; };
private static readonly byte[] _defaultInterModeProbs = private static readonly byte[] DefaultInterModeProbs =
[ {
2, 173, 34, // 0 = both zero mv 2, 173, 34, // 0 = both zero mv
7, 145, 85, // 1 = one zero mv + one a predicted mv 7, 145, 85, // 1 = one zero mv + one a predicted mv
7, 166, 63, // 2 = two predicted mvs 7, 166, 63, // 2 = two predicted mvs
@@ -215,120 +225,120 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
8, 64, 46, // 4 = two new mvs 8, 64, 46, // 4 = two new mvs
17, 81, 31, // 5 = one intra neighbour + x 17, 81, 31, // 5 = one intra neighbour + x
25, 29, 30 // 6 = two intra neighbours 25, 29, 30 // 6 = two intra neighbours
]; };
/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */ /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
public static readonly sbyte[] IntraModeTree = public static readonly sbyte[] IntraModeTree =
[ {
-(int)PredictionMode.DcPred, 2, /* 0 = DC_NODE */ -(int)PredictionMode.TmPred, 4, /* 1 = TM_NODE */ -(int)PredictionMode.DcPred, 2, /* 0 = DC_NODE */ -(int)PredictionMode.TmPred, 4, /* 1 = TM_NODE */
-(int)PredictionMode.VPred, 6, /* 2 = V_NODE */ 8, 12, /* 3 = COM_NODE */ -(int)PredictionMode.HPred, -(int)PredictionMode.VPred, 6, /* 2 = V_NODE */ 8, 12, /* 3 = COM_NODE */ -(int)PredictionMode.HPred,
10, /* 4 = H_NODE */ -(int)PredictionMode.D135Pred, -(int)PredictionMode.D117Pred, /* 5 = D135_NODE */ 10, /* 4 = H_NODE */ -(int)PredictionMode.D135Pred, -(int)PredictionMode.D117Pred, /* 5 = D135_NODE */
-(int)PredictionMode.D45Pred, 14, /* 6 = D45_NODE */ -(int)PredictionMode.D63Pred, -(int)PredictionMode.D45Pred, 14, /* 6 = D45_NODE */ -(int)PredictionMode.D63Pred,
16, /* 7 = D63_NODE */ -(int)PredictionMode.D153Pred, -(int)PredictionMode.D207Pred /* 8 = D153_NODE */ 16, /* 7 = D63_NODE */ -(int)PredictionMode.D153Pred, -(int)PredictionMode.D207Pred /* 8 = D153_NODE */
]; };
public static readonly sbyte[] InterModeTree = public static readonly sbyte[] InterModeTree =
[ {
-((int)PredictionMode.ZeroMv - (int)PredictionMode.NearestMv), 2, -((int)PredictionMode.ZeroMv - (int)PredictionMode.NearestMv), 2,
-((int)PredictionMode.NearestMv - (int)PredictionMode.NearestMv), 4, -((int)PredictionMode.NearestMv - (int)PredictionMode.NearestMv), 4,
-((int)PredictionMode.NearMv - (int)PredictionMode.NearestMv), -((int)PredictionMode.NearMv - (int)PredictionMode.NearestMv),
-((int)PredictionMode.NewMv - (int)PredictionMode.NearestMv) -((int)PredictionMode.NewMv - (int)PredictionMode.NearestMv)
]; };
public static readonly sbyte[] PartitionTree = public static readonly sbyte[] PartitionTree =
[ {
-(sbyte)PartitionType.PartitionNone, 2, -(sbyte)PartitionType.PartitionHorz, 4, -(sbyte)PartitionType.PartitionNone, 2, -(sbyte)PartitionType.PartitionHorz, 4,
-(sbyte)PartitionType.PartitionVert, -(sbyte)PartitionType.PartitionSplit -(sbyte)PartitionType.PartitionVert, -(sbyte)PartitionType.PartitionSplit
]; };
public static readonly sbyte[] SwitchableInterpTree = public static readonly sbyte[] SwitchableInterpTree =
[ {
-Constants.EightTap, 2, -Constants.EightTapSmooth, -Constants.EightTapSharp -Constants.EightTap, 2, -Constants.EightTapSmooth, -Constants.EightTapSharp
]; };
private static readonly byte[] _defaultIntraInterP = [9, 102, 187, 225]; private static readonly byte[] DefaultIntraInterP = { 9, 102, 187, 225 };
private static readonly byte[] _defaultCompInterP = [239, 183, 119, 96, 41]; private static readonly byte[] DefaultCompInterP = { 239, 183, 119, 96, 41 };
private static readonly byte[] _defaultCompRefP = [50, 126, 123, 221, 226]; private static readonly byte[] DefaultCompRefP = { 50, 126, 123, 221, 226 };
private static readonly byte[] _defaultSingleRefP = [33, 16, 77, 74, 142, 142, 172, 170, 238, 247]; private static readonly byte[] DefaultSingleRefP = { 33, 16, 77, 74, 142, 142, 172, 170, 238, 247 };
private static readonly byte[] _defaultTxProbs = [3, 136, 37, 5, 52, 13, 20, 152, 15, 101, 100, 66]; private static readonly byte[] DefaultTxProbs = { 3, 136, 37, 5, 52, 13, 20, 152, 15, 101, 100, 66 };
static EntropyMode() static EntropyMode()
{ {
byte[][] kfPartitionProbs = byte[][] KfPartitionProbs =
[ {
// 8x8 . 4x4 // 8x8 . 4x4
[158, 97, 94], // a/l both not split new byte[] { 158, 97, 94 }, // a/l both not split
[93, 24, 99], // a split, l not split new byte[] { 93, 24, 99 }, // a split, l not split
[85, 119, 44], // l split, a not split new byte[] { 85, 119, 44 }, // l split, a not split
[62, 59, 67], // a/l both split new byte[] { 62, 59, 67 }, // a/l both split
// 16x16 . 8x8 // 16x16 . 8x8
[149, 53, 53], // a/l both not split new byte[] { 149, 53, 53 }, // a/l both not split
[94, 20, 48], // a split, l not split new byte[] { 94, 20, 48 }, // a split, l not split
[83, 53, 24], // l split, a not split new byte[] { 83, 53, 24 }, // l split, a not split
[52, 18, 18], // a/l both split new byte[] { 52, 18, 18 }, // a/l both split
// 32x32 . 16x16 // 32x32 . 16x16
[150, 40, 39], // a/l both not split new byte[] { 150, 40, 39 }, // a/l both not split
[78, 12, 26], // a split, l not split new byte[] { 78, 12, 26 }, // a split, l not split
[67, 33, 11], // l split, a not split new byte[] { 67, 33, 11 }, // l split, a not split
[24, 7, 5], // a/l both split new byte[] { 24, 7, 5 }, // a/l both split
// 64x64 . 32x32 // 64x64 . 32x32
[174, 35, 49], // a/l both not split new byte[] { 174, 35, 49 }, // a/l both not split
[68, 11, 27], // a split, l not split new byte[] { 68, 11, 27 }, // a split, l not split
[57, 15, 9], // l split, a not split new byte[] { 57, 15, 9 }, // l split, a not split
[12, 3, 3] // a/l both split new byte[] { 12, 3, 3 } // a/l both split
]; };
} }
private static readonly byte[] _defaultSkipProbs = [192, 128, 64]; private static readonly byte[] DefaultSkipProbs = { 192, 128, 64 };
private static readonly byte[] _defaultSwitchableInterpProb = [235, 162, 36, 255, 34, 3, 149, 144]; private static readonly byte[] DefaultSwitchableInterpProb = { 235, 162, 36, 255, 34, 3, 149, 144 };
private static void InitModeProbs(ref Vp9EntropyProbs fc) private static void InitModeProbs(ref Vp9EntropyProbs fc)
{ {
Entropy.CopyProbs(ref fc.UvModeProb, _defaultIfUvProbs); Entropy.CopyProbs(ref fc.UvModeProb, DefaultIfUvProbs);
Entropy.CopyProbs(ref fc.YModeProb, _defaultIfYProbs); Entropy.CopyProbs(ref fc.YModeProb, DefaultIfYProbs);
Entropy.CopyProbs(ref fc.SwitchableInterpProb, _defaultSwitchableInterpProb); Entropy.CopyProbs(ref fc.SwitchableInterpProb, DefaultSwitchableInterpProb);
Entropy.CopyProbs(ref fc.PartitionProb, _defaultPartitionProbs); Entropy.CopyProbs(ref fc.PartitionProb, DefaultPartitionProbs);
Entropy.CopyProbs(ref fc.IntraInterProb, _defaultIntraInterP); Entropy.CopyProbs(ref fc.IntraInterProb, DefaultIntraInterP);
Entropy.CopyProbs(ref fc.CompInterProb, _defaultCompInterP); Entropy.CopyProbs(ref fc.CompInterProb, DefaultCompInterP);
Entropy.CopyProbs(ref fc.CompRefProb, _defaultCompRefP); Entropy.CopyProbs(ref fc.CompRefProb, DefaultCompRefP);
Entropy.CopyProbs(ref fc.SingleRefProb, _defaultSingleRefP); Entropy.CopyProbs(ref fc.SingleRefProb, DefaultSingleRefP);
Entropy.CopyProbs(ref fc.Tx32x32Prob, _defaultTxProbs.AsSpan().Slice(0, 6)); Entropy.CopyProbs(ref fc.Tx32x32Prob, DefaultTxProbs.AsSpan().Slice(0, 6));
Entropy.CopyProbs(ref fc.Tx16x16Prob, _defaultTxProbs.AsSpan().Slice(6, 4)); Entropy.CopyProbs(ref fc.Tx16x16Prob, DefaultTxProbs.AsSpan().Slice(6, 4));
Entropy.CopyProbs(ref fc.Tx8x8Prob, _defaultTxProbs.AsSpan().Slice(10, 2)); Entropy.CopyProbs(ref fc.Tx8x8Prob, DefaultTxProbs.AsSpan().Slice(10, 2));
Entropy.CopyProbs(ref fc.SkipProb, _defaultSkipProbs); Entropy.CopyProbs(ref fc.SkipProb, DefaultSkipProbs);
Entropy.CopyProbs(ref fc.InterModeProb, _defaultInterModeProbs); Entropy.CopyProbs(ref fc.InterModeProb, DefaultInterModeProbs);
} }
internal static void TxCountsToBranchCounts32X32(ReadOnlySpan<uint> txCount32X32P, internal static void TxCountsToBranchCounts32x32(ReadOnlySpan<uint> txCount32x32P,
ref Array3<Array2<uint>> ct32X32P) ref Array3<Array2<uint>> ct32x32P)
{ {
ct32X32P[0][0] = txCount32X32P[(int)TxSize.Tx4X4]; ct32x32P[0][0] = txCount32x32P[(int)TxSize.Tx4x4];
ct32X32P[0][1] = txCount32X32P[(int)TxSize.Tx8X8] + txCount32X32P[(int)TxSize.Tx16X16] + ct32x32P[0][1] = txCount32x32P[(int)TxSize.Tx8x8] + txCount32x32P[(int)TxSize.Tx16x16] +
txCount32X32P[(int)TxSize.Tx32X32]; txCount32x32P[(int)TxSize.Tx32x32];
ct32X32P[1][0] = txCount32X32P[(int)TxSize.Tx8X8]; ct32x32P[1][0] = txCount32x32P[(int)TxSize.Tx8x8];
ct32X32P[1][1] = txCount32X32P[(int)TxSize.Tx16X16] + txCount32X32P[(int)TxSize.Tx32X32]; ct32x32P[1][1] = txCount32x32P[(int)TxSize.Tx16x16] + txCount32x32P[(int)TxSize.Tx32x32];
ct32X32P[2][0] = txCount32X32P[(int)TxSize.Tx16X16]; ct32x32P[2][0] = txCount32x32P[(int)TxSize.Tx16x16];
ct32X32P[2][1] = txCount32X32P[(int)TxSize.Tx32X32]; ct32x32P[2][1] = txCount32x32P[(int)TxSize.Tx32x32];
} }
internal static void TxCountsToBranchCounts16X16(ReadOnlySpan<uint> txCount16X16P, internal static void TxCountsToBranchCounts16x16(ReadOnlySpan<uint> txCount16x16P,
ref Array2<Array2<uint>> ct16X16P) ref Array2<Array2<uint>> ct16x16P)
{ {
ct16X16P[0][0] = txCount16X16P[(int)TxSize.Tx4X4]; ct16x16P[0][0] = txCount16x16P[(int)TxSize.Tx4x4];
ct16X16P[0][1] = txCount16X16P[(int)TxSize.Tx8X8] + txCount16X16P[(int)TxSize.Tx16X16]; ct16x16P[0][1] = txCount16x16P[(int)TxSize.Tx8x8] + txCount16x16P[(int)TxSize.Tx16x16];
ct16X16P[1][0] = txCount16X16P[(int)TxSize.Tx8X8]; ct16x16P[1][0] = txCount16x16P[(int)TxSize.Tx8x8];
ct16X16P[1][1] = txCount16X16P[(int)TxSize.Tx16X16]; ct16x16P[1][1] = txCount16x16P[(int)TxSize.Tx16x16];
} }
internal static void TxCountsToBranchCounts8X8(ReadOnlySpan<uint> txCount8X8P, internal static void TxCountsToBranchCounts8x8(ReadOnlySpan<uint> txCount8x8P,
ref Array1<Array2<uint>> ct8X8P) ref Array1<Array2<uint>> ct8x8P)
{ {
ct8X8P[0][0] = txCount8X8P[(int)TxSize.Tx4X4]; ct8x8P[0][0] = txCount8x8P[(int)TxSize.Tx4x4];
ct8X8P[0][1] = txCount8X8P[(int)TxSize.Tx8X8]; ct8x8P[0][1] = txCount8x8P[(int)TxSize.Tx8x8];
} }
public static unsafe void SetupPastIndependence(ref Vp9Common cm) public static unsafe void SetupPastIndependence(ref Vp9Common cm)

View File

@@ -14,22 +14,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
public static readonly sbyte[] JointTree = public static readonly sbyte[] JointTree =
[ {
-(sbyte)MvJointType.Zero, 2, -(sbyte)MvJointType.Hnzvz, 4, -(sbyte)MvJointType.Zero, 2, -(sbyte)MvJointType.Hnzvz, 4,
-(sbyte)MvJointType.Hzvnz, -(sbyte)MvJointType.Hnzvnz -(sbyte)MvJointType.Hzvnz, -(sbyte)MvJointType.Hnzvnz
]; };
public static readonly sbyte[] ClassTree = public static readonly sbyte[] ClassTree =
[ {
-(sbyte)MvClassType.Class0, 2, -(sbyte)MvClassType.Class1, 4, 6, 8, -(sbyte)MvClassType.Class2, -(sbyte)MvClassType.Class0, 2, -(sbyte)MvClassType.Class1, 4, 6, 8, -(sbyte)MvClassType.Class2,
-(sbyte)MvClassType.Class3, 10, 12, -(sbyte)MvClassType.Class4, -(sbyte)MvClassType.Class5, -(sbyte)MvClassType.Class3, 10, 12, -(sbyte)MvClassType.Class4, -(sbyte)MvClassType.Class5,
-(sbyte)MvClassType.Class6, 14, 16, 18, -(sbyte)MvClassType.Class7, -(sbyte)MvClassType.Class8, -(sbyte)MvClassType.Class6, 14, 16, 18, -(sbyte)MvClassType.Class7, -(sbyte)MvClassType.Class8,
-(sbyte)MvClassType.Class9, -(sbyte)MvClassType.Class10 -(sbyte)MvClassType.Class9, -(sbyte)MvClassType.Class10
]; };
public static readonly sbyte[] Class0Tree = [-0, -1]; public static readonly sbyte[] Class0Tree = { -0, -1 };
public static readonly sbyte[] FpTree = [-0, 2, -1, 4, -2, -3]; public static readonly sbyte[] FpTree = { -0, 2, -1, 4, -2, -3 };
private static bool JointVertical(MvJointType type) private static bool JointVertical(MvJointType type)
{ {
@@ -41,8 +41,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
return type == MvJointType.Hnzvz || type == MvJointType.Hnzvnz; return type == MvJointType.Hnzvz || type == MvJointType.Hnzvnz;
} }
private static readonly byte[] _logInBase2 = private static readonly byte[] LogInBase2 =
[ {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
@@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 10 9, 9, 9, 9, 9, 9, 9, 9, 9, 10
]; };
private static int ClassBase(MvClassType c) private static int ClassBase(MvClassType c)
{ {
@@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
MvClassType c = z >= Class0Size * 4096 MvClassType c = z >= Class0Size * 4096
? MvClassType.Class10 ? MvClassType.Class10
: (MvClassType)_logInBase2[z >> 3]; : (MvClassType)LogInBase2[z >> 3];
if (!offset.IsNull) if (!offset.IsNull)
{ {
offset.Value = z - ClassBase(c); offset.Value = z - ClassBase(c);
@@ -95,18 +95,18 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
private static void IncComponent(int v, ref Vp9BackwardUpdates compCounts, int compIndex, int incr, int usehp) private static void IncComponent(int v, ref Vp9BackwardUpdates compCounts, int compIndex, int incr, int usehp)
{ {
int o = 0; int s, z, c, o = 0, d, e, f;
Debug.Assert(v != 0); /* should not be zero */ Debug.Assert(v != 0); /* should not be zero */
int s = v < 0 ? 1 : 0; s = v < 0 ? 1 : 0;
compCounts.Sign[compIndex][s] += (uint)incr; compCounts.Sign[compIndex][s] += (uint)incr;
int z = (s != 0 ? -v : v) - 1 /* magnitude - 1 */; z = (s != 0 ? -v : v) - 1; /* magnitude - 1 */
int c = (int)GetClass(z, new Ptr<int>(ref o)); c = (int)GetClass(z, new Ptr<int>(ref o));
compCounts.Classes[compIndex][c] += (uint)incr; compCounts.Classes[compIndex][c] += (uint)incr;
int d = o >> 3 /* int mv data */; d = o >> 3; /* int mv data */
int f = (o >> 1) & 3 /* fractional pel mv data */; f = (o >> 1) & 3; /* fractional pel mv data */
int e = o & 1 /* high precision mv data */; e = o & 1; /* high precision mv data */
if (c == (int)MvClassType.Class0) if (c == (int)MvClassType.Class0)
{ {

View File

@@ -21,47 +21,48 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
ref VpxCodecFrameBuffer fb) ref VpxCodecFrameBuffer fb)
{ {
int i; int i;
if (cbPriv.IsNull) Ptr<InternalFrameBufferList> intFbList = cbPriv;
if (intFbList.IsNull)
{ {
return -1; return -1;
} }
// Find a free frame buffer. // Find a free frame buffer.
for (i = 0; i < cbPriv.Value.IntFb.Length; ++i) for (i = 0; i < intFbList.Value.IntFb.Length; ++i)
{ {
if (!cbPriv.Value.IntFb[i].InUse) if (!intFbList.Value.IntFb[i].InUse)
{ {
break; break;
} }
} }
if (i == cbPriv.Value.IntFb.Length) if (i == intFbList.Value.IntFb.Length)
{ {
return -1; return -1;
} }
if ((ulong)cbPriv.Value.IntFb[i].Data.Length < minSize) if ((ulong)intFbList.Value.IntFb[i].Data.Length < minSize)
{ {
if (!cbPriv.Value.IntFb[i].Data.IsNull) if (!intFbList.Value.IntFb[i].Data.IsNull)
{ {
allocator.Free(cbPriv.Value.IntFb[i].Data); allocator.Free(intFbList.Value.IntFb[i].Data);
} }
// The data must be zeroed to fix a valgrind error from the C loop filter // The data must be zeroed to fix a valgrind error from the C loop filter
// due to access uninitialized memory in frame border. It could be // due to access uninitialized memory in frame border. It could be
// skipped if border were totally removed. // skipped if border were totally removed.
cbPriv.Value.IntFb[i].Data = allocator.Allocate<byte>((int)minSize); intFbList.Value.IntFb[i].Data = allocator.Allocate<byte>((int)minSize);
if (cbPriv.Value.IntFb[i].Data.IsNull) if (intFbList.Value.IntFb[i].Data.IsNull)
{ {
return -1; return -1;
} }
} }
fb.Data = cbPriv.Value.IntFb[i].Data; fb.Data = intFbList.Value.IntFb[i].Data;
cbPriv.Value.IntFb[i].InUse = true; intFbList.Value.IntFb[i].InUse = true;
// Set the frame buffer's private data to point at the internal frame buffer. // Set the frame buffer's private data to point at the internal frame buffer.
fb.Priv = new Ptr<InternalFrameBuffer>(ref cbPriv.Value.IntFb[i]); fb.Priv = new Ptr<InternalFrameBuffer>(ref intFbList.Value.IntFb[i]);
return 0; return 0;
} }

View File

@@ -35,15 +35,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
private static readonly Transform2D[] _iht4 = private static readonly Transform2D[] Iht4 =
[ {
new(Idct4, Idct4), // DCT_DCT = 0 new(Idct4, Idct4), // DCT_DCT = 0
new(Iadst4, Idct4), // ADST_DCT = 1 new(Iadst4, Idct4), // ADST_DCT = 1
new(Idct4, Iadst4), // DCT_ADST = 2 new(Idct4, Iadst4), // DCT_ADST = 2
new(Iadst4, Iadst4) // ADST_ADST = 3 new(Iadst4, Iadst4) // ADST_ADST = 3
]; };
public static void Iht4X416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType) public static void Iht4x416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
{ {
Span<int> output = stackalloc int[4 * 4]; Span<int> output = stackalloc int[4 * 4];
Span<int> outptr = output; Span<int> outptr = output;
@@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Inverse transform row vectors // Inverse transform row vectors
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
_iht4[txType].Rows(input, outptr); Iht4[txType].Rows(input, outptr);
input = input.Slice(4); input = input.Slice(4);
outptr = outptr.Slice(4); outptr = outptr.Slice(4);
} }
@@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tempIn[j] = output[(j * 4) + i]; tempIn[j] = output[(j * 4) + i];
} }
_iht4[txType].Cols(tempIn, tempOut); Iht4[txType].Cols(tempIn, tempOut);
for (int j = 0; j < 4; ++j) for (int j = 0; j < 4; ++j)
{ {
dest[(j * stride) + i] = dest[(j * stride) + i] =
@@ -75,21 +75,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
private static readonly Transform2D[] _iht8 = private static readonly Transform2D[] Iht8 =
[ {
new(Idct8, Idct8), // DCT_DCT = 0 new(Idct8, Idct8), // DCT_DCT = 0
new(Iadst8, Idct8), // ADST_DCT = 1 new(Iadst8, Idct8), // ADST_DCT = 1
new(Idct8, Iadst8), // DCT_ADST = 2 new(Idct8, Iadst8), // DCT_ADST = 2
new(Iadst8, Iadst8) // ADST_ADST = 3 new(Iadst8, Iadst8) // ADST_ADST = 3
]; };
public static void Iht8X864Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType) public static void Iht8x864Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
Span<int> tempIn = stackalloc int[8]; Span<int> tempIn = stackalloc int[8];
Span<int> tempOut = stackalloc int[8]; Span<int> tempOut = stackalloc int[8];
Transform2D ht = _iht8[txType]; Transform2D ht = Iht8[txType];
// Inverse transform row vectors // Inverse transform row vectors
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
@@ -116,21 +116,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
private static readonly Transform2D[] _iht16 = private static readonly Transform2D[] Iht16 =
[ {
new(Idct16, Idct16), // DCT_DCT = 0 new(Idct16, Idct16), // DCT_DCT = 0
new(Iadst16, Idct16), // ADST_DCT = 1 new(Iadst16, Idct16), // ADST_DCT = 1
new(Idct16, Iadst16), // DCT_ADST = 2 new(Idct16, Iadst16), // DCT_ADST = 2
new(Iadst16, Iadst16) // ADST_ADST = 3 new(Iadst16, Iadst16) // ADST_ADST = 3
]; };
public static void Iht16X16256Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType) public static void Iht16x16256Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
Span<int> tempIn = stackalloc int[16]; Span<int> tempIn = stackalloc int[16];
Span<int> tempOut = stackalloc int[16]; Span<int> tempOut = stackalloc int[16];
Transform2D ht = _iht16[txType]; Transform2D ht = Iht16[txType];
// Rows // Rows
for (int i = 0; i < 16; ++i) for (int i = 0; i < 16; ++i)
@@ -158,31 +158,31 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
// Idct // Idct
public static void Idct4X4Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Idct4x4Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
if (eob > 1) if (eob > 1)
{ {
Idct4X416Add(input, dest, stride); Idct4x416Add(input, dest, stride);
} }
else else
{ {
Idct4X41Add(input, dest, stride); Idct4x41Add(input, dest, stride);
} }
} }
public static void Iwht4X4Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Iwht4x4Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
if (eob > 1) if (eob > 1)
{ {
Iwht4X416Add(input, dest, stride); Iwht4x416Add(input, dest, stride);
} }
else else
{ {
Iwht4X41Add(input, dest, stride); Iwht4x41Add(input, dest, stride);
} }
} }
public static void Idct8X8Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Idct8x8Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
// If dc is 1, then input[0] is the reconstructed value, do not need // If dc is 1, then input[0] is the reconstructed value, do not need
// dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
@@ -192,109 +192,109 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
if (eob == 1) if (eob == 1)
{ {
// DC only DCT coefficient // DC only DCT coefficient
Idct8X81Add(input, dest, stride); Idct8x81Add(input, dest, stride);
} }
else if (eob <= 12) else if (eob <= 12)
{ {
Idct8X812Add(input, dest, stride); Idct8x812Add(input, dest, stride);
} }
else else
{ {
Idct8X864Add(input, dest, stride); Idct8x864Add(input, dest, stride);
} }
} }
public static void Idct16X16Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Idct16x16Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
/* The calculation can be simplified if there are not many non-zero dct /* The calculation can be simplified if there are not many non-zero dct
* coefficients. Use eobs to separate different cases. */ * coefficients. Use eobs to separate different cases. */
if (eob == 1) /* DC only DCT coefficient. */ if (eob == 1) /* DC only DCT coefficient. */
{ {
Idct16X161Add(input, dest, stride); Idct16x161Add(input, dest, stride);
} }
else if (eob <= 10) else if (eob <= 10)
{ {
Idct16X1610Add(input, dest, stride); Idct16x1610Add(input, dest, stride);
} }
else if (eob <= 38) else if (eob <= 38)
{ {
Idct16X1638Add(input, dest, stride); Idct16x1638Add(input, dest, stride);
} }
else else
{ {
Idct16X16256Add(input, dest, stride); Idct16x16256Add(input, dest, stride);
} }
} }
public static void Idct32X32Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Idct32x32Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
if (eob == 1) if (eob == 1)
{ {
Idct32X321Add(input, dest, stride); Idct32x321Add(input, dest, stride);
} }
else if (eob <= 34) else if (eob <= 34)
{ {
// Non-zero coeff only in upper-left 8x8 // Non-zero coeff only in upper-left 8x8
Idct32X3234Add(input, dest, stride); Idct32x3234Add(input, dest, stride);
} }
else if (eob <= 135) else if (eob <= 135)
{ {
// Non-zero coeff only in upper-left 16x16 // Non-zero coeff only in upper-left 16x16
Idct32X32135Add(input, dest, stride); Idct32x32135Add(input, dest, stride);
} }
else else
{ {
Idct32X321024Add(input, dest, stride); Idct32x321024Add(input, dest, stride);
} }
} }
// Iht // Iht
public static void Iht4X4Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Iht4x4Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
Idct4X4Add(input, dest, stride, eob); Idct4x4Add(input, dest, stride, eob);
} }
else else
{ {
Iht4X416Add(input, dest, stride, (int)txType); Iht4x416Add(input, dest, stride, (int)txType);
} }
} }
public static void Iht8X8Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob) public static void Iht8x8Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest, int stride, int eob)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
Idct8X8Add(input, dest, stride, eob); Idct8x8Add(input, dest, stride, eob);
} }
else else
{ {
Iht8X864Add(input, dest, stride, (int)txType); Iht8x864Add(input, dest, stride, (int)txType);
} }
} }
public static void Iht16X16Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest, public static void Iht16x16Add(TxType txType, ReadOnlySpan<int> input, Span<byte> dest,
int stride, int eob) int stride, int eob)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
Idct16X16Add(input, dest, stride, eob); Idct16x16Add(input, dest, stride, eob);
} }
else else
{ {
Iht16X16256Add(input, dest, stride, (int)txType); Iht16x16256Add(input, dest, stride, (int)txType);
} }
} }
private static readonly HighbdTransform2D[] _highbdIht4 = private static readonly HighbdTransform2D[] HighbdIht4 =
[ {
new(HighbdIdct4, HighbdIdct4), // DCT_DCT = 0 new(HighbdIdct4, HighbdIdct4), // DCT_DCT = 0
new(HighbdIadst4, HighbdIdct4), // ADST_DCT = 1 new(HighbdIadst4, HighbdIdct4), // ADST_DCT = 1
new(HighbdIdct4, HighbdIadst4), // DCT_ADST = 2 new(HighbdIdct4, HighbdIadst4), // DCT_ADST = 2
new(HighbdIadst4, HighbdIadst4) // ADST_ADST = 3 new(HighbdIadst4, HighbdIadst4) // ADST_ADST = 3
]; };
public static void HighbdIht4X416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd) public static void HighbdIht4x416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd)
{ {
Span<int> output = stackalloc int[4 * 4]; Span<int> output = stackalloc int[4 * 4];
Span<int> outptr = output; Span<int> outptr = output;
@@ -304,7 +304,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Inverse transform row vectors. // Inverse transform row vectors.
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
_highbdIht4[txType].Rows(input, outptr, bd); HighbdIht4[txType].Rows(input, outptr, bd);
input = input.Slice(4); input = input.Slice(4);
outptr = outptr.Slice(4); outptr = outptr.Slice(4);
} }
@@ -317,7 +317,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tempIn[j] = output[(j * 4) + i]; tempIn[j] = output[(j * 4) + i];
} }
_highbdIht4[txType].Cols(tempIn, tempOut, bd); HighbdIht4[txType].Cols(tempIn, tempOut, bd);
for (int j = 0; j < 4; ++j) for (int j = 0; j < 4; ++j)
{ {
dest[(j * stride) + i] = HighbdClipPixelAdd(dest[(j * stride) + i], dest[(j * stride) + i] = HighbdClipPixelAdd(dest[(j * stride) + i],
@@ -326,21 +326,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
private static readonly HighbdTransform2D[] _highIht8 = private static readonly HighbdTransform2D[] HighIht8 =
[ {
new(HighbdIdct8, HighbdIdct8), // DCT_DCT = 0 new(HighbdIdct8, HighbdIdct8), // DCT_DCT = 0
new(HighbdIadst8, HighbdIdct8), // ADST_DCT = 1 new(HighbdIadst8, HighbdIdct8), // ADST_DCT = 1
new(HighbdIdct8, HighbdIadst8), // DCT_ADST = 2 new(HighbdIdct8, HighbdIadst8), // DCT_ADST = 2
new(HighbdIadst8, HighbdIadst8) // ADST_ADST = 3 new(HighbdIadst8, HighbdIadst8) // ADST_ADST = 3
]; };
public static void HighbdIht8X864Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd) public static void HighbdIht8x864Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd)
{ {
Span<int> output = stackalloc int[8 * 8]; Span<int> output = stackalloc int[8 * 8];
Span<int> outptr = output; Span<int> outptr = output;
Span<int> tempIn = stackalloc int[8]; Span<int> tempIn = stackalloc int[8];
Span<int> tempOut = stackalloc int[8]; Span<int> tempOut = stackalloc int[8];
HighbdTransform2D ht = _highIht8[txType]; HighbdTransform2D ht = HighIht8[txType];
// Inverse transform row vectors. // Inverse transform row vectors.
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
@@ -367,22 +367,22 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
} }
private static readonly HighbdTransform2D[] _highIht16 = private static readonly HighbdTransform2D[] HighIht16 =
[ {
new(HighbdIdct16, HighbdIdct16), // DCT_DCT = 0 new(HighbdIdct16, HighbdIdct16), // DCT_DCT = 0
new(HighbdIadst16, HighbdIdct16), // ADST_DCT = 1 new(HighbdIadst16, HighbdIdct16), // ADST_DCT = 1
new(HighbdIdct16, HighbdIadst16), // DCT_ADST = 2 new(HighbdIdct16, HighbdIadst16), // DCT_ADST = 2
new(HighbdIadst16, HighbdIadst16) // ADST_ADST = 3 new(HighbdIadst16, HighbdIadst16) // ADST_ADST = 3
]; };
public static void HighbdIht16X16256Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, public static void HighbdIht16x16256Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType,
int bd) int bd)
{ {
Span<int> output = stackalloc int[16 * 16]; Span<int> output = stackalloc int[16 * 16];
Span<int> outptr = output; Span<int> outptr = output;
Span<int> tempIn = stackalloc int[16]; Span<int> tempIn = stackalloc int[16];
Span<int> tempOut = stackalloc int[16]; Span<int> tempOut = stackalloc int[16];
HighbdTransform2D ht = _highIht16[txType]; HighbdTransform2D ht = HighIht16[txType];
// Rows // Rows
for (int i = 0; i < 16; ++i) for (int i = 0; i < 16; ++i)
@@ -410,31 +410,31 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
// Idct // Idct
public static void HighbdIdct4X4Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd) public static void HighbdIdct4x4Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd)
{ {
if (eob > 1) if (eob > 1)
{ {
HighbdIdct4X416Add(input, dest, stride, bd); HighbdIdct4x416Add(input, dest, stride, bd);
} }
else else
{ {
HighbdIdct4X41Add(input, dest, stride, bd); HighbdIdct4x41Add(input, dest, stride, bd);
} }
} }
public static void HighbdIwht4X4Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd) public static void HighbdIwht4x4Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd)
{ {
if (eob > 1) if (eob > 1)
{ {
HighbdIwht4X416Add(input, dest, stride, bd); HighbdIwht4x416Add(input, dest, stride, bd);
} }
else else
{ {
HighbdIwht4X41Add(input, dest, stride, bd); HighbdIwht4x41Add(input, dest, stride, bd);
} }
} }
public static void HighbdIdct8X8Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd) public static void HighbdIdct8x8Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd)
{ {
// If dc is 1, then input[0] is the reconstructed value, do not need // If dc is 1, then input[0] is the reconstructed value, do not need
// dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
@@ -444,99 +444,99 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// DC only DCT coefficient // DC only DCT coefficient
if (eob == 1) if (eob == 1)
{ {
VpxHighbdidct8X81AddC(input, dest, stride, bd); VpxHighbdidct8x81AddC(input, dest, stride, bd);
} }
else if (eob <= 12) else if (eob <= 12)
{ {
HighbdIdct8X812Add(input, dest, stride, bd); HighbdIdct8x812Add(input, dest, stride, bd);
} }
else else
{ {
HighbdIdct8X864Add(input, dest, stride, bd); HighbdIdct8x864Add(input, dest, stride, bd);
} }
} }
public static void HighbdIdct16X16Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd) public static void HighbdIdct16x16Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd)
{ {
// The calculation can be simplified if there are not many non-zero dct // The calculation can be simplified if there are not many non-zero dct
// coefficients. Use eobs to separate different cases. // coefficients. Use eobs to separate different cases.
// DC only DCT coefficient. // DC only DCT coefficient.
if (eob == 1) if (eob == 1)
{ {
HighbdIdct16X161Add(input, dest, stride, bd); HighbdIdct16x161Add(input, dest, stride, bd);
} }
else if (eob <= 10) else if (eob <= 10)
{ {
HighbdIdct16X1610Add(input, dest, stride, bd); HighbdIdct16x1610Add(input, dest, stride, bd);
} }
else if (eob <= 38) else if (eob <= 38)
{ {
HighbdIdct16X1638Add(input, dest, stride, bd); HighbdIdct16x1638Add(input, dest, stride, bd);
} }
else else
{ {
HighbdIdct16X16256Add(input, dest, stride, bd); HighbdIdct16x16256Add(input, dest, stride, bd);
} }
} }
public static void HighbdIdct32X32Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd) public static void HighbdIdct32x32Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int eob, int bd)
{ {
// Non-zero coeff only in upper-left 8x8 // Non-zero coeff only in upper-left 8x8
if (eob == 1) if (eob == 1)
{ {
HighbdIdct32X321Add(input, dest, stride, bd); HighbdIdct32x321Add(input, dest, stride, bd);
} }
else if (eob <= 34) else if (eob <= 34)
{ {
HighbdIdct32X3234Add(input, dest, stride, bd); HighbdIdct32x3234Add(input, dest, stride, bd);
} }
else if (eob <= 135) else if (eob <= 135)
{ {
HighbdIdct32X32135Add(input, dest, stride, bd); HighbdIdct32x32135Add(input, dest, stride, bd);
} }
else else
{ {
HighbdIdct32X321024Add(input, dest, stride, bd); HighbdIdct32x321024Add(input, dest, stride, bd);
} }
} }
// Iht // Iht
public static void HighbdIht4X4Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride, public static void HighbdIht4x4Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride,
int eob, int bd) int eob, int bd)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
HighbdIdct4X4Add(input, dest, stride, eob, bd); HighbdIdct4x4Add(input, dest, stride, eob, bd);
} }
else else
{ {
HighbdIht4X416Add(input, dest, stride, (int)txType, bd); HighbdIht4x416Add(input, dest, stride, (int)txType, bd);
} }
} }
public static void HighbdIht8X8Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride, public static void HighbdIht8x8Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride,
int eob, int bd) int eob, int bd)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
HighbdIdct8X8Add(input, dest, stride, eob, bd); HighbdIdct8x8Add(input, dest, stride, eob, bd);
} }
else else
{ {
HighbdIht8X864Add(input, dest, stride, (int)txType, bd); HighbdIht8x864Add(input, dest, stride, (int)txType, bd);
} }
} }
public static void HighbdIht16X16Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride, public static void HighbdIht16x16Add(TxType txType, ReadOnlySpan<int> input, Span<ushort> dest, int stride,
int eob, int bd) int eob, int bd)
{ {
if (txType == TxType.DctDct) if (txType == TxType.DctDct)
{ {
HighbdIdct16X16Add(input, dest, stride, eob, bd); HighbdIdct16x16Add(input, dest, stride, eob, bd);
} }
else else
{ {
HighbdIht16X16256Add(input, dest, stride, (int)txType, bd); HighbdIht16x16256Add(input, dest, stride, (int)txType, bd);
} }
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -46,10 +46,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
// MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT; // MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT;
private static readonly uint[] _countToUpdateFactor = private static readonly uint[] CountToUpdateFactor =
[ {
0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, 70, 76, 83, 89, 96, 102, 108, 115, 121, 128 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, 70, 76, 83, 89, 96, 102, 108, 115, 121, 128
]; };
private const int ModeMvCountSat = 20; private const int ModeMvCountSat = 20;
@@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
} }
uint count = Math.Min(den, ModeMvCountSat); uint count = Math.Min(den, ModeMvCountSat);
uint factor = _countToUpdateFactor[(int)count]; uint factor = CountToUpdateFactor[(int)count];
byte prob = GetProb(ct[0], den); byte prob = GetProb(ct[0], den);
return WeightedProb(preProb, prob, (int)factor); return WeightedProb(preProb, prob, (int)factor);
} }

View File

@@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
public const int MaxQ = 255; public const int MaxQ = 255;
public const int QindexBits = 8; public const int QindexBits = 8;
private static readonly short[] _dcQlookup = private static readonly short[] DcQlookup =
[ {
4, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 4, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29,
30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51,
52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 70, 71, 72, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 70, 71, 72,
@@ -22,10 +22,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
447, 454, 461, 467, 475, 482, 489, 497, 505, 513, 522, 530, 539, 549, 559, 569, 579, 590, 602, 614, 626, 447, 454, 461, 467, 475, 482, 489, 497, 505, 513, 522, 530, 539, 549, 559, 569, 579, 590, 602, 614, 626,
640, 654, 668, 684, 700, 717, 736, 755, 775, 796, 819, 843, 869, 896, 925, 955, 988, 1022, 1058, 1098, 640, 654, 668, 684, 700, 717, 736, 755, 775, 796, 819, 843, 869, 896, 925, 955, 988, 1022, 1058, 1098,
1139, 1184, 1232, 1282, 1336 1139, 1184, 1232, 1282, 1336
]; };
private static readonly short[] _dcQlookup10 = private static readonly short[] DcQlookup10 =
[ {
4, 9, 10, 13, 15, 17, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 50, 53, 57, 60, 64, 68, 71, 75, 78, 82, 4, 9, 10, 13, 15, 17, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 50, 53, 57, 60, 64, 68, 71, 75, 78, 82,
86, 90, 93, 97, 101, 105, 109, 113, 116, 120, 124, 128, 132, 136, 140, 143, 147, 151, 155, 159, 163, 86, 90, 93, 97, 101, 105, 109, 113, 116, 120, 124, 128, 132, 136, 140, 143, 147, 151, 155, 159, 163,
166, 170, 174, 178, 182, 185, 189, 193, 197, 200, 204, 208, 212, 215, 219, 223, 226, 230, 233, 237, 241, 166, 170, 174, 178, 182, 185, 189, 193, 197, 200, 204, 208, 212, 215, 219, 223, 226, 230, 233, 237, 241,
@@ -39,10 +39,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
1692, 1717, 1741, 1766, 1791, 1817, 1844, 1871, 1900, 1929, 1958, 1990, 2021, 2054, 2088, 2123, 2159, 1692, 1717, 1741, 1766, 1791, 1817, 1844, 1871, 1900, 1929, 1958, 1990, 2021, 2054, 2088, 2123, 2159,
2197, 2236, 2276, 2319, 2363, 2410, 2458, 2508, 2561, 2616, 2675, 2737, 2802, 2871, 2944, 3020, 3102, 2197, 2236, 2276, 2319, 2363, 2410, 2458, 2508, 2561, 2616, 2675, 2737, 2802, 2871, 2944, 3020, 3102,
3188, 3280, 3375, 3478, 3586, 3702, 3823, 3953, 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347 3188, 3280, 3375, 3478, 3586, 3702, 3823, 3953, 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347
]; };
private static readonly short[] _dcQlookup12 = private static readonly short[] DcQlookup12 =
[ {
4, 12, 18, 25, 33, 41, 50, 60, 70, 80, 91, 103, 115, 127, 140, 153, 166, 180, 194, 208, 222, 237, 251, 4, 12, 18, 25, 33, 41, 50, 60, 70, 80, 91, 103, 115, 127, 140, 153, 166, 180, 194, 208, 222, 237, 251,
266, 281, 296, 312, 327, 343, 358, 374, 390, 405, 421, 437, 453, 469, 484, 500, 516, 532, 548, 564, 580, 266, 281, 296, 312, 327, 343, 358, 374, 390, 405, 421, 437, 453, 469, 484, 500, 516, 532, 548, 564, 580,
596, 611, 627, 643, 659, 674, 690, 706, 721, 737, 752, 768, 783, 798, 814, 829, 844, 859, 874, 889, 904, 596, 611, 627, 643, 659, 674, 690, 706, 721, 737, 752, 768, 783, 798, 814, 829, 844, 859, 874, 889, 904,
@@ -58,10 +58,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
8214, 8352, 8492, 8635, 8788, 8945, 9104, 9275, 9450, 9639, 9832, 10031, 10245, 10465, 10702, 10946, 8214, 8352, 8492, 8635, 8788, 8945, 9104, 9275, 9450, 9639, 9832, 10031, 10245, 10465, 10702, 10946,
11210, 11482, 11776, 12081, 12409, 12750, 13118, 13501, 13913, 14343, 14807, 15290, 15812, 16356, 16943, 11210, 11482, 11776, 12081, 12409, 12750, 13118, 13501, 13913, 14343, 14807, 15290, 15812, 16356, 16943,
17575, 18237, 18949, 19718, 20521, 21387 17575, 18237, 18949, 19718, 20521, 21387
]; };
private static readonly short[] _acQlookup = private static readonly short[] AcQlookup =
[ {
4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
@@ -74,10 +74,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
729, 743, 757, 771, 786, 801, 816, 832, 848, 864, 881, 898, 915, 933, 951, 969, 988, 1007, 1026, 1046, 729, 743, 757, 771, 786, 801, 816, 832, 848, 864, 881, 898, 915, 933, 951, 969, 988, 1007, 1026, 1046,
1066, 1087, 1108, 1129, 1151, 1173, 1196, 1219, 1243, 1267, 1292, 1317, 1343, 1369, 1396, 1423, 1451, 1066, 1087, 1108, 1129, 1151, 1173, 1196, 1219, 1243, 1267, 1292, 1317, 1343, 1369, 1396, 1423, 1451,
1479, 1508, 1537, 1567, 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828 1479, 1508, 1537, 1567, 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828
]; };
private static readonly short[] _acQlookup10 = private static readonly short[] AcQlookup10 =
[ {
4, 9, 11, 13, 16, 18, 21, 24, 27, 30, 33, 37, 40, 44, 48, 51, 55, 59, 63, 67, 71, 75, 79, 83, 88, 92, 4, 9, 11, 13, 16, 18, 21, 24, 27, 30, 33, 37, 40, 44, 48, 51, 55, 59, 63, 67, 71, 75, 79, 83, 88, 92,
96, 100, 105, 109, 114, 118, 122, 127, 131, 136, 140, 145, 149, 154, 158, 163, 168, 172, 177, 181, 186, 96, 100, 105, 109, 114, 118, 122, 127, 131, 136, 140, 145, 149, 154, 158, 163, 168, 172, 177, 181, 186,
190, 195, 199, 204, 208, 213, 217, 222, 226, 231, 235, 240, 244, 249, 253, 258, 262, 267, 271, 275, 280, 190, 195, 199, 204, 208, 213, 217, 222, 226, 231, 235, 240, 244, 249, 253, 258, 262, 267, 271, 275, 280,
@@ -92,10 +92,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
3659, 3731, 3803, 3876, 3952, 4028, 4104, 4184, 4264, 4348, 4432, 4516, 4604, 4692, 4784, 4876, 4972, 3659, 3731, 3803, 3876, 3952, 4028, 4104, 4184, 4264, 4348, 4432, 4516, 4604, 4692, 4784, 4876, 4972,
5068, 5168, 5268, 5372, 5476, 5584, 5692, 5804, 5916, 6032, 6148, 6268, 6388, 6512, 6640, 6768, 6900, 5068, 5168, 5268, 5372, 5476, 5584, 5692, 5804, 5916, 6032, 6148, 6268, 6388, 6512, 6640, 6768, 6900,
7036, 7172, 7312 7036, 7172, 7312
]; };
private static readonly short[] _acQlookup12 = private static readonly short[] AcQlookup12 =
[ {
4, 13, 19, 27, 35, 44, 54, 64, 75, 87, 99, 112, 126, 139, 154, 168, 183, 199, 214, 230, 247, 263, 280, 4, 13, 19, 27, 35, 44, 54, 64, 75, 87, 99, 112, 126, 139, 154, 168, 183, 199, 214, 230, 247, 263, 280,
297, 314, 331, 349, 366, 384, 402, 420, 438, 456, 475, 493, 511, 530, 548, 567, 586, 604, 623, 642, 660, 297, 314, 331, 349, 366, 384, 402, 420, 438, 456, 475, 493, 511, 530, 548, 567, 586, 604, 623, 642, 660,
679, 698, 716, 735, 753, 772, 791, 809, 828, 846, 865, 884, 902, 920, 939, 957, 976, 994, 1012, 1030, 679, 698, 716, 735, 753, 772, 791, 809, 828, 846, 865, 884, 902, 920, 939, 957, 976, 994, 1012, 1030,
@@ -111,15 +111,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
13565, 13821, 14093, 14365, 14637, 14925, 15213, 15502, 15806, 16110, 16414, 16734, 17054, 17390, 17726, 13565, 13821, 14093, 14365, 14637, 14925, 15213, 15502, 15806, 16110, 16414, 16734, 17054, 17390, 17726,
18062, 18414, 18766, 19134, 19502, 19886, 20270, 20670, 21070, 21486, 21902, 22334, 22766, 23214, 23662, 18062, 18414, 18766, 19134, 19502, 19886, 20270, 20670, 21070, 21486, 21902, 22334, 22766, 23214, 23662,
24126, 24590, 25070, 25551, 26047, 26559, 27071, 27599, 28143, 28687, 29247 24126, 24590, 25070, 25551, 26047, 26559, 27071, 27599, 28143, 28687, 29247
]; };
public static short DcQuant(int qindex, int delta, BitDepth bitDepth) public static short DcQuant(int qindex, int delta, BitDepth bitDepth)
{ {
switch (bitDepth) switch (bitDepth)
{ {
case BitDepth.Bits8: return _dcQlookup[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits8: return DcQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
case BitDepth.Bits10: return _dcQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits10: return DcQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
case BitDepth.Bits12: return _dcQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits12: return DcQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
default: default:
Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12"); Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12");
return -1; return -1;
@@ -130,9 +130,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
{ {
switch (bitDepth) switch (bitDepth)
{ {
case BitDepth.Bits8: return _acQlookup[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits8: return AcQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
case BitDepth.Bits10: return _acQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits10: return AcQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
case BitDepth.Bits12: return _acQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)]; case BitDepth.Bits12: return AcQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
default: default:
Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12"); Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12");
return -1; return -1;

View File

@@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
internal static class ReconIntra internal static class ReconIntra
{ {
public static readonly TxType[] IntraModeToTxTypeLookup = public static readonly TxType[] IntraModeToTxTypeLookup =
[ {
TxType.DctDct, // DC TxType.DctDct, // DC
TxType.AdstDct, // V TxType.AdstDct, // V
TxType.DctAdst, // H TxType.DctAdst, // H
@@ -19,14 +19,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
TxType.DctAdst, // D207 TxType.DctAdst, // D207
TxType.AdstDct, // D63 TxType.AdstDct, // D63
TxType.AdstAdst // TM TxType.AdstAdst // TM
]; };
private const int NeedLeft = 1 << 1; private const int NeedLeft = 1 << 1;
private const int NeedAbove = 1 << 2; private const int NeedAbove = 1 << 2;
private const int NeedAboveRight = 1 << 3; private const int NeedAboveRight = 1 << 3;
private static ReadOnlySpan<byte> ExtendModes => private static ReadOnlySpan<byte> ExtendModes => new byte[]
[ {
NeedAbove | NeedLeft, // DC NeedAbove | NeedLeft, // DC
NeedAbove, // V NeedAbove, // V
NeedLeft, // H NeedLeft, // H
@@ -37,103 +37,123 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
NeedLeft, // D207 NeedLeft, // D207
NeedAboveRight, // D63 NeedAboveRight, // D63
NeedLeft | NeedAbove // TM NeedLeft | NeedAbove // TM
]; };
private unsafe delegate void IntraPredFn(byte* dst, int stride, byte* above, byte* left); private unsafe delegate void IntraPredFn(byte* dst, int stride, byte* above, byte* left);
private static readonly unsafe IntraPredFn[][] _pred = private static readonly unsafe IntraPredFn[][] Pred =
[ {
[null, null, null, null], new IntraPredFn[] { null, null, null, null },
[VPredictor4X4, VPredictor8X8, VPredictor16X16, VPredictor32X32], new IntraPredFn[] { VPredictor4x4, VPredictor8x8, VPredictor16x16, VPredictor32x32 },
[HPredictor4X4, HPredictor8X8, HPredictor16X16, HPredictor32X32], new IntraPredFn[] { HPredictor4x4, HPredictor8x8, HPredictor16x16, HPredictor32x32 },
[D45Predictor4X4, D45Predictor8X8, D45Predictor16X16, D45Predictor32X32], new IntraPredFn[] { D45Predictor4x4, D45Predictor8x8, D45Predictor16x16, D45Predictor32x32 },
[D135Predictor4X4, D135Predictor8X8, D135Predictor16X16, D135Predictor32X32], new IntraPredFn[] { D135Predictor4x4, D135Predictor8x8, D135Predictor16x16, D135Predictor32x32 },
[D117Predictor4X4, D117Predictor8X8, D117Predictor16X16, D117Predictor32X32], new IntraPredFn[] { D117Predictor4x4, D117Predictor8x8, D117Predictor16x16, D117Predictor32x32 },
[D153Predictor4X4, D153Predictor8X8, D153Predictor16X16, D153Predictor32X32], new IntraPredFn[] { D153Predictor4x4, D153Predictor8x8, D153Predictor16x16, D153Predictor32x32 },
[D207Predictor4X4, D207Predictor8X8, D207Predictor16X16, D207Predictor32X32], new IntraPredFn[] { D207Predictor4x4, D207Predictor8x8, D207Predictor16x16, D207Predictor32x32 },
[D63Predictor4X4, D63Predictor8X8, D63Predictor16X16, D63Predictor32X32], new IntraPredFn[] { D63Predictor4x4, D63Predictor8x8, D63Predictor16x16, D63Predictor32x32 },
[TmPredictor4X4, TmPredictor8X8, TmPredictor16X16, TmPredictor32X32] new IntraPredFn[] { TmPredictor4x4, TmPredictor8x8, TmPredictor16x16, TmPredictor32x32 }
]; };
private static readonly unsafe IntraPredFn[][][] _dcPred = private static readonly unsafe IntraPredFn[][][] DcPred =
[ {
[ new[]
[ {
Dc128Predictor4X4, Dc128Predictor8X8, Dc128Predictor16X16, Dc128Predictor32X32 new IntraPredFn[]
], {
[ Dc128Predictor4x4, Dc128Predictor8x8, Dc128Predictor16x16, Dc128Predictor32x32
DcTopPredictor4X4, DcTopPredictor8X8, DcTopPredictor16X16, DcTopPredictor32X32 },
] new IntraPredFn[]
], {
[ DcTopPredictor4x4, DcTopPredictor8x8, DcTopPredictor16x16, DcTopPredictor32x32
[ }
DcLeftPredictor4X4, DcLeftPredictor8X8, DcLeftPredictor16X16, DcLeftPredictor32X32 },
], new[]
[DcPredictor4X4, DcPredictor8X8, DcPredictor16X16, DcPredictor32X32] {
] new IntraPredFn[]
]; {
DcLeftPredictor4x4, DcLeftPredictor8x8, DcLeftPredictor16x16, DcLeftPredictor32x32
},
new IntraPredFn[] { DcPredictor4x4, DcPredictor8x8, DcPredictor16x16, DcPredictor32x32 }
}
};
private unsafe delegate void IntraHighPredFn(ushort* dst, int stride, ushort* above, ushort* left, int bd); private unsafe delegate void IntraHighPredFn(ushort* dst, int stride, ushort* above, ushort* left, int bd);
private static readonly unsafe IntraHighPredFn[][] _predHigh = private static readonly unsafe IntraHighPredFn[][] PredHigh =
[ {
[null, null, null, null], new IntraHighPredFn[] { null, null, null, null },
[ new IntraHighPredFn[]
HighbdVPredictor4X4, HighbdVPredictor8X8, HighbdVPredictor16X16, HighbdVPredictor32X32 {
], HighbdVPredictor4x4, HighbdVPredictor8x8, HighbdVPredictor16x16, HighbdVPredictor32x32
[ },
HighbdHPredictor4X4, HighbdHPredictor8X8, HighbdHPredictor16X16, HighbdHPredictor32X32 new IntraHighPredFn[]
], {
[ HighbdHPredictor4x4, HighbdHPredictor8x8, HighbdHPredictor16x16, HighbdHPredictor32x32
HighbdD45Predictor4X4, HighbdD45Predictor8X8, HighbdD45Predictor16X16, HighbdD45Predictor32X32 },
], new IntraHighPredFn[]
[ {
HighbdD135Predictor4X4, HighbdD135Predictor8X8, HighbdD135Predictor16X16, HighbdD45Predictor4x4, HighbdD45Predictor8x8, HighbdD45Predictor16x16, HighbdD45Predictor32x32
HighbdD135Predictor32X32 },
], new IntraHighPredFn[]
[ {
HighbdD117Predictor4X4, HighbdD117Predictor8X8, HighbdD117Predictor16X16, HighbdD135Predictor4x4, HighbdD135Predictor8x8, HighbdD135Predictor16x16,
HighbdD117Predictor32X32 HighbdD135Predictor32x32
], },
[ new IntraHighPredFn[]
HighbdD153Predictor4X4, HighbdD153Predictor8X8, HighbdD153Predictor16X16, {
HighbdD153Predictor32X32 HighbdD117Predictor4x4, HighbdD117Predictor8x8, HighbdD117Predictor16x16,
], HighbdD117Predictor32x32
[ },
HighbdD207Predictor4X4, HighbdD207Predictor8X8, HighbdD207Predictor16X16, new IntraHighPredFn[]
HighbdD207Predictor32X32 {
], HighbdD153Predictor4x4, HighbdD153Predictor8x8, HighbdD153Predictor16x16,
[ HighbdD153Predictor32x32
HighbdD63Predictor4X4, HighbdD63Predictor8X8, HighbdD63Predictor16X16, HighbdD63Predictor32X32 },
], new IntraHighPredFn[]
[ {
HighbdTmPredictor4X4, HighbdTmPredictor8X8, HighbdTmPredictor16X16, HighbdTmPredictor32X32 HighbdD207Predictor4x4, HighbdD207Predictor8x8, HighbdD207Predictor16x16,
] HighbdD207Predictor32x32
]; },
new IntraHighPredFn[]
{
HighbdD63Predictor4x4, HighbdD63Predictor8x8, HighbdD63Predictor16x16, HighbdD63Predictor32x32
},
new IntraHighPredFn[]
{
HighbdTmPredictor4x4, HighbdTmPredictor8x8, HighbdTmPredictor16x16, HighbdTmPredictor32x32
}
};
private static readonly unsafe IntraHighPredFn[][][] _dcPredHigh = private static readonly unsafe IntraHighPredFn[][][] DcPredHigh =
[ {
[ new[]
[ {
HighbdDc128Predictor4X4, HighbdDc128Predictor8X8, HighbdDc128Predictor16X16, new IntraHighPredFn[]
HighbdDc128Predictor32X32 {
], HighbdDc128Predictor4x4, HighbdDc128Predictor8x8, HighbdDc128Predictor16x16,
[ HighbdDc128Predictor32x32
HighbdDcTopPredictor4X4, HighbdDcTopPredictor8X8, HighbdDcTopPredictor16X16, },
HighbdDcTopPredictor32X32 new IntraHighPredFn[]
] {
], HighbdDcTopPredictor4x4, HighbdDcTopPredictor8x8, HighbdDcTopPredictor16x16,
[ HighbdDcTopPredictor32x32
[ }
HighbdDcLeftPredictor4X4, HighbdDcLeftPredictor8X8, HighbdDcLeftPredictor16X16, },
HighbdDcLeftPredictor32X32 new[]
], {
[ new IntraHighPredFn[]
HighbdDcPredictor4X4, HighbdDcPredictor8X8, HighbdDcPredictor16X16, {
HighbdDcPredictor32X32 HighbdDcLeftPredictor4x4, HighbdDcLeftPredictor8x8, HighbdDcLeftPredictor16x16,
] HighbdDcLeftPredictor32x32
] },
]; new IntraHighPredFn[]
{
HighbdDcPredictor4x4, HighbdDcPredictor8x8, HighbdDcPredictor16x16,
HighbdDcPredictor32x32
}
}
};
private static unsafe void BuildIntraPredictorsHigh( private static unsafe void BuildIntraPredictorsHigh(
ref MacroBlockD xd, ref MacroBlockD xd,
@@ -351,11 +371,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Predict // Predict
if (mode == PredictionMode.DcPred) if (mode == PredictionMode.DcPred)
{ {
_dcPredHigh[leftAvailable][upAvailable][(int)txSize](dst, dstStride, constAboveRow, leftCol, xd.Bd); DcPredHigh[leftAvailable][upAvailable][(int)txSize](dst, dstStride, constAboveRow, leftCol, xd.Bd);
} }
else else
{ {
_predHigh[(int)mode][(int)txSize](dst, dstStride, constAboveRow, leftCol, xd.Bd); PredHigh[(int)mode][(int)txSize](dst, dstStride, constAboveRow, leftCol, xd.Bd);
} }
} }
@@ -568,11 +588,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Predict // Predict
if (mode == PredictionMode.DcPred) if (mode == PredictionMode.DcPred)
{ {
_dcPred[leftAvailable][upAvailable][(int)txSize](dst, dstStride, constAboveRow, leftCol); DcPred[leftAvailable][upAvailable][(int)txSize](dst, dstStride, constAboveRow, leftCol);
} }
else else
{ {
_pred[(int)mode][(int)txSize](dst, dstStride, constAboveRow, leftCol); Pred[(int)mode][(int)txSize](dst, dstStride, constAboveRow, leftCol);
} }
} }

View File

@@ -2,19 +2,19 @@
{ {
internal enum BlockSize internal enum BlockSize
{ {
Block4X4, Block4x4,
Block4X8, Block4x8,
Block8X4, Block8x4,
Block8X8, Block8x8,
Block8X16, Block8x16,
Block16X8, Block16x8,
Block16X16, Block16x16,
Block16X32, Block16x32,
Block32X16, Block32x16,
Block32X32, Block32x32,
Block32X64, Block32x64,
Block64X32, Block64x32,
Block64X64, Block64x64,
BlockSizes, BlockSizes,
BlockInvalid = BlockSizes BlockInvalid = BlockSizes
} }

View File

@@ -15,10 +15,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
{ {
public Array4<ulong> LeftY; public Array4<ulong> LeftY;
public Array4<ulong> AboveY; public Array4<ulong> AboveY;
public ulong Int4X4Y; public ulong Int4x4Y;
public Array4<ushort> LeftUv; public Array4<ushort> LeftUv;
public Array4<ushort> AboveUv; public Array4<ushort> AboveUv;
public ushort Int4X4Uv; public ushort Int4x4Uv;
public Array64<byte> LflY; public Array64<byte> LflY;
} }
} }

View File

@@ -29,12 +29,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public PredictionMode GetYMode(int block) public PredictionMode GetYMode(int block)
{ {
return SbType < BlockSize.Block8X8 ? Bmi[block].Mode : Mode; return SbType < BlockSize.Block8x8 ? Bmi[block].Mode : Mode;
} }
public TxSize GetUvTxSize(ref MacroBlockDPlane pd) public TxSize GetUvTxSize(ref MacroBlockDPlane pd)
{ {
Debug.Assert(SbType < BlockSize.Block8X8 || Debug.Assert(SbType < BlockSize.Block8x8 ||
Luts.SsSizeLookup[(int)SbType][pd.SubsamplingX][pd.SubsamplingY] != BlockSize.BlockInvalid); Luts.SsSizeLookup[(int)SbType][pd.SubsamplingX][pd.SubsamplingY] != BlockSize.BlockInvalid);
return Luts.UvTxsizeLookup[(int)SbType][(int)TxSize][pd.SubsamplingX][pd.SubsamplingY]; return Luts.UvTxsizeLookup[(int)SbType][(int)TxSize][pd.SubsamplingX][pd.SubsamplingY];
} }
@@ -49,17 +49,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
return RefFrame[1] > Constants.IntraFrame; return RefFrame[1] > Constants.IntraFrame;
} }
private static readonly int[][] _idxNColumnToSubblock = private static readonly int[][] IdxNColumnToSubblock =
[ {
[1, 2], [1, 3], [3, 2], [3, 3] new[] { 1, 2 }, new[] { 1, 3 }, new[] { 3, 2 }, new[] { 3, 3 }
]; };
// This function returns either the appropriate sub block or block's mv // This function returns either the appropriate sub block or block's mv
// on whether the block_size < 8x8 and we have check_sub_blocks set. // on whether the block_size < 8x8 and we have check_sub_blocks set.
public Mv GetSubBlockMv(int whichMv, int searchCol, int blockIdx) public Mv GetSubBlockMv(int whichMv, int searchCol, int blockIdx)
{ {
return blockIdx >= 0 && SbType < BlockSize.Block8X8 return blockIdx >= 0 && SbType < BlockSize.Block8x8
? Bmi[_idxNColumnToSubblock[blockIdx][searchCol == 0 ? 1 : 0]].Mv[whichMv] ? Bmi[IdxNColumnToSubblock[blockIdx][searchCol == 0 ? 1 : 0]].Mv[whichMv]
: Mv[whichMv]; : Mv[whichMv];
} }

View File

@@ -10,8 +10,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public short Row; public short Row;
public short Col; public short Col;
private static ReadOnlySpan<byte> LogInBase2 => private static ReadOnlySpan<byte> LogInBase2 => new byte[]
[ {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
@@ -42,12 +42,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 10 9, 9, 9, 9, 9, 9, 9, 9, 9, 10
]; };
public bool UseHp() public bool UseHp()
{ {
const int KMvRefThresh = 64; // Threshold for use of high-precision 1/8 mv const int kMvRefThresh = 64; // Threshold for use of high-precision 1/8 mv
return Math.Abs(Row) < KMvRefThresh && Math.Abs(Col) < KMvRefThresh; return Math.Abs(Row) < kMvRefThresh && Math.Abs(Col) < kMvRefThresh;
} }
public static bool JointVertical(MvJointType type) public static bool JointVertical(MvJointType type)

View File

@@ -38,85 +38,96 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
int h, int h,
int bd); int bd);
private static readonly unsafe ConvolveFn[][][] _predictX16Y16 = private static readonly unsafe ConvolveFn[][][] PredictX16Y16 =
[ {
[ new[]
[ConvolveCopy, ConvolveAvg], {
[Convolve8Vert, Convolve8AvgVert] new ConvolveFn[] { ConvolveCopy, ConvolveAvg },
], new ConvolveFn[] { Convolve8Vert, Convolve8AvgVert }
[ },
[Convolve8Horiz, Convolve8AvgHoriz], new[]
[Convolve8, Convolve8Avg] {
] new ConvolveFn[] { Convolve8Horiz, Convolve8AvgHoriz },
]; new ConvolveFn[] { Convolve8, Convolve8Avg }
}
};
private static readonly unsafe ConvolveFn[][][] _predictX16 = private static readonly unsafe ConvolveFn[][][] PredictX16 =
[ {
[ new[]
[ScaledVert, ScaledAvgVert], [ScaledVert, ScaledAvgVert] {
], new ConvolveFn[] { ScaledVert, ScaledAvgVert }, new ConvolveFn[] { ScaledVert, ScaledAvgVert }
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]] },
]; new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
};
private static readonly unsafe ConvolveFn[][][] _predictY16 = private static readonly unsafe ConvolveFn[][][] PredictY16 =
[ {
[[ScaledHoriz, ScaledAvgHoriz], [Scaled2D, ScaledAvg2D]], new[] { new ConvolveFn[] { ScaledHoriz, ScaledAvgHoriz }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } },
[[ScaledHoriz, ScaledAvgHoriz], [Scaled2D, ScaledAvg2D]] new[] { new ConvolveFn[] { ScaledHoriz, ScaledAvgHoriz }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
]; };
private static readonly unsafe ConvolveFn[][][] _predict = private static readonly unsafe ConvolveFn[][][] Predict =
[ {
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]], new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } },
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]] new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
]; };
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictX16Y16 = private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictX16Y16 =
[ {
[ new[]
[HighbdConvolveCopy, HighbdConvolveAvg], {
[HighbdConvolve8Vert, HighbdConvolve8AvgVert] new HighbdConvolveFn[] { HighbdConvolveCopy, HighbdConvolveAvg },
], new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert }
[ },
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz], new[]
[HighbdConvolve8, HighbdConvolve8Avg] {
] new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
]; new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictX16 = private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictX16 =
[ {
[ new[]
[HighbdConvolve8Vert, HighbdConvolve8AvgVert], {
[HighbdConvolve8Vert, HighbdConvolve8AvgVert] new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert },
], new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert }
[ },
[HighbdConvolve8, HighbdConvolve8Avg], new[]
[HighbdConvolve8, HighbdConvolve8Avg] {
] new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
]; new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictY16 = private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictY16 =
[ {
[ new[]
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz], {
[HighbdConvolve8, HighbdConvolve8Avg] new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
], new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
[ },
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz], new[]
[HighbdConvolve8, HighbdConvolve8Avg] {
] new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
]; new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredict = private static readonly unsafe HighbdConvolveFn[][][] HighbdPredict =
[ {
[ new[]
[HighbdConvolve8, HighbdConvolve8Avg], {
[HighbdConvolve8, HighbdConvolve8Avg] new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
], new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
[ },
[HighbdConvolve8, HighbdConvolve8Avg], new[]
[HighbdConvolve8, HighbdConvolve8Avg] {
] new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
]; new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
public int XScaleFp; // Horizontal fixed point scale factor public int XScaleFp; // Horizontal fixed point scale factor
public int YScaleFp; // Vertical fixed point scale factor public int YScaleFp; // Vertical fixed point scale factor
@@ -155,13 +166,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16) if (YStepQ4 == 16)
{ {
// No scaling in either direction. // No scaling in either direction.
_predictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, PredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h); h);
} }
else else
{ {
// No scaling in x direction. Must always scale in the y direction. // No scaling in x direction. Must always scale in the y direction.
_predictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, PredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h); h);
} }
} }
@@ -170,13 +181,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16) if (YStepQ4 == 16)
{ {
// No scaling in the y direction. Must always scale in the x direction. // No scaling in the y direction. Must always scale in the x direction.
_predictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, PredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h); h);
} }
else else
{ {
// Must always scale in both directions. // Must always scale in both directions.
_predict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, h); Predict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, h);
} }
} }
} }
@@ -204,13 +215,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16) if (YStepQ4 == 16)
{ {
// No scaling in either direction. // No scaling in either direction.
_highbdPredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, HighbdPredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY,
ys, w, h, bd); ys, w, h, bd);
} }
else else
{ {
// No scaling in x direction. Must always scale in the y direction. // No scaling in x direction. Must always scale in the y direction.
_highbdPredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, HighbdPredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
w, h, bd); w, h, bd);
} }
} }
@@ -219,13 +230,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16) if (YStepQ4 == 16)
{ {
// No scaling in the y direction. Must always scale in the x direction. // No scaling in the y direction. Must always scale in the x direction.
_highbdPredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, HighbdPredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
w, h, bd); w, h, bd);
} }
else else
{ {
// Must always scale in both directions. // Must always scale in both directions.
_highbdPredict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, HighbdPredict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h, bd); h, bd);
} }
} }

View File

@@ -16,8 +16,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public const int PredictionProbs = 3; public const int PredictionProbs = 3;
private static readonly int[] _segFeatureDataSigned = [1, 1, 0, 0]; private static readonly int[] SegFeatureDataSigned = { 1, 1, 0, 0 };
private static readonly int[] _segFeatureDataMax = [QuantCommon.MaxQ, Vp9.LoopFilter.MaxLoopFilter, 3, 0]; private static readonly int[] SegFeatureDataMax = { QuantCommon.MaxQ, Vp9.LoopFilter.MaxLoopFilter, 3, 0 };
public bool Enabled; public bool Enabled;
public bool UpdateMap; public bool UpdateMap;
@@ -48,21 +48,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
internal static int FeatureDataMax(SegLvlFeatures featureId) internal static int FeatureDataMax(SegLvlFeatures featureId)
{ {
return _segFeatureDataMax[(int)featureId]; return SegFeatureDataMax[(int)featureId];
} }
internal static int IsSegFeatureSigned(SegLvlFeatures featureId) internal static int IsSegFeatureSigned(SegLvlFeatures featureId)
{ {
return _segFeatureDataSigned[(int)featureId]; return SegFeatureDataSigned[(int)featureId];
} }
internal void SetSegData(int segmentId, SegLvlFeatures featureId, int segData) internal void SetSegData(int segmentId, SegLvlFeatures featureId, int segData)
{ {
Debug.Assert(segData <= _segFeatureDataMax[(int)featureId]); Debug.Assert(segData <= SegFeatureDataMax[(int)featureId]);
if (segData < 0) if (segData < 0)
{ {
Debug.Assert(_segFeatureDataSigned[(int)featureId] != 0); Debug.Assert(SegFeatureDataSigned[(int)featureId] != 0);
Debug.Assert(-segData <= _segFeatureDataMax[(int)featureId]); Debug.Assert(-segData <= SegFeatureDataMax[(int)featureId]);
} }
FeatureData[segmentId][(int)featureId] = (short)segData; FeatureData[segmentId][(int)featureId] = (short)segData;

View File

@@ -1,6 +1,7 @@
using Ryujinx.Common.Memory; using Ryujinx.Common.Memory;
using Ryujinx.Graphics.Nvdec.Vp9.Common; using Ryujinx.Graphics.Nvdec.Vp9.Common;
using Ryujinx.Graphics.Video; using Ryujinx.Graphics.Video;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -65,23 +66,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public Surface(int width, int height) public Surface(int width, int height)
{ {
const int Border = 32; const int border = 32;
const int SsX = 1; const int ssX = 1;
const int SsY = 1; const int ssY = 1;
const bool Highbd = false; const bool highbd = false;
int alignedWidth = (width + 7) & ~7; int alignedWidth = (width + 7) & ~7;
int alignedHeight = (height + 7) & ~7; int alignedHeight = (height + 7) & ~7;
int yStride = (alignedWidth + (2 * Border) + 31) & ~31; int yStride = (alignedWidth + (2 * border) + 31) & ~31;
int yplaneSize = (alignedHeight + (2 * Border)) * yStride; int yplaneSize = (alignedHeight + (2 * border)) * yStride;
int uvWidth = alignedWidth >> SsX; int uvWidth = alignedWidth >> ssX;
int uvHeight = alignedHeight >> SsY; int uvHeight = alignedHeight >> ssY;
int uvStride = yStride >> SsX; int uvStride = yStride >> ssX;
int uvBorderW = Border >> SsX; int uvBorderW = border >> ssX;
int uvBorderH = Border >> SsY; int uvBorderH = border >> ssY;
int uvplaneSize = (uvHeight + (2 * uvBorderH)) * uvStride; int uvplaneSize = (uvHeight + (2 * uvBorderH)) * uvStride;
int frameSize = (Highbd ? 2 : 1) * (yplaneSize + (2 * uvplaneSize)); int frameSize = (highbd ? 2 : 1) * (yplaneSize + (2 * uvplaneSize));
nint pointer = Marshal.AllocHGlobal(frameSize); nint pointer = Marshal.AllocHGlobal(frameSize);
_pointer = pointer; _pointer = pointer;
@@ -90,8 +91,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
AlignedWidth = alignedWidth; AlignedWidth = alignedWidth;
AlignedHeight = alignedHeight; AlignedHeight = alignedHeight;
Stride = yStride; Stride = yStride;
UvWidth = (width + SsX) >> SsX; UvWidth = (width + ssX) >> ssX;
UvHeight = (height + SsY) >> SsY; UvHeight = (height + ssY) >> ssY;
UvAlignedWidth = uvWidth; UvAlignedWidth = uvWidth;
UvAlignedHeight = uvHeight; UvAlignedHeight = uvHeight;
UvStride = uvStride; UvStride = uvStride;
@@ -101,7 +102,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
return new ArrayPtr<byte>(pointer + start + border, size - border); return new ArrayPtr<byte>(pointer + start + border, size - border);
} }
YBuffer = NewPlane(0, yplaneSize, (Border * yStride) + Border); YBuffer = NewPlane(0, yplaneSize, (border * yStride) + border);
UBuffer = NewPlane(yplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW); UBuffer = NewPlane(yplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW);
VBuffer = NewPlane(yplaneSize + uvplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW); VBuffer = NewPlane(yplaneSize + uvplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW);
} }
@@ -146,8 +147,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (cb != null) if (cb != null)
{ {
const int AlignAddrExtraSize = 31; const int alignAddrExtraSize = 31;
ulong externalFrameSize = frameSize + AlignAddrExtraSize; ulong externalFrameSize = frameSize + alignAddrExtraSize;
Debug.Assert(!fb.IsNull); Debug.Assert(!fb.IsNull);

View File

@@ -2,10 +2,10 @@
{ {
public enum TxMode public enum TxMode
{ {
Only4X4, // Only 4x4 transform used Only4x4, // Only 4x4 transform used
Allow8X8, // Allow block transform size up to 8x8 Allow8x8, // Allow block transform size up to 8x8
Allow16X16, // Allow block transform size up to 16x16 Allow16x16, // Allow block transform size up to 16x16
Allow32X32, // Allow block transform size up to 32x32 Allow32x32, // Allow block transform size up to 32x32
TxModeSelect, // Transform specified for each block TxModeSelect, // Transform specified for each block
TxModes TxModes
} }

View File

@@ -2,10 +2,10 @@
{ {
public enum TxSize public enum TxSize
{ {
Tx4X4, // 4x4 transform Tx4x4, // 4x4 transform
Tx8X8, // 8x8 transform Tx8x8, // 8x8 transform
Tx16X16, // 16x16 transform Tx16x16, // 16x16 transform
Tx32X32, // 32x32 transform Tx32x32, // 32x32 transform
TxSizes TxSizes
} }
} }

View File

@@ -845,30 +845,30 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (TxMode == TxMode.TxModeSelect) if (TxMode == TxMode.TxModeSelect)
{ {
Array1<Array2<uint>> branchCt8X8P = new(); Array1<Array2<uint>> branchCt8x8P = new();
Array2<Array2<uint>> branchCt16X16P = new(); Array2<Array2<uint>> branchCt16x16P = new();
Array3<Array2<uint>> branchCt32X32P = new(); Array3<Array2<uint>> branchCt32x32P = new();
for (int i = 0; i < EntropyMode.TxSizeContexts; ++i) for (int i = 0; i < EntropyMode.TxSizeContexts; ++i)
{ {
EntropyMode.TxCountsToBranchCounts8X8(counts.Tx8x8[i].AsSpan(), ref branchCt8X8P); EntropyMode.TxCountsToBranchCounts8x8(counts.Tx8x8[i].AsSpan(), ref branchCt8x8P);
for (int j = 0; j < (int)TxSize.TxSizes - 3; ++j) for (int j = 0; j < (int)TxSize.TxSizes - 3; ++j)
{ {
fc.Tx8x8Prob[i][j] = Prob.ModeMvMergeProbs(preFc.Tx8x8Prob[i][j], ref branchCt8X8P[j]); fc.Tx8x8Prob[i][j] = Prob.ModeMvMergeProbs(preFc.Tx8x8Prob[i][j], ref branchCt8x8P[j]);
} }
EntropyMode.TxCountsToBranchCounts16X16(counts.Tx16x16[i].AsSpan(), ref branchCt16X16P); EntropyMode.TxCountsToBranchCounts16x16(counts.Tx16x16[i].AsSpan(), ref branchCt16x16P);
for (int j = 0; j < (int)TxSize.TxSizes - 2; ++j) for (int j = 0; j < (int)TxSize.TxSizes - 2; ++j)
{ {
fc.Tx16x16Prob[i][j] = fc.Tx16x16Prob[i][j] =
Prob.ModeMvMergeProbs(preFc.Tx16x16Prob[i][j], ref branchCt16X16P[j]); Prob.ModeMvMergeProbs(preFc.Tx16x16Prob[i][j], ref branchCt16x16P[j]);
} }
EntropyMode.TxCountsToBranchCounts32X32(counts.Tx32x32[i].AsSpan(), ref branchCt32X32P); EntropyMode.TxCountsToBranchCounts32x32(counts.Tx32x32[i].AsSpan(), ref branchCt32x32P);
for (int j = 0; j < (int)TxSize.TxSizes - 1; ++j) for (int j = 0; j < (int)TxSize.TxSizes - 1; ++j)
{ {
fc.Tx32x32Prob[i][j] = fc.Tx32x32Prob[i][j] =
Prob.ModeMvMergeProbs(preFc.Tx32x32Prob[i][j], ref branchCt32X32P[j]); Prob.ModeMvMergeProbs(preFc.Tx32x32Prob[i][j], ref branchCt32x32P[j]);
} }
} }
} }
@@ -900,7 +900,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
countSat = Entropy.CoefCountSat; countSat = Entropy.CoefCountSat;
} }
for (t = (int)TxSize.Tx4X4; t <= (int)TxSize.Tx32X32; t++) for (t = (int)TxSize.Tx4x4; t <= (int)TxSize.Tx32x32; t++)
{ {
AdaptCoefProbs(t, countSat, updateFactor); AdaptCoefProbs(t, countSat, updateFactor);
} }
@@ -990,10 +990,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public void DefaultCoefProbs() public void DefaultCoefProbs()
{ {
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx4X4], Entropy.DefaultCoefProbs4X4); Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx4x4], Entropy.DefaultCoefProbs4x4);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx8X8], Entropy.DefaultCoefProbs8X8); Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx8x8], Entropy.DefaultCoefProbs8x8);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx16X16], Entropy.DefaultCoefProbs16X16); Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx16x16], Entropy.DefaultCoefProbs16x16);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx32X32], Entropy.DefaultCoefProbs32X32); Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx32x32], Entropy.DefaultCoefProbs32x32);
} }
} }
} }

View File

@@ -62,38 +62,38 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
} }
} }
byte[][] kfPartitionProbs = byte[][] KfPartitionProbs =
[ {
// 8x8 . 4x4 // 8x8 . 4x4
[158, 97, 94], // a/l both not split new byte[] { 158, 97, 94 }, // a/l both not split
[93, 24, 99], // a split, l not split new byte[] { 93, 24, 99 }, // a split, l not split
[85, 119, 44], // l split, a not split new byte[] { 85, 119, 44 }, // l split, a not split
[62, 59, 67], // a/l both split new byte[] { 62, 59, 67 }, // a/l both split
// 16x16 . 8x8 // 16x16 . 8x8
[149, 53, 53], // a/l both not split new byte[] { 149, 53, 53 }, // a/l both not split
[94, 20, 48], // a split, l not split new byte[] { 94, 20, 48 }, // a split, l not split
[83, 53, 24], // l split, a not split new byte[] { 83, 53, 24 }, // l split, a not split
[52, 18, 18], // a/l both split new byte[] { 52, 18, 18 }, // a/l both split
// 32x32 . 16x16 // 32x32 . 16x16
[150, 40, 39], // a/l both not split new byte[] { 150, 40, 39 }, // a/l both not split
[78, 12, 26], // a split, l not split new byte[] { 78, 12, 26 }, // a split, l not split
[67, 33, 11], // l split, a not split new byte[] { 67, 33, 11 }, // l split, a not split
[24, 7, 5], // a/l both split new byte[] { 24, 7, 5 }, // a/l both split
// 64x64 . 32x32 // 64x64 . 32x32
[174, 35, 49], // a/l both not split new byte[] { 174, 35, 49 }, // a/l both not split
[68, 11, 27], // a split, l not split new byte[] { 68, 11, 27 }, // a split, l not split
[57, 15, 9], // l split, a not split new byte[] { 57, 15, 9 }, // l split, a not split
[12, 3, 3] // a/l both split new byte[] { 12, 3, 3 } // a/l both split
]; };
for (int i = 0; i < kfPartitionProbs.Length; i++) for (int i = 0; i < KfPartitionProbs.Length; i++)
{ {
for (int j = 0; j < kfPartitionProbs[i].Length; j++) for (int j = 0; j < KfPartitionProbs[i].Length; j++)
{ {
cm.Fc.Value.KfPartitionProb[i][j] = kfPartitionProbs[i][j]; cm.Fc.Value.KfPartitionProb[i][j] = KfPartitionProbs[i][j];
} }
} }
@@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
Array8<uint> frameSizes = new(); Array8<uint> frameSizes = new();
int frameCount = 0; int frameCount = 0;
res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount); res = Types.Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
if (res != CodecErr.Ok) if (res != CodecErr.Ok)
{ {
return res; return res;
@@ -322,7 +322,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
// Account for suboptimal termination by the encoder. // Account for suboptimal termination by the encoder.
while (dataStart.Length != 0) while (dataStart.Length != 0)
{ {
byte marker = Decoder.ReadMarker(dataStart); byte marker = Types.Decoder.ReadMarker(dataStart);
if (marker != 0) if (marker != 0)
{ {
break; break;

View File

@@ -1,4 +1,5 @@
using Silk.NET.Vulkan; using Silk.NET.Vulkan;
using System.Text.RegularExpressions;
namespace Ryujinx.Graphics.Vulkan namespace Ryujinx.Graphics.Vulkan
{ {

View File

@@ -41,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
{ {
List<BrowserOutput> result = List<BrowserOutput> result =
[ [
new(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton) new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton)
]; ];
_normalSession.Push(BuildResponseNew(result)); _normalSession.Push(BuildResponseNew(result));

View File

@@ -15,6 +15,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace Ryujinx.HLE.HOS.Applets.Error namespace Ryujinx.HLE.HOS.Applets.Error
{ {
@@ -158,15 +159,13 @@ namespace Ryujinx.HLE.HOS.Applets.Error
string[] buttons = GetButtonsText(module, description, "DlgBtn"); string[] buttons = GetButtonsText(module, description, "DlgBtn");
(uint Module, uint Description) errorCodeTuple = (module, uint.Parse(description.ToString("0000"))); bool showDetails = _horizon.Device.UIHandler.DisplayErrorAppletDialog($"Error Code: {module}-{description:0000}", "\n" + message, buttons);
bool showDetails = _horizon.Device.UIHandler.DisplayErrorAppletDialog($"Error Code: {module}-{description:0000}", "\n" + message, buttons, errorCodeTuple);
if (showDetails) if (showDetails)
{ {
message = GetMessageText(module, description, "FlvMsg"); message = GetMessageText(module, description, "FlvMsg");
buttons = GetButtonsText(module, description, "FlvBtn"); buttons = GetButtonsText(module, description, "FlvBtn");
_horizon.Device.UIHandler.DisplayErrorAppletDialog($"Details: {module}-{description:0000}", "\n" + message, buttons, errorCodeTuple); _horizon.Device.UIHandler.DisplayErrorAppletDialog($"Details: {module}-{description:0000}", "\n" + message, buttons);
} }
} }

View File

@@ -23,6 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
{ {
class IUserLocalCommunicationService : IpcService, IDisposable class IUserLocalCommunicationService : IpcService, IDisposable
{ {
public static string DefaultLanPlayHost = "ryuldn.vudjun.com";
public static short LanPlayPort = 30456;
public INetworkClient NetworkClient { get; private set; } public INetworkClient NetworkClient { get; private set; }
private const int NifmRequestID = 90; private const int NifmRequestID = 90;
@@ -1089,18 +1092,20 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
case MultiplayerMode.LdnRyu: case MultiplayerMode.LdnRyu:
try try
{ {
string ldnServer = context.Device.Configuration.MultiplayerLdnServer string ldnServer = context.Device.Configuration.MultiplayerLdnServer;
?? throw new InvalidOperationException("Cannot initialize RyuLDN with a null Multiplayer server."); if (string.IsNullOrEmpty(ldnServer))
{
ldnServer = DefaultLanPlayHost;
}
if (!IPAddress.TryParse(ldnServer, out IPAddress ipAddress)) if (!IPAddress.TryParse(ldnServer, out IPAddress ipAddress))
{ {
ipAddress = Dns.GetHostEntry(ldnServer).AddressList[0]; ipAddress = Dns.GetHostEntry(ldnServer).AddressList[0];
} }
NetworkClient = new LdnMasterProxyClient(ipAddress.ToString(), SharedConstants.LanPlayPort, context.Device.Configuration); NetworkClient = new LdnMasterProxyClient(ipAddress.ToString(), LanPlayPort, context.Device.Configuration);
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error?.Print(LogClass.ServiceLdn, "Could not locate RyuLDN server. Defaulting to stubbed wireless."); Logger.Error?.Print(LogClass.ServiceLdn, "Could not locate LdnRyu server. Defaulting to stubbed wireless.");
Logger.Error?.Print(LogClass.ServiceLdn, ex.Message); Logger.Error?.Print(LogClass.ServiceLdn, ex.Message);
NetworkClient = new LdnDisabledClient(); NetworkClient = new LdnDisabledClient();
} }

View File

@@ -113,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
public async Task<ushort> NatPunch() public async Task<ushort> NatPunch()
{ {
NatDiscoverer discoverer = new(); NatDiscoverer discoverer = new();
CancellationTokenSource cts = new(2500); CancellationTokenSource cts = new(5000);
NatDevice device; NatDevice device;

View File

@@ -34,10 +34,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{ {
if (errorCode != LinuxError.SUCCESS) if (errorCode != LinuxError.SUCCESS)
{ {
if (errorCode != LinuxError.EWOULDBLOCK)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Operation failed with error {errorCode}.");
}
result = -1; result = -1;
} }
@@ -70,8 +66,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
BsdSocketType type = (BsdSocketType)context.RequestData.ReadInt32(); BsdSocketType type = (BsdSocketType)context.RequestData.ReadInt32();
ProtocolType protocol = (ProtocolType)context.RequestData.ReadInt32(); ProtocolType protocol = (ProtocolType)context.RequestData.ReadInt32();
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Creating socket with domain={domain}, type={type}, protocol={protocol}");
BsdSocketCreationFlags creationFlags = (BsdSocketCreationFlags)((int)type >> (int)BsdSocketCreationFlags.FlagsShift); BsdSocketCreationFlags creationFlags = (BsdSocketCreationFlags)((int)type >> (int)BsdSocketCreationFlags.FlagsShift);
type &= BsdSocketType.TypeMask; type &= BsdSocketType.TypeMask;
@@ -101,21 +95,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
} }
} }
LinuxError errno = LinuxError.SUCCESS; ISocket newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
ISocket newBsdSocket; {
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
};
try LinuxError errno = LinuxError.SUCCESS;
{
newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
{
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
};
}
catch (SocketException exception)
{
LinuxError errNo = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
return WriteBsdResult(context, 0, errNo);
}
int newSockFd = _context.RegisterFileDescriptor(newBsdSocket); int newSockFd = _context.RegisterFileDescriptor(newBsdSocket);
@@ -126,7 +111,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
if (exempt) if (exempt)
{ {
Logger.Info?.Print(LogClass.ServiceBsd, "Disconnecting exempt socket.");
newBsdSocket.Disconnect(); newBsdSocket.Disconnect();
} }
@@ -813,10 +797,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{ {
errno = socket.Listen(backlog); errno = socket.Listen(backlog);
} }
else
{
Logger.Warning?.PrintMsg(LogClass.ServiceBsd, $"Invalid socket fd '{socketFd}'.");
}
return WriteBsdResult(context, 0, errno); return WriteBsdResult(context, 0, errno);
} }

View File

@@ -92,30 +92,18 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{ {
newSocket = new ManagedSocket(Socket.Accept()); newSocket = new ManagedSocket(Socket.Accept());
IPEndPoint remoteEndPoint = newSocket.RemoteEndPoint;
bool isPrivateIp = remoteEndPoint.Address.ToString().StartsWith("192.168.");
Logger.Info?.PrintMsg(LogClass.ServiceBsd,
isPrivateIp
? $"Accepted connection from {ProtocolType}/{remoteEndPoint.Address}:{remoteEndPoint.Port}"
: $"Accepted connection from {ProtocolType}/***:{remoteEndPoint.Port}");
return LinuxError.SUCCESS; return LinuxError.SUCCESS;
} }
catch (SocketException exception) catch (SocketException exception)
{ {
newSocket = null; newSocket = null;
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
public LinuxError Bind(IPEndPoint localEndPoint) public LinuxError Bind(IPEndPoint localEndPoint)
{ {
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Socket binding to: {ProtocolType}/{localEndPoint.Port}");
try try
{ {
Socket.Bind(localEndPoint); Socket.Bind(localEndPoint);
@@ -124,10 +112,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -139,15 +123,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Connect(IPEndPoint remoteEndPoint) public LinuxError Connect(IPEndPoint remoteEndPoint)
{ {
bool isLDNPrivateIP = remoteEndPoint.Address.ToString().StartsWith("192.168.");
if (isLDNPrivateIP)
{
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Connecting to: {ProtocolType}/{remoteEndPoint.Address}:{remoteEndPoint.Port}");
}
else
{
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Connecting to: {ProtocolType}/***:{remoteEndPoint.Port}");
}
try try
{ {
Socket.Connect(remoteEndPoint); Socket.Connect(remoteEndPoint);
@@ -162,10 +137,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
else else
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -173,13 +144,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public void Disconnect() public void Disconnect()
{ {
Logger.Info?.Print(LogClass.ServiceBsd, "Socket disconnecting");
Socket.Disconnect(true); Socket.Disconnect(true);
} }
public void Dispose() public void Dispose()
{ {
Logger.Info?.Print(LogClass.ServiceBsd, "Socket closed");
Socket.Close(); Socket.Close();
Socket.Dispose(); Socket.Dispose();
} }
@@ -190,16 +159,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{ {
Socket.Listen(backlog); Socket.Listen(backlog);
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Socket listening: {ProtocolType}/{(Socket.LocalEndPoint as IPEndPoint).Port}");
return LinuxError.SUCCESS; return LinuxError.SUCCESS;
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -219,15 +182,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
private bool _hasEmittedBlockingWarning; bool hasEmittedBlockingWarning = false;
public LinuxError Receive(out int receiveSize, Span<byte> buffer, BsdSocketFlags flags) public LinuxError Receive(out int receiveSize, Span<byte> buffer, BsdSocketFlags flags)
{ {
@@ -243,10 +202,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
shouldBlockAfterOperation = true; shouldBlockAfterOperation = true;
} }
if (Blocking && !_hasEmittedBlockingWarning) if (Blocking && !hasEmittedBlockingWarning)
{ {
Logger.Warning?.PrintMsg(LogClass.ServiceBsd, "Blocking socket operations are not yet working properly. Expect network errors."); Logger.Warning?.PrintMsg(LogClass.ServiceBsd, "Blocking socket operations are not yet working properly. Expect network errors.");
_hasEmittedBlockingWarning = true; hasEmittedBlockingWarning = true;
} }
receiveSize = Socket.Receive(buffer, ConvertBsdSocketFlags(flags)); receiveSize = Socket.Receive(buffer, ConvertBsdSocketFlags(flags));
@@ -255,10 +214,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
receiveSize = -1; receiveSize = -1;
result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode); result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
@@ -290,10 +245,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
shouldBlockAfterOperation = true; shouldBlockAfterOperation = true;
} }
if (Blocking && !_hasEmittedBlockingWarning) if (Blocking && !hasEmittedBlockingWarning)
{ {
Logger.Warning?.PrintMsg(LogClass.ServiceBsd, "Blocking socket operations are not yet working properly. Expect network errors."); Logger.Warning?.PrintMsg(LogClass.ServiceBsd, "Blocking socket operations are not yet working properly. Expect network errors.");
_hasEmittedBlockingWarning = true; hasEmittedBlockingWarning = true;
} }
if (!Socket.IsBound) if (!Socket.IsBound)
@@ -310,10 +265,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
receiveSize = -1; receiveSize = -1;
result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode); result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
@@ -337,10 +288,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
sendSize = -1; sendSize = -1;
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
@@ -357,10 +304,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
sendSize = -1; sendSize = -1;
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
@@ -398,10 +341,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -448,10 +387,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -584,10 +519,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }
@@ -626,10 +557,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
} }
catch (SocketException exception) catch (SocketException exception)
{ {
if (exception.SocketErrorCode != SocketError.WouldBlock)
{
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
}
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode); return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
} }
} }

View File

@@ -150,7 +150,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{ BsdSocketOption.SoLinger, SocketOptionName.Linger }, { BsdSocketOption.SoLinger, SocketOptionName.Linger },
{ BsdSocketOption.SoOobInline, SocketOptionName.OutOfBandInline }, { BsdSocketOption.SoOobInline, SocketOptionName.OutOfBandInline },
{ BsdSocketOption.SoReusePort, SocketOptionName.ReuseAddress }, { BsdSocketOption.SoReusePort, SocketOptionName.ReuseAddress },
{ BsdSocketOption.SoNoSigpipe, SocketOptionName.DontLinger },
{ BsdSocketOption.SoSndBuf, SocketOptionName.SendBuffer }, { BsdSocketOption.SoSndBuf, SocketOptionName.SendBuffer },
{ BsdSocketOption.SoRcvBuf, SocketOptionName.ReceiveBuffer }, { BsdSocketOption.SoRcvBuf, SocketOptionName.ReceiveBuffer },
{ BsdSocketOption.SoSndLoWat, SocketOptionName.SendLowWater }, { BsdSocketOption.SoSndLoWat, SocketOptionName.SendLowWater },

View File

@@ -1,6 +1,4 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy; using Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy;
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -66,18 +64,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
{ {
if (_proxy.Supported(domain, type, protocol)) if (_proxy.Supported(domain, type, protocol))
{ {
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Socket is using LDN proxy");
return new LdnProxySocket(domain, type, protocol, _proxy); return new LdnProxySocket(domain, type, protocol, _proxy);
} }
else
{
Logger.Warning?.PrintMsg(LogClass.ServiceBsd, $"LDN proxy does not support socket {domain}, {type}, {protocol}");
}
}
else
{
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Opening socket using host networking stack");
} }
return new DefaultSocket(domain, type, protocol, lanInterfaceId); return new DefaultSocket(domain, type, protocol, lanInterfaceId);
} }
} }

View File

@@ -45,12 +45,10 @@ namespace Ryujinx.HLE.UI
/// <param name="value">The value associated to the <paramref name="kind"/>.</param> /// <param name="value">The value associated to the <paramref name="kind"/>.</param>
void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value); void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value);
/// <summary>
/// Displays a Message Dialog box specific to Error Applet and blocks until it is closed. /// Displays a Message Dialog box specific to Error Applet and blocks until it is closed.
/// </summary> /// </summary>
/// <returns>False when OK is pressed, True when another button (Details) is pressed.</returns> /// <returns>False when OK is pressed, True when another button (Details) is pressed.</returns>
// ReSharper disable once UnusedParameter.Global bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText);
bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText, (uint Module, uint Description)? errorCode = null);
/// <summary> /// <summary>
/// Creates a handler to process keyboard inputs into text strings. /// Creates a handler to process keyboard inputs into text strings.

View File

@@ -1,5 +1,5 @@
using MsgPack;
using Ryujinx.Horizon.Common; using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Prepo.Types;
using Ryujinx.Memory; using Ryujinx.Memory;
using System; using System;
using System.Threading; using System.Threading;
@@ -8,7 +8,7 @@ namespace Ryujinx.Horizon
{ {
public static class HorizonStatic public static class HorizonStatic
{ {
internal static void HandlePlayReport(PlayReport report) => internal static void HandlePlayReport(MessagePackObject report) =>
new Thread(() => PlayReport?.Invoke(report)) new Thread(() => PlayReport?.Invoke(report))
{ {
Name = "HLE.PlayReportEvent", Name = "HLE.PlayReportEvent",
@@ -16,7 +16,7 @@ namespace Ryujinx.Horizon
Priority = ThreadPriority.AboveNormal Priority = ThreadPriority.AboveNormal
}.Start(); }.Start();
public static event Action<PlayReport> PlayReport; public static event Action<MessagePackObject> PlayReport;
[field: ThreadStatic] [field: ThreadStatic]
public static HorizonOptions Options { get; private set; } public static HorizonOptions Options { get; private set; }

View File

@@ -1,3 +1,4 @@
using Gommon;
using MsgPack; using MsgPack;
using MsgPack.Serialization; using MsgPack.Serialization;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
@@ -11,12 +12,19 @@ using Ryujinx.Horizon.Sdk.Sf;
using Ryujinx.Horizon.Sdk.Sf.Hipc; using Ryujinx.Horizon.Sdk.Sf.Hipc;
using System; using System;
using System.Text; using System.Text;
using System.Threading;
using ApplicationId = Ryujinx.Horizon.Sdk.Ncm.ApplicationId; using ApplicationId = Ryujinx.Horizon.Sdk.Ncm.ApplicationId;
namespace Ryujinx.Horizon.Prepo.Ipc namespace Ryujinx.Horizon.Prepo.Ipc
{ {
partial class PrepoService : IPrepoService partial class PrepoService : IPrepoService
{ {
enum PlayReportKind
{
Normal,
System,
}
private readonly ArpApi _arp; private readonly ArpApi _arp;
private readonly PrepoServicePermissionLevel _permissionLevel; private readonly PrepoServicePermissionLevel _permissionLevel;
private ulong _systemSessionId; private ulong _systemSessionId;
@@ -192,13 +200,6 @@ namespace Ryujinx.Horizon.Prepo.Ipc
StringBuilder builder = new(); StringBuilder builder = new();
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray()); MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray());
PlayReport playReport = new()
{
Kind = playReportKind,
Room = gameRoom,
ReportData = deserializedReport
};
builder.AppendLine(); builder.AppendLine();
builder.AppendLine("PlayReport log:"); builder.AppendLine("PlayReport log:");
builder.AppendLine($" Kind: {playReportKind}"); builder.AppendLine($" Kind: {playReportKind}");
@@ -208,12 +209,10 @@ namespace Ryujinx.Horizon.Prepo.Ipc
if (pid != 0) if (pid != 0)
{ {
builder.AppendLine($" Pid: {pid}"); builder.AppendLine($" Pid: {pid}");
playReport.Pid = pid;
} }
else else
{ {
builder.AppendLine($" ApplicationId: {applicationId}"); builder.AppendLine($" ApplicationId: {applicationId}");
playReport.AppId = applicationId;
} }
Result result = _arp.GetApplicationInstanceId(out ulong applicationInstanceId, pid); Result result = _arp.GetApplicationInstanceId(out ulong applicationInstanceId, pid);
@@ -224,20 +223,17 @@ namespace Ryujinx.Horizon.Prepo.Ipc
_arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty applicationLaunchProperty, applicationInstanceId).AbortOnFailure(); _arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty applicationLaunchProperty, applicationInstanceId).AbortOnFailure();
playReport.Version = applicationLaunchProperty.Version;
builder.AppendLine($" ApplicationVersion: {applicationLaunchProperty.Version}"); builder.AppendLine($" ApplicationVersion: {applicationLaunchProperty.Version}");
if (!userId.IsNull) if (!userId.IsNull)
{ {
builder.AppendLine($" UserId: {userId}"); builder.AppendLine($" UserId: {userId}");
playReport.UserId = userId;
} }
builder.AppendLine($" Room: {gameRoom}"); builder.AppendLine($" Room: {gameRoom}");
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}"); builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
HorizonStatic.HandlePlayReport(playReport); HorizonStatic.HandlePlayReport(deserializedReport);
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString()); Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());

View File

@@ -1,24 +0,0 @@
using MsgPack;
using Ryujinx.Horizon.Sdk.Account;
using Ryujinx.Horizon.Sdk.Ncm;
namespace Ryujinx.Horizon.Prepo.Types
{
public struct PlayReport
{
public PlayReportKind Kind { get; init; }
public string Room { get; init; }
public MessagePackObject ReportData { get; init; }
public ApplicationId? AppId;
public ulong? Pid;
public uint Version;
public Uid? UserId;
}
public enum PlayReportKind
{
Normal,
System,
}
}

View File

@@ -111,7 +111,7 @@ namespace Ryujinx.Input.SDL2
byte blue = packedRgb > 0 ? (byte)(packedRgb % 256) : (byte)0; byte blue = packedRgb > 0 ? (byte)(packedRgb % 256) : (byte)0;
if (SDL_GameControllerSetLED(_gamepadHandle, red, green, blue) != 0) if (SDL_GameControllerSetLED(_gamepadHandle, red, green, blue) != 0)
Logger.Debug?.Print(LogClass.Hid, "LED setting failed; probably in the middle of disconnecting."); Logger.Error?.Print(LogClass.Hid, "LED setting failed; probably in the middle of disconnecting.");
} }
private GamepadFeaturesFlag GetFeaturesFlag() private GamepadFeaturesFlag GetFeaturesFlag()

View File

@@ -185,15 +185,6 @@ namespace Ryujinx.Input.HLE
} }
} }
public bool InputUpdatesBlocked
{
get
{
lock (_lock)
return _blockInputUpdates;
}
}
public void BlockInputUpdates() public void BlockInputUpdates()
{ {
lock (_lock) lock (_lock)

View File

@@ -517,7 +517,7 @@ namespace Ryujinx.Ava
Device?.System.ChangeDockedModeState(e.NewValue); Device?.System.ChangeDockedModeState(e.NewValue);
} }
public void UpdateAudioVolumeState(object sender, ReactiveEventArgs<float> e) private void UpdateAudioVolumeState(object sender, ReactiveEventArgs<float> e)
{ {
Device?.SetVolume(e.NewValue); Device?.SetVolume(e.NewValue);
@@ -951,7 +951,7 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.Multiplayer.Mode, ConfigurationState.Instance.Multiplayer.Mode,
ConfigurationState.Instance.Multiplayer.DisableP2p, ConfigurationState.Instance.Multiplayer.DisableP2p,
ConfigurationState.Instance.Multiplayer.LdnPassphrase, ConfigurationState.Instance.Multiplayer.LdnPassphrase,
ConfigurationState.Instance.Multiplayer.GetLdnServer(), ConfigurationState.Instance.Multiplayer.LdnServer,
ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value, ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value,
ConfigurationState.Instance.Hacks.ShowDirtyHacks ? ConfigurationState.Instance.Hacks.EnabledHacks : null)); ConfigurationState.Instance.Hacks.ShowDirtyHacks ? ConfigurationState.Instance.Hacks.EnabledHacks : null));
} }
@@ -1041,7 +1041,6 @@ namespace Ryujinx.Ava
if (_viewModel.StartGamesInFullscreen) if (_viewModel.StartGamesInFullscreen)
{ {
_viewModel.WindowState = WindowState.FullScreen; _viewModel.WindowState = WindowState.FullScreen;
_viewModel.Window.TitleBar.ExtendsContentIntoTitleBar = true;
} }
if (_viewModel.WindowState is WindowState.FullScreen || _viewModel.StartGamesWithoutUI) if (_viewModel.WindowState is WindowState.FullScreen || _viewModel.StartGamesWithoutUI)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
using System;
namespace Ryujinx.Ava.Common
{
public static class ThemeManager
{
public static event Action ThemeChanged;
public static void OnThemeChanged()
{
ThemeChanged?.Invoke();
}
}
}

View File

@@ -1,5 +1,6 @@
using DiscordRPC; using DiscordRPC;
using Gommon; using Gommon;
using MsgPack;
using Ryujinx.Ava.Utilities; using Ryujinx.Ava.Utilities;
using Ryujinx.Ava.Utilities.AppLibrary; using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Ava.Utilities.Configuration; using Ryujinx.Ava.Utilities.Configuration;
@@ -9,7 +10,6 @@ using Ryujinx.Common.Logging;
using Ryujinx.HLE; using Ryujinx.HLE;
using Ryujinx.HLE.Loaders.Processes; using Ryujinx.HLE.Loaders.Processes;
using Ryujinx.Horizon; using Ryujinx.Horizon;
using Ryujinx.Horizon.Prepo.Types;
using System.Text; using System.Text;
namespace Ryujinx.Ava namespace Ryujinx.Ava
@@ -24,7 +24,7 @@ namespace Ryujinx.Ava
private static readonly string _description = private static readonly string _description =
ReleaseInformation.IsValid ReleaseInformation.IsValid
? $"{VersionString} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelSourceRepo}" ? $"{VersionString} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelSourceRepo}@{ReleaseInformation.BuildGitHash}"
: "dev build"; : "dev build";
private const string ApplicationId = "1293250299716173864"; private const string ApplicationId = "1293250299716173864";
@@ -37,9 +37,6 @@ namespace Ryujinx.Ava
private static RichPresence _discordPresencePlaying; private static RichPresence _discordPresencePlaying;
private static ApplicationMetadata _currentApp; private static ApplicationMetadata _currentApp;
public static bool HasAssetImage(string titleId) => TitleIDs.DiscordGameAssetKeys.ContainsIgnoreCase(titleId);
public static bool HasAnalyzer(string titleId) => PlayReports.Analyzer.TitleIds.ContainsIgnoreCase(titleId);
public static void Initialize() public static void Initialize()
{ {
_discordPresenceMain = new RichPresence _discordPresenceMain = new RichPresence
@@ -56,7 +53,6 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update; ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue); TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue);
HorizonStatic.PlayReport += HandlePlayReport; HorizonStatic.PlayReport += HandlePlayReport;
PlayReports.Initialize();
} }
private static void Update(object sender, ReactiveEventArgs<bool> evnt) private static void Update(object sender, ReactiveEventArgs<bool> evnt)
@@ -124,22 +120,20 @@ namespace Ryujinx.Ava
_currentApp = null; _currentApp = null;
} }
private static void HandlePlayReport(PlayReport playReport) private static void HandlePlayReport(MessagePackObject playReport)
{ {
if (_discordClient is null) return; if (_discordClient is null) return;
if (!TitleIDs.CurrentApplication.Value.HasValue) return; if (!TitleIDs.CurrentApplication.Value.HasValue) return;
if (_discordPresencePlaying is null) return; if (_discordPresencePlaying is null) return;
FormattedValue formattedValue = Analyzer.FormattedValue formattedValue =
PlayReports.Analyzer.Format(TitleIDs.CurrentApplication.Value, _currentApp, playReport); PlayReports.Analyzer.Format(TitleIDs.CurrentApplication.Value, _currentApp, playReport);
if (!formattedValue.Handled) return; if (!formattedValue.Handled) return;
_discordPresencePlaying.Details = TruncateToByteLength( _discordPresencePlaying.Details = formattedValue.Reset
formattedValue.Reset ? $"Playing {_currentApp.Title}"
? $"Playing {_currentApp.Title}" : formattedValue.FormattedString;
: formattedValue.FormattedString
);
if (_discordClient.CurrentPresence.Details.Equals(_discordPresencePlaying.Details)) if (_discordClient.CurrentPresence.Details.Equals(_discordPresencePlaying.Details))
return; //don't trigger an update if the set presence Details are identical to current return; //don't trigger an update if the set presence Details are identical to current

View File

@@ -289,8 +289,7 @@ namespace Ryujinx.Headless
DriverUtilities.InitDriverConfig(option.BackendThreading == BackendThreading.Off); DriverUtilities.InitDriverConfig(option.BackendThreading == BackendThreading.Off);
if (_inputConfiguration.OfType<StandardControllerInputConfig>() if (_inputConfiguration.OfType<StandardControllerInputConfig>().Any(ic => ic.Led.UseRainbow))
.Any(ic => ic?.Led?.UseRainbow ?? false))
Rainbow.Enable(); Rainbow.Enable();
while (true) while (true)

View File

@@ -148,7 +148,7 @@ namespace Ryujinx.Headless
IgnoreMissingServices = configurationState.System.IgnoreMissingServices; IgnoreMissingServices = configurationState.System.IgnoreMissingServices;
if (NeedsOverride(nameof(IgnoreControllerApplet))) if (NeedsOverride(nameof(IgnoreControllerApplet)))
IgnoreControllerApplet = configurationState.System.IgnoreControllerApplet; IgnoreControllerApplet = configurationState.System.IgnoreApplet;
return; return;
@@ -387,7 +387,7 @@ namespace Ryujinx.Headless
[Option("graphics-shaders-dump-path", Required = false, HelpText = "Dumps shaders in this local directory. (Developer only)")] [Option("graphics-shaders-dump-path", Required = false, HelpText = "Dumps shaders in this local directory. (Developer only)")]
public string GraphicsShadersDumpPath { get; set; } public string GraphicsShadersDumpPath { get; set; }
[Option("graphics-backend", Required = false, Default = GraphicsBackend.Vulkan, HelpText = "Change Graphics Backend to use.")] [Option("graphics-backend", Required = false, Default = GraphicsBackend.OpenGl, HelpText = "Change Graphics Backend to use.")]
public GraphicsBackend GraphicsBackend { get; set; } public GraphicsBackend GraphicsBackend { get; set; }
[Option("preferred-gpu-vendor", Required = false, Default = "", HelpText = "When using the Vulkan backend, prefer using the GPU from the specified vendor.")] [Option("preferred-gpu-vendor", Required = false, Default = "", HelpText = "When using the Vulkan backend, prefer using the GPU from the specified vendor.")]

View File

@@ -513,7 +513,7 @@ namespace Ryujinx.Headless
Exit(); Exit();
} }
public bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText, (uint Module, uint Description)? errorCode = null) public bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText)
{ {
SDL_MessageBoxData data = new() SDL_MessageBoxData data = new()
{ {
@@ -521,7 +521,7 @@ namespace Ryujinx.Headless
message = message, message = message,
buttons = new SDL_MessageBoxButtonData[buttonsText.Length], buttons = new SDL_MessageBoxButtonData[buttonsText.Length],
numbuttons = buttonsText.Length, numbuttons = buttonsText.Length,
window = WindowHandle window = WindowHandle,
}; };
for (int i = 0; i < buttonsText.Length; i++) for (int i = 0; i < buttonsText.Length; i++)

View File

@@ -47,7 +47,6 @@ namespace Ryujinx.Ava
if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 19041)) if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 19041))
{ {
_ = MessageBoxA(nint.Zero, "You are running an outdated version of Windows.\n\nRyujinx supports Windows 10 version 20H1 and newer.\n", $"Ryujinx {Version}", MbIconwarning); _ = MessageBoxA(nint.Zero, "You are running an outdated version of Windows.\n\nRyujinx supports Windows 10 version 20H1 and newer.\n", $"Ryujinx {Version}", MbIconwarning);
return 0;
} }
PreviewerDetached = true; PreviewerDetached = true;

View File

@@ -22,8 +22,6 @@ namespace Ryujinx.Ava
{ {
public class RyujinxApp : Application public class RyujinxApp : Application
{ {
public static event Action ThemeChanged;
internal static string FormatTitle(LocaleKeys? windowTitleKey = null, bool includeVersion = true) internal static string FormatTitle(LocaleKeys? windowTitleKey = null, bool includeVersion = true)
=> windowTitleKey is null => windowTitleKey is null
? $"{FullAppName}{(includeVersion ? $" {Program.Version}" : string.Empty)}" ? $"{FullAppName}{(includeVersion ? $" {Program.Version}" : string.Empty)}"
@@ -114,7 +112,7 @@ namespace Ryujinx.Ava
baseStyle = ConfigurationState.Instance.UI.BaseStyle; baseStyle = ConfigurationState.Instance.UI.BaseStyle;
} }
ThemeChanged?.Invoke(); ThemeManager.OnThemeChanged();
RequestedThemeVariant = baseStyle switch RequestedThemeVariant = baseStyle switch
{ {

View File

@@ -41,7 +41,7 @@ namespace Ryujinx.Ava.UI.Applet
bool okPressed = false; bool okPressed = false;
if (ConfigurationState.Instance.System.IgnoreControllerApplet) if (ConfigurationState.Instance.System.IgnoreApplet)
return false; return false;
Dispatcher.UIThread.InvokeAsync(async () => Dispatcher.UIThread.InvokeAsync(async () =>
@@ -75,32 +75,31 @@ namespace Ryujinx.Ava.UI.Applet
bool opened = false; bool opened = false;
UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent, UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent,
title, title,
message, message,
string.Empty, string.Empty,
LocaleManager.Instance[LocaleKeys.DialogOpenSettingsWindowLabel], LocaleManager.Instance[LocaleKeys.DialogOpenSettingsWindowLabel],
string.Empty, string.Empty,
LocaleManager.Instance[LocaleKeys.SettingsButtonClose], LocaleManager.Instance[LocaleKeys.SettingsButtonClose],
(int)Symbol.Important, (int)Symbol.Important,
deferEvent, deferEvent,
async window => async window =>
{ {
if (opened) if (opened)
{ {
return; return;
} }
opened = true; opened = true;
_parent.SettingsWindow = _parent.SettingsWindow = new SettingsWindow(_parent.VirtualFileSystem, _parent.ContentManager);
new SettingsWindow(_parent.VirtualFileSystem, _parent.ContentManager);
await _parent.SettingsWindow.ShowDialog(window); await _parent.SettingsWindow.ShowDialog(window);
_parent.SettingsWindow = null; _parent.SettingsWindow = null;
opened = false; opened = false;
}); });
if (response == UserResult.Ok) if (response == UserResult.Ok)
{ {
@@ -111,9 +110,7 @@ namespace Ryujinx.Ava.UI.Applet
} }
catch (Exception ex) catch (Exception ex)
{ {
await ContentDialogHelper.CreateErrorDialog( await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogMessageDialogErrorExceptionMessage, ex));
LocaleManager.Instance.UpdateAndGetDynamicValue(
LocaleKeys.DialogMessageDialogErrorExceptionMessage, ex));
dialogCloseEvent.Set(); dialogCloseEvent.Set();
} }
@@ -137,9 +134,7 @@ namespace Ryujinx.Ava.UI.Applet
try try
{ {
_parent.ViewModel.AppHost.NpadManager.BlockInputUpdates(); _parent.ViewModel.AppHost.NpadManager.BlockInputUpdates();
(UserResult result, string userInput) = (UserResult result, string userInput) = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard], args);
await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard],
args);
if (result == UserResult.Ok) if (result == UserResult.Ok)
{ {
@@ -151,9 +146,7 @@ namespace Ryujinx.Ava.UI.Applet
{ {
error = true; error = true;
await ContentDialogHelper.CreateErrorDialog( await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogSoftwareKeyboardErrorExceptionMessage, ex));
LocaleManager.Instance.UpdateAndGetDynamicValue(
LocaleKeys.DialogSoftwareKeyboardErrorExceptionMessage, ex));
} }
finally finally
{ {
@@ -184,8 +177,7 @@ namespace Ryujinx.Ava.UI.Applet
args.InitialText = "Ryujinx"; args.InitialText = "Ryujinx";
args.StringLengthMin = 1; args.StringLengthMin = 1;
args.StringLengthMax = 25; args.StringLengthMax = 25;
(UserResult result, string userInput) = (UserResult result, string userInput) = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.CabinetDialog], args);
await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.CabinetDialog], args);
if (result == UserResult.Ok) if (result == UserResult.Ok)
{ {
inputText = userInput; inputText = userInput;
@@ -209,13 +201,11 @@ namespace Ryujinx.Ava.UI.Applet
Dispatcher.UIThread.InvokeAsync(async () => Dispatcher.UIThread.InvokeAsync(async () =>
{ {
dialogCloseEvent.Set(); dialogCloseEvent.Set();
await ContentDialogHelper.CreateInfoDialog( await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.CabinetScanDialog],
LocaleManager.Instance[LocaleKeys.CabinetScanDialog], string.Empty,
string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk],
LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty,
string.Empty, LocaleManager.Instance[LocaleKeys.CabinetTitle]);
LocaleManager.Instance[LocaleKeys.CabinetTitle]
);
}); });
dialogCloseEvent.WaitOne(); dialogCloseEvent.WaitOne();
} }
@@ -227,8 +217,7 @@ namespace Ryujinx.Ava.UI.Applet
_parent.ViewModel.AppHost?.Stop(); _parent.ViewModel.AppHost?.Stop();
} }
public bool DisplayErrorAppletDialog(string title, string message, string[] buttons, public bool DisplayErrorAppletDialog(string title, string message, string[] buttons)
(uint Module, uint Description)? errorCode = null)
{ {
ManualResetEvent dialogCloseEvent = new(false); ManualResetEvent dialogCloseEvent = new(false);
@@ -240,7 +229,9 @@ namespace Ryujinx.Ava.UI.Applet
{ {
ErrorAppletWindow msgDialog = new(_parent, buttons, message) ErrorAppletWindow msgDialog = new(_parent, buttons, message)
{ {
Title = title, WindowStartupLocation = WindowStartupLocation.CenterScreen, Width = 400 Title = title,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
Width = 400
}; };
object response = await msgDialog.Run(); object response = await msgDialog.Run();
@@ -258,9 +249,7 @@ namespace Ryujinx.Ava.UI.Applet
{ {
dialogCloseEvent.Set(); dialogCloseEvent.Set();
await ContentDialogHelper.CreateErrorDialog( await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogErrorAppletErrorExceptionMessage, ex));
LocaleManager.Instance.UpdateAndGetDynamicValue(
LocaleKeys.DialogErrorAppletErrorExceptionMessage, ex));
} }
}); });
@@ -289,11 +278,13 @@ namespace Ryujinx.Ava.UI.Applet
.ForEach(profile => profiles.Add(new Models.UserProfile(profile, nav))); .ForEach(profile => profiles.Add(new Models.UserProfile(profile, nav)));
profiles.Add(new Models.UserProfile(guest, nav)); profiles.Add(new Models.UserProfile(guest, nav));
ProfileSelectorDialogViewModel viewModel = new() UserSelectorDialogViewModel viewModel = new()
{ {
Profiles = profiles, SelectedUserId = _parent.AccountManager.LastOpenedUser.UserId Profiles = profiles,
SelectedUserId = _parent.AccountManager.LastOpenedUser.UserId
}; };
(selected, _) = await ProfileSelectorDialog.ShowInputDialog(viewModel); UserSelectorDialog content = new(viewModel);
(selected, _) = await UserSelectorDialog.ShowInputDialog(content);
dialogCloseEvent.Set(); dialogCloseEvent.Set();
}); });
@@ -320,7 +311,6 @@ namespace Ryujinx.Ava.UI.Applet
} }
} }
} }
return profile; return profile;
} }
} }

View File

@@ -1,5 +1,5 @@
<UserControl <UserControl
x:Class="Ryujinx.Ava.UI.Applet.ProfileSelectorDialog" x:Class="Ryujinx.Ava.UI.Applet.UserSelectorDialog"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -12,9 +12,9 @@
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d" mc:Ignorable="d"
Focusable="True" Focusable="True"
x:DataType="viewModels:ProfileSelectorDialogViewModel"> x:DataType="viewModels:UserSelectorDialogViewModel">
<Design.DataContext> <Design.DataContext>
<viewModels:ProfileSelectorDialogViewModel /> <viewModels:UserSelectorDialogViewModel />
</Design.DataContext> </Design.DataContext>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

View File

@@ -16,15 +16,15 @@ using UserProfileSft = Ryujinx.HLE.HOS.Services.Account.Acc.UserProfile;
namespace Ryujinx.Ava.UI.Applet namespace Ryujinx.Ava.UI.Applet
{ {
public partial class ProfileSelectorDialog : UserControl public partial class UserSelectorDialog : UserControl, INotifyPropertyChanged
{ {
public ProfileSelectorDialogViewModel ViewModel { get; set; } public UserSelectorDialogViewModel ViewModel { get; set; }
public ProfileSelectorDialog(ProfileSelectorDialogViewModel viewModel) public UserSelectorDialog(UserSelectorDialogViewModel viewModel)
{ {
DataContext = ViewModel = viewModel;
InitializeComponent(); InitializeComponent();
ViewModel = viewModel;
DataContext = ViewModel;
} }
private void Grid_PointerEntered(object sender, PointerEventArgs e) private void Grid_PointerEntered(object sender, PointerEventArgs e)
@@ -54,7 +54,7 @@ namespace Ryujinx.Ava.UI.Applet
if (ViewModel.Profiles[selectedIndex] is UserProfile userProfile) if (ViewModel.Profiles[selectedIndex] is UserProfile userProfile)
{ {
ViewModel.SelectedUserId = userProfile.UserId; ViewModel.SelectedUserId = userProfile.UserId;
Logger.Info?.Print(LogClass.UI, $"Selected: {userProfile.UserId}", "ProfileSelector"); Logger.Info?.Print(LogClass.UI, $"Selected user: {userProfile.UserId}");
ObservableCollection<BaseModel> newProfiles = []; ObservableCollection<BaseModel> newProfiles = [];
@@ -79,7 +79,7 @@ namespace Ryujinx.Ava.UI.Applet
} }
} }
public static async Task<(UserId Id, bool Result)> ShowInputDialog(ProfileSelectorDialogViewModel viewModel) public static async Task<(UserId Id, bool Result)> ShowInputDialog(UserSelectorDialog content)
{ {
ContentDialog contentDialog = new() ContentDialog contentDialog = new()
{ {
@@ -87,25 +87,22 @@ namespace Ryujinx.Ava.UI.Applet
PrimaryButtonText = LocaleManager.Instance[LocaleKeys.Continue], PrimaryButtonText = LocaleManager.Instance[LocaleKeys.Continue],
SecondaryButtonText = string.Empty, SecondaryButtonText = string.Empty,
CloseButtonText = LocaleManager.Instance[LocaleKeys.Cancel], CloseButtonText = LocaleManager.Instance[LocaleKeys.Cancel],
Content = new ProfileSelectorDialog(viewModel), Content = content,
Padding = new Thickness(0) Padding = new Thickness(0)
}; };
UserId result = UserId.Null; UserId result = UserId.Null;
bool input = false; bool input = false;
contentDialog.Closed += Handler;
await ContentDialogHelper.ShowAsync(contentDialog);
return (result, input);
void Handler(ContentDialog sender, ContentDialogClosedEventArgs eventArgs) void Handler(ContentDialog sender, ContentDialogClosedEventArgs eventArgs)
{ {
if (eventArgs.Result == ContentDialogResult.Primary) if (eventArgs.Result == ContentDialogResult.Primary)
{ {
result = viewModel.SelectedUserId; if (contentDialog.Content is UserSelectorDialog view)
input = true; {
result = view.ViewModel.SelectedUserId;
input = true;
}
} }
else else
{ {
@@ -113,6 +110,12 @@ namespace Ryujinx.Ava.UI.Applet
input = false; input = false;
} }
} }
contentDialog.Closed += Handler;
await ContentDialogHelper.ShowAsync(contentDialog);
return (result, input);
} }
} }
} }

View File

@@ -189,7 +189,7 @@ namespace Ryujinx.Ava.UI.Controls
DirectoryInfo mainDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "0")); DirectoryInfo mainDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "0"));
DirectoryInfo backupDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "1")); DirectoryInfo backupDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "1"));
List<FileInfo> cacheFiles = []; List<FileInfo> cacheFiles = new();
if (mainDir.Exists) if (mainDir.Exists)
{ {

View File

@@ -4,7 +4,6 @@
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
xmlns:ext="using:Ryujinx.Ava.Common.Markup" xmlns:ext="using:Ryujinx.Ava.Common.Markup"
xmlns:viewModels="using:Ryujinx.Ava.UI.ViewModels" xmlns:viewModels="using:Ryujinx.Ava.UI.ViewModels"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView" x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView"
@@ -55,21 +54,9 @@
Tag="{Binding AppData.IdString}" Tag="{Binding AppData.IdString}"
Text="{Binding AppData.LocalizedStatus}" Text="{Binding AppData.LocalizedStatus}"
Foreground="{Binding AppData.PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}" Foreground="{Binding AppData.PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}"
ToolTip.Tip="{Binding AppData.LocalizedStatusTooltip}"
TextAlignment="Start" TextAlignment="Start"
TextWrapping="Wrap"> TextWrapping="Wrap" />
<ToolTip.Tip>
<StackPanel Orientation="Vertical">
<TextBlock
Text="{Binding AppData.LocalizedStatusTooltip}" />
<Separator
Margin="0, 10, 0, 10"
IsVisible="{Binding AppData.HasCompatibilityLabels}" />
<TextBlock
IsVisible="{Binding AppData.HasCompatibilityLabels}"
Text="{Binding AppData.FormattedCompatibilityLabels}" />
</StackPanel>
</ToolTip.Tip>
</TextBlock>
<Button.Styles> <Button.Styles>
<Style Selector="Button"> <Style Selector="Button">
<Setter Property="MinWidth" <Setter Property="MinWidth"
@@ -98,55 +85,6 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" /> <Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
<StackPanel Orientation="Vertical" Spacing="5">
<StackPanel Orientation="Horizontal" Spacing="5">
<ui:SymbolIcon Foreground="ForestGreen" Symbol="Checkmark" IsVisible="{Binding AppData.HasRichPresenceAsset}"/>
<TextBlock
Foreground="ForestGreen"
HorizontalAlignment="Stretch"
IsVisible="{Binding AppData.HasRichPresenceAsset}"
Text="{ext:Locale GameInfoRpcImage}"
TextAlignment="Start"
TextWrapping="Wrap" >
</TextBlock>
<ui:SymbolIcon Foreground="Red" Symbol="Cancel" IsVisible="{Binding !AppData.HasRichPresenceAsset}"/>
<TextBlock
Foreground="Red"
HorizontalAlignment="Stretch"
IsVisible="{Binding !AppData.HasRichPresenceAsset}"
Text="{ext:Locale GameInfoRpcImage}"
TextAlignment="Start"
TextWrapping="Wrap" >
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="5" ToolTip.Tip="{Binding DynamicRichPresenceDescription}">
<ui:SymbolIcon
Foreground="ForestGreen"
Symbol="Checkmark"
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"/>
<TextBlock
Foreground="ForestGreen"
HorizontalAlignment="Stretch"
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"
Text="{ext:Locale GameInfoRpcDynamic}"
TextAlignment="Start"
TextWrapping="Wrap">
</TextBlock>
<ui:SymbolIcon
Foreground="Red"
Symbol="Cancel"
IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"/>
<TextBlock
Foreground="Red"
HorizontalAlignment="Stretch"
IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"
Text="{ext:Locale GameInfoRpcDynamic}"
TextAlignment="Start"
TextWrapping="Wrap" >
</TextBlock>
</StackPanel>
</StackPanel>
<Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
<TextBlock <TextBlock
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
IsVisible="{Binding AppData.HasLdnGames}" IsVisible="{Binding AppData.HasLdnGames}"
@@ -154,35 +92,22 @@
TextAlignment="Start" TextAlignment="Start"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<Separator IsVisible="{Binding AppData.HasLdnGames}" Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" /> <Separator IsVisible="{Binding AppData.HasLdnGames}" Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
<StackPanel Orientation="Vertical" Spacing="5"> <StackPanel
<Grid HorizontalAlignment="Left"
ColumnDefinitions="Auto,*,Auto"> VerticalAlignment="Top"
<TextBlock Orientation="Vertical"
Grid.Column="0" Spacing="5">
Text="{ext:Locale GameListHeaderLastPlayed}" <TextBlock
VerticalAlignment="Top" HorizontalAlignment="Stretch"
TextAlignment="Start" Text="{Binding FormattedLastPlayed}"
TextWrapping="NoWrap" /> TextAlignment="Start"
<TextBlock TextWrapping="Wrap" />
Grid.Column="2" <TextBlock
Text="{Binding AppData.LastPlayedString}" HorizontalAlignment="Stretch"
TextAlignment="End" Text="{Binding FormattedPlayTime}"
TextWrapping="Wrap" /> IsVisible="{Binding AppData.HasPlayedPreviously}"
</Grid> TextAlignment="Start"
<Grid TextWrapping="Wrap" />
ColumnDefinitions="Auto,*,Auto"
IsVisible="{Binding AppData.HasPlayedPreviously}">
<TextBlock
Grid.Column="0"
Text="{ext:Locale GameListHeaderTimePlayed}"
VerticalAlignment="Top"
TextAlignment="Start"
TextWrapping="NoWrap" />
<TextBlock Grid.Column="2"
Text="{Binding AppData.TimePlayedString}"
TextAlignment="End"
TextWrapping="Wrap" />
</Grid>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@@ -1,9 +1,12 @@
using Avalonia.Controls; using Avalonia;
using Avalonia.Controls;
using Avalonia.Input.Platform; using Avalonia.Input.Platform;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Styling; using Avalonia.Styling;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using Ryujinx.Ava;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Controls;
using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.UI.Windows; using Ryujinx.Ava.UI.Windows;

View File

@@ -93,19 +93,8 @@
IsVisible="{Binding HasPlayabilityInfo}" IsVisible="{Binding HasPlayabilityInfo}"
Background="{DynamicResource AppListBackgroundColor}" Background="{DynamicResource AppListBackgroundColor}"
Margin="-1, 0, 0, 0" Margin="-1, 0, 0, 0"
Padding="0"> Padding="0"
<ToolTip.Tip> ToolTip.Tip="{Binding LocalizedStatusTooltip}">
<StackPanel Orientation="Vertical">
<TextBlock
Text="{Binding LocalizedStatusTooltip}" />
<Separator
Margin="0, 10, 0, 10"
IsVisible="{Binding HasCompatibilityLabels}" />
<TextBlock
IsVisible="{Binding HasCompatibilityLabels}"
Text="{Binding FormattedCompatibilityLabels}" />
</StackPanel>
</ToolTip.Tip>
<TextBlock <TextBlock
Margin="1.5" Margin="1.5"
Tag="{Binding IdString}" Tag="{Binding IdString}"

View File

@@ -7,6 +7,7 @@ using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.Utilities.AppLibrary; using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Ava.Utilities.Compat; using Ryujinx.Ava.Utilities.Compat;
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
namespace Ryujinx.Ava.UI.Controls namespace Ryujinx.Ava.UI.Controls

View File

@@ -18,7 +18,7 @@ namespace Ryujinx.Ava.UI.Helpers
LocaleKeys.CompatibilityListNothing or LocaleKeys.CompatibilityListNothing or
LocaleKeys.CompatibilityListBoots or LocaleKeys.CompatibilityListBoots or
LocaleKeys.CompatibilityListMenus => Brushes.Red, LocaleKeys.CompatibilityListMenus => Brushes.Red,
LocaleKeys.CompatibilityListIngame => Brushes.DarkOrange, LocaleKeys.CompatibilityListIngame => Brushes.Yellow,
_ => Brushes.ForestGreen _ => Brushes.ForestGreen
}; };

View File

@@ -1,7 +1,6 @@
using Avalonia.Logging; using Avalonia.Logging;
using Avalonia.Utilities; using Avalonia.Utilities;
using Gommon; using Gommon;
using Ryujinx.Ava.Utilities.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using System; using System;
using System.Text; using System.Text;
@@ -15,19 +14,13 @@ namespace Ryujinx.Ava.UI.Helpers
internal class LoggerAdapter : ILogSink internal class LoggerAdapter : ILogSink
{ {
private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog;
public static void Register() public static void Register()
{ {
AvaLogger.Sink = new LoggerAdapter(); AvaLogger.Sink = new LoggerAdapter();
ConfigurationState.Instance.Logger.EnableAvaloniaLog.Event
+= (_, e) => _avaloniaLogsEnabled = e.NewValue;
} }
private static RyuLogger.Log? GetLog(AvaLogLevel level, string area) private static RyuLogger.Log? GetLog(AvaLogLevel level, string area)
{ {
if (!_avaloniaLogsEnabled) return null;
return level switch return level switch
{ {
AvaLogLevel.Verbose => RyuLogger.Debug, AvaLogLevel.Verbose => RyuLogger.Debug,

View File

@@ -2,7 +2,6 @@ using Avalonia.Media.Imaging;
using Avalonia.Styling; using Avalonia.Styling;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using Gommon;
using Ryujinx.Ava.Common; using Ryujinx.Ava.Common;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Utilities.Configuration; using Ryujinx.Ava.Utilities.Configuration;
@@ -25,35 +24,30 @@ namespace Ryujinx.Ava.UI.ViewModels
Version = RyujinxApp.FullAppName + "\n" + Program.Version; Version = RyujinxApp.FullAppName + "\n" + Program.Version;
UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value); UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value);
RyujinxApp.ThemeChanged += Ryujinx_ThemeChanged; ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
} }
private void Ryujinx_ThemeChanged() private void ThemeManager_ThemeChanged()
{ {
Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value)); Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value));
} }
private const string LogoPathFormat = "resm:Ryujinx.Assets.UIImages.Logo_{0}_{1}.png?assembly=Ryujinx";
private void UpdateLogoTheme(string theme) private void UpdateLogoTheme(string theme)
{ {
bool isDarkTheme = theme == "Dark" || (theme == "Auto" && RyujinxApp.DetectSystemTheme() == ThemeVariant.Dark); bool isDarkTheme = theme == "Dark" || (theme == "Auto" && RyujinxApp.DetectSystemTheme() == ThemeVariant.Dark);
string themeName = isDarkTheme ? "Dark" : "Light"; string basePath = "resm:Ryujinx.Assets.UIImages.";
string themeSuffix = isDarkTheme ? "Dark.png" : "Light.png";
GithubLogo = LoadBitmap(LogoPathFormat.Format("GitHub", themeName)); GithubLogo = LoadBitmap($"{basePath}Logo_GitHub_{themeSuffix}?assembly=Ryujinx");
DiscordLogo = LoadBitmap(LogoPathFormat.Format("Discord", themeName)); DiscordLogo = LoadBitmap($"{basePath}Logo_Discord_{themeSuffix}?assembly=Ryujinx");
} }
private static Bitmap LoadBitmap(string uri) => new(Avalonia.Platform.AssetLoader.Open(new Uri(uri))); private static Bitmap LoadBitmap(string uri) => new(Avalonia.Platform.AssetLoader.Open(new Uri(uri)));
public void Dispose() public void Dispose()
{ {
RyujinxApp.ThemeChanged -= Ryujinx_ThemeChanged; ThemeManager.ThemeChanged -= ThemeManager_ThemeChanged;
GithubLogo.Dispose();
DiscordLogo.Dispose();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
} }

View File

@@ -264,7 +264,7 @@ namespace Ryujinx.Ava.UI.ViewModels
Logger.Error?.Print(LogClass.Application, $"Couldn't get valid amiibo data: {exception}"); Logger.Error?.Print(LogClass.Application, $"Couldn't get valid amiibo data: {exception}");
// Neither local or remote files are valid JSON, close window. // Neither local or remote files are valid JSON, close window.
await ShowInfoDialog(); ShowInfoDialog();
Close(); Close();
} }
else if (!remoteIsValid) else if (!remoteIsValid)
@@ -273,7 +273,7 @@ namespace Ryujinx.Ava.UI.ViewModels
// Only the local file is valid, the local one should be used // Only the local file is valid, the local one should be used
// but the user should be warned. // but the user should be warned.
await ShowInfoDialog(); ShowInfoDialog();
} }
} }
@@ -525,7 +525,7 @@ namespace Ryujinx.Ava.UI.ViewModels
AmiiboImage = bitmap; AmiiboImage = bitmap;
} }
private static async Task ShowInfoDialog() private static async void ShowInfoDialog()
{ {
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogAmiiboApiTitle], await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogAmiiboApiTitle],
LocaleManager.Instance[LocaleKeys.DialogAmiiboApiConnectErrorMessage], LocaleManager.Instance[LocaleKeys.DialogAmiiboApiConnectErrorMessage],

View File

@@ -1,7 +1,6 @@
using Gommon; using Gommon;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Utilities.AppLibrary; using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Ava.Utilities.PlayReport;
namespace Ryujinx.Ava.UI.ViewModels namespace Ryujinx.Ava.UI.ViewModels
{ {
@@ -11,14 +10,12 @@ namespace Ryujinx.Ava.UI.ViewModels
public ApplicationDataViewModel(ApplicationData appData) => AppData = appData; public ApplicationDataViewModel(ApplicationData appData) => AppData = appData;
public string DynamicRichPresenceDescription =>
AppData.HasDynamicRichPresenceSupport
? AppData.RichPresenceSpec.Value.Description
: GameSpec.DefaultDescription;
public string FormattedVersion => LocaleManager.Instance[LocaleKeys.GameListHeaderVersion].Format(AppData.Version); public string FormattedVersion => LocaleManager.Instance[LocaleKeys.GameListHeaderVersion].Format(AppData.Version);
public string FormattedDeveloper => LocaleManager.Instance[LocaleKeys.GameListHeaderDeveloper].Format(AppData.Developer); public string FormattedDeveloper => LocaleManager.Instance[LocaleKeys.GameListHeaderDeveloper].Format(AppData.Developer);
public string FormattedFileExtension => LocaleManager.Instance[LocaleKeys.GameListHeaderFileExtension].Format(AppData.FileExtension); public string FormattedFileExtension => LocaleManager.Instance[LocaleKeys.GameListHeaderFileExtension].Format(AppData.FileExtension);
public string FormattedLastPlayed => LocaleManager.Instance[LocaleKeys.GameListHeaderLastPlayed].Format(AppData.LastPlayedString);
public string FormattedPlayTime => LocaleManager.Instance[LocaleKeys.GameListHeaderTimePlayed].Format(AppData.TimePlayedString);
public string FormattedFileSize => LocaleManager.Instance[LocaleKeys.GameListHeaderFileSize].Format(AppData.FileSizeString); public string FormattedFileSize => LocaleManager.Instance[LocaleKeys.GameListHeaderFileSize].Format(AppData.FileSizeString);
public string FormattedLdnInfo => public string FormattedLdnInfo =>

View File

@@ -7,7 +7,6 @@ using Avalonia.Media.Imaging;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using DynamicData; using DynamicData;
using DynamicData.Binding; using DynamicData.Binding;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
@@ -105,13 +104,6 @@ namespace Ryujinx.Ava.UI.ViewModels
[ObservableProperty] private bool _isSubMenuOpen; [ObservableProperty] private bool _isSubMenuOpen;
[ObservableProperty] private ApplicationContextMenu _listAppContextMenu; [ObservableProperty] private ApplicationContextMenu _listAppContextMenu;
[ObservableProperty] private ApplicationContextMenu _gridAppContextMenu; [ObservableProperty] private ApplicationContextMenu _gridAppContextMenu;
[ObservableProperty] private bool _updateAvailable;
public static AsyncRelayCommand UpdateCommand { get; } = Commands.Create(async () =>
{
if (Updater.CanUpdate(true))
await Updater.BeginUpdateAsync(true);
});
private bool _showLoadProgress; private bool _showLoadProgress;
private bool _isGameRunning; private bool _isGameRunning;
@@ -793,7 +785,7 @@ namespace Ryujinx.Ava.UI.ViewModels
return false; return false;
} }
public async Task HandleFirmwareInstallation(string filename) private async Task HandleFirmwareInstallation(string filename)
{ {
try try
{ {
@@ -1155,10 +1147,10 @@ namespace Ryujinx.Ava.UI.ViewModels
List<string> dirs = result.Select(it => it.Path.LocalPath).ToList(); List<string> dirs = result.Select(it => it.Path.LocalPath).ToList();
int numAdded = onDirsSelected(dirs, out int numRemoved); int numAdded = onDirsSelected(dirs, out int numRemoved);
string msg = string.Join("\n", string msg = String.Join("\r\n", new string[] {
string.Format(LocaleManager.Instance[localeMessageRemovedKey], numRemoved), string.Format(LocaleManager.Instance[localeMessageRemovedKey], numRemoved),
string.Format(LocaleManager.Instance[localeMessageAddedKey], numAdded) string.Format(LocaleManager.Instance[localeMessageAddedKey], numAdded)
); });
await Dispatcher.UIThread.InvokeAsync(async () => await Dispatcher.UIThread.InvokeAsync(async () =>
{ {
@@ -1347,25 +1339,6 @@ namespace Ryujinx.Ava.UI.ViewModels
OpenHelper.OpenFolder(AppDataManager.BaseDirPath); OpenHelper.OpenFolder(AppDataManager.BaseDirPath);
} }
public void OpenScreenshotsFolder()
{
string screenshotsDir = Path.Combine(AppDataManager.BaseDirPath, "screenshots");
try
{
if (!Directory.Exists(screenshotsDir))
Directory.CreateDirectory(screenshotsDir);
}
catch (Exception ex)
{
Logger.Error?.Print(LogClass.Application, $"Failed to create directory at path {screenshotsDir}. Error : {ex.GetType().Name}", "Screenshot");
return;
}
OpenHelper.OpenFolder(screenshotsDir);
}
public void OpenLogsFolder() public void OpenLogsFolder()
{ {
string logPath = AppDataManager.GetOrCreateLogsDir(); string logPath = AppDataManager.GetOrCreateLogsDir();

View File

@@ -13,7 +13,6 @@ using Ryujinx.Ava.UI.Models.Input;
using Ryujinx.Ava.UI.Windows; using Ryujinx.Ava.UI.Windows;
using Ryujinx.Ava.Utilities.Configuration; using Ryujinx.Ava.Utilities.Configuration;
using Ryujinx.Ava.Utilities.Configuration.System; using Ryujinx.Ava.Utilities.Configuration.System;
using Ryujinx.Ava.Utilities.Configuration.UI;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Configuration.Multiplayer; using Ryujinx.Common.Configuration.Multiplayer;
using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.GraphicsDriver;
@@ -49,7 +48,8 @@ namespace Ryujinx.Ava.UI.ViewModels
private int _graphicsBackendMultithreadingIndex; private int _graphicsBackendMultithreadingIndex;
private float _volume; private float _volume;
[ObservableProperty] private bool _isVulkanAvailable = true; [ObservableProperty] private bool _isVulkanAvailable = true;
[ObservableProperty] private bool _gameListNeedsRefresh; [ObservableProperty] private bool _gameDirectoryChanged;
[ObservableProperty] private bool _autoloadDirectoryChanged;
private readonly List<string> _gpuIds = []; private readonly List<string> _gpuIds = [];
private int _graphicsBackendIndex; private int _graphicsBackendIndex;
private int _scalingFilter; private int _scalingFilter;
@@ -121,14 +121,9 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool RememberWindowState { get; set; } public bool RememberWindowState { get; set; }
public bool ShowTitleBar { get; set; } public bool ShowTitleBar { get; set; }
public int HideCursor { get; set; } public int HideCursor { get; set; }
public int UpdateCheckerType { get; set; }
public bool EnableDockedMode { get; set; } public bool EnableDockedMode { get; set; }
public bool EnableKeyboard { get; set; } public bool EnableKeyboard { get; set; }
public bool EnableMouse { get; set; } public bool EnableMouse { get; set; }
public bool DisableInputWhenOutOfFocus { get; set; }
public int FocusLostActionType { get; set; }
public VSyncMode VSyncMode public VSyncMode VSyncMode
{ {
get => _vSyncMode; get => _vSyncMode;
@@ -209,7 +204,6 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool EnableTrace { get; set; } public bool EnableTrace { get; set; }
public bool EnableGuest { get; set; } public bool EnableGuest { get; set; }
public bool EnableFsAccessLog { get; set; } public bool EnableFsAccessLog { get; set; }
public bool EnableAvaloniaLog { get; set; }
public bool EnableDebug { get; set; } public bool EnableDebug { get; set; }
public bool IsOpenAlEnabled { get; set; } public bool IsOpenAlEnabled { get; set; }
public bool IsSoundIoEnabled { get; set; } public bool IsSoundIoEnabled { get; set; }
@@ -481,8 +475,6 @@ namespace Ryujinx.Ava.UI.ViewModels
RememberWindowState = config.RememberWindowState; RememberWindowState = config.RememberWindowState;
ShowTitleBar = config.ShowTitleBar; ShowTitleBar = config.ShowTitleBar;
HideCursor = (int)config.HideCursor.Value; HideCursor = (int)config.HideCursor.Value;
UpdateCheckerType = (int)config.UpdateCheckerType.Value;
FocusLostActionType = (int)config.FocusLostActionType.Value;
GameDirectories.Clear(); GameDirectories.Clear();
GameDirectories.AddRange(config.UI.GameDirs.Value); GameDirectories.AddRange(config.UI.GameDirs.Value);
@@ -502,7 +494,6 @@ namespace Ryujinx.Ava.UI.ViewModels
EnableDockedMode = config.System.EnableDockedMode; EnableDockedMode = config.System.EnableDockedMode;
EnableKeyboard = config.Hid.EnableKeyboard; EnableKeyboard = config.Hid.EnableKeyboard;
EnableMouse = config.Hid.EnableMouse; EnableMouse = config.Hid.EnableMouse;
DisableInputWhenOutOfFocus = config.Hid.DisableInputWhenOutOfFocus;
// Keyboard Hotkeys // Keyboard Hotkeys
KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value); KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value);
@@ -526,7 +517,7 @@ namespace Ryujinx.Ava.UI.ViewModels
EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks; EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks;
DramSize = config.System.DramSize; DramSize = config.System.DramSize;
IgnoreMissingServices = config.System.IgnoreMissingServices; IgnoreMissingServices = config.System.IgnoreMissingServices;
IgnoreApplet = config.System.IgnoreControllerApplet; IgnoreApplet = config.System.IgnoreApplet;
// CPU // CPU
EnablePptc = config.System.EnablePtc; EnablePptc = config.System.EnablePtc;
@@ -569,7 +560,6 @@ namespace Ryujinx.Ava.UI.ViewModels
EnableGuest = config.Logger.EnableGuest; EnableGuest = config.Logger.EnableGuest;
EnableDebug = config.Logger.EnableDebug; EnableDebug = config.Logger.EnableDebug;
EnableFsAccessLog = config.Logger.EnableFsAccessLog; EnableFsAccessLog = config.Logger.EnableFsAccessLog;
EnableAvaloniaLog = config.Logger.EnableAvaloniaLog;
FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode; FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode;
OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value; OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value;
@@ -590,10 +580,16 @@ namespace Ryujinx.Ava.UI.ViewModels
config.RememberWindowState.Value = RememberWindowState; config.RememberWindowState.Value = RememberWindowState;
config.ShowTitleBar.Value = ShowTitleBar; config.ShowTitleBar.Value = ShowTitleBar;
config.HideCursor.Value = (HideCursorMode)HideCursor; config.HideCursor.Value = (HideCursorMode)HideCursor;
config.UpdateCheckerType.Value = (UpdaterType)UpdateCheckerType;
config.FocusLostActionType.Value = (FocusLostType)FocusLostActionType; if (GameDirectoryChanged)
config.UI.GameDirs.Value = [..GameDirectories]; {
config.UI.AutoloadDirs.Value = [..AutoloadDirectories]; config.UI.GameDirs.Value = [..GameDirectories];
}
if (AutoloadDirectoryChanged)
{
config.UI.AutoloadDirs.Value = [..AutoloadDirectories];
}
config.UI.BaseStyle.Value = BaseStyleIndex switch config.UI.BaseStyle.Value = BaseStyleIndex switch
{ {
@@ -607,18 +603,14 @@ namespace Ryujinx.Ava.UI.ViewModels
config.System.EnableDockedMode.Value = EnableDockedMode; config.System.EnableDockedMode.Value = EnableDockedMode;
config.Hid.EnableKeyboard.Value = EnableKeyboard; config.Hid.EnableKeyboard.Value = EnableKeyboard;
config.Hid.EnableMouse.Value = EnableMouse; config.Hid.EnableMouse.Value = EnableMouse;
config.Hid.DisableInputWhenOutOfFocus.Value = DisableInputWhenOutOfFocus;
// Keyboard Hotkeys // Keyboard Hotkeys
config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig(); config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig();
// System // System
config.System.Region.Value = (Region)Region; config.System.Region.Value = (Region)Region;
if (config.System.Language.Value != (Language)Language)
GameListNeedsRefresh = true;
config.System.Language.Value = (Language)Language; config.System.Language.Value = (Language)Language;
if (_validTzRegions.Contains(TimeZone)) if (_validTzRegions.Contains(TimeZone))
{ {
config.System.TimeZone.Value = TimeZone; config.System.TimeZone.Value = TimeZone;
@@ -629,7 +621,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.System.EnableFsIntegrityChecks.Value = EnableFsIntegrityChecks; config.System.EnableFsIntegrityChecks.Value = EnableFsIntegrityChecks;
config.System.DramSize.Value = DramSize; config.System.DramSize.Value = DramSize;
config.System.IgnoreMissingServices.Value = IgnoreMissingServices; config.System.IgnoreMissingServices.Value = IgnoreMissingServices;
config.System.IgnoreControllerApplet.Value = IgnoreApplet; config.System.IgnoreApplet.Value = IgnoreApplet;
// CPU // CPU
config.System.EnablePtc.Value = EnablePptc; config.System.EnablePtc.Value = EnablePptc;
@@ -687,7 +679,6 @@ namespace Ryujinx.Ava.UI.ViewModels
config.Logger.EnableGuest.Value = EnableGuest; config.Logger.EnableGuest.Value = EnableGuest;
config.Logger.EnableDebug.Value = EnableDebug; config.Logger.EnableDebug.Value = EnableDebug;
config.Logger.EnableFsAccessLog.Value = EnableFsAccessLog; config.Logger.EnableFsAccessLog.Value = EnableFsAccessLog;
config.Logger.EnableAvaloniaLog.Value = EnableAvaloniaLog;
config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode; config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode;
config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel; config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel;
@@ -709,7 +700,8 @@ namespace Ryujinx.Ava.UI.ViewModels
SaveSettingsEvent?.Invoke(); SaveSettingsEvent?.Invoke();
GameListNeedsRefresh = false; GameDirectoryChanged = false;
AutoloadDirectoryChanged = false;
} }
private static void RevertIfNotSaved() private static void RevertIfNotSaved()

View File

@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
namespace Ryujinx.Ava.UI.ViewModels namespace Ryujinx.Ava.UI.ViewModels
{ {
public partial class ProfileSelectorDialogViewModel : BaseModel public partial class UserSelectorDialogViewModel : BaseModel
{ {
[ObservableProperty] private UserId _selectedUserId; [ObservableProperty] private UserId _selectedUserId;

View File

@@ -66,10 +66,6 @@
Command="{Binding OpenRyujinxFolder}" Command="{Binding OpenRyujinxFolder}"
Header="{ext:Locale MenuBarFileOpenEmuFolder}" Header="{ext:Locale MenuBarFileOpenEmuFolder}"
ToolTip.Tip="{ext:Locale OpenRyujinxFolderTooltip}" /> ToolTip.Tip="{ext:Locale OpenRyujinxFolderTooltip}" />
<MenuItem
Command="{Binding OpenScreenshotsFolder}"
Header="{ext:Locale MenuBarFileOpenScreenshotsFolder}"
ToolTip.Tip="{ext:Locale OpenScreenshotFolderTooltip}"/>
<MenuItem <MenuItem
Command="{Binding OpenLogsFolder}" Command="{Binding OpenLogsFolder}"
Header="{ext:Locale MenuBarFileOpenLogsFolder}" Header="{ext:Locale MenuBarFileOpenLogsFolder}"

View File

@@ -52,7 +52,11 @@ namespace Ryujinx.Ava.UI.Views.Main
AboutWindowMenuItem.Command = Commands.Create(AboutWindow.Show); AboutWindowMenuItem.Command = Commands.Create(AboutWindow.Show);
CompatibilityListMenuItem.Command = Commands.Create(() => CompatibilityList.Show()); CompatibilityListMenuItem.Command = Commands.Create(() => CompatibilityList.Show());
UpdateMenuItem.Command = MainWindowViewModel.UpdateCommand; UpdateMenuItem.Command = Commands.Create(async () =>
{
if (Updater.CanUpdate(true))
await Updater.BeginUpdateAsync(true);
});
FaqMenuItem.Command = FaqMenuItem.Command =
SetupGuideMenuItem.Command = SetupGuideMenuItem.Command =

View File

@@ -23,7 +23,7 @@
Background="{DynamicResource ThemeContentBackgroundColor}" Background="{DynamicResource ThemeContentBackgroundColor}"
DockPanel.Dock="Bottom" DockPanel.Dock="Bottom"
IsVisible="{Binding ShowMenuAndStatusBar}" IsVisible="{Binding ShowMenuAndStatusBar}"
ColumnDefinitions="Auto,Auto,*,Auto,Auto,Auto"> ColumnDefinitions="Auto,Auto,*,Auto,Auto">
<StackPanel <StackPanel
Grid.Column="0" Grid.Column="0"
Margin="5" Margin="5"
@@ -283,28 +283,6 @@
<StackPanel <StackPanel
Grid.Column="4" Grid.Column="4"
Margin="0,0,5,0" Margin="0,0,5,0"
Orientation="Horizontal">
<StackPanel.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="EnableNonGameRunningControls" />
<Binding Path="UpdateAvailable" />
</MultiBinding>
</StackPanel.IsVisible>
<Button Margin="0, 0, 5, -2"
Command="{Binding UpdateCommand}"
Background="{DynamicResource SystemAccentColor}">
<TextBlock
Margin="-5"
Foreground="{StaticResource SystemColorButtonTextColor}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="{ext:Locale UpdaterBackgroundStatusBarButtonText}" />
</Button>
<controls:MiniVerticalSeparator Margin="5,0,0,0"/>
</StackPanel>
<StackPanel
Grid.Column="5"
Margin="0,0,5,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsVisible="{Binding ShowFirmwareStatus}" IsVisible="{Binding ShowFirmwareStatus}"
Orientation="Horizontal"> Orientation="Horizontal">

View File

@@ -74,10 +74,6 @@
ToolTip.Tip="{ext:Locale DebugLogTooltip}"> ToolTip.Tip="{ext:Locale DebugLogTooltip}">
<TextBlock Text="{ext:Locale SettingsTabLoggingEnableDebugLogs}" /> <TextBlock Text="{ext:Locale SettingsTabLoggingEnableDebugLogs}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding EnableAvaloniaLog}"
ToolTip.Tip="{ext:Locale AvaloniaLogTooltip}">
<TextBlock Text="{ext:Locale SettingsTabLoggingEnableAvaloniaLogs}" />
</CheckBox>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Stretch"> <StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Stretch">
<TextBlock VerticalAlignment="Center" <TextBlock VerticalAlignment="Center"
ToolTip.Tip="{ext:Locale FSAccessLogModeTooltip}" ToolTip.Tip="{ext:Locale FSAccessLogModeTooltip}"

View File

@@ -133,6 +133,12 @@
<ComboBoxItem> <ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabSystemSystemLanguageBrazilianPortuguese}" /> <TextBlock Text="{ext:Locale SettingsTabSystemSystemLanguageBrazilianPortuguese}" />
</ComboBoxItem> </ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabSystemSystemLanguageSwedish}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabSystemSystemLanguageNorwegian}" />
</ComboBoxItem>
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
<StackPanel <StackPanel
@@ -310,8 +316,8 @@
</CheckBox> </CheckBox>
<CheckBox <CheckBox
IsChecked="{Binding IgnoreApplet}" IsChecked="{Binding IgnoreApplet}"
ToolTip.Tip="{ext:Locale IgnoreControllerAppletTooltip}"> ToolTip.Tip="{ext:Locale IgnoreAppletTooltip}">
<TextBlock Text="{ext:Locale SettingsTabSystemIgnoreControllerApplet}" /> <TextBlock Text="{ext:Locale SettingsTabSystemIgnoreApplet}" />
</CheckBox> </CheckBox>
<CheckBox <CheckBox
IsChecked="{Binding EnableCustomVSyncInterval}" IsChecked="{Binding EnableCustomVSyncInterval}"

View File

@@ -1,4 +1,5 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity;
using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ava.UI.ViewModels;
using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;

View File

@@ -6,7 +6,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
xmlns:helper="clr-namespace:Ryujinx.Common.Helper;assembly=Ryujinx.Common"
mc:Ignorable="d" mc:Ignorable="d"
x:DataType="viewModels:SettingsViewModel"> x:DataType="viewModels:SettingsViewModel">
<Design.DataContext> <Design.DataContext>
@@ -31,57 +30,18 @@
ToolTip.Tip="{ext:Locale ToggleDiscordTooltip}" ToolTip.Tip="{ext:Locale ToggleDiscordTooltip}"
Text="{ext:Locale SettingsTabGeneralEnableDiscordRichPresence}" /> Text="{ext:Locale SettingsTabGeneralEnableDiscordRichPresence}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding CheckUpdatesOnStart}">
<TextBlock Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunch}" />
</CheckBox>
<CheckBox IsChecked="{Binding ShowConfirmExit}"> <CheckBox IsChecked="{Binding ShowConfirmExit}">
<TextBlock Text="{ext:Locale SettingsTabGeneralShowConfirmExitDialog}" /> <TextBlock Text="{ext:Locale SettingsTabGeneralShowConfirmExitDialog}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding RememberWindowState}"> <CheckBox IsChecked="{Binding RememberWindowState}">
<TextBlock Text="{ext:Locale SettingsTabGeneralRememberWindowState}" /> <TextBlock Text="{ext:Locale SettingsTabGeneralRememberWindowState}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding ShowTitleBar}" IsVisible="{x:Static helper:RunningPlatform.IsWindows}"> <CheckBox IsChecked="{Binding ShowTitleBar}" Name="ShowTitleBarBox">
<TextBlock Text="{ext:Locale SettingsTabGeneralShowTitleBar}" /> <TextBlock Text="{ext:Locale SettingsTabGeneralShowTitleBar}" />
</CheckBox> </CheckBox>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{ext:Locale SettingsTabGeneralFocusLossType}"
Width="150" />
<ComboBox SelectedIndex="{Binding FocusLostActionType}"
HorizontalContentAlignment="Left"
MinWidth="100">
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeDoNothing}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeBlockInput}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeMuteAudio}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeBlockInputAndMuteAudio}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypePauseEmulation}" />
</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunch}"
Width="150" />
<ComboBox SelectedIndex="{Binding UpdateCheckerType}"
HorizontalContentAlignment="Left"
MinWidth="100">
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunchOff}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunchPromptAtStartup}" />
</ComboBoxItem>
<ComboBoxItem>
<TextBlock Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunchBackground}" />
</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal"> <StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" <TextBlock VerticalAlignment="Center"
Text="{ext:Locale SettingsTabGeneralHideCursor}" Text="{ext:Locale SettingsTabGeneralHideCursor}"

View File

@@ -21,6 +21,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
public SettingsUiView() public SettingsUiView()
{ {
InitializeComponent(); InitializeComponent();
ShowTitleBarBox.IsVisible = OperatingSystem.IsWindows();
AddGameDirButton.Command = AddGameDirButton.Command =
Commands.Create(() => AddDirButton(GameDirPathBox, ViewModel.GameDirectories, true)); Commands.Create(() => AddDirButton(GameDirPathBox, ViewModel.GameDirectories, true));
AddAutoloadDirButton.Command = AddAutoloadDirButton.Command =
@@ -37,7 +38,10 @@ namespace Ryujinx.Ava.UI.Views.Settings
addDirBox.Clear(); addDirBox.Clear();
ViewModel.GameListNeedsRefresh = true; if (isGameList)
ViewModel.GameDirectoryChanged = true;
else
ViewModel.AutoloadDirectoryChanged = true;
} }
else else
{ {
@@ -47,7 +51,10 @@ namespace Ryujinx.Ava.UI.Views.Settings
{ {
directories.Add(folder.Value.Path.LocalPath); directories.Add(folder.Value.Path.LocalPath);
ViewModel.GameListNeedsRefresh = true; if (isGameList)
ViewModel.GameDirectoryChanged = true;
else
ViewModel.AutoloadDirectoryChanged = true;
} }
} }
} }
@@ -59,7 +66,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
foreach (string path in new List<string>(GameDirsList.SelectedItems.Cast<string>())) foreach (string path in new List<string>(GameDirsList.SelectedItems.Cast<string>()))
{ {
ViewModel.GameDirectories.Remove(path); ViewModel.GameDirectories.Remove(path);
ViewModel.GameListNeedsRefresh = true; ViewModel.GameDirectoryChanged = true;
} }
if (GameDirsList.ItemCount > 0) if (GameDirsList.ItemCount > 0)
@@ -75,7 +82,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
foreach (string path in new List<string>(AutoloadDirsList.SelectedItems.Cast<string>())) foreach (string path in new List<string>(AutoloadDirsList.SelectedItems.Cast<string>()))
{ {
ViewModel.AutoloadDirectories.Remove(path); ViewModel.AutoloadDirectories.Remove(path);
ViewModel.GameListNeedsRefresh = true; ViewModel.AutoloadDirectoryChanged = true;
} }
if (AutoloadDirsList.ItemCount > 0) if (AutoloadDirsList.ItemCount > 0)

View File

@@ -125,7 +125,7 @@
Background="Transparent" Background="Transparent"
Click="Button_OnClick" Click="Button_OnClick"
CornerRadius="15" CornerRadius="15"
Tag="https://discord.gg/PEuzjrFXUA" Tag="https://discord.gg/dHPrkBkkyA"
ToolTip.Tip="{ext:Locale AboutDiscordUrlTooltipMessage}"> ToolTip.Tip="{ext:Locale AboutDiscordUrlTooltipMessage}">
<Image Source="{Binding DiscordLogo}" /> <Image Source="{Binding DiscordLogo}" />
</Button> </Button>
@@ -142,40 +142,42 @@
<Grid <Grid
Grid.Column="2" Grid.Column="2"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" RowDefinitions="Auto,Auto,Auto"> VerticalAlignment="Stretch" RowDefinitions="Auto,Auto">
<StackPanel <StackPanel
Grid.Row="0" Grid.Row="0"
Margin="0,10,0,0"
Spacing="2"> Spacing="2">
<TextBlock <TextBlock
Classes="h1" FontSize="15"
FontWeight="Bold" FontWeight="Bold"
Text="{ext:Locale AboutRyujinxAboutTitle}" /> Text="{ext:Locale AboutRyujinxAboutTitle}" />
<TextBlock <TextBlock
FontSize="10"
Text="{ext:Locale AboutRyujinxAboutContent}" Text="{ext:Locale AboutRyujinxAboutContent}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</StackPanel> </StackPanel>
<Separator Grid.Row="1" Margin="0,20" />
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="1"
Margin="0,10,0,0"
Spacing="2"> Spacing="2">
<TextBlock <TextBlock
Classes="h1" FontSize="15"
FontWeight="Bold" FontWeight="Bold"
Text="{ext:Locale AboutRyujinxMaintainersTitle}" /> Text="{ext:Locale AboutRyujinxMaintainersTitle}" />
<TextBlock <TextBlock
FontSize="10"
Margin="0, 0, 0, 5" Margin="0, 0, 0, 5"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Developers}"/> Text="{Binding Developers}"/>
<TextBlock <TextBlock
Classes="h1" FontSize="15"
FontWeight="Bold" FontWeight="Bold"
Text="{ext:Locale AboutRyujinxFormerMaintainersTitle}" /> Text="{ext:Locale AboutRyujinxFormerMaintainersTitle}" />
<TextBlock <TextBlock
FontSize="11" FontSize="10"
Text="{Binding FormerDevelopers}" Text="{Binding FormerDevelopers}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<Button <Button
Margin="0, 5, 0, 0"
Padding="5" Padding="5"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Background="Transparent" Background="Transparent"

View File

@@ -18,6 +18,8 @@ namespace Ryujinx.Ava.UI.Windows
{ {
public AboutWindow() public AboutWindow()
{ {
DataContext = new AboutWindowViewModel();
InitializeComponent(); InitializeComponent();
GitHubRepoButton.Tag = GitHubRepoButton.Tag =
@@ -26,14 +28,12 @@ namespace Ryujinx.Ava.UI.Windows
public static async Task Show() public static async Task Show()
{ {
using AboutWindowViewModel viewModel = new();
ContentDialog contentDialog = new() ContentDialog contentDialog = new()
{ {
PrimaryButtonText = string.Empty, PrimaryButtonText = string.Empty,
SecondaryButtonText = string.Empty, SecondaryButtonText = string.Empty,
CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose], CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
Content = new AboutWindow { DataContext = viewModel } Content = new AboutWindow()
}; };
Style closeButton = new(x => x.Name("CloseButton")); Style closeButton = new(x => x.Name("CloseButton"));

View File

@@ -21,9 +21,7 @@
x:DataType="viewModels:MainWindowViewModel" x:DataType="viewModels:MainWindowViewModel"
mc:Ignorable="d" mc:Ignorable="d"
WindowStartupLocation="Manual" WindowStartupLocation="Manual"
Focusable="True" Focusable="True">
GotFocus="InputElement_OnGotFocus"
LostFocus="InputElement_OnLostFocus">
<Window.Styles> <Window.Styles>
<Style Selector="TitleBar:fullscreen"> <Style Selector="TitleBar:fullscreen">
<Setter Property="Background" Value="#000000" /> <Setter Property="Background" Value="#000000" />

View File

@@ -1,7 +1,6 @@
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Threading; using Avalonia.Threading;
@@ -20,7 +19,6 @@ using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.Utilities; using Ryujinx.Ava.Utilities;
using Ryujinx.Ava.Utilities.AppLibrary; using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Ava.Utilities.Configuration; using Ryujinx.Ava.Utilities.Configuration;
using Ryujinx.Ava.Utilities.Configuration.UI;
using Ryujinx.Common; using Ryujinx.Common;
using Ryujinx.Common.Helper; using Ryujinx.Common.Helper;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
@@ -140,23 +138,7 @@ namespace Ryujinx.Ava.UI.Windows
NotificationHelper.SetNotificationManager(this); NotificationHelper.SetNotificationManager(this);
Executor.ExecuteBackgroundAsync(async () => Executor.ExecuteBackgroundAsync(ShowIntelMacWarningAsync);
{
await ShowIntelMacWarningAsync();
FilePath firmwarePath = CommandLineState.FirmwareToInstallPathArg;
if (firmwarePath is not null)
{
if ((firmwarePath.ExistsAsFile && firmwarePath.Extension is "xci" or "zip") ||
firmwarePath.ExistsAsDirectory)
{
await Dispatcher.UIThread.InvokeAsync(() =>
ViewModel.HandleFirmwareInstallation(firmwarePath));
CommandLineState.FirmwareToInstallPathArg = null;
}
else
Logger.Notice.Print(LogClass.UI, "Invalid firmware type provided. Path must be a directory, or a .zip or .xci file.");
}
});
} }
private void OnScalingChanged(object sender, EventArgs e) private void OnScalingChanged(object sender, EventArgs e)
@@ -189,12 +171,17 @@ namespace Ryujinx.Ava.UI.Windows
{ {
Dispatcher.UIThread.Post(() => Dispatcher.UIThread.Post(() =>
{ {
List<LdnGameData> ldnGameDataArray = e.LdnData.ToList();
ViewModel.LdnData.Clear(); ViewModel.LdnData.Clear();
foreach (ApplicationData application in ViewModel.Applications.Where(it => it.HasControlHolder)) foreach (ApplicationData application in ViewModel.Applications.Where(it => it.HasControlHolder))
{ {
ref ApplicationControlProperty controlHolder = ref application.ControlHolder.Value; ref ApplicationControlProperty controlHolder = ref application.ControlHolder.Value;
ViewModel.LdnData[application.IdString] = e.LdnData.Where(ref controlHolder); ViewModel.LdnData[application.IdString] =
LdnGameData.GetArrayForApp(
ldnGameDataArray,
ref controlHolder
);
UpdateApplicationWithLdnData(application); UpdateApplicationWithLdnData(application);
} }
@@ -413,21 +400,10 @@ namespace Ryujinx.Ava.UI.Windows
await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys)); await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
} }
if (!Updater.CanUpdate() || CommandLineState.HideAvailableUpdates) if (ConfigurationState.Instance.CheckUpdatesOnStart && !CommandLineState.HideAvailableUpdates && Updater.CanUpdate())
return;
switch (ConfigurationState.Instance.UpdateCheckerType.Value)
{ {
case UpdaterType.PromptAtStartup: await Updater.BeginUpdateAsync()
await Updater.BeginUpdateAsync() .Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
.Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
break;
case UpdaterType.CheckInBackground:
if ((await Updater.CheckVersionAsync()).TryGet(out (Version Current, Version Incoming) versions))
{
Dispatcher.UIThread.Post(() => RyujinxApp.MainWindow.ViewModel.UpdateAvailable = versions.Current < versions.Incoming);
}
break;
} }
} }
@@ -773,119 +749,5 @@ namespace Ryujinx.Ava.UI.Windows
_intelMacWarningShown = true; _intelMacWarningShown = true;
} }
private void InputElement_OnGotFocus(object sender, GotFocusEventArgs e)
{
if (ViewModel.AppHost is null) return;
if (!_focusLoss.Active)
return;
switch (_focusLoss.Type)
{
case FocusLostType.BlockInput:
{
if (!ViewModel.AppHost.NpadManager.InputUpdatesBlocked)
{
_focusLoss = default;
return;
}
ViewModel.AppHost.NpadManager.UnblockInputUpdates();
_focusLoss = default;
break;
}
case FocusLostType.MuteAudio:
{
if (!ViewModel.AppHost.Device.IsAudioMuted())
{
_focusLoss = default;
return;
}
ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute);
_focusLoss = default;
break;
}
case FocusLostType.BlockInputAndMuteAudio:
{
if (!ViewModel.AppHost.Device.IsAudioMuted())
goto case FocusLostType.BlockInput;
ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute);
ViewModel.AppHost.NpadManager.UnblockInputUpdates();
_focusLoss = default;
break;
}
case FocusLostType.PauseEmulation:
{
if (!ViewModel.AppHost.Device.System.IsPaused)
{
_focusLoss = default;
return;
}
ViewModel.AppHost.Resume();
_focusLoss = default;
break;
}
}
}
private (FocusLostType Type, bool Active) _focusLoss;
private void InputElement_OnLostFocus(object sender, RoutedEventArgs e)
{
if (ConfigurationState.Instance.FocusLostActionType.Value is FocusLostType.DoNothing)
return;
if (ViewModel.AppHost is null) return;
switch (ConfigurationState.Instance.FocusLostActionType.Value)
{
case FocusLostType.BlockInput:
{
if (ViewModel.AppHost.NpadManager.InputUpdatesBlocked)
return;
ViewModel.AppHost.NpadManager.BlockInputUpdates();
_focusLoss = (FocusLostType.BlockInput, ViewModel.AppHost.NpadManager.InputUpdatesBlocked);
break;
}
case FocusLostType.MuteAudio:
{
if (ViewModel.AppHost.Device.GetVolume() is 0)
return;
ViewModel.VolumeBeforeMute = ViewModel.AppHost.Device.GetVolume();
ViewModel.AppHost.Device.SetVolume(0);
_focusLoss = (FocusLostType.MuteAudio, ViewModel.AppHost.Device.GetVolume() is 0f);
break;
}
case FocusLostType.BlockInputAndMuteAudio:
{
if (ViewModel.AppHost.Device.GetVolume() is 0)
goto case FocusLostType.BlockInput;
ViewModel.VolumeBeforeMute = ViewModel.AppHost.Device.GetVolume();
ViewModel.AppHost.Device.SetVolume(0);
ViewModel.AppHost.NpadManager.BlockInputUpdates();
_focusLoss = (FocusLostType.BlockInputAndMuteAudio, ViewModel.AppHost.Device.GetVolume() is 0f && ViewModel.AppHost.NpadManager.InputUpdatesBlocked);
break;
}
case FocusLostType.PauseEmulation:
{
if (ViewModel.AppHost.Device.System.IsPaused)
return;
ViewModel.AppHost.Pause();
_focusLoss = (FocusLostType.PauseEmulation, ViewModel.AppHost.Device.System.IsPaused);
break;
}
}
}
} }
} }

View File

@@ -45,7 +45,7 @@ namespace Ryujinx.Ava.UI.Windows
{ {
InputPage.InputView?.SaveCurrentProfile(); InputPage.InputView?.SaveCurrentProfile();
if (Owner is MainWindow window && ViewModel.GameListNeedsRefresh) if (Owner is MainWindow window && (ViewModel.GameDirectoryChanged || ViewModel.AutoloadDirectoryChanged))
{ {
window.LoadApplications(); window.LoadApplications();
} }

View File

@@ -43,18 +43,7 @@ namespace Ryujinx.Ava
private const int ConnectionCount = 4; private const int ConnectionCount = 4;
private static string _buildVer; private static string _buildVer;
private static string _platformExt;
private static readonly string _platformExt =
RunningPlatform.IsMacOS
? "macos_universal.app.tar.gz"
: RunningPlatform.IsWindows
? "win_x64.zip"
: RunningPlatform.IsX64Linux
? "linux_x64.tar.gz"
: RunningPlatform.IsArmLinux
? "linux_arm64.tar.gz"
: throw new PlatformNotSupportedException();
private static string _buildUrl; private static string _buildUrl;
private static long _buildSize; private static long _buildSize;
private static bool _updateSuccessful; private static bool _updateSuccessful;
@@ -62,8 +51,30 @@ namespace Ryujinx.Ava
private static readonly string[] _windowsDependencyDirs = []; private static readonly string[] _windowsDependencyDirs = [];
public static async Task<Optional<(Version Current, Version Incoming)>> CheckVersionAsync(bool showVersionUpToDate = false) public static async Task BeginUpdateAsync(bool showVersionUpToDate = false)
{ {
if (_running)
{
return;
}
_running = true;
// Detect current platform
if (OperatingSystem.IsMacOS())
{
_platformExt = "macos_universal.app.tar.gz";
}
else if (OperatingSystem.IsWindows())
{
_platformExt = "win_x64.zip";
}
else if (OperatingSystem.IsLinux())
{
string arch = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "arm64" : "x64";
_platformExt = $"linux_{arch}.tar.gz";
}
if (!Version.TryParse(Program.Version, out Version currentVersion)) if (!Version.TryParse(Program.Version, out Version currentVersion))
{ {
Logger.Error?.Print(LogClass.Application, $"Failed to convert the current {RyujinxApp.FullAppName} version!"); Logger.Error?.Print(LogClass.Application, $"Failed to convert the current {RyujinxApp.FullAppName} version!");
@@ -74,7 +85,7 @@ namespace Ryujinx.Ava
_running = false; _running = false;
return default; return;
} }
Logger.Info?.Print(LogClass.Application, "Checking for updates."); Logger.Info?.Print(LogClass.Application, "Checking for updates.");
@@ -112,7 +123,7 @@ namespace Ryujinx.Ava
_running = false; _running = false;
return default; return;
} }
break; break;
@@ -138,7 +149,7 @@ namespace Ryujinx.Ava
_running = false; _running = false;
return default; return;
} }
} }
catch (Exception exception) catch (Exception exception)
@@ -150,7 +161,7 @@ namespace Ryujinx.Ava
_running = false; _running = false;
return default; return;
} }
if (!Version.TryParse(_buildVer, out Version newVersion)) if (!Version.TryParse(_buildVer, out Version newVersion))
@@ -163,27 +174,9 @@ namespace Ryujinx.Ava
_running = false; _running = false;
return default;
}
return (currentVersion, newVersion);
}
public static async Task BeginUpdateAsync(bool showVersionUpToDate = false)
{
if (_running)
{
return; return;
} }
_running = true;
Optional<(Version, Version)> versionTuple = await CheckVersionAsync(showVersionUpToDate);
if (_running is false || !versionTuple.HasValue) return;
(Version currentVersion, Version newVersion) = versionTuple.Value;
if (newVersion <= currentVersion) if (newVersion <= currentVersion)
{ {
if (showVersionUpToDate) if (showVersionUpToDate)

Some files were not shown because too many files have changed in this diff Show More