コード例 #1
0
ファイル: mcl_fec.cpp プロジェクト: jcable/mcl
/**
 * Set the FEC code to be used.
 * This function is sender specific (a receiver gets the FEC
 * codec information info from the various incoming packet fields).
 * => See header file for more informations.
 */
mcl_error_status
mcl_fec::set_fec_code (mcl_cb		*const mclcb,
		       const INT32	new_code)
{
	if (new_code == MCL_FEC_SCHEME_NULL) {
		this->fec_codec = MCL_FEC_SCHEME_NULL;
		ASSERT(get_max_k() > 0); /* must be true if initialized */
		TRACELVL(5, (mcl_stdout, "   mcl_fec::set_fec_code: use NO FEC\n"))
		return MCL_OK;
	}
コード例 #2
0
bool split_clusters(const char *input_path,const char *cluster_path,const char *output_path,int num_features,int clip_size) {

	DiskReadMda C; C.setPath(cluster_path);
    Mda C2;
    C2.allocate(C.N1(),C.N2());
    for (int i=0; i<C.N2(); i++) {
        C2.setValue(C.value(0,i),0,i);
        C2.setValue(C.value(1,i),1,i);
    }

    int K=get_K(C);

    int kk=1;
	#pragma omp parallel for
    for (int k=1; k<=K; k++) {
		DiskReadMda X; X.setPath(input_path);  //needed here for thread safety?
		DiskReadMda C; C.setPath(cluster_path);
		printf("k=%d/%d... ",k,K);
        QList<int> times=get_times(C,k);
        Mda clips;
		printf("extract clips... ");
		extract_clips(clips,X,times,clip_size);
        Mda features;
		printf("compute features... ");
		compute_features(features,clips,num_features);
		printf("isosplit... ");
        QVector<int> labels0=isosplit(features);
		printf("setting...\n");
        int K0=get_max_k(labels0);
		if (K0>1) printf("::: split into %d clusters\n",K0);
		else printf("\n");
		int jjj=0;
		for (int bb=0; bb<C.N2(); bb++) {
			if (C.value(2,bb)==k) {
			   C2.setValue(kk+labels0[jjj]-1,2,bb);
			   jjj++;
			}
		}
		kk+=K0;
    }

	C2.write(output_path);

	return true;
}