madshi bug tracker - madVR
View Issue Details
0000253madVRbugpublic2015-02-14 08:512016-02-13 10:30
Neroldy 
madshi 
normalminoralways
acknowledgedopen 
Windows8.1
0.87.13
MPC-HC.1.7.8.x86
LAV Splitter Source 0.64 x86
LAV Video Decoder 0.64 x86
Software
none (progressive)
no
Off
all modes
AMD
HD8650G + HD8790M
Catalyst 14.501.1003
0000253: XySubFilter + madVR for cropped movie
I'm sorry for my bad English.
I use XySubFiler + madVR for cropped movie, such as 1280x534, the PGS subtitle's shape will changed. But for 1280x720, everything will be fine. And if I use XySubFilter + EVR-CP, the situation will not happen.
I will upload 2 pictures.
Just using XySubFilter + madVR play cropped video with PGS subtitle.
No tags attached.
jpg xysub.JPG (28,267) 2015-02-14 08:51
http://bugs.madshi.net/file_download.php?file_id=114&type=bug
jpg

jpg normal.JPG (20,060) 2015-02-14 08:52
http://bugs.madshi.net/file_download.php?file_id=115&type=bug
jpg

rar sample .part1.rar (5,242,880) 2015-02-15 07:21
http://bugs.madshi.net/file_download.php?file_id=116&type=bug
rar sample .part2.rar (5,242,880) 2015-02-15 07:24
http://bugs.madshi.net/file_download.php?file_id=117&type=bug
rar sample .part3.rar (5,242,880) 2015-02-15 07:27
http://bugs.madshi.net/file_download.php?file_id=118&type=bug
rar sample .part4.rar (3,985,704) 2015-02-15 07:30
http://bugs.madshi.net/file_download.php?file_id=119&type=bug
Issue History
2015-02-14 08:51NeroldyNew Issue
2015-02-14 08:51NeroldyFile Added: xysub.JPG
2015-02-14 08:52NeroldyFile Added: normal.JPG
2015-02-14 09:53madshiNote Added: 0000706
2015-02-14 09:53madshiAssigned To => madshi
2015-02-14 09:53madshiStatusnew => feedback
2015-02-15 07:21NeroldyFile Added: sample .part1.rar
2015-02-15 07:21NeroldyNote Added: 0000707
2015-02-15 07:21NeroldyStatusfeedback => assigned
2015-02-15 07:24NeroldyFile Added: sample .part2.rar
2015-02-15 07:27NeroldyFile Added: sample .part3.rar
2015-02-15 07:30NeroldyFile Added: sample .part4.rar
2015-03-22 16:42madshiNote Added: 0000812
2015-03-22 16:43madshiStatusassigned => feedback
2015-03-22 19:10cyberbeingNote Added: 0000817
2015-03-22 19:22madshiNote Added: 0000819
2015-03-22 21:26cyberbeingNote Added: 0000825
2015-03-22 21:27cyberbeingNote Edited: 0000825bug_revision_view_page.php?bugnote_id=825#r187
2015-03-22 21:28cyberbeingNote Edited: 0000825bug_revision_view_page.php?bugnote_id=825#r188
2015-03-22 21:59madshiNote Added: 0000828
2015-03-22 21:59madshiStatusfeedback => acknowledged
2015-03-25 13:39kasper93Note Added: 0000857
2015-03-25 13:41kasper93Note Edited: 0000857bug_revision_view_page.php?bugnote_id=857#r197
2015-03-25 14:47madshiNote Added: 0000858
2016-02-13 10:30fawarionNote Added: 0001280

Notes
(0000706)
madshi   
2015-02-14 09:53   
Can I have a small sample of the video + PGS, please? The sample may be very short, I just something to reproduce the problem on my PC.
(0000707)
Neroldy   
2015-02-15 07:21   
Of course, I will upload the sample. It has 4 parts.
(0000812)
madshi   
2015-03-22 16:42   
Hmmmm... This is a difficult problem which needs some discussion:

The PGS is 1920x1080. The movie was 1280x720 and was then cropped to 1280x534. Now madVR has to scale down the PGS subtitles somehow. Currently the PGS X and Y downscaling factors are simply calculated by doing x=1920/1280 und y=1080/534. However, this results in the AR ratio of the subtitles changing.

Now I wonder what the best solution is? Probably I should be using the same scaling factor for both X and Y? But how should I calculate the scaling factor? Should I calculate both factors and simply use the smaller one?

One additional problem is that currently subtitles are drawn in a moment when madVR still only renders the active video rect. Which means that drawing subtitles into the black bars currently doesn't work yet. This will be fixed in a future version.
(0000817)
cyberbeing   
2015-03-22 19:10   
If you were going to allow PGS typesetting, I'd assume you'd need to:

Resize PGS Width to Output Width.
Resize PGS Height with the same factor used for PGS Width (maintain AR)

1920x1080 PGS + 1920x800 Output
=
1920x1080 as-is, display centered vertically on the output frame.

1920x1080 PGS + 1280x534 Output
=
Resize to 1280x720, display centered vertically on the output frame.

The problem, is that you would need to support rendering to black bars or else dialog may be hidden. If you wanted madVR to behave intelligently, you'd have a fallback behavior when black bars were not present or too small to fit the entire PGS frame in original aspect ratio.

__

One fallback solution could be to crop the top and bottom edges of the PGS frame and move them inside the video frame, though you'd probably need to double check your crop lines were transparent:

1920x1080 PGS + 1920x800 Output
=
1920x1080 cropped to 1920x800 Center + 1920x140 Top + 1920x140 Bottom. Top and Bottom crop shifted inside Center crop and displayed.

1920x1080 PGS + 1280x534 Output
=
Resize to 1280x720, crop to 1280x534 Center + 1280x93 Top + 1280x93 Bottom. Top and Bottom crop shifted inside Center crop and displayed.

__

Another fallback solution could be to resize the frame to fit inside the Output frame, while maintaining aspect ratio. This would be at the expense of typesetting positions and subtitle size:

1920x1080 PGS + 1920x800 Output
=
Resize to 1422x800, display centered horizontally on the output frame.

1920x1080 PGS + 1280x534 Output
=
Resize to 949x534, display centered horizontally on the output frame.

__

The last solution is what madVR currently does, stretching the PGS frame to match the output frame, ignoring Aspect Ratio:

1920x1080 PGS + 1920x800 Output
=
Resize to 1920x800, display.

1920x1080 PGS + 1280x534 Output
=
Resize to 1280x534, display.

__


My only concern for any solution is that fixing this for PGS does not break VSFilter compatibility in regards ASS subtitles and anamorphic video, particularly when the "Render to Original Video Size" option is enabled.
(0000819)
madshi   
2015-03-22 19:22   
Rendering in black bars is planned for a future version, so that's what I'll be doing.

The question is which scaling factor I should be using. You're saying I should only look at the width. But what happens if a 4:3 Blu-Ray is cropped? Then the encoded movie would be 960x720. In this case I'd have to look at the height, wouldn't I? I think I should calculate both X and Y downscaling factors and pick the smaller one, no?

I don't think any of this should break ASS subtitles. ASS subtitles are supposed to be rendered by XySubFilter in exactly the resolution I need, so no scaling needs to be done there. Any changes I'll do because of this bug report it going to be only for subtitle images that need scaling.
(0000825)
cyberbeing   
2015-03-22 21:26   
(edited on: 2015-03-22 21:28)
> Rendering in black bars is planned for a future version, so that's what I'll be doing.

You'll still need some kind of fallback for situations where black bars may not exist, like Windowed mode?


> I think I should calculate both X and Y downscaling factors and pick the smaller one, no?

Yes, that sound right.

1920x1080 PGS + 1440x1080 Output
=
1920x1080 as-is, display centered horizontally on the output frame.

1920x1080 PGS + 960x720 Output
=
Resize to 1280x720, display centered horizontally on the output frame.


> Any changes I'll do because of this bug report it going to be
> only for subtitle images that need scaling.

Which is why I feared it would affect XySubFilter's "Render to Original Video Size" option, unless I'm forgetting how madVR handles that option. From the point of view of madVR, that option causes XySubFilter to report the size of ASS bitmaps in a similar way to PGS. If madVR blends subtitle bitmaps which match originalVideoSize immediately, prior to anamorphic and other scaling, it shouldn't be an issue.

(0000828)
madshi   
2015-03-22 21:59   
If the subtitle frame's "GetOutputRect()" happens to match the unscaled video resolution then I *think* madVR should not apply any scaling.
(0000857)
kasper93   
2015-03-25 13:39   
(edited on: 2015-03-25 13:41)
It is indeed tough case to handle. We did add so called "best fit" in MPC-HC's renderer. Subtitles have always preserved aspect ratio and scaled to the video (if needed). Idea here is that to always get perfect (source like) subtitle placing and sizing also on cropped video frames. Of course in this case user need to simulate "black bars" in case there are subtitles to be drawn there. Otherwise they will be cropped. But this is by design.

(Additionally I wanted to add adaptive mode to scale down subtitles (preserving AR) if they don't fit in window rect, but we didn't decide to do that after all.)

For reference here is my commit with all math to calculate target rect. All magic is there to handle cropped 4:3 and alike.
https://github.com/mpc-hc/mpc-hc/commit/752ba8d9e651e3f19d2f2dd74cd5b391cab14cbf [^]
We did exclude anamorphic videos later on because DVB subtitles doesn't play well with this logic, I mean it works fine but subtitles are not corrected for anamorphic since we always preserve aspect ratio of sub frame. DVB subtitles are ment to be drawn on video and streched along with it. Though I never seen cropped anamorphic sample ;p

(0000858)
madshi   
2015-03-25 14:47   
Thank you kasper95, I'll have a look at your implemention when I get around to implement/fix this.
(0001280)
fawarion   
2016-02-13 10:30   
Yeahhh.... I have Get the Same problem
when Using DXVA for Chroma Upscaling or Chroma Downscaling in HP Pavilion G4-1314au VGA is AMD APU radeon(tm) HD 6480G, if use another scaling alogarithms except DXVA. Scaling from DXVA in AMD are bettter colour from another scaling but got Cropped display.

When i have using same configuration setting in my Dell notebook with AMD ATI Radeon, there are no crooped display, nothing seriuously problem.

I'am Using same new Catalyst version 15.7.1

AMD HD Radeon APU was better than AMD ATI radeon.
Whats wrong ......? ?_?