Exemplo n.º 1
0
/**
    \fn processYuv
*/
uint8_t    flyContrast::processYuv(ADMImage* in, ADMImage *out)
{
    buildContrastTable (param.coef, param.offset, tableluma, tablechroma);


    out->copyInfo(in);

    if(param.doLuma)
        doContrast(in,out,tableluma,PLANAR_Y);
    else
        out->copyPlane(in,out,PLANAR_Y);


    if(param.doChromaU)
        doContrast(in,out,tablechroma,PLANAR_U);
    else
        out->copyPlane(in,out,PLANAR_U);

    if(param.doChromaV)
        doContrast(in,out,tablechroma,PLANAR_V);
    else
        out->copyPlane(in,out,PLANAR_V);

    return 1;
}
Exemplo n.º 2
0
bool ADMVideoContrast::configure( )

{
    if( DIA_getContrast(previousFilter,&_param))
    {
        buildContrastTable (_param.coef, _param.offset, _tableFlat, _tableNZ);
        return true;
    }
    return false;
}
Exemplo n.º 3
0
/**
    \fn      ctor
    \brief
*/
ADMVideoContrast::ADMVideoContrast(ADM_coreVideoFilter *in,CONFcouple *couples) : ADM_coreVideoFilter(in,couples)
{
        if(!couples || !ADM_paramLoad(couples,contrast_param,&_param))
		{
            // Default value
              _param.offset = 0;
              _param.coef = 1.0f;
              _param.doLuma = 1;
              _param.doChromaU = 1;
              _param.doChromaV = 1;
        }

        buildContrastTable (_param.coef, _param.offset, _tableFlat, _tableNZ);

}
Exemplo n.º 4
0
/**
    \fn processYuv
*/
uint8_t    flyContrast::processYuv(ADMImage* in, ADMImage *out)
{
    buildContrastTable (param.coef, param.offset, tableluma, tablechroma);


    out->copyInfo(in);
    if(!previewActivated)
    {
        out->copyPlane(in,out,PLANAR_Y);
        out->copyPlane(in,out,PLANAR_U);
        out->copyPlane(in,out,PLANAR_V);
    }
    else
    {
        if(param.doLuma)
            doContrast(in,out,tableluma,PLANAR_Y);
        else
            out->copyPlane(in,out,PLANAR_Y);


        if(param.doChromaU)
            doContrast(in,out,tablechroma,PLANAR_U);
        else
            out->copyPlane(in,out,PLANAR_U);

        if(param.doChromaV)
            doContrast(in,out,tablechroma,PLANAR_V);
        else
            out->copyPlane(in,out,PLANAR_V);
    }
    if(!scene) return true;
    
    // Draw luma histogram
    uint8_t *luma=out->GetReadPtr(PLANAR_Y);
    int     stride=out->GetPitch(PLANAR_Y);
    int     decimate=4;
    double  sumsum[256];    
    for(int i=0;i<256;i++) sumsum[i]=0;
    
    double  totalSum=(double)(out->_width*out->_height)/decimate; // # of sampling points
    for(int y=0;y<in->_height;y+=decimate)
    {
        uint8_t *p=luma;
        for(int x=0;x<in->_width;x++)
        {
            sumsum[*p]++;
            p++;
        }
        luma+=stride*decimate;
    }
    // normalize
    for(int i=0;i<256;i++)
    {
        // zoom factor =10
        sumsum[i]=(10*sumsum[i]*(127))/totalSum;
        if(sumsum[i]>127) sumsum[i]=127;
    }
    int toggle=0;
    
    scene->clear();
    for(int i=0;i<256;i++)
    {
        QLineF qline(i,127,i,127-sumsum[i]);
        scene->addLine(qline);
    }
    // Draw 16 and 235 line
        QLineF qline(16,100,16,126);
        scene->addLine(qline);
        QLineF qline2(235,100,235,126);
        scene->addLine(qline2);
    
    return 1;
}