uint8_t ADMVideoMPdelogo::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>=_info.nb_frames) { printf("MPdelogo : Filter : out of bound!\n"); return 0; } ADM_assert(_param); ADMImage *curImage; char txt[256]; curImage=vidCache->getImage(frame); if(!curImage) { printf("MPdelogo : error getting frame\n"); return 0; } delogo(YPLANE(data), YPLANE(curImage), _info.width, _info.width, _info.width, _info.height, _param->xoff, _param->yoff, _param->lw, _param->lh, _param->band, _param->show,0); delogo(UPLANE(data), UPLANE(curImage), _info.width>>1, _info.width>>1, _info.width>>1, _info.height>>1,_param->xoff>>1, _param->yoff>>1, _param->lw>>1, _param->lh>>1, _param->band>>1, _param->show,0); delogo(VPLANE(data), VPLANE(curImage), _info.width>>1, _info.width>>1, _info.width>>1, _info.height>>1,_param->xoff>>1, _param->yoff>>1, _param->lw>>1, _param->lh>>1, _param->band>>1, _param->show,0); vidCache->unlockAll(); return 1; }
uint8_t ADMVideoUVSwap::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>= _info.nb_frames) return 0; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,data,flags)) return 0; uint32_t sz; uint8_t *start; sz=_info.width*_info.height; sz>>=2; start=UPLANE(data); memcpy(_buf,start,sz); memcpy(UPLANE(data),VPLANE(data),sz); memcpy(VPLANE(data),_buf,sz); return 1; }
uint8_t AVDMVideoWhirl::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { uint32_t page=_info.width*_info.height; ADMImage *cur,*prev; double frac; if(frame>= _info.nb_frames) return 0; if(frame>STEP_SIZE) frac=1; else frac=(double)frame/(double)STEP_SIZE; if(frame>(_info.nb_frames-1)) return 0; *len=(page*3)>>1; if(!_in->getFrameNumberNoAlloc(frame,len,_uncompressed,flags)) return 0; data->copyInfo(_uncompressed); Process(YPLANE(_uncompressed),YPLANE(data),_info.width,_info.height,frac); Process(UPLANE(_uncompressed),UPLANE(data),_info.width>>1,_info.height>>1,frac); Process(VPLANE(_uncompressed),VPLANE(data),_info.width>>1,_info.height>>1,frac); return 1; }
uint8_t ADMVideoDeinterlace::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //uint8_t *dst,*dstu,*dstv,*srcu,*srcv; uint32_t uvlen; if(frame>=_info.nb_frames) return 0; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; uvlen= _info.width*_info.height; *len= (uvlen*3)>>1; // No interleaving detected if(!hasMotion(_uncompressed)) { data->duplicate(_uncompressed); } else { //printf("Blending\n"); doBlend(_uncompressed,data); memcpy(UPLANE(data),UPLANE(_uncompressed),uvlen>>2); memcpy(VPLANE(data),VPLANE(_uncompressed),uvlen>>2); data->copyInfo(_uncompressed); } return 1; }
uint8_t ADMVideoDropOut::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { UNUSED_ARG(flags); uint32_t uvlen; uint32_t dlen,dflags; ADMImage *_next; ADMImage *_previous; ADMImage *_current; // printf("\n DropOut : %lu\n",frame); uvlen= _info.width*_info.height; *len=uvlen+(uvlen>>1); if(frame> _info.nb_frames-1) return 0; if(!frame || (frame==_info.nb_frames-1)) { _current=vidCache->getImage(frame); if(!_current) return 0; memcpy(YPLANE(data),YPLANE(_current),uvlen); memcpy(UPLANE(data),UPLANE(_current),uvlen>>2); memcpy(VPLANE(data),VPLANE(_current),uvlen>>2); vidCache->unlockAll(); return 1; }
// // Remove y and v just keep U and expand it // uint8_t ADMVideoDenoise::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //uint32_t x,w; uint32_t page; ADM_assert(_param); if(frame>= _info.nb_frames) return 0; if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; page=_info.width*_info.height; *len=(page*3)>>1; if((_lastFrame+1)!=frame) // async jump { // just copy it memcpy(YPLANE(data),YPLANE(_uncompressed),page); memcpy(UPLANE(data),UPLANE(_uncompressed),page>>2); memcpy(VPLANE(data),VPLANE(_uncompressed),page>>2); memcpy(YPLANE(_locked),YPLANE(_uncompressed),page); memcpy(UPLANE(_locked),UPLANE(_uncompressed),page>>2); memcpy(VPLANE(_locked),VPLANE(_uncompressed),page>>2); _lastFrame=frame; return 1; }
uint8_t flyHue::process(void ) { uint8_t *src,*dst; uint32_t stride; float hue,sat; hue=param.hue*M_PI/180.; sat=(100+param.saturation)/100.; memcpy(YPLANE(_yuvBufferOut),YPLANE(_yuvBuffer),_w*_h); // copy luma // Do it! HueProcess_C(VPLANE(_yuvBufferOut), UPLANE(_yuvBufferOut), VPLANE(_yuvBuffer), UPLANE(_yuvBuffer), _w>>1,_w>>1, _w>>1,_h>>1, hue, sat); // Copy half source to display dst=_yuvBufferOut->data+_w*_h; src=_yuvBuffer->data+_w*_h; stride=_w>>1; for(uint32_t y=0;y<_h;y++) // We do both u & v! { memcpy(dst,src,stride>>1); dst+=stride; src+=stride; } return 1; }
uint8_t ADMVideoEq2::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { ADMImage *mysrc=NULL; if(frame>=_info.nb_frames) return 0; mysrc=vidCache->getImage(frame); if(!mysrc) return 0; uint32_t w,h; w=_info.width; h=_info.height; #ifdef ADM_CPU_X86 if(CpuCaps::hasMMX()) { affine_1d_MMX(&(settings.param[0]),YPLANE(data),YPLANE(mysrc),w,h); w>>=1; h>>=1; affine_1d_MMX(&(settings.param[2]),UPLANE(data),UPLANE(mysrc),w,h); affine_1d_MMX(&(settings.param[1]),VPLANE(data),VPLANE(mysrc),w,h); } else #endif {
void frame_changed( void ) { uint32_t new_frame,max,l,f; double percent; GtkWidget *wid; GtkAdjustment *adj; max=incoming->getInfo()->nb_frames; wid=WID(hscale1); adj=gtk_range_get_adjustment (GTK_RANGE(wid)); new_frame=0; percent=(double)GTK_ADJUSTMENT(adj)->value; percent*=max; percent/=100.; new_frame=(uint32_t)floor(percent); if(new_frame>=max) new_frame=max-1; ADM_assert(incoming->getFrameNumberNoAlloc(new_frame, &l, imgsrc,&f)); memcpy(UPLANE(imgdisplay),UPLANE(imgsrc),(w*h)>>2); memcpy(VPLANE(imgdisplay),VPLANE(imgsrc),(w*h)>>2); update(); draw(); }
uint8_t ADMVideoChromaShift::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>= _info.nb_frames) return 0; ADM_assert(_param); // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; // copy luma as it is left untouched uint32_t w=_info.width; uint32_t h=_info.height; // uint8_t *in,*out; uint32_t page; page=(w*h); memcpy(YPLANE(data),YPLANE(_uncompressed),page); if(!_param->u) { memcpy(UPLANE(data),UPLANE(_uncompressed),page>>2); }
uint8_t ADMVideoMosaic::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>=_info.nb_frames) { printf("Filter : out of bound!\n"); return 0; } ADM_assert(_param); ADMImage *curImage; char txt[256]; for(int y=0;y<_param->vz;y++) for(int x=0;x<_param->hz;x++) { curImage=vidCache->getImage(frame+y*_param->hz+x); if(!curImage) continue; if(_param->show) { sprintf(txt," %02d",frame+x+y*_param->hz); drawString(curImage,2,0,txt); } uint8_t *src[3]; uint8_t *dst[3]; int ssrc[3]; int ddst[3]; uint32_t page; page=_in->getInfo()->width*_in->getInfo()->height; src[0]=YPLANE(curImage); src[1]=UPLANE(curImage); src[2]=VPLANE(curImage); ssrc[0]=_in->getInfo()->width; ssrc[1]=ssrc[2]=_in->getInfo()->width>>1; page=_info.width*tinyH; dst[0]=YPLANE(data)+page*y+tinyW*x; dst[1]=UPLANE(data)+((page*y)/4)+((tinyW*x)/2); dst[2]=VPLANE(data)+((page*y)/4)+((tinyW*x)/2); ddst[0]=_info.width; ddst[1]=ddst[2]=_info.width>>1; sws_scale(_context,src,ssrc,0,_in->getInfo()->height,dst,ddst); } vidCache->unlockAll(); return 1; }
//************************************************************* uint8_t ADMVideoLavPPDeint::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>= _info.nb_frames) return 0; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; // const uint8_t *iBuff[3]; uint8_t *oBuff[3]; int strideTab[3],strideTab2[3]; oBuff[0]=YPLANE(data); oBuff[1]=UPLANE(data); oBuff[2]=VPLANE(data); iBuff[0]=YPLANE(_uncompressed); iBuff[1]=UPLANE(_uncompressed); iBuff[2]=VPLANE(_uncompressed); strideTab[0]=strideTab2[0]=_info.width; strideTab[1]=strideTab2[1]=_info.width>>1; strideTab[2]=strideTab2[2]=_info.width>>1; int type; if(_uncompressed->flags&AVI_KEY_FRAME) type=1; else if(_uncompressed->flags & AVI_B_FRAME) type=3; else type=2; pp_postprocess( iBuff, strideTab, oBuff, strideTab2, _info.width, _info.height, NULL, 0, ppmode, ppcontext, type); // I ? data->copyInfo(_uncompressed); return 1; }
uint8_t ADMVideoFlipV::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>= _info.nb_frames) return 0; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; uint8_t *in,*out; uint32_t stride=_info.width; uint32_t h=_info.height; uint32_t page,qpage; page=stride*h; qpage=page>>2; in=YPLANE(_uncompressed); out=YPLANE(data)+(h-1)*stride; // flip y for(uint32_t y=h;y>0;y--) { memcpy(out,in,stride); in+=stride; out-=stride; } // Flip U & V stride>>=1; in=UPLANE(_uncompressed); out=UPLANE(data)+qpage-stride; // flip u for(uint32_t y=h>>1;y>0;y--) { memcpy(out,in,stride); in+=stride; out-=stride; } in=VPLANE(_uncompressed); out=VPLANE(data)+qpage-stride; // flip u for(uint32_t y=h>>1;y>0;y--) { memcpy(out,in,stride); in+=stride; out-=stride; } data->copyInfo(_uncompressed); return 1; }
uint8_t AVDM_Fade::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data,uint32_t *flags) { uint32_t num_frames,tgt; ADMImage *src; num_frames=_info.nb_frames; // ?? tgt=frame+_info.orgFrame; if(frame>=num_frames) { printf("[Fade] out of bound\n"); return 0; } src=vidCache->getImage(tgt); if(!src) return 0; if(tgt>_param->endFade || tgt <_param->startFade ||_param->endFade==_param->startFade ) { data->duplicate(src); vidCache->unlockAll(); return 1; } uint8_t *s,*d,*index; uint32_t count=_info.width*_info.height,w; float num,den; den=_param->endFade-_param->startFade; num=tgt-_param->startFade; num=num/den; num*=255.; w=(uint32_t)floor(num+0.4); s=src->data; d=data->data; index=lookup[w]; for(int i=0;i<count;i++) { *d++=index[*s++]; } memcpy(UPLANE(data),UPLANE(src),count>>2); memcpy(VPLANE(data),VPLANE(src),count>>2); vidCache->unlockAll(); return 1; }
static uint8_t unblend(ADMImage *tgt,ADMImage *src,ADMImage *srcP) { int delta; uint32_t ww,hh; uint8_t *s1,*s2,*d1; int a1,a2,t1; tinyUnblend(YPLANE(tgt),YPLANE(src),YPLANE(srcP),tgt->_width,tgt->_height); tinyUnblend(UPLANE(tgt),UPLANE(src),UPLANE(srcP),tgt->_width>>1,tgt->_height>>1); tinyUnblend(VPLANE(tgt),VPLANE(src),VPLANE(srcP),tgt->_width>>1,tgt->_height>>1); return 1; }
static uint8_t restore(ADMImage *tgt,ADMImage *srcP,ADMImage *src,ADMImage *srcN,ADMImage *srcNN) { int delta; uint32_t ww,hh; uint8_t *s1,*s2,*d1; int a1,a2,t1; tinyRestore(YPLANE(tgt),YPLANE(srcP),YPLANE(src),YPLANE(srcN),YPLANE(srcNN),tgt->_width,tgt->_height); tinyRestore(UPLANE(tgt),UPLANE(srcP),UPLANE(src),UPLANE(srcN),UPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); tinyRestore(VPLANE(tgt),VPLANE(srcP),VPLANE(src),VPLANE(srcN),VPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); return 1; }
ADMVideoDenoise::ADMVideoDenoise( AVDMGenericVideoStream *in,CONFcouple *couples) { if(distMatrixDone==false) { buildDistMatrix(); distMatrixDone=true; } _in=in; memcpy(&_info,_in->getInfo(),sizeof(_info)); uint32_t page; _info.encoding=1; page= _in->getInfo()->width*_in->getInfo()->height; // _uncompressed=new uint8_t [page]; _uncompressed=new ADMImage(_in->getInfo()->width,_in->getInfo()->height); ADM_assert(_uncompressed); // _locked=new uint8_t [page]; _locked=new ADMImage(_in->getInfo()->width,_in->getInfo()->height); ADM_assert(_locked); // _lockcount=new uint8_t [page]; _lockcount=new ADMImage(_in->getInfo()->width,_in->getInfo()->height); memset(YPLANE(_lockcount),0,page); memset(UPLANE(_lockcount),0,page>>2); memset(VPLANE(_lockcount),0,page>>2); _param=NULL; if(couples) { _param=NEW(NOISE_PARAM); GET(lumaLock); GET(lumaThreshold); GET(chromaLock); GET(chromaThreshold); GET(sceneChange); } else { #define XXX 1 _param=NEW(NOISE_PARAM); _param->lumaLock= 4*XXX; _param->lumaThreshold= 10*XXX; _param->chromaLock= 8*XXX; _param->chromaThreshold= 16*XXX; _param->sceneChange= 30*XXX; } _lastFrame=0xfffffff0; }
uint8_t flyEq2::process(void) { Eq2Settings mySettings; #if 0 printf("Contrast :%f\n",param.contrast); printf("brightness :%f\n",param.brightness); printf("saturation :%f\n",param.saturation); printf("gamma_weight :%f\n",param.gamma_weight); printf("gamma :%f\n",param.gamma); printf("rgamma :%f\n",param.rgamma); printf("bgamma :%f\n",param.bgamma); printf("ggamma :%f\n",param.ggamma); printf("******************\n"); #endif update_lut(&mySettings,¶m); typedef void lutMeType(oneSetting *par, unsigned char *dst, unsigned char *src, unsigned int w, unsigned int h); lutMeType *lutMe=apply_lut; #ifdef ADM_CPU_X86 if(CpuCaps::hasMMX()) { lutMe=affine_1d_MMX; } #endif lutMe(&(mySettings.param[0]),YPLANE(_yuvBufferOut),YPLANE(_yuvBuffer),_w,_h); lutMe(&(mySettings.param[2]),UPLANE(_yuvBufferOut),UPLANE(_yuvBuffer),_w>>1,_h>>1); lutMe(&(mySettings.param[1]),VPLANE(_yuvBufferOut),VPLANE(_yuvBuffer),_w>>1,_h>>1); #if 1 _yuvBuffer->copyLeftSideTo(_yuvBufferOut); #endif return 1; }
uint8_t AVDMVideoHzStackField::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { uint32_t ref,ref2; ADMImage *ptr1,*ptr2; if(frame>=_info.nb_frames) return 0; if(!_in->getFrameNumberNoAlloc(frame, len, _uncompressed, flags)) return 0; uint32_t pg=_info.width*_info.height; // Duplicate _uncompressed memcpy(YPLANE(data),YPLANE(_uncompressed),pg); memcpy(UPLANE(data),UPLANE(_uncompressed),pg>>2); memcpy(VPLANE(data),VPLANE(_uncompressed),pg>>2); return 1; }
uint8_t AVDMVideoSwapField::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //static Image in,out; if(frame>=_info.nb_frames) return 0; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; uint32_t w=_info.width; uint32_t h=_info.height; uint32_t page=w*h; uint32_t stride; // copy u & v memcpy(UPLANE(data),UPLANE(_uncompressed),page>>2); memcpy(VPLANE(data),VPLANE(_uncompressed),page>>2); uint8_t *odd,*even,*target,*target2; even=YPLANE(_uncompressed); odd=even+w; target=YPLANE(data); target2=YPLANE(data)+w; stride=2*w; h>>=1; for(;h--;h>0) { memcpy(target,odd,w); memcpy(target2,even,w); target+=stride; target2+=stride; odd+=stride; even+=stride; } data->copyInfo(_uncompressed); return 1; }
uint8_t AVDMVideoStreamMPResize::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { if(frame>=_info.nb_frames) { printf("Filter : out of bound!\n"); return 0; } ADM_assert(_param); if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; uint8_t *src[3]; uint8_t *dst[3]; int ssrc[3]; int ddst[3]; uint32_t page; page=_in->getInfo()->width*_in->getInfo()->height; src[0]=YPLANE(_uncompressed); src[1]=UPLANE(_uncompressed); src[2]=VPLANE(_uncompressed); ssrc[0]=_in->getInfo()->width; ssrc[1]=ssrc[2]=_in->getInfo()->width>>1; page=_info.width*_info.height; dst[0]=YPLANE(data); dst[1]=UPLANE(data); dst[2]=VPLANE(data); ddst[0]=_info.width; ddst[1]=ddst[2]=_info.width>>1; sws_scale(_context,src,ssrc,0,_in->getInfo()->height,dst,ddst); data->copyInfo(_uncompressed); return 1; }
// // Remove y and v just keep U and expand it // uint8_t ADMVideoChromaU::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { uint32_t w,x; uint32_t page; if(frame>= _info.nb_frames) return 0; if(!_in->getFrameNumberNoAlloc(frame, len,data,flags)) return 0; page= _info.width*_info.height; *len=(page*3)>>1; // now expand u uint8_t *y,*v,*y2; y=YPLANE(data); y2=y+_info.width; v=UPLANE(data); for(w= _info.height>>1;w>0;w--) { for(x= _info.width>>1;x>0;x--) { *y=*v; *y2=*v; *(y+1)=*v; *(y2+1)=*v; v++; y+=2; y2+=2; } y+=_info.width; y2+=_info.width; } // Remove chroma u & v memset(UPLANE(data),0x80,page>>2); memset(VPLANE(data),0x80,page>>2); }
/** * \fn copyLeftSideTo * \brief Copy half the image (left part) to dest * @param dest : Image to copy to */ uint8_t ADMImage::copyLeftSideTo(ADMImage *dest) { uint8_t *src,*dst; uint32_t stride; ADM_assert(_width==dest->_width); ADM_assert(_height==dest->_height); dst=YPLANE(dest); src=YPLANE(this); stride=_width; for(uint32_t y=0;y<_height;y++) // We do both u & v! { memcpy(dst,src,stride>>1); dst+=stride; src+=stride; } // U dst=UPLANE(dest); src=UPLANE(this); stride=_width>>1; uint32_t h2=_height>>1; for(uint32_t y=0;y<h2;y++) // We do both u & v! { memcpy(dst,src,stride>>1); dst+=stride; src+=stride; } // V dst=VPLANE(dest); src=VPLANE(this); for(uint32_t y=0;y<h2;y++) // We do both u & v! { memcpy(dst,src,stride>>1); dst+=stride; src+=stride; } return 1; }
uint8_t ADMVideoPullDown::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //static Image in,out; if(frame>=_info.nb_frames) { printf("out of bound frame (%lu / %lu)\n",frame,_info.nb_frames); return 0; } uint32_t w=_info.width; uint32_t h=_info.height; uint32_t page=w*h; uint32_t i; uint32_t target; uint32_t loop=0; *len=(page*3)>>1; cont: target=frame-((frame)%5); // got it ? if(_cacheStart==target) { uint32_t index; aprintf("Filter: It is in cache...(cachestart=%lu)\n",_cacheStart); index=frame%5; aprintf("getting %lu)\n",index); memcpy(YPLANE(data),YPLANE(_uncompressed[index]),page); memcpy(UPLANE(data),UPLANE(_uncompressed[index]),page>>2); memcpy(VPLANE(data),VPLANE(_uncompressed[index]),page>>2); *flags=0; return 1; }
static uint8_t restore(ADMImage *tgt,ADMImage *srcP,ADMImage *src,ADMImage *srcN,ADMImage *srcNN) { int delta; uint32_t ww,hh; uint8_t *s1,*s2,*d1; int a1,a2,t1; #if defined (ARCH_X86 ) || defined (ARCH_X86_64 ) if(CpuCaps::hasMMX()) { tinyRestoreMMX(YPLANE(tgt),YPLANE(srcP),YPLANE(src),YPLANE(srcN),YPLANE(srcNN),tgt->_width,tgt->_height); tinyRestoreMMX(UPLANE(tgt),UPLANE(srcP),UPLANE(src),UPLANE(srcN),UPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); tinyRestoreMMX(VPLANE(tgt),VPLANE(srcP),VPLANE(src),VPLANE(srcN),VPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); return 1; } #endif tinyRestore(YPLANE(tgt),YPLANE(srcP),YPLANE(src),YPLANE(srcN),YPLANE(srcNN),tgt->_width,tgt->_height); tinyRestore(UPLANE(tgt),UPLANE(srcP),UPLANE(src),UPLANE(srcN),UPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); tinyRestore(VPLANE(tgt),VPLANE(srcP),VPLANE(src),VPLANE(srcN),VPLANE(srcNN),tgt->_width>>1,tgt->_height>>1); return 1; }
/** \fn preAmble \fn prepare a frame to be encoded */ bool x264Encoder::preAmble (ADMImage * in) { MMSET(pic); pic.img.i_csp = X264_CSP_I420; pic.img.i_plane = 3; pic.img.plane[0] = YPLANE(in); pic.img.plane[2] = UPLANE(in); pic.img.plane[1] = VPLANE(in); pic.img.i_stride[0] = in->GetPitch(PLANAR_Y); pic.img.i_stride[1] = in->GetPitch(PLANAR_U); pic.img.i_stride[2] = in->GetPitch(PLANAR_V); pic.i_type = X264_TYPE_AUTO; pic.i_pts = in->Pts; return true; }
uint8_t ADMVideoHue::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { ADMImage *mysrc=NULL; if(frame>=_info.nb_frames) return 0; mysrc=vidCache->getImage(frame); if(!mysrc) return 0; memcpy(YPLANE(data),YPLANE(mysrc),_info.width*_info.height); HueProcess_C(VPLANE(data), UPLANE(data), VPLANE(mysrc), UPLANE(mysrc), _info.width>>1,_info.width>>1, _info.width>>1,_info.height>>1, _hue, _saturation); vidCache->unlockAll(); return 1; }
//______________________________________________________________ uint8_t vidDelta::getFrameNumberNoAlloc (uint32_t frame, uint32_t * len, ADMImage * data, uint32_t * flags) { int w,h,page; ADMImage *cur,*prev,*next; w=_info.width; h=_info.height; page=w*h; if(frame>= _info.nb_frames) return 0; if(!frame || frame>=_info.nb_frames-1) { memset(YPLANE(data),0,page); memset(UPLANE(data),128,page>>2); memset(VPLANE(data),128,page>>2); return 1; }
uint8_t ADMVideoLuma::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { ADM_assert(frame<_info.nb_frames); // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,data,flags)) return 0; uint32_t sz; sz=_info.width*_info.height; memset(UPLANE(data),128,sz>>2); memset(VPLANE(data),128,sz>>2); return 1; }
/** \fn getFrame \brief Get a processed frame */ bool verticalFlipFilter::getNextFrame(uint32_t *fn,ADMImage *image) { // since we do nothing, just get the output of previous filter if(false==previousFilter->getNextFrame(fn,image)) { ADM_warning("FlipFilter : Cannot get frame\n"); return false; } // do in place flip int w=info.width; int h=info.height; int stride=image->GetPitch(PLANAR_Y); flipMe(YPLANE(image),w,h,stride); stride=image->GetPitch(PLANAR_U); flipMe(UPLANE(image),w>>1,h>>1,stride); stride=image->GetPitch(PLANAR_V); flipMe(VPLANE(image),w>>1,h>>1,stride); return true; }