Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 9th September 2013, 17:30   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
@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
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.