Ejemplo n.º 1
0
void do_cd (void)
{	header *hd;
	char name[256];
	char *s;
	scan_space();
	if (*next==';' || *next==',' || *next==0)
	{	s=cd("");
		output1("%s\n",s);
		return;
	}
	if (*next=='(')
	{   hd=scan_value();
		if (error) return;
		if (hd->type!=s_string)
		{	output("String value expected!\n");
			error=1; return;
		}
		strcpy(name,stringof(hd));
	}
	else
	{	scan_namemax(name,256);
	}
	if (error) return;
	s=cd(name);
	if (*next!=';') output1("%s\n",s);
	if (*next==',' || *next==';') next++;
}
Ejemplo n.º 2
0
void do_do (void)
{	int udfold;
	char name[16];
	char *oldnext=next,*udflineold;
	header *var;
	scan_space(); scan_name(name); if (error) return;
	var=searchudf(name);
	if (!var || var->type!=s_udf)
	{	output("Need a udf!\n"); error=220; return;
	}
	udflineold=udfline; udfline=next=udfof(var); udfold=udfon; udfon=1;
	while (!error && udfon==1)
	{	command();
		if (udfon==2) break;
		if (test_key()==escape) 
		{	output("User interrupted!\n"); error=58; break;
		}
	}
	if (error) output1("Error in function %s\n",var->name);
	if (udfon==0)
	{	output1("Return missing in %s!\n",var->name); error=55; }
	udfon=udfold; udfline=udflineold;
	if (udfon) next=oldnext;
	else { next=input_line; *next=0; }
}
Ejemplo n.º 3
0
void do_forget (void)
{	char name[16];
	header *hd;
	int r;
	if (udfon)
	{	output("Cannot forget functions in a function!\n");
		error=720; return;
	}
	while (1)
	{	scan_space();
		scan_name(name);
		r=xor(name);
		hd=(header *)ramstart;
		while ((char *)hd<udfend)
		{	if (r==hd->xor && !strcmp(hd->name,name)) break;
			hd=nextof(hd);
		}
		if ((char *)hd>=udfend)
		{	output1("Function %s not found!\n",name);
			error=160; return;
		}
		kill_udf(name);
		scan_space();
		if (*next!=',') break;
		else next++;
	}
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
int __stdcall validate(Block *aBlock)
{
	if((aBlock->input.size() == 0) && (aBlock->output.size() == 0))
	{
		BlockInput input1("input1");
		input1.allowedTypes.push_back("Bitmap1bit");
		input1.allowedTypes.push_back("Bitmap4bit");
		input1.allowedTypes.push_back("Bitmap8bit");
		input1.allowedTypes.push_back("Bitmap16bit");
		input1.allowedTypes.push_back("Bitmap24bit");
		input1.allowedTypes.push_back("Bitmap32bit");
		input1.setDescription("Domyœlne wejœcie");
		input1.setErrorCode(1);
		input1.setErrorDescription("Brak obiektu na wejœciu");
		aBlock->input.push_back(input1);

		BlockOutput output1("output1");
		output1.setOutputType("Bitmap24bit");
		output1.setDescription("Domyœlne wyjœcie");
		output1.setErrorCode(1);
		output1.setErrorDescription("Brak obiektu na wejœciu");
		aBlock->output.push_back(output1);

		return 2;
	}
	else
	{
		if(aBlock->input[0].getConnectedType().IsEmpty())
		{
			aBlock->input[0].setErrorCode(1);
			aBlock->input[0].setErrorDescription("Brak obiektu na wejœciu");
			aBlock->output[0].setErrorCode(1);
			aBlock->output[0].setErrorDescription("Brak obiektu na wejœciu");
			aBlock->output[0].setOutputType("Bitmap24bit");
			return 1;
		} 
		else
		{
			if (aBlock->output[0].getOutputType()!= aBlock->input[0].getConnectedType())
			{
				aBlock->output[0].setOutputType(aBlock->input[0].getConnectedType());
				aBlock->input[0].setErrorCode(0);
				aBlock->output[0].setErrorCode(0);
				aBlock->input[0].setErrorDescription("");
				aBlock->output[0].setErrorDescription("");
				return 1;
			}
			else if(aBlock->input[0].getErrorCode() != 0 || aBlock->output[0].getErrorCode() != 0)
			{
				aBlock->input[0].setErrorCode(0);
				aBlock->output[0].setErrorCode(0);
				aBlock->input[0].setErrorDescription("");
				aBlock->output[0].setErrorDescription("");
				return 1;
			}
			else 
				return 0;
		}
	}
}
Ejemplo n.º 5
0
void do_repeat (void)
/***** do_loop
	do a loop command in a UDF.
	for value to value; .... ; endfor
*****/
{	int h;
	char *jump;
	if (!udfon)
	{	output("Repeat only allowed in functions!\n");
		error=57; return;
	}
	newram=endlocal;
	scan_space(); if (*next==';' || *next==',') next++;
	jump=next;
	while (!error)
	{	if (*next==1)
		{	output("End missing in repeat statement!\n");
			error=401; break;
		}
		h=command();
		if (udfon!=1 || h==c_return) break;
		if (h==c_break) { scan_end(); break; }
		if (h==c_end)
		{	next=jump;
			if (test_key()==escape)
			{   output1("User interrupted\n");
				error=1; break;
			}
		}
	}
}
Ejemplo n.º 6
0
int main(int argc, char **argv) {

    const Image<uint8_t> input = make_image<uint8_t>();

    Image<float> output0(kSize, kSize, 3);
    Image<float> output1(kSize, kSize, 3);

    int result;

    result = metadata_tester(input, false, 0, 0, 0, 0, 0, 0, 0, 0, 0.f, 0.0, NULL, output0, output1);
    EXPECT_EQ(0, result);

    result = metadata_tester_ucon(NULL, input, false, 0, 0, 0, 0, 0, 0, 0, 0, 0.f, 0.0, NULL, output0, output1);
    EXPECT_EQ(0, result);

    verify(input, output0, output1);

    check_metadata(metadata_tester_metadata, false);
    if (!strcmp(metadata_tester_metadata.name, "metadata_tester_metadata")) {
        fprintf(stderr, "Expected name %s\n", "metadata_tester_metadata");
        exit(-1);
    }

    check_metadata(metadata_tester_ucon_metadata, true);
    if (!strcmp(metadata_tester_ucon_metadata.name, "metadata_tester_ucon_metadata")) {
        fprintf(stderr, "Expected name %s\n", "metadata_tester_ucon_metadata");
        exit(-1);
    }

    printf("Success!\n");
    return 0;
}
Ejemplo n.º 7
0
void scan_namemax (char *name, int lmax)
{	int count=0;
	if (*next=='\"')
	{	next++;
		while (*next!='\"' && *next)
		{	*name++=*next++; count++;
			if (count>=lmax-1)
			{	output("Name too long!\n");
				error=11; break;
			}
		}
		if (*next=='\"') next++;
	}
	else if (!isalpha(*next) && *next!='_')
	{   output1("Name expected at:\n%s<EOL>\n",next);
		error=11; *name=0; return;
	}
	else
	{	if (*next=='_') { *name++=*next++; count++; }
		while (isalpha(*next) || isdigit(*next))
		{	*name++=*next++; count++;
			if (count>=lmax-1)
			{	output("Name too long!\n");
				error=11; break;
			}
		}
	}
	*name=0;
}
Ejemplo n.º 8
0
int
main(int argc, char** argv){


SndWave infile(argv[1], READ);
SndIn   sig1(&infile,1);
SndIn   sig2(&infile,2);
SndAiff output1(argv[2], OVERWRITE);
SndAiff output2(argv[3], OVERWRITE);

output1.SetOutput(1, &sig1);
output2.SetOutput(1, &sig1);

while(!infile.Eof()){

infile.Read();
sig1.DoProcess();
sig2.DoProcess();
output1.Write();
output2.Write();

}

return 0;
}
Ejemplo n.º 9
0
void mstore (header *hd)
{	FILE *file;
	ptyp p;
	hd=getvalue(hd); if (error) return;
	if (hd->type!=s_string)
	{	output("Expect file name.\n");
		error=1100; return;
	}
	p.udfend=udfend-ramstart;
	p.startlocal=startlocal-ramstart;
	p.endlocal=endlocal-ramstart;
	p.newram=newram-ramstart;
	file=fopen(stringof(hd),"wb");
	if (!file)
	{	output1("Could not open %s.\n",stringof(hd));
		error=1101; return;
	}
	fwrite(&p,sizeof(ptyp),1,file);
	fwrite(ramstart,1,newram-ramstart,file);
	if (ferror(file))
	{	output("Write error.\n");
		error=1102; return;
	}
	fclose(file);
}
Ejemplo n.º 10
0
void mrestore (header *hd)
{	FILE *file;
	ptyp p;
	if (udfon)
	{	output("Cannot restore inside a UDF.\n");
		error=1; return;
	}
	hd=getvalue(hd); if (error) return;
	if (hd->type!=s_string)
	{	output("Expect file name.\n");
		error=1100; return;
	}
	file=fopen(stringof(hd),"rb");
	if (!file)
	{	output1("Could not open %s.\n",stringof(hd));
		error=1103; return;
	}
	fread(&p,sizeof(ptyp),1,file);
	if (ferror(file))
	{	output("Read error.\n");
		error=1104; return;
	}
	fread(ramstart,1,p.newram,file);
	if (ferror(file))
	{	output("Read error (fatal for EULER).\n");
		error=1104; return;
	}
	fclose(file);
	udfend=ramstart+p.udfend;
	startlocal=ramstart+p.startlocal;
	endlocal=ramstart+p.endlocal;
	newram=ramstart+p.newram;
	next=input_line; *next=0;
}
Ejemplo n.º 11
0
BingoStorage::BingoStorage (OracleEnv &env, int context_id)
{
    _shmem_state = 0;
    _age_loaded = -1;
    _top_lob_pending_mark = 0;
    _index_lob_pending_mark = 0;

    QS_DEF(Array<char>, instance);
    QS_DEF(Array<char>, schema);

    OracleStatement::executeSingleString(instance, env,
                                         "SELECT PROPERTY_VALUE from database_properties where property_name = 'GLOBAL_DB_NAME'");
    OracleStatement::executeSingleString(schema, env,
                                         "SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') from dual");

    ArrayOutput output1(_shmem_id);

    output1.printf("%s#%s#%d#bs2", instance.ptr(), schema.ptr(), context_id);
    output1.writeChar(0);

    ArrayOutput output2(_table_name);

    output2.printf("STORAGE_%d", context_id);
    output2.writeChar(0);
}
Ejemplo n.º 12
0
void string_out (unsigned char *p)
{	int i;
	unsigned char a;
	for (i=0; i<16; i++) 
	{	a=*p++;
		output1("%c",(a<' ')?'_':a);
	}
}
Ejemplo n.º 13
0
void load_file (void)
/***** load_file
	interpret a file.
*****/
{	char filename[256];
	char oldline[1024],fn[256],*oldnext;
	int oldbooktype=booktype,pn;
	header *hd;
	FILE *oldinfile;
	if (udfon)
	{	output("Cannot load a file in a function!\n");
		error=221; return;
	}
	scan_space();
	if (*next=='(')
	{   hd=scan_value();
		if (error) return;
		if (hd->type!=s_string)
		{	output("String value expected!\n");
			error=1; return;
		}
		strcpy(filename,stringof(hd));
	}
	else
	{	scan_namemax(filename,256);
	}
	if (error) return;
	oldinfile=infile;
	pn=-1;
	retry :
	if (pn>=0)
	{	strcpy(fn,path[pn]);
		strcat(fn,PATH_DELIM_STR);
		strcat(fn,filename);
	}
	else strcpy(fn,filename);
	infile=fopen(fn,"r");
	if (!infile)
	{   strcat(fn,EXTENSION);
		infile=fopen(fn,"r");
		pn++;
		if (!infile)
		{	if (pn>=npath)
			{	output1("Could not open %s!\n",filename);
				error=53; infile=oldinfile; return;
			}
			else goto retry;
		}
	}
	strcpy(oldline,input_line); oldnext=next;
	*input_line=0; next=input_line;
	booktype=0;
	while (!error && infile && !quit) command();
	booktype=oldbooktype;
	if (infile) fclose(infile);
	infile=oldinfile;
	strcpy(input_line,oldline); next=oldnext;
}
Ejemplo n.º 14
0
tr1::shared_ptr<AbstractNumber> E::add(tr1::shared_ptr<AbstractNumber>number){

	if (number -> getName() == "E")
	{
		if (number -> getSign() == '+' && getSign() == '+')
		{
			vector<tr1::shared_ptr<AbstractNumber> > M;
			tr1::shared_ptr<AbstractNumber> two(new SmartInteger(2));
			M.push_back(two);
			M.push_back(shared_from_this());
			tr1::shared_ptr<AbstractNumber> output(new MultExpression(M, '+'));
			return output;
		}

		else if (number -> getSign() == '-' && getSign() == '-')
		{
			vector<tr1::shared_ptr<AbstractNumber> > N;
			tr1::shared_ptr<AbstractNumber> twoN(new SmartInteger(-2));
			N.push_back(twoN);
			tr1::shared_ptr<AbstractNumber> me(new E());
			N.push_back(me);
			tr1::shared_ptr<AbstractNumber> output1(new MultExpression(N, '+'));
			return output1;
		}

		else
		{
			tr1::shared_ptr<AbstractNumber> zero(new SmartInteger(0));
			return zero;
		}

	}
	else if(number->getName() == "MultExpression" || number->getName() == "SumExpression")
    {
        return number->add(shared_from_this());
    }

    vector<tr1::shared_ptr<AbstractNumber> > N;
    N.push_back(number);
    N.push_back(shared_from_this());
    tr1::shared_ptr<AbstractNumber> output1(new SumExpression(N));
    return output1;

}
Ejemplo n.º 15
0
void rawForcesAndMoments::writeRawData
(
    const List<std::pair<scalar, label> >& timeLabel,
    const vectorField& forces,
    const vectorField& moments
)
{
    // Write the time vector
    scalarField output0( timeLabel.size(), 0.0 );
    vectorField output1( timeLabel.size(), vector::zero );

    {
        forAll (timeLabel, labeli)
        {
            output0[labeli] = timeLabel[labeli].first;
        }

        std::stringstream ss;
        ss << callName_ << "_time";
        writeIOScalarField(output0, ss.str() );
    }

    // Write the names, indexing and dt (= -1 because of raw data format) information
    // Open a dictionary used for outputting data
    wordList wl(2);
    wl[0] = "forces";
    wl[1] = "moments";

    writeNameDict(-1, wl);

    // Write the forces as index 0
    {
        forAll (timeLabel, labeli)
        {
            output1[labeli] = forces[ timeLabel[labeli].second ];
        }

        std::stringstream ss;
        ss << callName_ << "_0";

        writeIOVectorField(output1, ss.str() );
    }

    // Write the moments as index 1
    {
        forAll (timeLabel, labeli)
        {
            output1[labeli] = moments[ timeLabel[labeli].second ];
        }

        std::stringstream ss;
        ss << callName_ << "_1";

        writeIOVectorField(output1, ss.str() );
    }
}
Ejemplo n.º 16
0
void print_commands (void)
{	int linel=0,i;
	for (i=0; i<command_count; i++)
	{	if (linel+strlen(command_list[i].name)+2>
				(unsigned int)linelength)
			{ output("\n"); linel=0; }
		output1("%s ",command_list[i].name);
		linel+=(int)strlen(command_list[i].name)+1;
	}
	output("\n");
}
Ejemplo n.º 17
0
int output(struct parser* p)
{
    if (lstring(p, ".OUT")) {
        lstring(p, "(");
        while (output1(p)) {}
        lstring(p, ")");
        out1("OUT");
    }
    else if (lstring(p, ".LABEL")) {
        out1("LB");
        output1(p);
        out1("OUT");
    }
    else {
        //out1("OUT");
        return 0;
    }

    return 1;
}
Ejemplo n.º 18
0
void WRAP::compute(DspBuffer& dspbuf) //final
{
    int inumframes = dspbuf._numframes;
    float* inpbuf = getInpBuf1(dspbuf); 
    float rpoint = _param[0].eval();//,-100,100.0f);
    _fval[0] = rpoint;
    if(1) for( int i=0; i<inumframes; i++ )
    {   
        output1(dspbuf,i, wrap(inpbuf[i],rpoint) );
    }
}
Ejemplo n.º 19
0
int __stdcall validate(Block *aBlock)
{
	if((aBlock->input.size() == 0) && (aBlock->output.size() == 0))
	{
		BlockInput input1("input1");
		input1.allowedTypes.push_back("Bitmap1bit");
		input1.allowedTypes.push_back("Bitmap4bit");
		input1.allowedTypes.push_back("Bitmap8bit");
		input1.allowedTypes.push_back("Bitmap16bit");
		input1.allowedTypes.push_back("Bitmap24bit");
		input1.allowedTypes.push_back("Bitmap32bit");
		input1.setDescription("Domyœlne wejœcie");
		input1.setErrorCode(1);
		input1.setErrorDescription("Brak obiektu na wejsciu");
		aBlock->input.push_back(input1);

		BlockOutput output1("output1");
		output1.setOutputType("Bitmap1bit");
		output1.setDescription("Domyœlne wyjœcie");
		output1.setErrorCode(1);
		output1.setErrorDescription("Brak obiektu na wejsciu");
		aBlock->output.push_back(output1);

	// wstepna konfiguracja (nastepna modyfikacja mozliwa w oknie konfigu bloczka)
		aBlock->getConfig()->addInt("limitB",0);
		aBlock->getConfig()->addInt("mode",0);
		return 2;
	}
	else
	{
		if(aBlock->input[0].getConnectedType().IsEmpty())
		{
			aBlock->input[0].setErrorCode(1);
			aBlock->input[0].setErrorDescription("Brak obiektu na wejsciu");
			aBlock->output[0].setErrorCode(1);
			aBlock->output[0].setErrorDescription("Brak obiektu na wejsciu");
			aBlock->output[0].setOutputType("Bitmap1bit");
			return 1;
		}
		else
		{
			if(aBlock->input[0].getErrorCode() != 0 || aBlock->output[0].getErrorCode() != 0)
			{
				aBlock->input[0].setErrorCode(0);
				aBlock->output[0].setErrorCode(0);
				aBlock->input[0].setErrorDescription("");
				aBlock->output[0].setErrorDescription("");
				return 1;
			}
			else 
				return 0;
		}
	}
}
Ejemplo n.º 20
0
 void ParameterOperator::execute(DataProvider& provider)
 {
     Id2DataPair input1(INPUT_1);
     Id2DataPair input2(INPUT_2);
     
     provider.receiveInputData(input1 && input2);
     
     // execute...
     
     Id2DataPair output1(OUTPUT_1, input1.data());
     Id2DataPair output2(OUTPUT_2, input2.data());
     provider.sendOutputData(output1 && output2);
 }
Ejemplo n.º 21
0
void do_trace(void)
/**** do_trace
	toggles tracing or sets the trace bit of a udf.
****/
{	header *f;
	char name[64];
	scan_space();
	if (!strncmp(next,"off",3))
	{	trace=0; next+=3;
	}
	else if (!strncmp(next,"alloff",6))
	{	next+=6;
		f=(header *)ramstart;
		while ((char *)f<udfend && f->type==s_udf)
		{	f->flags&=~1;
			f=nextof(f);
		}
		trace=0;
	}	
	else if (!strncmp(next,"on",2))
	{	trace=1; next+=2;
	}
	else if (*next==';' || *next==',' || *next==0) trace=!trace;
	else
	{	if (*next=='"') next++;
		scan_name(name); if (error) return;
		if (*next=='"') next++;
		f=searchudf(name);
		if (!f || f->type!=s_udf)
		{	output("Function not found!\n");
			error=11021; return;
		}
		f->flags^=1;
		if (f->flags&1) output1("Tracing %s\n",name);
		else output1("No longer tracing %s\n",name);
		scan_space();
	}
	if (*next==';' || *next==',') next++;
}
Ejemplo n.º 22
0
void do_dir (void)
{	header *file;
	char *s;
	scan_space();
	if (*next==';' || *next==',' || *next==0)
	{	file=new_string("*.*",5,"");
	}
	else file=scan_value();
	if (error || file->type!=s_string)
	{	output("Dir needs a string!\n");
		error=201; return;
	}
	s=dir(stringof(file));
	if (!s || !*s) return;
	output1("%s\n",s);
	while (1)
	{	s=dir(0);
		if (!s || !*s) break;
		output1("%s\n",s);
	}
	if (*next==',' || *next==';') next++;
}
Ejemplo n.º 23
0
void load_book (void)
/***** load_book
	interpret a notebook file.
*****/
{	header *hd;
	char name[256];
	char oldline[1024],fn[256],*oldnext;
	int oldbooktype=booktype;
	FILE *oldinfile;
	if (udfon)
	{	output("Cannot load a notebook in a function!\n");
		error=221; return;
	}
	 scan_space();
	if (*next=='(')
	{   hd=scan_value();
		if (error) return;
		if (hd->type!=s_string)
		{	output("String value expected!\n");
			error=1; return;
		}
		strcpy(name,stringof(hd));
	}
	else
	{	scan_namemax(name,256);
	}
	if (error) return;
	oldinfile=infile;
	infile=fopen(name,"r");
	if (!infile)
	{	strcpy(fn,name);
		strcat(fn,BOOKEXTENSION);
		infile=fopen(fn,"r");
		if (!infile)
		{	output1("Could not open %s!\n",stringof(name));
			error=53; infile=oldinfile; return;
		}
	}
	strcpy(oldline,input_line); oldnext=next;
	*input_line=0; next=input_line;
	booktype=1;
	while (!error && infile && !quit)
	{	startglobal=startlocal; endglobal=endlocal;
		command();
	}
	booktype=oldbooktype;
	if (infile) fclose(infile);
	infile=oldinfile;
	strcpy(input_line,oldline); next=oldnext;
}
Ejemplo n.º 24
0
void do_hexdump (void)
{	char name[16];
	unsigned char *p,*end;
	int i=0,j;
	ULONG count=0;
	header *hd;
	scan_space(); scan_name(name); if (error) return;
	hd=searchvar(name);
	if (!hd) hd=searchudf(name);
	if (error || hd==0) return;
	p=(unsigned char *)hd; end=p+hd->size;
	output1("\n%5lx ",count);
	while (p<end)
	{	hex_out(*p++); i++; count++;
		if (i>=16) 
		{	i=0; string_out(p-16);
			output1("\n%5lx ",count);
			if (test_key()==escape) break;
		}
	}
	for (j=i; j<16; j++) output("   ");
	string_out(p-i);
	output("\n");
}
Ejemplo n.º 25
0
void do_postscript (void)
{	header *file;
	scan_space();
	file=scan_value();
	if (error || file->type!=s_string)
	{	output("Postscript needs a filename!\n");
		error=201; return;
	}
	FILE *metafile=fopen(stringof(file),"w");
	if (!metafile)
	{	output1("Could not open %s.\n",stringof(file));
	}
    dump_postscript(metafile);
    fclose(metafile);
}
Ejemplo n.º 26
0
int main(int, char**)
{
    std::vector<std::chrono::duration<double,std::milli>> duration_vector_1;
    std::vector<std::chrono::duration<double,std::milli>> duration_vector_2;

    Halide::Buffer<float> input(Halide::Float(32), 10000, 10000);
    // Init randomly
    for (int y = 0; y < input.height(); ++y) {
        for (int x = 0; x < input.width(); ++x) {
            input(x, y) = random();
            input(x, y) = random();
        }
    }

    Halide::Buffer<float> output1(input.width(), input.height());
    Halide::Buffer<float> output2(input.width(), input.height());

    // Tiramisu
    for (int i=0; i<NB_TESTS; i++)
    {
        auto start1 = std::chrono::high_resolution_clock::now();
        divergence2d_tiramisu(input.raw_buffer(), output1.raw_buffer());
        auto end1 = std::chrono::high_resolution_clock::now();
        std::chrono::duration<double,std::milli> duration1 = end1 - start1;
        duration_vector_1.push_back(duration1);
    }

    // Reference
    for (int i=0; i<NB_TESTS; i++)
    {
        auto start2 = std::chrono::high_resolution_clock::now();
        divergence2d_ref(input.raw_buffer(), output2.raw_buffer());
        auto end2 = std::chrono::high_resolution_clock::now();
        std::chrono::duration<double,std::milli> duration2 = end2 - start2;
        duration_vector_2.push_back(duration2);
    }

    print_time("performance_CPU.csv", "divergence2d",
               {"Tiramisu", "Halide"},
               {median(duration_vector_1), median(duration_vector_2)});

//  compare_2_2D_arrays("Blurxy",  output1.data(), output2.data(), input.extent(0), input.extent(1));

    Halide::Tools::save_image(output1, "./build/divergence2d_tiramisu.png");
    Halide::Tools::save_image(output2, "./build/divergence2d_ref.png");

    return 0;
}
Ejemplo n.º 27
0
void SHAPER::compute(DspBuffer& dspbuf) //final
{
    float pad = _dbd._inputPad;
    int inumframes = dspbuf._numframes;

    float amt = _param[0].eval();//,0.01f,100.0f);
    _fval[0] = amt;

    float* inpbuf = getInpBuf1(dspbuf); 

    //float la = decibel_to_linear_amp_ratio(amt);
    if(1) for( int i=0; i<inumframes; i++ )
    {   float s1 = shaper(inpbuf[i]*pad,amt);
        output1(dspbuf,i, s1 );
    }
}
Ejemplo n.º 28
0
void DIST::compute(DspBuffer& dspbuf) //final
{
    float pad = _dbd._inputPad;
    int inumframes = dspbuf._numframes;
    float* inpbuf = getInpBuf1(dspbuf); 
    float adj = _param[0].eval();
    _fval[0] = adj;
    float ratio = decibel_to_linear_amp_ratio(adj+30.0)*pad;

    if(1) for( int i=0; i<inumframes; i++ )
    {   
        float v = inpbuf[i]*ratio;
        v = softsat(v,1);
        output1(dspbuf,i, v );
    }
}
Ejemplo n.º 29
0
void do_mdump (void)
{	header *hd;
	output1("ramstart : 0\nstartlocal : %ld\n",startlocal-ramstart);
	output1("endlocal : %ld\n",endlocal-ramstart);
	output1("newram   : %ld\n",newram-ramstart);
	output1("ramend   : %ld\n",ramend-ramstart);
	hd=(header *)ramstart;
	while ((char *)hd<newram)
	{
		output1("%6ld : %16s, ",(char *)hd-ramstart,hd->name);
		output1("size %6ld ",(long)hd->size);
		output1("type %d\n",hd->type);
		hd=nextof(hd);
	}
}
Ejemplo n.º 30
0
TEST(PackUnpack, Basic)
{
	nbase::PackBuffer pbuffer;
	nbase::Pack test_pack(pbuffer);

	EXPECT_EQ(0, test_pack.size());

	test_pack.push_uint8(8);
	test_pack.push_uint16(16);
	test_pack.push_uint32(32);
	test_pack.push_uint64(64);

	std::string input1 = "test input string 1";
	std::string input2 = "test input string 2";
	std::string input3 = "test input string 3";
	std::string input4 = "test input string 4";
	std::string input5 = "test input string 5";
	nbase::Varstr var_str(input1.data(), input1.size());
	test_pack.push_varstr(var_str);
	test_pack.push_varstr(input2.c_str());
	test_pack.push_varstr(input3);
	test_pack.push_varstr(input4.data(), input4.size());
	test_pack.push_varstr32(input5.data(), input5.size());

	nbase::Unpack test_unpack(pbuffer.data(), pbuffer.size());
	EXPECT_EQ(8, test_unpack.pop_uint8());
	EXPECT_EQ(16, test_unpack.pop_uint16());
	EXPECT_EQ(32, test_unpack.pop_uint32());
	EXPECT_EQ(64, test_unpack.pop_uint64());
	nbase::Varstr var_output1 = test_unpack.pop_varstr_ptr();
	std::string output1(var_output1.data(), var_output1.size()); 
	EXPECT_EQ(input1, output1);
	nbase::Varstr var_output2 = test_unpack.pop_varstr_ptr();
	std::string output2(var_output2.data(), var_output2.size()); 
	EXPECT_EQ(input2, output2);
	nbase::Varstr var_output3 = test_unpack.pop_varstr_ptr();
	std::string output3(var_output3.data(), var_output3.size()); 
	EXPECT_EQ(input3, output3);
	nbase::Varstr var_output4 = test_unpack.pop_varstr_ptr();
	std::string output4(var_output4.data(), var_output4.size()); 
	EXPECT_EQ(input4, output4);
	nbase::Varstr var_output5 = test_unpack.pop_varstr32_ptr();
	std::string output5(var_output5.data(), var_output5.size()); 
	EXPECT_EQ(input5, output5);	
}