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); }
/** * Waits for filtering to be completed on a job. * This is typically called because an app has requested job info that requires * filtering to be completed, such as getJobInfo. */ void SpeechData::waitJobFiltering(const mlJob* job) { #if NO_FILTERS return; #endif uint jobNum = job->jobNum; bool waited = false; QPtrListIterator<PooledFilterMgr> it(m_pooledFilterMgrs); for ( ; it.current(); ++it ) { PooledFilterMgr* pooledFilterMgr = it.current(); if (pooledFilterMgr->busy) { if (pooledFilterMgr->job->jobNum == jobNum) { if (!pooledFilterMgr->filterMgr->noSBD()) kdDebug() << "SpeechData::waitJobFiltering: Waiting for filter to finish. Not optimium. " << "Try waiting for textSet signal before querying for job information." << endl; pooledFilterMgr->filterMgr->waitForFinished(); // kdDebug() << "SpeechData::waitJobFiltering: waiting for job " << jobNum << endl; waited = true; } } } if (waited) doFiltering(); }
void SpeechData::slotFilterMgrStopped() { doFiltering(); }
void SpeechData::slotFilterMgrFinished() { // kdDebug() << "SpeechData::slotFilterMgrFinished: received signal FilterMgr finished signal." << endl; doFiltering(); }