Why is hardware de-interlacing for SD MPEG2 so bad?

I’m unsure if this is the update to 18 as I’d not noticed it before.

I’d noticed that the deinterlacing options were greyed out whilst watching Millenium (NTSC 29.97Hz 480i), and also watching That Mitchel and Webb (PAL 25Hz 576i) proved to be impossible because the content was not actually deinterlaced properly at all.

I’ve now set MPEG-2 to decode in software for less than HD and it’s now perfectly deinterlaced.

What is happening with the hardware decode that causes it to be so bad? The stair steps are so bad it looks like blocky video.

Thoughts?

This is the NTSC video:

Video
ID                                       : 1
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings                          : CustomMatrix / BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Bit rate mode                            : Variable
Bit rate                                 : 5 056 kb/s
Maximum bit rate                         : 9 800 kb/s
Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Original frame rate                      : 23.976 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Scan order                               : 2:3 Pulldown
Compression mode                         : Lossy
Time code of first frame                 : 00:59:59;15
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Open
GOP, Open/Closed of first frame          : Closed
Language                                 : English
Default                                  : No
Forced                                   : No
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601

This is the PAL:

Video
ID                                       : 1
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=13
Format settings, picture structure       : Frame
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Duration                                 : 29 min 8 s
Bit rate mode                            : Variable
Bit rate                                 : 4 458 kb/s
Maximum bit rate                         : 9 000 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Original display aspect ratio            : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.430
Time code of first frame                 : 10:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Open
Stream size                              : 929 MiB (94%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.470 System B/G
Matrix coefficients                      : BT.470 System B/G

Is hardware acceleration enabled?

To be honest, I plan to disable HW decoding for MPEG2 < 1080p; as it’s not needed.

Thanks Sam, yeah hardly any CPU usage at all and the hardware deinterlacing is very definitely not working well :slight_smile:

Check the codec display screen.
Does it actually show hardware acceleration as on?

What’s the output of /sys/module/di/parameters/bypass_all?

Are you going to be looking at the various software upscaling options? Only nearest neighbour and bilinear are working properly at the moment (in software mode).

No.

The other options are too taxing for the system. We can hide them in a new update.

Sorry for the delay Sam. It definitely says hardware when it’s being crap, the deinterlace method shows hardware.

Off on hols for a week soon so unable to check any more. The software decoding is fine though.

Ok – no problem.

When you get back if you can check above it will be interesting

Sam

@sam_nazarko i would beg you to keep this setting configurable. I currently get nice smooth playback for sd tv channels (576i mpeg2 streams) but only when mpeg2 h/w acceleration is switched to Always.

If i set this to “HD and up” then the same streams become unwatchable. Video goes out of sync with audio and you notice the video going slighly slower then slightly faster, etc.

After reading your plans in this thread i tried fiddling with settings such as video scaling method (tried both billinear and nearest neighbour) also tried setting the “Enable HQ scalers for scaling above” to 100% (to disable hq scalers)… All in an attempt to see if I could get my streams to playback smoothly without h/w acceleration.

Basically none of the options yielded playback smoothness as good as with h/w acceleration, for me at least. And I do not have any issues with the H/W de-interlacing (probably depends on the type of stream or something).

When you’re back, can you post some pictures illustrating the problem?

Ok, noted.

I think the reason Paul is seeing problems with MPEG2 content is because of some of the changes I’ve made to prevent you needing to set sysfs parameters for smooth Live TV

Sam

IIRC my issue was with hd streams and could be fixed by setting either bypass_all or bypass_hd to 1.

The solution that was put into place was to set bypass_all=1 when a non-VC1 stream is started.

In retrospect, i wonder whether bypass_hd would have been more appropriate, so the di module isn’t by-passed for non-hd content? I believe thats the way it was done in LE.

Tried that. VC-1 worked; but you still experienced Live TV issues.
For now – we at least need some confirmation from @Paul_Solecki if this makes a difference.

My recollection is that either bypass_all or bypass_hd fixed the issue for me

Certainly, it won’t be until next week at the earliest though.