How to deinterlace Kodicom 8800 clone ? Combing effect

Forum for questions and support relating to the 1.24.x releases only.
Locked
m1ke
Posts: 53
Joined: Thu Nov 08, 2007 1:37 pm
Location: Surrey

How to deinterlace Kodicom 8800 clone ? Combing effect

Post by m1ke »

Hi guys,
I have a prob with the above card where I get an interlaced combing effect on all the images when there is motion. It appears at all resolutions I have tried: 320x240, 640x480 & full PAL 768x576. I normally run the 3 cams I have at full PAL. Both the card & the cams are supposed to support full PAL.
It has always done it - but would like to see if I can fix it now as it is annoying.

Have tried (as per other forum posts):
V4L_MULTI_BUFFER on / off
CAPTURES_PER_FRAME 1 / 2
V4L2_CAPTURE_FIELDS 0,1,2,3 & 7

None of the above has helped. This is to be expected perhaps as the help on the top two options does say it will not have effect if the card has one bt878 chip per channel as mine does but I thought it was worth a go anyway.
The V4L2_CAPTURE_FIELDS option is currently set back to 0. Changing this to 1 doesn't make any difference & changing it to 2,3 or 7 results in a strange mirrored image effect - one image above the other. In both the mirrored images the combing effect is reduced but not completely but obviously I cant leave it like that!

So how do I get rid of the combing effect ? Or how do I deinterlace the images ?

Any help much appreciated,
Thanks in advance,

Mike.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by mastertheknife »

Hi,

PAL and NTSC are interlaced formats unfortunately. On interlaced displays (CRT TVs, etc) the images appear fine, but on modern progressive displays (LCDs, etc) a mouse teeth effect is visible during movement.
There are few things you can do:
1) Live with the interlaced video. Some people don't mind the interlaced image, although in my opinion interlacing makes CCTV useless during movement.
2) Deinterlace your footages manually, e.g. with a software like VirtualDub.
3) Get a progressive image at the cost of lower resolution: Capture at no higher than 384x288 (PAL) or 320x240 (NTSC) and set V4L2_CAPTURE_FIELDS to 2 (top field only) or 3 (bottom field only). 7 (alternate) also works, but creates a bobbing effect (image going up and down) that can confuse the motion detection code.
4) Wait until i finish writing deinterlacing code for ZM (already in progress), see here:
Options: http://i.imgur.com/sBXhR.jpg
Original: http://i.imgur.com/Penhn.jpg
Deinterlaced: http://i.imgur.com/AgzuX.jpg

mastertheknife
Kfir Itzhak.
m1ke
Posts: 53
Joined: Thu Nov 08, 2007 1:37 pm
Location: Surrey

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by m1ke »

Hi again Kfir,
Many thanks for that insight. I tried your suggestion of setting resolution of to 384x288 and V4L2_CAPTURE_FIELDS to 2 and this worked - the combing was gone!

Am I right in thinking that 384x288 set as above with V4L2_CAPTURE_FIELDS to 2 is actually not giving any more information than 768x576 interlaced ?

In which case I may as well set the cams to half PAL as above ?

Thanks again,

Mike.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by mastertheknife »

m1ke wrote:Hi again Kfir,
Many thanks for that insight. I tried your suggestion of setting resolution of to 384x288 and V4L2_CAPTURE_FIELDS to 2 and this worked - the combing was gone!

Am I right in thinking that 384x288 set as above with V4L2_CAPTURE_FIELDS to 2 is actually not giving any more information than 768x576 interlaced ?

In which case I may as well set the cams to half PAL as above ?

Thanks again,

Mike.
By capturing at 384x288 with V4L2_CAPTURE_FIELDS set to 2, you are basically telling V4L2 to only capture the even numbered lines. This way you don't get any interlacing artifacts because you are getting a progressive image.
This is why 384x288 (actually 768x288) is the highest resolution you can use if you want a progressive image for PAL, and 320x240 (actually 640x240) for NTSC.
There are 576 vertical lines in PAL, 288 even numbered lines and 288 odd numbered lines. A frame is made up from 2 fields, The top(even) field and the bottom(odd) field. The odd lines and the even lines are being captured at different times. This is why interlacing shows artifacts and is why you don't see those artifacts if you display only the even or only the odd lines.

mastertheknife
Kfir Itzhak.
m1ke
Posts: 53
Joined: Thu Nov 08, 2007 1:37 pm
Location: Surrey

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by m1ke »

Hi Kfir,
I just wondered if you had got any futher with your deinterlacing code for ZM ?

I am living with the combing effect at the moment. I figured the higher res was worth it (just).

I have been having loads of issues with the box crashing out with kernel panics. I think I have traced the issue down to the Kodicom BT878 card overheating despite heat sinks and fan - perhaps just one chip (bttv2). I have just added another much more powerfull fan an hour or so ago so I will see how it goes now... I changed every component in the PC so I hope I have nailed it!

Cheers,

Mike.
m1ke
Posts: 53
Joined: Thu Nov 08, 2007 1:37 pm
Location: Surrey

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by m1ke »

Ok - seems it was an over heating issue as since new 5000 rpm fan installed blowing right over the card there have been no more 'SCERR' errors in the log files and no more kernel panics.

In answer to my own question I see you have the de-interlacing well underway as explained in your "ZM 1.25.0 Performance Patch - Completed" post - I should have read a bit more.

However on 7 May I installed your patched version of ZM as per the above post (e413042.tar.gz) and I don't seem to have the deinterlacing option on the source tab as shown here: http://i.imgur.com/sBXhR.jpg

I wonder if there is another patch I need to add. I have looked on your git page but doesn't seem to be any other file to download other than e413042.tar.gz ?
Am I missing something ?

Thanks again for your hard work.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by mastertheknife »

Hi m1ke, sorry for the long delay.

I have merged the deinterlacing code into the perfpatch branch.
Its not perfect yet, only the four field motion adaptive deinterlacing technique was optimized so far, and this specific deinterlacing technique sometimes displays white lines, which i couldn't fix yet.
Simply download, run ./configure, make, make install and run this SQL query to update the database:

Code: Select all

ALTER TABLE `Monitors` ADD `Deinterlacing` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `Orientation`
http://www.github.com/mastertheknife/Zo ... /perfpatch


mastertheknife
Kfir Itzhak.
m1ke
Posts: 53
Joined: Thu Nov 08, 2007 1:37 pm
Location: Surrey

Re: How to deinterlace Kodicom 8800 clone ? Combing effect

Post by m1ke »

Great, thanks, I will give it a try when I get a moment.

Thanks again,
Mike.
Locked