-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Super-xBR and NNEDI3 for chroma prescaling #3226
Comments
You could make a copy of the super xbr code and run it using the I don't really want to introduce more of the prescaling nonsense into mpv, preferably move it out to user shaders wherever possible. |
Ah okay, thanks for the info! |
Just to make sure, would it be in the pre-shaders section or scale-shader? |
Neither, I meant |
Oops, my bad. I'll take a look at that option, thanks! |
Ah I missed it because the PDF that came with the Windows build didn't list that option. I see it on the website. On a off topic note (let me know if I should open another issue), I don't see anywhere where superxbr-sharpness or superxbr-edge-strength is explained, but by reading your code, I can figure out the range at least. |
@Aktanusa I updated the |
Thanks a lot! I'll take a look when I get back from work. |
Neato. although using nnedi3-nns32-win8x6.hook works perfectly fine, but the -chroma version of it becomes a slideshow. The video I'm playing is 720x480 yuv420p. I would think that even though it's doing it over 2 planes, it's still 1/4 of the pixels per plane, so it's still processing 1/2 the pixels overall. I don't know enough about how this shader works though to know if that's equivalent though. |
@paulguy You are correct, chroma-only prescaling should be two times faster. And it's the case for My guess is it's due to compiler optimization working poorly on EDIT: I checked all the combinations and it seems that |
@bjin wow, looks great! Seems to do exactly what I want. Now to get off my lazy ass and compile a Windows build, or install Linux, though AMD drivers on Linux is iffy, lol. Edit: Just curious, does the -yuv version perform better than -all on YUV sources hence why that option is there? |
They should be the same if you are playing YUV video only (and have a decent GLSL compiler to remove dead code). As for the reason providing a YUV only version, it's not recommended to apply luma prescaler to RGB video, since highly visible artifacts will be produced (much worse than chroma prescaling). |
Ah, thanks for your answer. Now excuse my ignorance, but I thought super-xBR was originally meant for pixel art, which I thought would be in RGB. I would think there wouldn't be artifacts with it, unless you mean the artifacts are with nnedi3? |
Super-xBR was refactored to work on luma plane only when it was ported to mpv. The motivation behind this move at that time was that not to introduce prescaling on both luma and RGB (to avoid increasing maintain code of prescaling code). This isn't true anymore with @haasn's new hook system. It's now possible to add a version of Super-xBR that works properly on RGB (with either luma plane from source, or some random colormatrix). But until then, please don't use current "-all" version which literally applies luma prescaling on "R" and "G" and "B" separately. |
Thanks for the explanation and patience with me! Now I understand and won't use "-all" on RGB sources. It also explains why with the original code @haasn implemented didn't apply to RGB sources, since it didn't make sense. |
Note that superxbr could also probably be refactored to scale R,G,B simultaneously (using matrices instead of vectors). I did manage to get a proof-of-concept of this working once, so if you really care about RGB scaling and performance you could try to apply it yourself. |
@Aktanusa I made some changes to |
@bjin Thanks so much for all your work! I'll try it out when I can. Most of my RGB sources are from emulators so I only sometimes need it. |
Left to user scripts. |
Previously I used [with and without -vf-add vapoursynth=~/.config/mpv/motioninterpolation_720p.vpy] in hopes that it would upscale video up to 360p to x4 and up to 720p to x2 on 1080p display. What would be closest settings for these "hooks" ? |
@bjin I finally got time this weekend to test these out. It works great! Thanks again. I should note the only problem I had was loading multiple hooks, which @haasn helped me by telling me the files should be like so:
@v-fox remove:
and add:
This will emulate what the original command was doing, which is only prescaling on the luma channel. If you want to prescale on the chroma also, you need to use a different hook. @bjin 's README should explain which does what. |
It seems that using multiple hooks is really finicky and mpv fails
I've read it but there is nothing about over-upscaling and how to avoid it and I'm not sure which hook I should use for superxbr upscaling in most situations if I'm also using vf=format=yuv422p. |
The escaping is required by the shell you are using (like
This is limited by the current condition support ( I know a few dirty tricks to ignore both passes, but I don't like the approach and thus it's not implemented.
If in doubt, use
This is not expected. What kind of artifacts did you see? |
Yep, like 99% of all user terminals (although I use zsh). And since mpv doesn't have official GUI, users of things such smplayer and Xt7 will have to figure out that they have to 1) have " in their in-GUI configs 2) then escape them. Probability of anyone doing it is close to zero. That's why " was a poor choice for a required character of command line option.
I'm not sure what logic is now but it would be absolutely insane to hardcode power-of-two upscaling everywhere. Current code simple isn't any replacement for the old one until it starts calculating sane target upscale ratio itself and single hook would become enough for that.
Does indeed seems to work without artifacts. Dropping frames like crazy on HD thought. And this kind of strong upscale algorithms are only really needed for low-res muddy videos to get all details out of them.
Strangely I can't reproduce it anymore at all >_< But first time I tried with |
I'm on vanilla Ubuntu (don't judge me >_<) which I think uses bash as the default shell and I didn't have any problems using
I agree right now it seems a bit complicated to auto set the user hooks depending on the file, but looking through the manual, I think it might be possible with LUA scripting and command interface (though the |
@bjin I just noticed in the README that it mentions for YUV4:2:0 that the luma and chroma planes are not aligned if using a hook for chroma, and then use a hook for all YUV. Can you elaborate on what you mean by not aligned? |
For example, you get a |
Thanks for the explanation. That's what you meant. I knew that the chroma placement is different between MPEG1 and MPEG2, but I didn't understand you were warning that the pixel shift would be done with |
I'm guessing currently Super-xBR and NNEDI3 are only being used on luma based on the option name prescale-luma, so I was wondering if it could be added for chorma too. With most material being in 4:2:0 colorspace, just scaling the chroma back to 4:4:4 would be perfectly 1 pass of the prescale.
The text was updated successfully, but these errors were encountered: