Leak
11th August 2005, 13:10
While I'm in the process of revamping LeakKernelDeint to make use of SoftWire and finally add SSE2 support, I've come to the conclusion that instead of special-casing the heck around oddly aligned frames I'll use AlignPlanar instead.
But after taking a closer look at it, I'm wondering - does "planar alignment" only mean that the pitch is aligned to FRAME_ALIGN? Shouldn't it also mean that the frame data start address is aligned to FRAME_ALIGN?
If the latter is the case, not only the pitch has to be checked, but also the addresses of the planes themselves - if I do a Crop(2,0,-14,0,false) on an aligned frame (well, not neccessarily me, but maybe Joe Random User :D), AlignPlanar will assume that the frame is still aligned, but since the Y data will start 2 bytes beyond the original address doing things like reading 16 values at once into an XMM register using the faster MOVDQA instruction will cause an exception, which somehow defeats the purpose of making sure the frame is aligned... ;)
In case the filter works as planned, I'll have to align the frames myself, which isn't a big deal, but what's the use of AlignPlanar then? :confused:
And while I'm at it - when creating a new YV12 frame, are the chroma planes' start addresses and pitches guaranteed to also be aligned to a FRAME_ALIGN boundary?
np: Donnacha Costello - To Thee This Night (I Will No Requiem Raise) (Pop Ambient 2004)
But after taking a closer look at it, I'm wondering - does "planar alignment" only mean that the pitch is aligned to FRAME_ALIGN? Shouldn't it also mean that the frame data start address is aligned to FRAME_ALIGN?
If the latter is the case, not only the pitch has to be checked, but also the addresses of the planes themselves - if I do a Crop(2,0,-14,0,false) on an aligned frame (well, not neccessarily me, but maybe Joe Random User :D), AlignPlanar will assume that the frame is still aligned, but since the Y data will start 2 bytes beyond the original address doing things like reading 16 values at once into an XMM register using the faster MOVDQA instruction will cause an exception, which somehow defeats the purpose of making sure the frame is aligned... ;)
In case the filter works as planned, I'll have to align the frames myself, which isn't a big deal, but what's the use of AlignPlanar then? :confused:
And while I'm at it - when creating a new YV12 frame, are the chroma planes' start addresses and pitches guaranteed to also be aligned to a FRAME_ALIGN boundary?
np: Donnacha Costello - To Thee This Night (I Will No Requiem Raise) (Pop Ambient 2004)