kassandro
11th April 2005, 08:38
I recently recognized a problem with the PLANAR_ALIGNED flag. Some internal filters, in my case ConvertToYV12, set this flag in order to indicate that this filters returns aligned frames. A nice idea. Unfortunately, most filter writers ignore this flag (I didn't even know about it until now) and simply pass through the color space of the child, although their filters may generate unaligned frames. Thus this flag is not trustworthy. Actually the mistake is in avisynth.h. In the GenericVideoFilter constructor the VideoInfo is simply copied. The constructor should also erase this flag in VideoInfo.pixel_type. Now if a filter creats aligned frames, then the filter writer should set this flag. Unfortunately, this modification makes this flag trustworthy only in the long run, because all filters have to be recompiled with the new avisynth.h. This align flag makes also sense for the other color spaces, whence it should be used for these color spaces as well.
avisynth.h itself has problems with PLANAR_ALIGNED. If this flag is set, BitsPerPixel() returns 0 instead of 12. To correct it, switch (pixel_type) has to be replaced by switch (pixel_type &~PLANAR_ALIGNED).
EDIT: sorry I did confuse something here, please ignore the article.
avisynth.h itself has problems with PLANAR_ALIGNED. If this flag is set, BitsPerPixel() returns 0 instead of 12. To correct it, switch (pixel_type) has to be replaced by switch (pixel_type &~PLANAR_ALIGNED).
EDIT: sorry I did confuse something here, please ignore the article.