Aspect ratio fix for SH4

Information, questions and any other thing related with A series.

tom_van
Official SamyGO Developer
Posts: 146
Joined: Tue Jan 19, 2010 10:44 am

Re: Aspect ratio fix for SH4

Post by tom_van »

As I wrote in the start message: aspect scaling in Samsung's code does NOT work for H.264. It could have been fixed if Samsung had released source code... but as they're not willing to do so I'm not so motivated to analyze the problem in the binary.
MPEG2 aspect scaling is much simpler - instead of arbitrary x/y fraction uses one predefined aspect ratios (implemented 4:3, 16:9 and 2.21:1).
If H264 original has one of these ratios, transcoding to high rate MPEG2 may help - but considering computing power needed and video degradation it is really ugly solution. HDMI connected external player do the job much better.

marcjero
Posts: 50
Joined: Sun Mar 06, 2011 8:40 pm

Re: Aspect ratio fix for SH4

Post by marcjero »

Thanks Tom for the clear explanation.

This TV is the last one I will buy from Samy as they didn't even try to fix this firmware. The cheapest dvd player available is handling aspect ratio much better...

marcjero
Posts: 50
Joined: Sun Mar 06, 2011 8:40 pm

Re: Aspect ratio fix for SH4

Post by marcjero »

Hi Tom,

I just discovered something interesting. I have MP4 H264 files (1280x536) 720p files that display just fine on the TV. I think that MP4 H264 are always displayed using 1:1 ar.

I'm using serviio as dlna server and I defined this : for mkv files serviio please remux h264 and ac3 into a mpegts container and it works very well so far. Problem is most of the time mkv picture is streched (for instance 2:21 picture is displayed full screen) but today I was able to watch a mkv movie with the correct aspect ratio. It took me a while to understand what did change. I found that if you play a MP4 file first, then the player keeps in memory the MP4 aspect ratio and then you can then play MPEGTS files using the same aspect ratio.

What do you think about this ? Did you try the MPEGTS H264 combo ?

marcjero
Posts: 50
Joined: Sun Mar 06, 2011 8:40 pm

Re: Aspect ratio fix for SH4

Post by marcjero »

I tested arfix 1.0. Works with H264 MP4. :D Doesn't work with H264 MPEGTS. arfix 1.1 didn't work for me at.(TV reboot)

Update : Play a MP4 movie first then arfix works also with H264 MPEGTS !

tom_van
Official SamyGO Developer
Posts: 146
Joined: Tue Jan 19, 2010 10:44 am

Re: Aspect ratio fix for SH4

Post by tom_van »

Hi Marcjero,

I'm aware of the strange behavior of WiseLink player for long time. And I also tried to use this 'feature' before I ended up making arfix-sh patch.

AFAIK the player resizing routine works with MPEG2/TS (compression/container) content until MPEG4/MPEG4 video is played. MPEG4 (probably container) leaves something in player variables, what prevents correct resizing of following MPEG2/TS. Correct behavior of scaling can be restored by playing a MPEG/PS file (VOB from DVD).

There is debug output available on service serial line:

Code: Select all

---> info.BitmapParams.Width : 720
---> info.BitmapParams.Height : 576
---> info.VideoParams.ScanType : 1
---> info.VideoParams.FrameRate : 25000
STVID_GetInputWindowMode Error
STVID_GetOutputWindowMode Error
STVID_SetInputWindowMode Error
STVID_SetOutputWindowMode Error
Patched SetSize MPEG AR 23, In 720x576, Out 1440x1080-240-0
STVID_SetSize Error
[MovieCore_STi] Play Out
So I doubt the aspect ratio from previous MPEG4 is used as you wrote, it seems that all formats are rendered fullscreen. Debug output is from patched version with arfix 1.1, but the problem was same before patching. The error prevents scaling other than fullscreen, so arfix cannot make any change then.

Playing H264/TS outputs the same error to debug. Fortunately my records from FullHD DVB-T programs are all in 16:9, so rendering fullscreen is ok. And H264/TS does not break scaling of following MPEG2/TS like the MPEG4/MPEG4 does.

BTW I reported this as a firmware error to local representative of Samsung in January 2009. They replied they resend the report to headquarters. Two newer firmwares was released since then and none of them fixed the issue.

marcjero
Posts: 50
Joined: Sun Mar 06, 2011 8:40 pm

Re: Aspect ratio fix for SH4

Post by marcjero »

Hi Tom,

I wasn't clear enough. First I have to say that the movies I play are not anamorphic. I had issues first when I tried to rip my own dvds to h264 and I ended rescalling the pictures to 1024x576 (PAL DVD are 720x576) to get correct aspect ratio. MKVs are built the same. So basically remuxing a MKV to MP4 container displays fine on the TV.

What I see is I can change aspect ratio of my MP4 H264 files using your fix.

This week I discovered the great serviio DLNA server. serviio is able to transcode or remux movies into mpeg or mpegts container. With serviio I remux MKV to MPEGTS/H264/AC3 in real time but unfortunately the movie is displayed full screen (streched, people looks so slim). But If I play first an MP4/H264 file, then I can play remuxed MPEGTS with correct aspect ratio and I can even change the aspect ratio parameters from the menu. So I guess that the H264 decoder isn't initialized fine when playing a MPEGTS/H264. Not surprising as MPEGTS/H264 isn't supported on this TV. So there are variables left when switching from a video format to another. In some situation it breaks the aspect ratio as you said, but in other case (mine) it helps.

Samy should provide us source code of exedsp. This way we could easily enhance the player and even include MKV support. Aren't there GPL license issues with the firmware ? Maybe there is a way to force them to publish the firmware source ? If exeDSP is using a GPL software should be released as GPL also.

tom_van
Official SamyGO Developer
Posts: 146
Joined: Tue Jan 19, 2010 10:44 am

Re: Aspect ratio fix for SH4

Post by tom_van »

marcjero wrote:But If I play first an MP4/H264 file, then I can play remuxed MPEGTS with correct aspect ratio and I can even change the aspect ratio parameters from the menu.
Really interesting. I just tried that playing MPEG4/MPEG4 before H264/TS does not help. Can you save my time and upload somewhere your H264/MPEG4 enabler?

tom_van
Official SamyGO Developer
Posts: 146
Joined: Tue Jan 19, 2010 10:44 am

Re: Aspect ratio fix for SH4

Post by tom_van »

Thanks for the file, Marcjero. I can confirm that playing this H264/MPEG4 really enables scaling of following H264/TS.
It also breaks scaling of MPEG2/TS. This part of firmware is real crap.
Anyway the new finding is promising. I'll try to analyze the problem and let you know.

marcjero
Posts: 50
Joined: Sun Mar 06, 2011 8:40 pm

Re: Aspect ratio fix for SH4

Post by marcjero »

Hi Tom,

maybe I can help you. Could you please share the code of exeDSP ? How do you proceed for debugging ?

Jerome

Post Reply

Return to “A Series”