Log in

View Full Version : YV12 alignment questions


Guest
15th April 2003, 17:52
I'm a bit confused about YV12 alignment issues so thought I'd ask for help. Maybe sh0dan understands this. :)

Suppose I have a filter that creates Y, U, and V planes. Consider the U plane. If I write an MMX routine that operates 8 bytes at a time on the U plane, does that mean I need to restrict input widths to 16? Or will Avisynth give me extra room? How do I properly code for and specify input width restrictions?

I understand there is an ALIGNED thing you can do with GetRowSize(), but does that add xtra space if needed or just report about extra pace that is already there?

Do I sound confused? :)

Thank you.

sh0dan
16th April 2003, 09:52
I understand there is an ALIGNED thing you can do with GetRowSize(), but does that add xtra space if needed or just report about extra pace that is already there?

It reports extra space that is already there.

A planar image is ALWAYS created with at least mod8 pitch. So when you request a new frame, or recieve a frame from the filter chain it will ALWAYS have at least mod8 pitch for chroma and mod16 pitch for luma.

NewVideoFrame works like this: If luma pitch is not naturally aligned to mod 16, it will be made bigger to satisfy this. Chroma pitch is (mostly) half of luma pitch.

Filters can enforce a lower pitch, but they must always apply the AlignPlanar filter after itself, if they intend to return a frame with a lower pitch.