Ejemplo n.º 1
0
int main(int argc, char *argv[]){

	// storing arguments from the comman line
	int filter_width = parseWidth(argv);
	float filter_weight[filter_width*filter_width];
	char *inputName = parseIn(argv);
	char *outputName = parseOut(argv);

	// parses the input weights from positional parameters
	parseWeight(filter_weight, argv, argc);

	// opening the files
	FILE *imageIn = fopen(inputName, "rb");
	FILE *imageOut = fopen(outputName, "wb");

	// initialize the before modification and after modification arrays
	unsigned char before[imageSize(imageIn)];
	unsigned char after[imageSize(imageIn)];

	// loading the raw data in to the before array
	loadBMP(imageIn, before);

	// apply the filter
	doFiltering(before, filter_weight, filter_width, after);

	// write to the new file
	fwrite(after, sizeof(unsigned char), imageSize(imageIn), imageOut);

	// closing the file.
	fclose(imageIn);
	fclose(imageOut);
}
Ejemplo n.º 2
0
/************************************************
 Split audio file to temporary dir
 ************************************************/
void Splitter::doRun()
{
    QStringList args;
    args << "split";
    args << "-w";
    args << "-O" << "always";
    args << "-n" << "%04d";
    args << "-t" << mFilePrefix +"%n";
    args << "-d" << mWorkDir;
    args << disk()->audioFileName();
    //qDebug() << args;

    QString shntool = settings->value(Settings::Prog_Shntool).toString();
    mProcess = new QProcess();
    mProcess->setReadChannel(QProcess::StandardError);

    mProcess->start(shntool, args);
    mProcess->waitForStarted();

    sendCueData();
    mProcess->closeWriteChannel();

    parseOut();
    mProcess->waitForFinished(-1);

    QProcess *proc = mProcess;
    mProcess = 0;
    delete proc;

    if (OutFormat::currentFormat()->createCue())
    {
        CueCreator cue(disk());
        cue.setHasPregapFile(mPreGapExists);
        if (!cue.write())
            error(disk()->track(0), cue.errorString());
    }
}