@VcMohan
As you recently posed a query on compiling for both v2.58 and v2.6a4, I assume that you want subsampling for both.
Below some code I use in RoboCrop, perhaps of use:
Code:
myName="RoboCrop: ";
if(vi.width==0 || vi.num_frames==0) env->ThrowError("%sClip has no video",myName);
# ifdef AVISYNTH_PLUGIN_25
if(vi.IsPlanar() && vi.pixel_type != 0xA0000008) { // Planar but NOT YV12, ie Avisynth v2.6+ ColorSpace
// Here Planar but NOT YV12, If v2.5 Plugin Does NOT support ANY v2.6+ ColorSpaces
env->ThrowError("%sColorSpace unsupported in v2.5 plugin",myName);
}
# endif
bool isyuv=false,isplanar=false,isyuy2=false,isrgb=false,isy8=false;
int xmod=1,ymod=1;
if(isyuv=vi.IsYUV()) {
if(isplanar=vi.IsPlanar()) {
PVideoFrame src = child->GetFrame(0, env); // get frame 0
int rowsizeUV=src->GetRowSize(PLANAR_U);
if(rowsizeUV!=0) { // Not Y8
const int ywid=src->GetRowSize(PLANAR_Y);
const int yhit=src->GetHeight(PLANAR_Y);
const int uhit=src->GetHeight(PLANAR_U);
xmod=ywid/rowsizeUV;
ymod=yhit/uhit;
} else {
isy8=true;
}
} else {
isyuy2=true;
xmod=2;
}
} else {
isrgb=true;
}
xSubS=xmod; // for Planar GetFrame
ySubS=ymod;
laced = args[3].AsBool(true);
ymod = (laced)? ymod*2 : ymod;
v2.58 header does not contain GetWidthSubsampling/GetHeightSubsampling