virtual void OnGotChunk( const ChunkHeader& ch ) { FCCParser fcc( ch.fcc ); // per file if ( fcc == FCC('dmlh') ) _Info._DMLHch = ch; if ( fcc == FCC('hdrl') ) _Info._HDRLch = ch; if ( fcc == FCC('avih') ) _Info._AVIHch = ch; if ( fcc == FCC('idx1') ) _Info._IDX1ch = ch; // per stream if ( fcc == FCC('strl') ) { int idx = (int)_Info._StreamInfos.size(); _Info._StreamInfos.push_back( AVIStreamInfo( idx ) ); } if ( fcc == FCC('strh') ) { _Info._StreamInfos.back().streamInfo.header = _Stream->Read<MediaStreamHeader>(); _Info._StreamInfos.back().STRHch = ch; } if ( fcc == FCC('indx') ) _Info._StreamInfos.back().streamInfo.indxChunk = ch; if ( fcc == FCC('strf') && _Info._StreamInfos.back().streamInfo.IsVideo() ) _Info._StreamInfos.back().streamInfo.video = _Stream->Read<BITMAPINFOHEADER>(); if ( fcc == FCC('strf') && _Info._StreamInfos.back().streamInfo.IsAudio() ) _Info._StreamInfos.back().streamInfo.audio = WaveFormatEx::FromStream( *_Stream ); // standard index (type 2) if ( fcc == FCC('ix##') ) _Info._StreamInfos[fcc.StreamIndex()].indexes.push_back( Index( ch ) ); // index entry if ( fcc == FCC('##db') ) _Info._StreamInfos[fcc.StreamIndex()].indexes.back().AddEntry( ch, true /*keyframe*/ ); if ( fcc == FCC('##dc') ) _Info._StreamInfos[fcc.StreamIndex()].indexes.back().AddEntry( ch, false/*delta frame*/ ); if ( fcc == FCC('##wb') ) _Info._StreamInfos[fcc.StreamIndex()].indexes.back().AddEntry( ch, true /*keyframe*/ ); }
bool xvid4Configure(void) { diaMenuEntry meE[]={ {0,QT_TRANSLATE_NOOP("xvid4","None")}, {1,QT_TRANSLATE_NOOP("xvid4","Low")}, {2,QT_TRANSLATE_NOOP("xvid4","Medium")}, {3,QT_TRANSLATE_NOOP("xvid4","Full")} }; diaMenuEntry qzE[]={ {0,QT_TRANSLATE_NOOP("xvid4","H.263")}, {1,QT_TRANSLATE_NOOP("xvid4","MPEG")}, {2,QT_TRANSLATE_NOOP("xvid4","Custom")} }; diaMenuEntry profileE[]={ { XVID_PROFILE_S_L0 ,"Simple Level0"}, { XVID_PROFILE_S_L1 ,"Simple Level1"}, { XVID_PROFILE_S_L2 ,"Simple Level2"}, { XVID_PROFILE_S_L3 ,"Simple Level3"}, { XVID_PROFILE_AS_L0 ,"Adv. Simple Level0"}, { XVID_PROFILE_AS_L1 ,"Adv. Simple Level1"}, { XVID_PROFILE_AS_L2 ,"Adv. Simple Level2"}, { XVID_PROFILE_AS_L3 ,"Adv. Simple Level3"}, { XVID_PROFILE_AS_L4 ,"Adv. Simple Level4"}, }; diaMenuEntry rdE[]={ {0,QT_TRANSLATE_NOOP("xvid4","None")}, {1,QT_TRANSLATE_NOOP("xvid4","DCT")}, {2,QT_TRANSLATE_NOOP("xvid4","Qpel16")}, {3,QT_TRANSLATE_NOOP("xvid4","Qpel8")}, {4,QT_TRANSLATE_NOOP("xvid4","Square")} }; diaMenuEntry threads[]={ {1,QT_TRANSLATE_NOOP("xvid4","One thread")}, {2,QT_TRANSLATE_NOOP("xvid4","Two threads)")}, {3,QT_TRANSLATE_NOOP("xvid4","Three threads")}, {99,QT_TRANSLATE_NOOP("xvid4","Auto (#cpu)")} }; diaMenuEntry arModeE[]={ {XVID_PAR_11_VGA,QT_TRANSLATE_NOOP("xvid4","1:1 (PC)")}, {XVID_PAR_43_PAL,QT_TRANSLATE_NOOP("xvid4","4:3 (PAL)")}, {XVID_PAR_43_NTSC,QT_TRANSLATE_NOOP("xvid4","4:3 (NTSC)")}, {XVID_PAR_169_PAL,QT_TRANSLATE_NOOP("xvid4","16:9 (PAL)")}, {XVID_PAR_169_NTSC,QT_TRANSLATE_NOOP("xvid4","16:9 (NTSC)")}, }; #define PX(x) &(xvid4Settings.x) diaElemBitrate bitrate(&(xvid4Settings.params),NULL); diaElemMenu meM(PX(motionEstimation),QT_TRANSLATE_NOOP("xvid4","MotionEstimation"),4,meE); diaElemMenu threadM(PX(nbThreads),QT_TRANSLATE_NOOP("xvid4","Threading"),4,threads); diaElemUInteger qminM(PX(qMin),QT_TRANSLATE_NOOP("xvid4","Mi_n. quantizer:"),1,31); diaElemUInteger qmaxM(PX(qMax),QT_TRANSLATE_NOOP("xvid4","Ma_x. quantizer:"),1,31); /* diaElemUInteger qdiffM(PX(max_qdiff),QT_TRANSLATE_NOOP("xvid4","Max. quantizer _difference:"),1,31); */ diaElemToggle trellis(PX(trellis),QT_TRANSLATE_NOOP("xvid4","_Trellis quantization")); diaElemUInteger max_b_frames(PX(maxBFrame),QT_TRANSLATE_NOOP("xvid4","_Number of B frames:"),0,32); diaElemMenu qzM(PX(cqmMode),QT_TRANSLATE_NOOP("xvid4","_Quantization type:"),2,qzE); diaElemMenu rdM(PX(rdMode),QT_TRANSLATE_NOOP("xvid4","_Macroblock decision:"),5,rdE); diaElemMenu profileM(PX(profile),QT_TRANSLATE_NOOP("xvid4","Profile:"),9,profileE); diaElemMenu par(PX(arMode),QT_TRANSLATE_NOOP("xvid4","Aspect Ratio:"),sizeof(arModeE)/sizeof(diaMenuEntry),arModeE); /* diaElemUInteger filetol(PX(vratetol),QT_TRANSLATE_NOOP("xvid4","_Filesize tolerance (kb):"),0,100000); diaElemFloat qzComp(PX(qcompress),QT_TRANSLATE_NOOP("xvid4","_Quantizer compression:"),0,1); diaElemFloat qzBlur(PX(qblur),QT_TRANSLATE_NOOP("xvid4","Quantizer _blur:"),0,1); */ diaElemUInteger GopSize(PX(maxKeyFrameInterval),QT_TRANSLATE_NOOP("xvid4","_Gop Size:"),1,500); // DIVX or XVID ? diaElemToggle fcc(PX(useXvidFCC),QT_TRANSLATE_NOOP("xvid4","Use XVID fcc (else DIVX)")); /* First Tab : encoding mode */ diaElemFrame frameMe(QT_TRANSLATE_NOOP("xvid4","Advanced Simple Profile")); frameMe.swallow(&profileM); frameMe.swallow(&max_b_frames); frameMe.swallow(&GopSize); frameMe.swallow(&bitrate); frameMe.swallow(&fcc); diaElem *diaME[]={&frameMe}; diaElemTabs tabME(QT_TRANSLATE_NOOP("xvid4","Motion Estimation"),1,diaME); /* 2nd Tab : Qz */ diaElem *diaQze[]={&qzM,&qminM,&qmaxM,&rdM,&meM,&trellis}; diaElemTabs tabQz(QT_TRANSLATE_NOOP("xvid4","Quantization"),6,diaQze); /* 3th Tab : thread */ diaElem *diaThread[]={&threadM}; diaElemTabs tabThread(QT_TRANSLATE_NOOP("xvid4","Threads"),1,diaThread); /** * 4th tab : aspect ratio * @return */ diaElem *diaAR[]={&par}; diaElemTabs tabAR(QT_TRANSLATE_NOOP("xvid4","Aspect Ratio"),1,diaAR); #if 0 diaElem *diaRC[]={&filetol,&qzComp,&qzBlur}; diaElemTabs tabRC(QT_TRANSLATE_NOOP("xvid4","Rate Control"),3,diaRC); #endif diaElemTabs *tabs[]={&tabME,&tabQz,&tabThread,&tabAR}; if( diaFactoryRunTabs(QT_TRANSLATE_NOOP("xvid4","Xvid4 MPEG-4 ASP configuration"),4,tabs)) { return true; } return false; }
/* * Main program : Molecular Dynamics simulation. */ int main(){ int move; double x[npart*3], vh[npart*3], f[npart*3]; double ekin; double vel; double sc; double start, time; /* * Parameter definitions */ double den = 0.83134; double side = pow((double)npart/den,0.3333333); double tref = 0.722; double rcoff = (double)mm/4.0; double h = 0.064; int irep = 10; int istop = 20; int iprint = 5; int movemx = 20; double a = side/(double)mm; double hsq = h*h; double hsq2 = hsq*0.5; double tscale = 16.0/((double)npart-1.0); double vaver = 1.13*sqrt(tref/24.0); /* * Initial output */ printf(" Molecular Dynamics Simulation example program\n"); printf(" ---------------------------------------------\n"); printf(" number of particles is ............ %6d\n",npart); printf(" side length of the box is ......... %13.6f\n",side); printf(" cut off is ........................ %13.6f\n",rcoff); printf(" reduced temperature is ............ %13.6f\n",tref); printf(" basic timestep is ................. %13.6f\n",h); printf(" temperature scale interval ........ %6d\n",irep); printf(" stop scaling at move .............. %6d\n",istop); printf(" print interval .................... %6d\n",iprint); printf(" total no. of steps ................ %6d\n",movemx); /* * Generate fcc lattice for atoms inside box */ fcc(x, npart, mm, a); /* * Initialise velocities and forces (which are zero in fcc positions) */ mxwell(vh, 3*npart, h, tref); dfill(3*npart, 0.0, f, 1); /* * Start of md */ printf("\n i ke pe e temp " " pres vel rp\n ----- ---------- ----------" " ---------- -------- -------- -------- ----\n"); start = secnds(); for (move=1; move<=movemx; move++) { /* * Move the particles and partially update velocities */ domove(3*npart, x, vh, f, side); /* * Compute forces in the new positions and accumulate the virial * and potential energy. */ forces(npart, x, f, side, rcoff); //kernelWrapper(npart,x,f,side,rcoff); /* * Scale forces, complete update of velocities and compute k.e. */ ekin=mkekin(npart, f, vh, hsq2, hsq); /* * Average the velocity and temperature scale if desired */ vel=velavg(npart, vh, vaver, h); if (move<istop && fmod(move, irep)==0) { sc=sqrt(tref/(tscale*ekin)); dscal(3*npart, sc, vh, 1); ekin=tref/tscale; } /* * Sum to get full potential energy and virial */ if (fmod(move, iprint)==0) prnout(move, ekin, epot, tscale, vir, vel, count, npart, den); } time = secnds() - start; printf("Time = %f\n",(float) time); }