Color change 2
Zoom and move
On this page I'll try to describe how the interlace option of my Transform-effects works.
1. What are interlaced videos?
To understand the problem of interlaced videos, you'll best read this WWW-page (another good description in german is on this URL). or ... (German). The problem is, that two diffrent pictures are mixed into one with every even row belonging to one picture, and every odd row belonging to the next (or previous) picture of the video. So if you have interlaced source material (like from a Camcorder or TV recording) and/or you are producing an interlaced video (like DVD), the result will always look a bit "wavey" on a computer monitor. When watched on a TV, everything should look fine.
2. How does the Transform-effects work?
If you have an effect like ColorChange or Filter, it doesn't matter if the video is interlaced or not. However, it does matter if you are somehow moving parts of the source video to other parts - and that is exacly what the Transform-effect does.
Transform takes every pixel from a source picture and places it somewhere else on the destination picture. This procedure is made for every pixel on every frame (picture) of the video. To be honest, the effect really works the other way round: for every pixel on the destination picture the position in the source picture is calculated, and then this pixel is copied (remark: at this point the "interpolate" option comes into play. Without interpolate, just the nearest source pixel to the exactly calculated source position is used. With interpolate tuned on, all 4 surrounding pixels are mixed together into the destination pixel.).
Now, if you have an interlaced source picture, you'll run into trouble, since you might be moving pixels from one half-frame of the source picture (eg. even rows) into the other half-frame on the destination picture (odd rows).
3. What does the interlace-option do?
Without interlace turned on, the effect just copies pixels from the source picture to the destination picture as described above. With interlace turned on, it behaves as follows: if the source picture claims not to be interlaced, the pixel is copied as usual. Otherwise, it is assumed, that both input and output pictures are interlaced (maybe this assumption is wrong?). So if the destination pixel lied in an even row, only source pixels from even rows are copied to the destination (the same holds for odd rows.). Let's say, the effect wants to calculate the destination pixel at position (5, 3). The calculated source position (eg. after a rotation) is (6.2, 8.1). Without interlace on, the pixel from position (6, 8) is copied to position (5, 3) (remark: with interpolate turned on, it'll copy 72% of pixel (6, 8), 8% of pixel (6, 9), 18% of pixel (7, 8), and 2% of pixel (7,9)).
With interlace tuned on, the effect first notes, that (5, 3) lies on an odd row and instead of copying from (6, 8) it'll copy from (6, 7). Therefore, only odd rows from the source picture get copied to odd rows on the destination picture. At the moment, the effect only rounds down to the next odd/even row (so 8.8 is changed to 7). Maybe it's better to round to the nearest odd/even row?
4. Why does the effect produce wavy artefacts?
Good question. There are a lot of possible things that might go wrong. First of all, my idea of handling interlaced videos might be wrong (I'll be glad if you tell me a better way to handle the problem). Next, my implementation might be faulty (Have a look at the source code - I welcome every correction and extension to the code). Third, maybe the effect has to handle more combinations like source video is not interlaced (eg. a photograph), but the destination should be interlaced. I really don't know, which combinations of input and output sources work correct, and which are wrong.
So with a little help we might get this effect to a point, where it looks good in most situations....
5. What can I do to help?
Well, first of all read this text and find the point where I am thinking wrong. Next, tell me which combinations of input and output material look good, and which are wrong. Usually the "wrong"-case could be detected best, if you use a Transform effect and rotate the video by 45 or maybe 90 degrees. My time to work on JPsEffects is very limited, so I cannot do a lot of testing and programming. Also, I don't read the Pinnacle forum too often, so better keep me informed by sending short emails to video at familie-riegel.de.
Thanks in advance for any help...