View Issue Details

IDProjectCategoryView StatusLast Update
0000253madVRbugpublic2016-02-13 10:30
ReporterNeroldy Assigned Tomadshi  
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
OSWindowsOS Version8.1 
Summary0000253: XySubFilter + madVR for cropped movie
DescriptionI'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.
Steps To ReproduceJust using XySubFilter + madVR play cropped video with PGS subtitle.
TagsNo tags attached.
madVR Version0.87.13
Media Player (with version info)MPC-HC.1.7.8.x86
Splitter (with version info)LAV Splitter Source 0.64 x86
Decoder (with version info)LAV Video Decoder 0.64 x86
DecodingSoftware
Deinterlacingnone (progressive)
DXVA2 Scaling Activeno
Aero / Desktop CompositionOff
Problem occurs with modeall modes
GPU ManufacturerAMD
GPU ModelHD8650G + HD8790M
GPU Driver VersionCatalyst 14.501.1003

Activities

Neroldy

2015-02-14 08:51

reporter  

xysub.JPG (28,267 bytes)   
xysub.JPG (28,267 bytes)   

Neroldy

2015-02-14 08:52

reporter  

normal.JPG (20,060 bytes)   
normal.JPG (20,060 bytes)   

madshi

2015-02-14 09:53

administrator   ~0000706

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.

Neroldy

2015-02-15 07:21

reporter  

sample .part1.rar (5,242,880 bytes)

Neroldy

2015-02-15 07:21

reporter   ~0000707

Of course, I will upload the sample. It has 4 parts.

Neroldy

2015-02-15 07:24

reporter  

sample .part2.rar (5,242,880 bytes)

Neroldy

2015-02-15 07:27

reporter  

sample .part3.rar (5,242,880 bytes)

Neroldy

2015-02-15 07:30

reporter  

sample .part4.rar (3,985,704 bytes)

madshi

2015-03-22 16:42

administrator   ~0000812

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.

cyberbeing

2015-03-22 19:10

reporter   ~0000817

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.

madshi

2015-03-22 19:22

administrator   ~0000819

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.

cyberbeing

2015-03-22 21:26

reporter   ~0000825

Last edited: 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.

madshi

2015-03-22 21:59

administrator   ~0000828

If the subtitle frame's "GetOutputRect()" happens to match the unscaled video resolution then I *think* madVR should not apply any scaling.

kasper93

2015-03-25 13:39

reporter   ~0000857

Last edited: 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

madshi

2015-03-25 14:47

administrator   ~0000858

Thank you kasper95, I'll have a look at your implemention when I get around to implement/fix this.

fawarion

2016-02-13 10:30

reporter   ~0001280

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 ......? ?_?

Issue History

Date Modified Username Field Change
2015-02-14 08:51 Neroldy New Issue
2015-02-14 08:51 Neroldy File Added: xysub.JPG
2015-02-14 08:52 Neroldy File Added: normal.JPG
2015-02-14 09:53 madshi Note Added: 0000706
2015-02-14 09:53 madshi Assigned To => madshi
2015-02-14 09:53 madshi Status new => feedback
2015-02-15 07:21 Neroldy File Added: sample .part1.rar
2015-02-15 07:21 Neroldy Note Added: 0000707
2015-02-15 07:21 Neroldy Status feedback => assigned
2015-02-15 07:24 Neroldy File Added: sample .part2.rar
2015-02-15 07:27 Neroldy File Added: sample .part3.rar
2015-02-15 07:30 Neroldy File Added: sample .part4.rar
2015-03-22 16:42 madshi Note Added: 0000812
2015-03-22 16:43 madshi Status assigned => feedback
2015-03-22 19:10 cyberbeing Note Added: 0000817
2015-03-22 19:22 madshi Note Added: 0000819
2015-03-22 21:26 cyberbeing Note Added: 0000825
2015-03-22 21:27 cyberbeing Note Edited: 0000825
2015-03-22 21:28 cyberbeing Note Edited: 0000825
2015-03-22 21:59 madshi Note Added: 0000828
2015-03-22 21:59 madshi Status feedback => acknowledged
2015-03-25 13:39 kasper93 Note Added: 0000857
2015-03-25 13:41 kasper93 Note Edited: 0000857
2015-03-25 14:47 madshi Note Added: 0000858
2016-02-13 10:30 fawarion Note Added: 0001280