PDA

View Full Version : Bug in Crop()


Boulder
20th June 2004, 18:26
I just noticed that this script gives distorted colors:

mpeg2source("c:\temp\captures\test.d2v")
Crop(16,4,-12,-4,align=true)


This does work:

mpeg2source("c:\temp\captures\test.d2v")
Crop(16,4,-8,-4,align=true)


Also if I convert to YUY2 before cropping, the first script works OK. It looks like that with YV12 data the resulting width must be mod-8 (Crop(16,4,-4,-4,align=true) gives the same faulty output), otherwise the colors are screwed up.

I'm using the latest Avisynth CVS build and Don's latest DGDecode.dll and DGIndex.

kassandro
20th June 2004, 19:01
Originally posted by Boulder
I just noticed that this script gives distorted colors:

mpeg2source("c:\temp\captures\test.d2v")
Crop(16,4,-12,-4,align=true)


Probably your mpeg2 source is interlaced. The width of interlaced yv12 must be a multiple of 8 (at least I think so). Crop after deinterlacing!
Sorry, that was nonsense! The height must be a multiple of 4 instead of 2, but this property is obviously fullfilled in your case.
Is crop the last filter?

Boulder
20th June 2004, 19:38
The error remains even when deinterlacing right after the MPEG2Source line. The Avisynth docs state that the width must be mod-2 and height mod-4 (interlaced) or mod-2 (progressive). All you need to reproduce the error is the first script so no filter can be responsible, unless DGDecode.dll proves to be the root of the problem.

DarkNite
21st June 2004, 09:09
Doesn't align=true require mod8 at the least?

"MMX/SSE likes 8-byte alignment and SSE2 likes 16-byte alignment."

Hmmm... "likes" isn't very definite.

It might be way too late for me and my vision has gone blurry, but I'm just not seeing the distorted colors when testing here.

kassandro
21st June 2004, 10:07
Originally posted by DarkNite
Doesn't align=true require mod8 at the least?

"MMX/SSE likes 8-byte alignment and SSE2 likes 16-byte alignment."

Hmmm... "likes" isn't very definite.

It might be way too late for me and my vision has gone blurry, but I'm just not seeing the distorted colors when testing here.
I think with MMX/SSE each pixel row has to start at a address, which should be a multiple of 8 (with SSE2 a multiple of 16). The length of the row itself can be arbitrary, but of course the pitch must again be a multiple of 8 respectively 16. In the above example "align=true" shouldn't do anything.