koying / SPMC

fork of xbmc/kodi
Other
635 stars 257 forks source link

¿Auto resolution switch? #1060

Open salondigital opened 6 years ago

salondigital commented 6 years ago

Hi Koying,

First of all congrats for your amazing work ;)

I read that Shield Experience 6.0 has the possibility to change (automatically) resolution. For ex., when I play a 1080p file and my Shield it's setted to 4K, SPMC change the resolution to native content (1080). With this, my TV recive the signal at 1080 and then upscale to 4K (a far better job than Shield).

Do you have any SPK for testing with this feature enabled? Any ETA for Alpha build with this?

Thanks again ;)

MajorPump commented 6 years ago

It's there already, set resolution in SPMC to 1080p. 1080p content plays at 1080p and 4k content changes resolution to 2160p. Coloor space, however, remains unaltered.

As a small hijack, A question to the more knowledgable, if I set SPMC resolution to 1080p I only get refresh rate options for the GUI in the line below of 23.97, 24, 29.97 and 30, is that correct or am I bugged? Refresh rate switch for source playback occurs correctly.

salondigital commented 6 years ago

Hi!

Yes, exactly. I did some test:

A) Panasonic VT30 Plasma 1080p TV. If I setted to 720p@60 (SPMC/Kodi) and play 720p file, the system keeps 720p (24 hz) resolution passtrough and the TV did the scale. If I play 1080p. the sytem changes to 1080@24 and when will finish, return to 720@60. Perfect. All color space is correct (REC.709).

B) 4K Samsung KS8000. If I setted to 1080p@60 (SPMC/Kodi) and play 1080p file, the system keeps 1080p (24 hz) resolution passtrough and the TV did the scale. If I play 4K. the sytem changes to 4K@24 and when will finish, return to 1080@60. BUT the color space doesn't change (always is setted to REC.709, incorrect because 4K needs BT.2020).

And I confirm the bug that in 1080p (in Kodi/SPMC) I can't change to 50 or 60 Hz. For ex., I played live tv (1080i 50 fps) and Kodi upscale to 4K OR send in 1080@25 (not 50).

Thanks!

MajorPump commented 6 years ago

But are you able to select 1920x1080 and refresh rates of 50, 59.94, 60 etc. in Systems->Video?

I only have options for 23.97, 24, 29.97 and 30 no other refresh rates but if I set my Shield to 1080p 59.97 SPMC sees my full range of refresh rates as normal for 1080 in the same setting option.

salondigital commented 6 years ago

Only 23.97, 24, 25, 29.97 and 30 :(

MajorPump commented 6 years ago

Glad it's not just me :)

When I'm back in front of my Shield I'll have to upload some logs and open an issue to ask Koying if it's a bug, hardware issue or intentional.

CLFNole commented 6 years ago

I tried this out setting SPMC to 1080p. It does show 1080p when playing 1080p movies but does that mean it is passing through 1080p to the TV (Sony in my case) which is then upscaling to 4K? When I checked out 4K movies display showed 4K but is the 4K also just be passed through to the TV? My TV HDR picture setting has Color set at BT2020 even though Shield is set for 709.

xonicrain commented 6 years ago

"Only 23.97, 24, 25, 29.97 and 30 :(" Kodi isn't changing color space and you have to live with the limitations of the selected hdmi mode/color space. Probably because there is no way to do so for now. Change the HDMI Mode of your Shield manually to (unswitching default setting) 3840x2160 59,940 Hz YUV 422 12 Bit Rec. 2020. You should now see up to 60 Hz in Kodi at 1080p.

esoteradactyl commented 6 years ago

Switching the shields ouput resolution from 10-bit to 12-bit bt2020 fixed things for me. I was then able to see refresh rates above 30.

Unfortunately color space doesn't change when playing 1080p content :(

MajorPump commented 6 years ago

I can confirm changing 10-bit to 12-bit rec. 2020 also gave me back the full set of refresh rate options above 30 Hz as well

koying commented 6 years ago

Might be worth mentioning to Nvidia. Personally, I use 1080p 4:4:4, and I have the full set of refresh rates, but might be TV/AVR dependent.

koying commented 6 years ago

To all looking for this issue, look in your logs to:

11:09:17.082 T:1525668128   DEBUG: CEGLNativeTypeAndroid: current mode: 45: 3840x2160@59.940060
11:09:17.083 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 45: 3840x2160@59.940060
11:09:17.083 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 47: 3840x2160@60.000000
11:09:17.083 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 48: 3840x2160@50.000000
11:09:17.083 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 49: 3840x2160@24.000000
11:09:17.083 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 50: 3840x2160@25.000000
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 51: 3840x2160@30.000000
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 54: 1920x1080@24.000000
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 55: 1920x1080@30.000000
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 56: 3840x2160@23.976025
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 57: 3840x2160@29.970030
11:09:17.084 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 60: 1920x1080@23.976025
11:09:17.085 T:1525668128   DEBUG: CEGLNativeTypeAndroid: available mode: 61: 1920x1080@29.970030

This is exactly what is reported to SPMC/Kodi by the system. If some modes are missing, it should be reported to Nvidia as a bug

wesk05 commented 6 years ago

Since there is no switching of color space on the Shield, no 1080p (or 720p) resolutions should be listed when the color space is set to Rec. 2020. Rec. 2020 (BT.2020) only supports 4K & 8K.

Njur commented 6 years ago

When setting the Shield to 1080p, SPMC works with auto resolution switching but apps like Netflix won't show 4k and HDR, is that correct?

MajorPump commented 6 years ago

Don't set the Shield to 1080p keep it a 4K, set SPMC/Kodi/MrMC to 1080p, that way Netflix and Amazon still show full content. Remember though that colorspace does not change so 1080p rec. 709 is mapped to rec. 2020 also some of us have found a far greater range of refresh rate options for SPMC if we set the Shield at 4K YUV 422 12-Bit rec. 2020 instead of YUV 420 10-Bit rec. 2020.

rfgamaral commented 6 years ago

Why cant I just keep all my GUIs at 4K and have the resolution auto-switch to 1080p when such a source is detected? Why does everyone keep recommending one to set 1080p resolutions on 4K TVs? Is auto-resolution switching from higher to lower resolutions not yet supported? Because a 1080p GUI on a big 4K TV will just look horrible.

MajorPump commented 6 years ago

It is what it is, if you prefer have the Shield do it's crappy upscaling instead, if you want different keep on at NVidia to make available correct APIs, Koying works with what he has available. Oh and for your info the SPMC doesn't look "horrible" on big 4K TV ;)

Njur commented 6 years ago

I have already lanczos scaling in SPMC, so are you saying that the TV does better job than the Shield with SPMC scaling capabilities? I have a B6 and soon a POS9002.

MajorPump commented 6 years ago

A good TV's upscalers will always be far superior to anything that can be done in software (in the case of lanczos3) and the Shield's hardware scaler algorithms since they have engines specifically dedicated to the task. This is why the "Holy Grail" is resolution switching (which would be made even more perfect with colorspace switching).

Switching off mediacodec (surface) and using the software implementation upscaler lanczos3 does give an improved image quality over Shield hardware scalers but at the cost of having to go back into settings to switch mediacodec (surface) back on to watch an HDR source and as I have said even that image quality pales in comparison to what your TV can do.

Njur commented 6 years ago

Okay thanks for the elaborating answer. So let me ask an extra question, since you clearly know what you are talking about:)

In current state will you say it is a better option to select 4K YUV 422 12-Bit rec. 2020 on Shield and 1080p in SPMC and the colorspace will be wrong instead of having Lanczos scaling with SPMC?

My biggest problem is that if I select YUV 422/420 on the Shield the colors in general looks outwashed. If I select RGB 8 bit and get very good colors. I know source material are often YCBCR 4:2:0, but it just doesn't look good in my opinion. My Shields are in version 5.0.2, so I'm kind of afraid to update, but the new features are promising.

rfgamaral commented 6 years ago

It is what it is, if you prefer have the Shield do it's crappy upscaling instead, if you want different keep on at NVidia to make available correct APIs, Koying works with what he has available.

Sorry if I sounded ungrateful on my original post, it was not my intent. I understand that Koying does what it can with what he's given, no more can we ask of him and we already ask too much. Please don't get me wrong, I was not complaining. I'm just trying to understand what the issue really is.

So, SPMC (and all other players like Kodi) can properly switch resolutions and framerate given their GUI is set to 1080p instead of 4K. That way, if I play a 1080p source, the TV will do the upscaling and a 4K source, well, it will play at 4K. Right? So far so good.

Oh and for your info the SPMC doesn't look "horrible" on big 4K TV ;) Well, I have a 65" TV and I'm like 2.5/3m (8.2/9.8feet) away from it. SPMC, Kodi or whatever application that is rendered at 1080p instead of the native 4K of my TV looks horrible. It's a matter of taste and standards, and to me, GUIs all stretched out like that on my TV don't look that great.

Now I understand there's a compromise, either I'll have good looking GUIs or awesome video upscaling. That's the current state of things, I get it now. What I'm trying to understand is where exactly is the problem? Is there any more detailed information about these incorrect APIs? Android has no bugs regarding these APIs? Is it only NVIDIA's fault? In all honesty, I'm just trying to understand and learn more about the problem.

rfgamaral commented 6 years ago

@Njur

I'm somewhat in the same boat, trying to pick the right settings. I've already upgraded myself and I've posted a few questions regarding this topic here, if you're interested.

I'm thinking, we can pick that mode (YUV 422, Rec.2020, as recommended on that topic) and then just tweak the TV color settings to match whatever each one of us consider "very good colors". You'd simply have to switch (on your TV) between a "Movie" and an "HDR" mode, depending on the content.

Wouldn't that work for you?

wrxtasy commented 6 years ago

To sum it up:

The Holy grail is hands off - Auto refresh and Auto Resolution switching from 1080p > 4K only when you actually playback 4K content. If that 4K content also happens to be HDR10 then you want correct colorspace mapping as well working after you Auto Resolution switch. That is currently what is busted on the Shield.

At least NVIDIA are attempting to step in the right direction. They need to due to the Shield's poor picture upscaler implementation.

This is all designed, as already mentioned so that your 4K TV's superior upscaling hardware does all the 1080p > 4K upscaling for the majority of your video content, which will mostly be 1080p.

All this auto switching works properly already, and has done so for some time now on Linux based 4K HDR Kodi media players like the AMLogic S905X Vero 4K and S905(X) / S912 LibreELEC Kodi Krypton boxes.

The developers on those boxes have big advantages tho as they get to have direct control of the Linux Kernel used and custom patch Kodi to support their custom Kernel.

EDIT: The other point to make for those using non HDR 10bit TV's is the Vero / LibreELEC Krypton boxes mentioned above has support for HDR > SDR colorspace mapping which does not work on the Shield yet.

MajorPump commented 6 years ago

Yep, just bought myself a Vero 4K (will arrive today), held off for ages because I really wanted a one box solution but finally jumped on the Vero because of all the good things I've heard about it and the community :)

JesCR commented 6 years ago

So the Vero 4K can do it right? 1080p to the tv in Rec709 -> TV upscale to 4k 4k HDR to the tv with BT2020 -> The tv plays at 4k HDR with the proper color space

And (sorry for the offtopic) What about HDR10 and Dolby Vision? What about 3D MVC ISO playback?

rpx91 commented 6 years ago

Vero 4k can't do 3D MVC yet but it's on their radar - https://discourse.osmc.tv/t/playback-of-packed-3d-3d-iso/37125

koying commented 6 years ago

Amlogic can decode 3D MVC since forever, but: 1) It is via the "old" amplayer decoder. Mediacodec has no support for 3D, whatsoever 2) It's decoded to HSBS (or HTAB, can't remember), so no full 3D

So yeah, there is hope for linux/LibreElec users, but little for android

lcohen999 commented 6 years ago

I have a quick question on all this. When I set SPMC to 1080p, I find that the animation, et. all is not as smooth as when setting SPMC to 4k.

Not that it is a huge deal but is there a way to resolve this?

Njur commented 6 years ago

According to this Nvidia are saying it's up to app developers to get auto color space to work with auto resolution change. Is that really true app developers should fix this and not Nvidia? It more looks like Nvidia comes with bad excuses.. https://forums.geforce.com/default/topic/1027516/shield-tv/shield-experience-upgrade-6-1-for-shield-tv-released-10-30-2017-/8/

koying commented 6 years ago

According to this Nvidia are saying it's up to app developers to get auto color space to work with auto resolution change

I don't read that. Manuel says the colorspace you choose in the shield settings are kept

Njur commented 6 years ago

Hi Chris. Thanks for the answer. But that wouldn't make sense if it have auto resolution change and not auto colorspace change. So when playing 4k HDR and try to use rec709 or am I misunderstanding something?

JesCR commented 6 years ago
> I don't read that.
Manuel says the colorspace you choose in the shield settings are kept

So if we setup the shield in 1080p rec709: -If we play 1080p content, it works fine and the tv scales to 4k -If we play 4k/HDR content the resolution changes to 2160p, BUT the space color don't change to BT2020: saturated or desaturated colors, color clipping etc

If we setup the shield in 2160p bt2020: -The shield scales (poorly) the 1080p content to 4k resulting in a bad picture quality.

So there is no way to setup the shield and play 1080p/4k HDR without problems?

classicjazz commented 6 years ago

@koying

My understanding is that:

For the Shield TV with Shield Experience 6.0, it is now possible for application developers to specify a lower resolution. However, it is not possible for an application developer to change the colorspace from Rec. 2020 to Rec. 709 on the fly. Since Rec. 2020 is only for 4K and 8K resolutions, users must set their settop to Rec. 709 for all videos. The problem with Rec.709 is two-fold for native 4K content: first, users cannot watch HDR content (high dynamic range or more grayscale). Second, users lose wide color gamut (richer, more saturated colors).

I go into a lot more detail including a comparison with MPV, Vulkan, and RAVU prescalers here.

Additionally, I have been prototyping configuration settings for Nvidia Shield using MPV and RAVU on OpenGL on a Retina 5K iMac here. (The Mac doesn't natively support Vulkan).

Obviously, Kodi uses VideoPlayer, not libmpv. But perhaps MPV could be configured as an external player or Kodi could implement a similar Vulkan and RAVU graphics layer + upscaler.

koying commented 6 years ago

I don't say it's good ;) I just say app developers have zero control on the colorspace, so I cannot change it from within spmc/kodi.

The existing Android api only allows to select "modes", which only reference resolution + refreshrate: https://developer.android.com/reference/android/view/Display.Mode.html

Njur commented 6 years ago

So who do we ask to get this to work correctly? Nvidia or developers?

lorcantc commented 6 years ago

So for now, when I'm watching mostly 1080p in SPMC, and on the odd occasion 4k on the Netflix app, on my 4k TV I should have the Shield set to 1080p, and change to 4k manually when I want to watch 4k on Netflix? Is that correct?

Or set the Shield to 4k and the SPMC GUI to 1080p? I'm not sure which guide to use in the wiki any more.

rfgamaral commented 6 years ago

Or set the Shield to 4k and the SPMC GUI to 1080p?

This.

Personally I use the SPMC GUI at 4K because at 1080p the posters on my 65" TV just look horrible and I can't stand that. Yes, the picture quality is not perfect because the TV upscaler is better and not being used. It's a trade off.

Njur commented 6 years ago

My question is still. who do we ask to get auto colorspace to work correctly? Nvidia or developers? As far as I Can see it is the only thing missing in Nvidia Shield for it to be perfect. How big is the problem with wrong color space

Alamei commented 6 years ago

Out of curiosity, does the newer Android API prevent an app from lowering the resolution in an automated fashion (i.e., only allows upward shifts in resolution modes), or was implementing it that way simply a choice made by the Kodi developers?

Njur commented 6 years ago

Anyone?

tfmaiden commented 6 years ago

After trying different settings today I noticed that, at least with the official Kodi app, if I set the shield to 1080p bt.709 and then play some 4k HDR videos the resolution will automatically change to 4k bt.2020 and then come back to 1080p after I stop the video, however, it doesn't work the other way around.

rpx91 commented 6 years ago

Just tried it on mine - it works! Thanks for letting us know. Finally can use my Shield again regularly.

koying commented 6 years ago

however, it doesn't work the other way around

The other way around works in SPMC 17.6a2. Doesn't seem likely to happen in Kodi, though, for, imho, very wrong reasons: https://github.com/xbmc/xbmc/pull/13191

rpx91 commented 6 years ago

So I was messing around with PlexConnect and had to uninstall and reinstall Kodi. Now the auto res/colour space switching no longer works. It seems really buggy.

But it works perfectly on SPMC

fabrizio5680 commented 6 years ago

I can't get my shield to 1) switch as per @tfmaiden comment, which when i read it I was a bit excited about.. 2) SPMC to do auto change resolution downwards, only works if I set GUI to 1080 and then auto switches when watching 4k content to 2160.

Using SPMC-spmc-krypton-1f9a682-armeabi-v7a.apk and Shield (2017 16gb) running 6.2

If you could provide more details as to how you're getting this to work would me much appreciated :)

Thanks for all the hard work

fergaldoyle commented 6 years ago

My Shield doesn't offer the option of 3840x2160 - 59,940Hz - YUV 422 12-bit Rec. 2020. The max I can use is 30Hz @ Rec 2020.

Is a limitation of my TV?

woiza commented 6 years ago

Is it possible to have two have shortcuts on the Shield's main screen / launcher for faster switching between resolutions and color spaces? E.g. one for 1080p RGB and one for 4K YUV 4:2:2 12 bit.

mika91 commented 6 years ago

I have a FHD TV, so if I set to 1080p@60 (SPMC/Kodi) and play 720p file, the system will change to 720p@24, or will stay at 1080p ? I'd like to use my tv to perform the upscaling. Thanks

mpiet1 commented 6 years ago

I saw in PR https://github.com/xbmc/xbmc/pull/13191 some commits. Are the changes integrated in a test build? If yes, please add a link to a SPMC / KODI build for nvidia shield.

MajorPump commented 6 years ago

All development of SPMC has finished. Koying has joined the MrMC team. SPMC is now no more.

mpiet1 commented 6 years ago

I read about Koying finished working for SPMC. @koying, thanks for your great work! I saw in the PR some commits by Koying 18 days ago, that some days after the sad leaving news...