if(inframe<1 || inframe>inframe>_info.nb_frames-2 )
if(inframe<1 || inframe>inframe>_info.nb_frames-3 )
uint8_t vidHardPDRemoval::getFrameNumberNoAlloc (uint32_t inframe,                                uint32_t * len,                                ADMImage * data, uint32_t * flags){		ADMImage *srcP,*srcN,*srcNN,*src,*final,*display;        float distMerged, distN,distP,distM,distR,skip=0;        char txt[255];                if(inframe<1 || inframe>inframe>_info.nb_frames-2 )        {                skip=1;        }        if(inframe>_lastRemoved+1 && inframe<_lastRemoved+5 )        {                skip=1;        }                if(skip)        {                data->duplicate(vidCache->getImage(inframe));                vidCache->unlockAll();                return 1;        }                if(_lastRemoved==inframe-1)        {                data->duplicate(rebuild);                if(_param->show&&inframe)                {                        sprintf(txt," Telecined 2");                        drawString(data,2,4,txt);                }                                return 1;        }        //data->duplicate(rebuild);        srcP=vidCache->getImage(inframe-1);        src=vidCache->getImage(inframe);        srcN=vidCache->getImage(inframe+1);        srcNN=vidCache->getImage(inframe+2);                // Let's rebuild the pseudo R, where we have A AR RB B        // If then we got R1 very close to R2, and that AR is very close to src        // Decide it is hard telecined (frame blending)#if 1        restore(rebuild,srcP,src,srcN,srcNN);#else        cand1->substract(src,srcP);        cand2->substract(srcN,srcNN);        rebuild->merge(cand1,cand2);#endif  #if 0        data->duplicate(rebuild);        vidCache->unlockAll();        return 1;#endif        // And remerge...        cand1->merge(srcP,rebuild);        cand2->merge(srcNN,rebuild);                distP=ADMImage::lumaDiff(cand1,src,_param->noise);        distN=ADMImage::lumaDiff(cand2,srcN,_param->noise);        distM=ADMImage::lumaDiff(src,srcP,_param->noise);        distR=ADMImage::lumaDiff(src,srcN,_param->noise);                                double medium;         if(distM>1&&distR>1)        {                if(distM>distR) medium=distR;                          else  medium=distM;                  //medium=min(distM,distR);                                  medium/=100;                 distN/=medium;                 distP/=medium;                 distR/=medium;                  }        medium=medium/(_info.width*_info.height);        medium*=1000;        if(medium<_param->identical)        {                 data->duplicate(src);                 vidCache->unlockAll();                if(_param->show)                {                        sprintf(txt," %% %02.1f : Identical",medium);                        drawString(data,2,3,txt);                }                return 1;        }        double mn;        if(inframe == _lastRemoved+5)        {                distN=(distN*7)/10;                distP=(distP*7)/10;                        }                //data->duplicate(src);         if(distN<_param->threshold && distP<_param->threshold)        {                data->duplicate(rebuild);                _lastRemoved=inframe;                if(_param->show && inframe == _lastRemoved+5)                {                        sprintf(txt," Fav");                        drawString(data,2,5,txt);                      }        }        else                data->duplicate(src);        if(_param->show)        {                display=data;                sprintf(txt," N %02.1f",distN);                drawString(display,2,0,txt);                sprintf(txt," P %02.1f",distP);                drawString(display,2,1,txt);                sprintf(txt," R %02.1f",distR);                drawString(display,2,2,txt);                sprintf(txt," %% %02.1f",medium);                drawString(display,2,3,txt);                if(_lastRemoved==inframe)                {                        sprintf(txt," Telecined 1",distP);                        drawString(display,2,4,txt);                }        }                  vidCache->unlockAll();	return 1;}