// OK void test_trellis(){ int** G = getGenerator(); int Ns = 4; int ** pout = new2d<int>(Ns,4); int ** ps = new2d<int>(Ns,2) ; trellis(G,2,3,Ns,pout,ps); printf("pout:\n"); for(int i = 0 ; i < Ns ; ++i){ for(int j = 0 ; j < 4 ; ++j) printf("%d, ",pout[i][j]); printf("\n"); } printf("pstate:\n"); for(int i = 0 ; i < Ns ; ++i){ for(int j = 0 ; j < 2 ; ++j) printf("%d, ",ps[i][j]); printf("\n"); } delete2d<int>(G); delete2d<int>(pout); delete2d<int>(ps); }
void align( const AlignMatrix& w, const SentenceValues& huLength, const SentenceValues& enLength, Trail& bestTrail, AlignMatrix& v ) { const int huBookSize = w.size(); const int enBookSize = w.otherSize(); const int thickness = w.thickness(); massert(w.size()+1 == v.size()); massert(w.otherSize()+1 == v.otherSize()); TrelliMatrix trellis( huBookSize+1,enBookSize+1,thickness, Dead ); buildDynProgMatrix( w, huLength, enLength, v, trellis ); //x std::cout << std::endl; //x dumpAlignMatrix(v); //x std::cout << std::endl; //x dumpTrelliMatrix(trellis); //x exit(-1); std::cerr << "Matrix built." << std::endl; trelliToLadder( trellis, bestTrail ); std::cerr << "Trail found." << std::endl; }
int main( int argc, char* argv[] ) { //! [Creating a Convolutional code] //! [Creating a Convolutional code structure] //! [Creating a trellis] /* We are creating a trellis structure with 1 input bit. The constraint length is 4, which means there are 3 registers associated with the input bit. There are two output bits, the first one with generator 4 (in octal) associated with the input bit. */ fec::Trellis trellis({4}, {{013, 017}}, {015}); //! [Creating a trellis] /* The trellis is used to create a code structure. We specify that one bloc will conatins 1024 branches before being terminated. */ auto options = fec::Convolutional::Options(trellis, 1024); options.termination(fec::Convolutional::Tail); options.algorithm(fec::Approximate); //! [Creating a Convolutional code structure] /* A code is created and ready to operate */ std::unique_ptr<fec::Codec> codec(new fec::Convolutional(options)); //! [Creating a Convolutional code] std::cout << per(codec, 3.0) << std::endl; return 0; }
bool x264Configure(void) { diaMenuEntry threads[]={ {1,QT_TR_NOOP("One thread")}, {2,QT_TR_NOOP("Two threads)")}, {3,QT_TR_NOOP("Three threads")}, {99,QT_TR_NOOP("Auto (#cpu)")} }; #define PX(x) &(x264Settings.x) // Main int nbPreset=sizeof(x264_preset_names)/sizeof(const char *); int nbTunes=sizeof(x264_tune_names)/sizeof(const char *); #define MKMENUENTRY(N,out,array) diaMenuEntry out[N]; \ for(int i=0;i<N;i++) {out[i].val=i;out[i].text=array[i];out[i].desc=NULL;} MKMENUENTRY(nbPreset,presetEntries,x264_preset_names); MKMENUENTRY(nbTunes,tuneEntries,x264_tune_names); diaElemMenu presetMenu(PX(preset),QT_TR_NOOP("Preset"),nbPreset,presetEntries); diaElemMenu tuneMenu(PX(tune),QT_TR_NOOP("Tune"),nbTunes,tuneEntries); uint32_t presetToggle=(uint32_t)x264Settings.usePreset; uint32_t tuneToggle=(uint32_t)x264Settings.useTune; diaElemToggle usePreset(&presetToggle,QT_TR_NOOP("Use preset")); diaElemToggle useTune(&tuneToggle, QT_TR_NOOP("Use tune")); uint32_t trelBol=*PX(Trellis); uint32_t cabacBol=*PX(CABAC); diaElemToggle trellis(&trelBol,QT_TR_NOOP("_Trellis quantization")); diaElemToggle cabac(&cabacBol,QT_TR_NOOP("Cabac encoding")); diaElemUInteger GopSize(PX(MaxIdr),QT_TR_NOOP("_Gop Size:"),1,500); diaElemUInteger max_b_frames(PX(MaxBFrame),QT_TR_NOOP("Max B Frames:"),0,5); diaElemBitrate bitrate(&(x264Settings.params),NULL); diaElemMenu threadM(PX(threads),QT_TR_NOOP("Threading"),4,threads); diaElemUInteger profile(PX(profile),QT_TR_NOOP("Profile:"),10,50); //------------------- /* First Tab : encoding mode */ diaElem *diaMain[]={&usePreset,&presetMenu,&useTune,&tuneMenu,&profile}; diaElemTabs tabMain(QT_TR_NOOP("Main"),5,diaMain); diaElemFrame frameMe(QT_TR_NOOP("Main")); frameMe.swallow(&max_b_frames); frameMe.swallow(&GopSize); frameMe.swallow(&bitrate); diaElem *diaME[]={&frameMe}; diaElemTabs tabME(QT_TR_NOOP("Encoding mode"),1,diaME); /* 2nd Tab : Qz */ diaElem *diaQze[]={&trellis,&cabac}; diaElemTabs tabQz(QT_TR_NOOP("Quantization"),2,diaQze); /* 3th Tab : thread */ diaElem *diaThread[]={&threadM}; diaElemTabs tabThread(QT_TR_NOOP("Threads"),1,diaThread); diaElemTabs *tabs[]={&tabMain,&tabME,&tabQz,&tabThread}; // usePreset.link(0,&trellis); //usePreset.link(0,&cabac); usePreset.link(1,&presetMenu); useTune.link(1,&tuneMenu); if( diaFactoryRunTabs(QT_TR_NOOP("X264 MPEG-4 AVC configuration"),4,tabs)) { *PX(Trellis)= trelBol; *PX(CABAC)= cabacBol; *PX(usePreset)= presetToggle; *PX(useTune)= tuneToggle; return true; } return false; }
bool ffMpeg2Configure(void) { diaMenuEntry arE[]= { {0,QT_TRANSLATE_NOOP("ffmpeg2","Normal (4:3)")}, {1,QT_TRANSLATE_NOOP("ffmpeg2","Wide (16:9)")} }; diaMenuEntry matrixE[]= { {MPEG2_MATRIX_DEFAULT,QT_TRANSLATE_NOOP("ffmpeg2","Default")}, {MPEG2_MATRIX_TMPGENC,QT_TRANSLATE_NOOP("ffmpeg2","Tmpgenc")}, {MPEG2_MATRIX_ANIME,QT_TRANSLATE_NOOP("ffmpeg2","Animes")}, {MPEG2_MATRIX_KVCD,QT_TRANSLATE_NOOP("ffmpeg2","KVCD")}, }; diaMenuEntry rdE[]={ {0,QT_TRANSLATE_NOOP("ffmpeg2","MB comparison")}, {1,QT_TRANSLATE_NOOP("ffmpeg2","Fewest bits (vhq)")}, {2,QT_TRANSLATE_NOOP("ffmpeg2","Rate distortion")} }; diaMenuEntry threads[]={ {0,QT_TRANSLATE_NOOP("ffmpeg2","One thread")}, {2,QT_TRANSLATE_NOOP("ffmpeg2","Two threads)")}, {3,QT_TRANSLATE_NOOP("ffmpeg2","Three threads")}, {99,QT_TRANSLATE_NOOP("ffmpeg2","Auto (#cpu)")} }; diaMenuEntry interE[]={ {0,QT_TRANSLATE_NOOP("ffmpeg2","Progressive")}, {1,QT_TRANSLATE_NOOP("ffmpeg2","Interlaced")}, }; diaMenuEntry foE[]={ {0,QT_TRANSLATE_NOOP("ffmpeg2","Top Field First")}, {1,QT_TRANSLATE_NOOP("ffmpeg2","Bottom Field First")}, }; mpeg2_encoder *conf=&Mp2Settings; uint32_t me=(uint32_t)conf->lavcSettings.me_method; #define PX(x) &(conf->lavcSettings.x) diaElemBitrate bitrate(&(Mp2Settings.params),NULL); diaElemMenu threadM(PX(MultiThreaded),QT_TRANSLATE_NOOP("ffmpeg2","Threading"),4,threads); diaElemUInteger qminM(PX(qmin),QT_TRANSLATE_NOOP("ffmpeg2","Mi_n. quantizer:"),1,31); diaElemUInteger qmaxM(PX(qmax),QT_TRANSLATE_NOOP("ffmpeg2","Ma_x. quantizer:"),1,31); diaElemUInteger qdiffM(PX(max_qdiff),QT_TRANSLATE_NOOP("ffmpeg2","Max. quantizer _difference:"),1,31); diaElemUInteger bufferS(PX(bufferSize),QT_TRANSLATE_NOOP("ffmpeg2","VBV Buffer Size:"),1,1024); diaElemUInteger maxBitrate(PX(maxBitrate),QT_TRANSLATE_NOOP("ffmpeg2","Max bitrate (kb/s):"),1,50000); diaElemToggle trellis(PX(_TRELLIS_QUANT),QT_TRANSLATE_NOOP("ffmpeg2","_Trellis quantization")); diaElemUInteger max_b_frames(PX(max_b_frames),QT_TRANSLATE_NOOP("ffmpeg2","_Number of B frames:"),0,32); uint32_t widescreen= conf->lavcSettings.widescreen; uint32_t iinterlaced= conf->lavcSettings.interlaced; uint32_t bff= conf->lavcSettings.bff; diaElemMenu rdM(PX(mb_eval),QT_TRANSLATE_NOOP("ffmpeg2","_Macroblock decision:"),3,rdE); diaElemMenu arM(&(widescreen),QT_TRANSLATE_NOOP("ffmpeg2","Aspect ratio:"),2,arE); diaElemMenu matrixM(&(Mp2Settings.matrix),QT_TRANSLATE_NOOP("ffmpeg2","Matrices:"),MPEG2_MATRIX_LAST,matrixE); diaElemUInteger filetol(PX(vratetol),QT_TRANSLATE_NOOP("ffmpeg2","_Filesize tolerance (kb):"),0,100000); diaElemFloat qzComp(PX(qcompress),QT_TRANSLATE_NOOP("ffmpeg2","_Quantizer compression:"),0,1); diaElemFloat qzBlur(PX(qblur),QT_TRANSLATE_NOOP("ffmpeg2","Quantizer _blur:"),0,1); diaElemUInteger GopSize(PX(gop_size),QT_TRANSLATE_NOOP("ffmpeg2","_Gop Size:"),1,30); diaElemMenu interlaced(&(iinterlaced),QT_TRANSLATE_NOOP("ffmpeg2","_Interlaced:"),2,interE); diaElemMenu fieldOrder(&(bff),QT_TRANSLATE_NOOP("ffmpeg2","Field Order:"),2,foE); /* First Tab : encoding mode */ diaElem *diamode[]={&arM,&threadM,&bitrate}; diaElemTabs tabMode(QT_TRANSLATE_NOOP("ffmpeg2","Basic Settings"),3,diamode); /* 2nd Tab : advanced*/ diaElem *diaAdv[]={&bufferS,&matrixM,&max_b_frames,&GopSize,&maxBitrate}; diaElemTabs tabAdv(QT_TRANSLATE_NOOP("ffmpeg2","Adv. Settings"),5,diaAdv); /* 2ndb Tab : interlacing*/ diaElem *diaInter[]={&interlaced,&fieldOrder}; diaElemTabs tabInter(QT_TRANSLATE_NOOP("ffmpeg2","Interlacing"),2,diaInter); /* 3nd Tab : Qz */ diaElem *diaQze[]={&rdM,&qminM,&qmaxM,&qdiffM,&trellis}; diaElemTabs tabQz(QT_TRANSLATE_NOOP("ffmpeg2","Quantization"),5,diaQze); /* 4th Tab : RControl */ diaElem *diaRC[]={&filetol,&qzComp,&qzBlur}; diaElemTabs tabRC(QT_TRANSLATE_NOOP("ffmpeg2","Rate Control"),3,diaRC); diaElemTabs *tabs[]={&tabMode,&tabAdv,&tabInter,&tabQz,&tabRC}; if( diaFactoryRunTabs(QT_TRANSLATE_NOOP("ffmpeg2","libavcodec MPEG-2 configuration"),5,tabs)) { conf->lavcSettings.me_method=(Motion_Est_ID)me; conf->lavcSettings.widescreen= widescreen; conf->lavcSettings.interlaced= iinterlaced; conf->lavcSettings.bff= bff; return true; } return false; }
int main(int argc,char* argv[]){ startRandom(); // control SNR step const double s_snr = -0.5; const double step = 0.02; const int snr_size = 500; // control the certain Frame and the bp int frame = 2; int t_lvl = 0; double _snr = 0; if(argc >= 3 ) _snr = strtod(argv[2],NULL); if(argc >= 4) frame = strtod(argv[3],NULL); if(argc >= 5) t_lvl = strtod(argv[4],NULL); // for video encode const int puncture = 0; // puncture or not const double rate = 1/(double)(2-puncture); // code rate const double a = 1; // Fading amplitude. a=1 -> AWGN channel double EbN0,L_c,sigma; // for basical info char buffer[50]; const int h = __HEIGHT, w = __WIDTH, f = frame+1 ; const int lm = h*w; const int lu = lm+(G_L-1); int ** G = getGenerator(); double * Ly = (double*) malloc(sizeof(double)*2*lu); int*** Y = new3d<int>(f,h,w); int* map_out = (int*) malloc(sizeof(int)*lm); double* Lu = (double*) malloc(sizeof(double)*lu); for(int i=0; i<lu ;++i) Lu[i] = 0; // pstate, pout const int Ns = pow(2,G_L-1); int ** pout = new2d<int>(Ns,4); int ** pstate = new2d<int>(Ns,2) ; double* Le1 = (double*)malloc(sizeof(double)*lu); double* Le2 = (double*)malloc(sizeof(double)*lu); trellis(G,G_N,G_L,Ns,pout,pstate); // frame buffer int*** imgr_bp = new3d<int>(PXL,h,w); double** Lu_c = new2d<double>(PXL,lu); //channel decoder output // buffer for Ia, Ie double* Le = (double*) malloc(sizeof(double)*lm); double* Ia_pc = (double*) malloc(sizeof(double)*snr_size); double* Ie_pc = (double*) malloc(sizeof(double)*snr_size); int idx = 0; double tmp_sum = 0, tmp ; // read YUV sprintf(buffer,"%s_cif.yuv",argv[1]); yuv_read(buffer,h,w,f,Y,NULL,NULL); // video_encode(Y,f,h,w,_snr,G,Ly,map_out) for frame and t_lvl EbN0 = pow(10,_snr/10); // convert Eb/N0[dB] to normal number L_c = 4*a*EbN0*rate; // reliability value of the channel sigma = 1/sqrt(2*rate*EbN0); // standard deviation of AWGN noise int* x = (int*) malloc(sizeof(int)*2*lu); img2bp_frame(Y[frame],h,w,imgr_bp); random_sequence(0,lm-1,map_out); rsc_encode(G,G_L,imgr_bp[t_lvl],map_out,w,lm,1,x); for(int i = 0 ; i < 2*lu ; ++i) Ly[i] = 0.5*L_c*((2*x[i] - 1)+ sigma*gaussian_noise()); printf("processing ...%2.2f%%\n",0); for(double snr = s_snr; idx < snr_size ; snr+=step, idx++ , tmp_sum=0){ printf("\tprocessing ...%2.2f%%\n",100*(snr-s_snr)/step/snr_size); // encode EbN0 = pow(10,snr/10); // convert Eb/N0[dB] to normal number L_c = 4*a*EbN0*rate; // reliability value of the channel sigma = 1/sqrt(2*rate*EbN0); // standard deviation of AWGN noise // img2bp_frame(Y[frame],h,w,imgr_bp); for(int i = 0 ; i < lm ; ++i){ tmp = (2*imgr_bp[t_lvl][map_out[i]/w][map_out[i]%w] - 1); Lu[i] = 0.5*L_c*( tmp + sigma*gaussian_noise()); tmp_sum+=log2(1 + exp(-Lu[i]*tmp)); } Ia_pc[idx] = 1 - tmp_sum/lm; // decode computeLe(Lu,Le1,Le2,lu); logmap(Ns, lu, 1, Ly, Le1, Le2, pstate, pout, Lu_c[t_lvl]); for(int i = 0 ; i < lm ; ++i) Le[map_out[i]] = Lu_c[t_lvl][i] - Lu[i]; tmp_sum = 0; for(int i=0; i < lm ; ++i) tmp_sum+=log2(1 + exp(-Le[i]*(2*imgr_bp[t_lvl][i/w][i%w]-1))); Ie_pc[idx] = 1 - tmp_sum/lm; } printf("\r100%% completed!\n"); FILE *file = fopen("output/exit_curve_pc.txt","a+"); fprintf(file,"============================\n%s:SNR=%lf, frame#%d,bp#%d\nIa=\n",argv[1],_snr,frame+1,t_lvl+1); for(int i = 0 ; i < snr_size ; ++i) fprintf(file,"%lf,",Ia_pc[i]); fprintf(file,"\nIe=\n"); for(int i = 0 ; i < snr_size ; ++i) fprintf(file,"%lf,",Ie_pc[i]); fprintf(file,"\n\n"); fclose(file); write_pc_for_matlab(Ia_pc,Ie_pc,snr_size); // free memory free(Ly); free(map_out); delete2d<int>(G); deleteY(Y); delete3d<int>(imgr_bp); delete2d<double>(Lu_c); delete2d<int>(pstate); delete2d<int>(pout); free(Le); free(Lu); free(Le1); free(Le2); free(Ia_pc); free(Ie_pc); free(x); }
/** \fn getFFCompressParams \brief Dialog for lavcodec mpeg4/... codec settings */ uint8_t DIA_xvid4(COMPRES_PARAMS *incoming) { int b; int ret=0; int code; xvid4EncParam localParam; ADM_assert(incoming->extraSettingsLen==sizeof(localParam)); memcpy(&localParam,incoming->extraSettings,sizeof(localParam)); #define PX(x) &(localParam.x) // Our tabs /* Tab 1 main */ diaElemBitrate bitrate(incoming,NULL); #define MKTOGGLE(y,x) diaElemToggle t_##x(PX(x),y) MKTOGGLE(QT_TR_NOOP("_Interlaced"), interlaced); MKTOGGLE(QT_TR_NOOP("Ca_rtoon mode"), cartoon); MKTOGGLE(QT_TR_NOOP("_Greyscale"), greyscale); MKTOGGLE(QT_TR_NOOP("Turbo mode"), turbo); MKTOGGLE(QT_TR_NOOP("C_hroma optimizer"), chroma_opt); diaElem *main[]={&bitrate,&t_interlaced,&t_cartoon,&t_greyscale,&t_turbo,&t_chroma_opt}; diaElemTabs tabMain(QT_TR_NOOP("Main"),6,main); /* Tab 2 motion */ diaMenuEntry motionMenu[] = { {0, QT_TR_NOOP("None"),NULL} ,{1, QT_TR_NOOP("Very Low"),NULL} ,{2, QT_TR_NOOP("Low"),NULL} ,{3, QT_TR_NOOP("Medium"),NULL} ,{4, QT_TR_NOOP("High"),NULL} ,{5, QT_TR_NOOP("Very High"),NULL} ,{6, QT_TR_NOOP("Ultra High"),NULL}}; diaElemMenu motion(PX(guiLevel),QT_TR_NOOP("Motion Search Precision"),7,motionMenu); diaMenuEntry vhqMenu[] = { {0, QT_TR_NOOP("Off"),NULL} ,{1, QT_TR_NOOP("Mode Decision"),NULL} ,{2, QT_TR_NOOP("Limited Search"),NULL} ,{3, QT_TR_NOOP("Medium Search"),NULL} ,{4, QT_TR_NOOP("Wide Search"),NULL} }; diaElemMenu vhq(PX(vhqmode),QT_TR_NOOP("VHQ Mode"),5,vhqMenu); /* Tab2-ASP */ diaElemUInteger bframe(PX(bframes),QT_TR_NOOP("Max B Frames"),0,3); diaElemToggle qpel(PX(qpel),QT_TR_NOOP("Quarter Pixel")); diaElemToggle gmc(PX(gmc),QT_TR_NOOP("GMC")); diaElemToggle bvhq(PX(bvhq),QT_TR_NOOP("BVHQ")); diaElemFrame frameASP(QT_TR_NOOP("Advanced Simple Profile")); frameASP.swallow(&bframe); frameASP.swallow(&qpel); frameASP.swallow(&gmc); frameASP.swallow(&bvhq); /* Tab 2 motion extra */ diaElemToggle inter4mv(PX(inter4mv),QT_TR_NOOP("4MV")); diaElemToggle chroma_me(PX(chroma_me),QT_TR_NOOP("Chroma ME")); diaElemToggle hqac(PX(chroma_me),QT_TR_NOOP("HQ AC")); diaElemFrame frameMore(QT_TR_NOOP("More Search")); frameMore.swallow(&inter4mv); frameMore.swallow(&chroma_me); frameMore.swallow(&hqac); /* Tab 2 gop size */ diaElemUInteger min_key_interval(PX(min_key_interval),QT_TR_NOOP("Min Gop Size"),1,900); diaElemUInteger max_key_interval(PX(max_key_interval),QT_TR_NOOP("Max Gop Size"),1,900); diaElemFrame frameGop(QT_TR_NOOP("GOP Size")); frameGop.swallow(&min_key_interval); frameGop.swallow(&max_key_interval); diaElem *motions[]={&motion,&vhq,&frameMore,&frameGop,&frameASP}; diaElemTabs tabMotion(QT_TR_NOOP("Motion"),5,motions); /* Tab 3 Qz*/ diaMenuEntry qzMenu[] = { {0, QT_TR_NOOP("H263"),NULL} ,{1, QT_TR_NOOP("Mpeg"),NULL}} ; diaElemMenu h263(PX(mpegQuantizer),QT_TR_NOOP("Quantization Matrix"),2,qzMenu); diaElemToggle trellis(PX(trellis),QT_TR_NOOP("Trellis Quantization")); diaElem *qz[]={&h263,&trellis}; diaElemTabs tabQz(QT_TR_NOOP("Quantization"),2,qz); /* Tab 4 : 2nd pass */ #define MKENTRY(y,x) diaElemUInteger x(PX(x),y,0,100); frameOne.swallow(&x); diaElemFrame frameOne(QT_TR_NOOP("Two Pass Tuning")); MKENTRY(QT_TR_NOOP("Key Frame Boost(%)"), keyframe_boost); MKENTRY(QT_TR_NOOP("I-frames closer than..."), kfthreshold); MKENTRY(QT_TR_NOOP(".. are reduced by(%)"), kfreduction); MKENTRY(QT_TR_NOOP("Max Overflow Improvement(%)"), max_overflow_improvement); MKENTRY(QT_TR_NOOP("Max Overglow Degradation(%)"), max_overflow_degradation); #undef MKENTRY #define MKENTRY(y,x) diaElemUInteger x(PX(x),y,0,100);frameTwo.swallow(&x); diaElemFrame frameTwo(QT_TR_NOOP("Curve Compression")); MKENTRY(QT_TR_NOOP("High Bitrate Scenes (%)"), curve_compression_high); MKENTRY(QT_TR_NOOP("Low Bitrate Scenes (%)"), curve_compression_low); MKENTRY(QT_TR_NOOP("Overflow Control Strength"), overflow_control_strength); diaElem *twopass[]={&frameOne,&frameTwo}; diaElemTabs tabPass(QT_TR_NOOP("Two Pass"),2,twopass); /**/ /* End of tabs */ diaElemTabs *tabs[4]={&tabMain,&tabMotion,&tabQz,&tabPass}; if( diaFactoryRunTabs(QT_TR_NOOP("Xvid4 Configuration"),4,tabs)) { memcpy(incoming->extraSettings,&localParam,sizeof(localParam)); return 1; } return 0; }
bool ffMpeg4Configure(void) { diaMenuEntry meE[]={ {1,QT_TRANSLATE_NOOP("ffmpeg4","None")}, {2,QT_TRANSLATE_NOOP("ffmpeg4","Full")}, {3,QT_TRANSLATE_NOOP("ffmpeg4","Log")}, {4,QT_TRANSLATE_NOOP("ffmpeg4","Phods")}, {5,QT_TRANSLATE_NOOP("ffmpeg4","EPZS")}, {6,QT_TRANSLATE_NOOP("ffmpeg4","X1")} }; diaMenuEntry qzE[]={ {0,QT_TRANSLATE_NOOP("ffmpeg4","H.263")}, {1,QT_TRANSLATE_NOOP("ffmpeg4","MPEG")} }; diaMenuEntry rdE[]={ {0,QT_TRANSLATE_NOOP("ffmpeg4","MB comparison")}, {1,QT_TRANSLATE_NOOP("ffmpeg4","Fewest bits (vhq)")}, {2,QT_TRANSLATE_NOOP("ffmpeg4","Rate distortion")} }; diaMenuEntry threads[]={ {0,QT_TRANSLATE_NOOP("ffmpeg4","One thread")}, {2,QT_TRANSLATE_NOOP("ffmpeg4","Two threads)")}, {3,QT_TRANSLATE_NOOP("ffmpeg4","Three threads")}, {99,QT_TRANSLATE_NOOP("ffmpeg4","Auto (#cpu)")} }; FFcodecSettings *conf=&Mp4Settings; uint32_t me=(uint32_t)conf->lavcSettings.me_method; #define PX(x) &(conf->lavcSettings.x) diaElemBitrate bitrate(&(Mp4Settings.params),NULL); diaElemMenu meM(&me,QT_TRANSLATE_NOOP("ffmpeg4","Matrices"),4,meE); diaElemMenu threadM(PX(MultiThreaded),QT_TRANSLATE_NOOP("ffmpeg4","Threading"),4,threads); diaElemUInteger qminM(PX(qmin),QT_TRANSLATE_NOOP("ffmpeg4","Mi_n. quantizer:"),1,31); diaElemUInteger qmaxM(PX(qmax),QT_TRANSLATE_NOOP("ffmpeg4","Ma_x. quantizer:"),1,31); diaElemUInteger qdiffM(PX(max_qdiff),QT_TRANSLATE_NOOP("ffmpeg4","Max. quantizer _difference:"),1,31); diaElemToggle fourMv(PX(_4MV),QT_TRANSLATE_NOOP("ffmpeg4","4_MV")); diaElemToggle trellis(PX(_TRELLIS_QUANT),QT_TRANSLATE_NOOP("ffmpeg4","_Trellis quantization")); diaElemToggle qpel(PX(_QPEL),QT_TRANSLATE_NOOP("ffmpeg4","_Quarter pixel")); diaElemToggle gmc(PX(_GMC),QT_TRANSLATE_NOOP("ffmpeg4","_GMC")); diaElemUInteger max_b_frames(PX(max_b_frames),QT_TRANSLATE_NOOP("ffmpeg4","_Number of B frames:"),0,32); diaElemMenu qzM(PX(mpeg_quant),QT_TRANSLATE_NOOP("ffmpeg4","_Quantization type:"),2,qzE); diaElemMenu rdM(PX(mb_eval),QT_TRANSLATE_NOOP("ffmpeg4","_Macroblock decision:"),3,rdE); diaElemUInteger filetol(PX(vratetol),QT_TRANSLATE_NOOP("ffmpeg4","_Filesize tolerance (kb):"),0,100000); diaElemFloat qzComp(PX(qcompress),QT_TRANSLATE_NOOP("ffmpeg4","_Quantizer compression:"),0,1); diaElemFloat qzBlur(PX(qblur),QT_TRANSLATE_NOOP("ffmpeg4","Quantizer _blur:"),0,1); diaElemUInteger GopSize(PX(gop_size),QT_TRANSLATE_NOOP("ffmpeg4","_Gop Size:"),1,500); /* First Tab : encoding mode */ diaElem *diamode[]={&GopSize,&threadM,&bitrate}; diaElemTabs tabMode(QT_TRANSLATE_NOOP("ffmpeg4","User Interface"),3,diamode); /* 2nd Tab : ME */ diaElemFrame frameMe(QT_TRANSLATE_NOOP("ffmpeg4","Advanced Simple Profile")); frameMe.swallow(&max_b_frames); frameMe.swallow(&qpel); frameMe.swallow(&gmc); diaElem *diaME[]={&fourMv,&frameMe}; diaElemTabs tabME(QT_TRANSLATE_NOOP("ffmpeg4","Motion Estimation"),2,diaME); /* 3nd Tab : Qz */ diaElem *diaQze[]={&qzM,&rdM,&qminM,&qmaxM,&qdiffM,&trellis}; diaElemTabs tabQz(QT_TRANSLATE_NOOP("ffmpeg4","Quantization"),6,diaQze); /* 4th Tab : RControl */ diaElem *diaRC[]={&filetol,&qzComp,&qzBlur}; diaElemTabs tabRC(QT_TRANSLATE_NOOP("ffmpeg4","Rate Control"),3,diaRC); diaElemTabs *tabs[]={&tabMode,&tabME,&tabQz,&tabRC}; if( diaFactoryRunTabs(QT_TRANSLATE_NOOP("ffmpeg4","libavcodec MPEG-4 configuration"),4,tabs)) { conf->lavcSettings.me_method=(Motion_Est_ID)me; return true; } return false; }
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; }