On Thu, May 12, 2005 at 11:09:08AM +0200, Michel Bardiaux wrote:
I just found I had asked a related question some month ago, never got a clear answer: assume I have an YUV420P image, 768x576, 2 interlaced fields, what do I with lavc to zoom it down by 2?
Treat the two fields as two independent, unrelated images and scale each one down by 2.
OK. Now, is there a reason why lavc does not do that, or was it just a Q&D?
It doesn't know whether the video is interlaced or not.
Do I need to apply the deinterlace filter first?
If you want to deinterlace, you can do this instead. However deinterlacing throws away roughly half the content of the video.
Sometimes my encoded movies show the infamous 'comb' effect (strong motion between the 2 fields). This of course could be due to the bttv, see below. I thought (mistakenly maybe) that the deinterlace filter was intended to compensate for the comb effect.
What you're calling the comb effect is simply the fact that you're putting two pictures together than don't go together. Deinterlacing effectively just throws away one of the two, or blurs the two together so you can't tell they don't go together.
Richard also mentionned (I think) that when it comes from a BT878, 420P is broken.
Yes, if you capture "4:2:0" video from bttv, you'll get a 768x576 luma plane which contains both fields (correct), and two 384x288 chroma planes (u and v) which contain a single field, the top one. The bottom field of chroma data will be totally missing.
ITIYM the U and V values average 2 pixels from the top field (since the image size coming from bttv is correct).
Not sure what you mean.
BTW does this apply to every version of bttv?
Probably, yes. The hardware does not support 4:2:0, so in order for the driver to support it, it would have to resample in kernelspace (very stupid idea).
So, same question w.r.t. YUV422P.
Same thing applies.
You lost me there. Maybe an example? Assume 4 pixels in the Y plane, as follows:
YA YB YC YD
For 420P the U should be (UA+UB+UC+UD)/4 (possibly a smarter filter of course) but bttv returns (UA+UB)/2. Right?
No, this would just be minor misalignment. Notice that your description of the problem has nothing to do with interlacing. Again, read the short paragraph I wrote above. BTTV's fake 4:2:0 is missing a whole field of chroma.
For 422P we should have (UA+UB)/2 and (UC+UD)/2, right? Your answer could be interpreted as meaning bttv returns (UA+UB)/2 *twice*. Is that so? Then, is there *any* format that isnt broken in bttv? Or is there a patch somewhere?
BTTV's 4:2:2 video is exactly right.
And if lavc butchers the image, please you or Richard tell me exactly what, then maybe I will be able to fix it.
It's not that lavc butchers it. If you use lavc's image resampling independently on fields it's just fine (except for being very slow).
Why *very* slow? Because of the overhead of extracting the fields then merging them again?
No, becuase the image resample code in lavc is not optimized at all. No work has to be done to extract or re-merge them. You just do it in place with stride arithmetic. Rich