Dudemanguy / mpv-manga-reader

Manga reading script for mpv
GNU General Public License v3.0
115 stars 4 forks source link

Images are washed out in double page mode #29

Open BanchouBoo opened 2 months ago

BanchouBoo commented 2 months ago

Images in double page mode are extremely washed out. Also true to a lesser extent in single page mode/without the plugin but that is unrelated to the script itself (if you have solutions for that though I'm all ears). Some image comparisons below. I've ensured that the brightness, contrast, etc are all default in both mpv and mcomix before taking these screenshots. I also checked on mpv master to make sure it wasn't related to https://github.com/Dudemanguy/mpv-manga-reader/issues/21 but it looks the same there too.

mcomix: mcomix

mpv without script/in single page mode: mpv-manga-single

mpv in double page mode (but cropped to a single page for easier comparison): mpv-manga-double

Dudemanguy commented 2 months ago

Can you share a sample of this?

BanchouBoo commented 2 months ago

..I did? There are three labeled screenshots attached to the post.

Dudemanguy commented 2 months ago

I mean the actual source not screenshots.

BanchouBoo commented 2 months ago

Here is the raw image file of the page from the cbz archive, is that what you mean? Bloom Into You - c001 (v01) - p010  Digital-HD   danke-Empire

Dudemanguy commented 2 months ago

Looks fine to me when using this page against itself for double page mode. Certainly nothing like your screenshot.

BanchouBoo commented 2 months ago

Any chance I could get your mpv.conf? I played around with my settings a bit, only thing that seemed to change the rendering was the vo setting. I have it as gpu-next normally.

Dudemanguy commented 2 months ago

This was with no relevant rendering settings. Just the defaults. This page has a pretty big resolution, so I suppose you're probably downscaling a lot more than me (my screen is 4k).

BanchouBoo commented 2 months ago

You're right that part of the problem is downscaling. I was able to get much better rendering (close to and better than mcomix) for single pages with the settings below, but double page rendering is still very washed out. It can't just be scaling, I tried taking two pages and combining them into one image and that renders correctly, so I'd assume it has to be something going on with the lavfi filters but I don't know much (anything, really) about those so I couldn't guess as to what nor would I know where to start to try and troubleshoot it myself.

dscale=ewa_lanczos
# 2.2 is closer to mcomix and better preserves small details like tiny individual dots, while 2.5
# blends them together more for a bit of a smoother look and also eliminates more artifacts
dscale-blur=2.5
# for vo=gpu-next
libplacebo-opts=downscaler=custom,downscaler_preset=ewa_lanczos,downscaler_blur=2.5

no-correct-downscaling
no-linear-downscaling
Dudemanguy commented 2 months ago

Can you try double page mode but without scaling the window? I'm not sure if your WM/DE will allow that, but I'd be curious if you notice any difference there in terms of visual output.

McBaws commented 2 months ago

adding video-unscaled=yes to the config might help with that

BanchouBoo commented 2 months ago

It does look normal unscaled. So scaling is definitely still a factor. Something about how the lavfi filters and downscaler interact, I guess?

https://github.com/Dudemanguy/mpv-manga-reader/assets/32691832/c3d5ff98-62a4-4b02-8813-f2babebceb47

Dudemanguy commented 2 months ago

I forgot how the scaling pipeline works with ffmpeg filters but evidently something weird must be happening here. Intuitively, I'm not sure why it would be causing a difference at all. In theory, all that the filter does is an hstack to put the images together (minus necessary scaling in certain cases because of mismatched image dimensions but this should not be relevant) and then mpv scales it later. Can't say I've noticed anything when upscaling (rarely I need to downscale), but maybe there's a similar problem.

Dudemanguy commented 1 month ago

For what it's worth, I tried this out on my 1080p laptop and couldn't reproduce. Looks fine here.