void update(void )
{
uint8_t *src,*dst;
uint32_t stride;
int32_t T,D,B,B2;   
ASHARP_PARAM *_param=&myHue;
uint32_t ww,hh;

                download();
                ww=incoming->getInfo()->width;
                hh=incoming->getInfo()->height;
                // parameters floating point to fixed point convertion
                T = (int)(_param->t*(4<<7));
                D = (int)(_param->d*(4<<7));
                B = (int)(256-_param->b*64);
                B2= (int)(256-_param->b*48);

                // clipping (recommended for SIMD code)

                if (T<-(4<<7)) T = -(4<<7); // yes, negatives values are accepted
                if (D<0) D = 0;
                if (B<0) B = 0;
                if (B2<0) B2 = 0;

                if (T>(32*(4<<7))) T = (32*(4<<7));
                if (D>(16*(4<<7))) D = (16*(4<<7));
                if (B>256) B = 256;
                if (B2>256) B2 = 256;


                memcpy(YPLANE(imgdisplay),YPLANE(imgsrc),ww*hh);
                asharp_run_c(     imgdisplay->GetWritePtr(PLANAR_Y),
                        imgdisplay->GetPitch(PLANAR_Y), 
                        hh,
                        ww,
                        T,
                        D,
                        B,
                        B2,
                        myHue.bf);
    
    // Copy half source to display
    dst=imgdisplay->data;
    src=imgsrc->data;
    stride=ww;
    for(uint32_t y=0;y<hh;y++)   // We do both u & v!
    {
        memcpy(dst,src,stride>>1);
        dst+=stride;
        src+=stride;
    }
    //
    COL_yv12rgb(  w,   h,imgdisplay->data,(uint8_t *)rgbbuffer );
}
Esempio n. 2
0
/**
    \fn process
*/
uint8_t    flyASharp::processYuv(ADMImage* in, ADMImage *out)
{

uint8_t *src,*dst;
uint32_t sstride,dstride;
int32_t T,D,B,B2;
uint32_t ww,hh;


                ww=in->GetWidth(PLANAR_Y);
                hh=in->GetHeight(PLANAR_Y);
                // parameters floating point to fixed point convertion
                T = (int)(param.t*(4<<7));
                D = (int)(param.d*(4<<7));
                B = (int)(256-param.b*64);
                B2= (int)(256-param.b*48);

                // clipping (recommended for SIMD code)

                if (T<-(4<<7)) T = -(4<<7); // yes, negatives values are accepted
                if (D<0) D = 0;
                if (B<0) B = 0;
                if (B2<0) B2 = 0;

                if (T>(32*(4<<7))) T = (32*(4<<7));
                if (D>(16*(4<<7))) D = (16*(4<<7));
                if (B>256) B = 256;
                if (B2>256) B2 = 256;

                out->duplicateFull(in);
                uint8_t *line=new uint8_t[ww];
                asharp_run_c(     
                        out->GetWritePtr(PLANAR_Y),
                        out->GetPitch(PLANAR_Y), 
                        hh,
                        ww,
                        T,
                        D,
                        B,
                        B2,
                        param.bf,line);
                delete [] line;
    
    // Copy back half source to display
    dst=out->GetWritePtr(PLANAR_Y);
    src=in->GetReadPtr(PLANAR_Y);
    sstride=in->GetPitch(PLANAR_Y);
    dstride=out->GetPitch(PLANAR_Y);
    for(uint32_t y=0;y<hh;y++)   // We do both u & v!
    {
        memcpy(dst,src,ww/2);
        dst+=dstride;
        src+=sstride;
    }
    // add separator
    dst=out->GetWritePtr(PLANAR_Y)+ww/2;
    for(int j=0;j<hh/2;j++)
    {
        dst[0]=0;
        dst[dstride]=0xff;
        dst+=dstride*2;
    }
    out->printString(1,1,QT_TRANSLATE_NOOP("asharp", "Original"));
    out->printString(ww/24+1,1,QT_TRANSLATE_NOOP("asharp", "Processed"));
    return 1;
}