bool NWindowEdit::setCursor () { getbegyx (getWriteWindow (), y, x); x += getCurX (); y += getCurY (); setsyx (y, x); return true; }
keyRet NWindowEdit::injectKey (int key) { switch (key) { case KEY_BACKSPACE: case 127: getyx (comwin, y, x); mvwdelch (comwin, y, x - 1); return RKEY_HANDLED; case KEY_EXIT: case K_ESC: return RKEY_ESC; case KEY_ENTER: case K_ENTER: return RKEY_ENTER; case KEY_LEFT: x = getCurX (); if (x > 0) wmove (getWriteWindow (), getCurY (), x - 1); break; case KEY_RIGHT: x = getCurX (); if (x < getWidth () - 3) wmove (getWriteWindow (), getCurY (), x + 1); break; default: if (isprint (key)) { if (passKey (key)) { waddch (getWriteWindow (), key); } // alfanum key, and it does not passed.. else { beep (); flash (); } return RKEY_HANDLED; } return NWindow::injectKey (key); } return RKEY_HANDLED; }
void TimgFilterSharpen::process(TffPict2 &pict,const TpresetSettings *cfg) { if ((cfg->sharpen.method==0 && !cfg->sharpen.xsharpStrength) || (cfg->sharpen.method==1 && !cfg->sharpen.unsharpStrength)) return; Trect *r=init(&pict.rect,cfg->fullSharpen); switch (cfg->sharpen.method) { case 0: if (config.cpu_flags&XVID_CPU_MMXEXT) { const unsigned char *srcY=getCurY(pict)+r->diffY;unsigned char *dstY=getNextY(pict)+r->diffY; xsharpen(srcY,dstY,cfg); } return; case 1: { const unsigned char *srcY=getCurY(pict)+r->diffY;unsigned char *dstY=getNextY(pict)+r->diffY; unsharpen(srcY,dstY,cfg); return; } } }
void TimgFilterTimesmooth::process(TffPict2 &pict,const TpresetSettings *cfg) { if (!cfg->blur.tempSmooth) return; Trect *r=init(&pict.rect,cfg->fullBlur); const unsigned char *srcY=getCurY(pict)+r->diffY ;unsigned char *dstY=getNextY(pict)+r->diffY ; const unsigned char *srcU=getCurU(pict)+r->diffUV;unsigned char *dstU=getNextU(pict)+r->diffUV; const unsigned char *srcV=getCurV(pict)+r->diffUV;unsigned char *dstV=getNextV(pict)+r->diffUV; if (cfg->blur.tempSmooth!=oldStrength) { oldStrength=cfg->blur.tempSmooth; for (int i=0;i<=510;i++) { int sqerr=((i-255)*(i-255))>>oldStrength; if (sqerr>16) sqerr=16; sqerr=16-sqerr; square_table[i]=sqerr; } }
void TimgFilterOffset::process(TffPict2 &pict,const TpresetSettings *cfg) { if (!cfg->offset.Y_X && !cfg->offset.Y_Y && !cfg->offset.U_X && !cfg->offset.U_Y && !cfg->offset.V_X && !cfg->offset.V_Y) return; Trect *r=init(&pict.rect,cfg->fullOffset); if (cfg->offset.Y_X || cfg->offset.Y_Y) { const unsigned char *srcY=getCurY(pict)+r->diffY;unsigned char *dstY=getNextY(pict)+r->diffY; offset(srcY,dstY,dxY,strideY,dyY,cfg->offset.Y_X,-cfg->offset.Y_Y,0); } if (cfg->offset.U_X || cfg->offset.U_Y) { const unsigned char *srcU=getCurU(pict)+r->diffUV;unsigned char *dstU=getNextU(pict)+r->diffUV; offset(srcU,dstU,dxUV,strideUV,dyUV,cfg->offset.U_X/2,-cfg->offset.U_Y/2,128); } if (cfg->offset.V_X || cfg->offset.V_Y) { const unsigned char *srcV=getCurV(pict)+r->diffUV;unsigned char *dstV=getNextV(pict)+r->diffUV; offset(srcV,dstV,dxUV,strideUV,dyUV,cfg->offset.V_X/2,-cfg->offset.V_Y/2,128); } }