这篇教程C++ stopTimer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stopTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ stopTimer函数的具体用法?C++ stopTimer怎么用?C++ stopTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stopTimer函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(int argc, char **argv){char filename[BUF_SIZE];char *dirin, *rootname, *fname;l_int32 i, firstpage, npages, nfiles;l_float32 thresh, weight;JBDATA *data;JBCLASSER *classer;SARRAY *safiles;PIX *pix, *pixt;PIXA *pixa, *pixadb;static char mainName[] = "jbcorrelation"; if (argc != 5 && argc != 7) return ERROR_INT(" Syntax: jbcorrelation dirin thresh weight " "rootname [firstpage, npages]", mainName, 1); dirin = argv[1]; thresh = atof(argv[2]); weight = atof(argv[3]); rootname = argv[4]; if (argc == 5) { firstpage = 0; npages = 0; } else { firstpage = atoi(argv[5]); npages = atoi(argv[6]); }#if 0 /*--------------------------------------------------------------*/ jbCorrelation(dirin, thresh, weight, COMPONENTS, rootname, firstpage, npages, 1); /*--------------------------------------------------------------*/#else /*--------------------------------------------------------------*/ safiles = getSortedPathnamesInDirectory(dirin, NULL, firstpage, npages); nfiles = sarrayGetCount(safiles); sarrayWriteStream(stderr, safiles); /* Classify components on requested pages */ startTimer(); classer = jbCorrelationInit(COMPONENTS, 0, 0, thresh, weight); jbAddPages(classer, safiles); fprintf(stderr, "Time to generate classes: %6.3f sec/n", stopTimer()); /* Save and write out the result */ data = jbDataSave(classer); jbDataWrite(rootname, data); fprintf(stderr, "Number of classes: %d/n", classer->nclass); /* Render the pages from the classifier data. * Use debugflag == FALSE to omit outlines of each component. */ pixa = jbDataRender(data, FALSE); /* Write the pages out */ npages = pixaGetCount(pixa); if (npages != nfiles) fprintf(stderr, "npages = %d, nfiles = %d, not equal!/n", npages, nfiles); for (i = 0; i < npages; i++) { pix = pixaGetPix(pixa, i, L_CLONE); snprintf(filename, BUF_SIZE, "%s.%05d", rootname, i); fprintf(stderr, "filename: %s/n", filename); pixWrite(filename, pix, IFF_PNG); pixDestroy(&pix); }#if DISPLAY_DIFFERENCE fname = sarrayGetString(safiles, 0, 0); pixt = pixRead(fname); pix = pixaGetPix(pixa, 0, L_CLONE); pixXor(pixt, pixt, pix); pixWrite("junk_output_diff", pixt, IFF_PNG); pixDestroy(&pix); pixDestroy(&pixt);#endif /* DISPLAY_DIFFERENCE */#if DEBUG_TEST_DATA_IO{ JBDATA *newdata; PIX *newpix; PIXA *newpixa; l_int32 same, iofail; /* Read the data back in and render the pages */ newdata = jbDataRead(rootname); newpixa = jbDataRender(newdata, FALSE); iofail = FALSE; for (i = 0; i < npages; i++) { pix = pixaGetPix(pixa, i, L_CLONE); newpix = pixaGetPix(newpixa, i, L_CLONE);//.........这里部分代码省略.........
开发者ID:BruceWoR,项目名称:tess-two-master,代码行数:101,
示例2: stopLaserBeaconvoid stopLaserBeacon() { // Shutdown timer Timer* beaconTimer = getTimerByCode(BEACON_TIMER_CODE); stopTimer(beaconTimer);}
开发者ID:hternier,项目名称:cen-electronic,代码行数:5,
示例3: stopTimervoid PluginListComponent::timerCallback(){ stopTimer(); scanFor (AudioPluginFormatManager::getInstance()->getFormat (typeToScan));}
开发者ID:adscum,项目名称:MoogLadders,代码行数:5,
示例4: mainint main(int argc, char **argv){l_int32 i;BOXA *boxa;NUMA *nas, *nab;PIX *pixs;PIXA *pixa, *pixas; /* ----------------- Custom with a few large pix -----------------*/ /* Set up pms */ nas = numaCreate(4); /* small */ numaAddNumber(nas, 5); numaAddNumber(nas, 4); numaAddNumber(nas, 3); numaAddNumber(nas, 2); setPixMemoryManager(pmsCustomAlloc, pmsCustomDealloc); pmsCreate(200000, 400000, nas, "/tmp/junk1.log"); /* Make the pix and do successive copies and removals of the copies */ pixas = GenerateSetOfMargePix(); startTimer(); for (i = 0; i < ntimes; i++) CopyStoreClean(pixas, nlevels, ncopies); fprintf(stderr, "Time (big pix; custom) = %7.3f sec/n", stopTimer()); /* Clean up */ numaDestroy(&nas); pixaDestroy(&pixas); pmsDestroy(); /* ----------------- Standard with a few large pix -----------------*/ setPixMemoryManager(malloc, free); /* Make the pix and do successive copies and removals of the copies */ startTimer(); pixas = GenerateSetOfMargePix(); for (i = 0; i < ntimes; i++) CopyStoreClean(pixas, nlevels, ncopies); fprintf(stderr, "Time (big pix; standard) = %7.3f sec/n", stopTimer()); pixaDestroy(&pixas); /* ----------------- Custom with many small pix -----------------*/ /* Set up pms */ nab = numaCreate(10); numaAddNumber(nab, 2000); numaAddNumber(nab, 2000); numaAddNumber(nab, 2000); numaAddNumber(nab, 500); numaAddNumber(nab, 100); numaAddNumber(nab, 100); numaAddNumber(nab, 100); setPixMemoryManager(pmsCustomAlloc, pmsCustomDealloc); if (logging) /* use logging == 0 for speed comparison */ pmsCreate(20, 40, nab, "/tmp/junk2.log"); else pmsCreate(20, 40, nab, NULL); pixs = pixRead("feyn.tif"); startTimer(); for (i = 0; i < 5; i++) { boxa = pixConnComp(pixs, &pixa, 8); boxaDestroy(&boxa); pixaDestroy(&pixa); } numaDestroy(&nab); pixDestroy(&pixs); pmsDestroy(); fprintf(stderr, "Time (custom) = %7.3f sec/n", stopTimer()); /* ----------------- Standard with many small pix -----------------*/ setPixMemoryManager(malloc, free); pixs = pixRead("feyn.tif"); startTimer(); for (i = 0; i < 5; i++) { boxa = pixConnComp(pixs, &pixa, 8); boxaDestroy(&boxa); pixaDestroy(&pixa); } pixDestroy(&pixs); fprintf(stderr, "Time (standard) = %7.3f sec/n", stopTimer()); return 0;}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:88,
示例5: stopTimerWin32AudioCDStream::~Win32AudioCDStream() { stopTimer();}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:3,
示例6: parallel_work//.........这里部分代码省略......... pthread_t workers[n]; volatile lock_t lock; // Or for clh volatile lock_t c_locks[n]; // Initialize using switch over type switch (type) { case TAS: state = 0; lock.tas = &state; for (i = 0; i < n; i++) { data[i].lock_f = &tas_lock; data[i].unlock_f = &tas_unlock; data[i].locks = &lock; } break; case BACK: state = 0; lock.tas = &state; for (i = 0; i < n; i++) { data[i].lock_f = &backoff_lock; data[i].unlock_f = &backoff_unlock; data[i].locks = &lock; } break; case MUTEX: pthread_mutex_init(&m, NULL); lock.m = &m; for (i = 0; i < n; i++) { data[i].lock_f = &mutex_lock; data[i].unlock_f = &mutex_unlock; data[i].locks = &lock; } break; case ALOCK: tail = 0; alock.tail = &tail; alock.head = &head; alock.max = n*4; alock.array = anders; for (i = 0; i < n; i++) { anders[i*4] = 0; data[i].lock_f = &anders_lock; data[i].unlock_f = &anders_unlock; data[i].locks = &lock; } anders[0] = 1; lock.a = alock; break; case CLH: p = new_clh_node(); p->locked = 0; for (i = 0; i < n; i++) { data[i].lock_f = &clh_lock; data[i].unlock_f = &clh_unlock; data[i].locks = c_locks+i; c_locks[i].clh.me = new_clh_node(); c_locks[i].clh.tail = &p; } } for (i=0; i<n; i++) { data[i].counter = &counter; data[i].my_count = work/n; } // Start timing startTimer(&watch); counter = 0; // spawn worker spawn_work(type, n, workers, data); // Kill worker for (i = 0; i < n; i++) { pthread_join(workers[i], NULL); } // Stop timing stopTimer(&watch); // print counter //printf("Counter = %i/n", counter); // print thread counters int sum = 0; for (i = 0; i < n; i++) { //printf("%i : %i /n", i, data[i].my_count); sum += data[i].my_count; } // print time //printf("%f/n",getElapsedTime(&watch)); if (work - counter - sum) { return 0; } return getElapsedTime(&watch);}
开发者ID:rahwang,项目名称:Parallel,代码行数:101,
示例7: stopTimervoid UGenPlugin::timerCallback(){ stopTimer(); processEnvs();}
开发者ID:0x4d52,项目名称:ugen,代码行数:5,
示例8: stopTimervoid Ipc::timerEvent(QTimerEvent *event){ QByteArray data; Message *msg; enum Cmd cmd; enum Result result; (void) event; if ((m_mode == ModeManager) && (m_cmdSent.msecsTo(QTime::currentTime()) > m_timeout)) // Проверка таймаута { stopTimer(); if (m_resultConnected.contains(ResultTimedOut)) emit timedOut(m_sentCmd); else { std::cout << "Command execution timed out" << std::endl; qApp->quit(); } return; } if (m_shared.lock()) { msg = (Message *)m_shared.constData(); if (msg->dataSize > 0) data.append((const char *)(msg + 1), msg->dataSize); } else return; switch (m_mode) { case ModeApplication: cmd = (enum Cmd)msg->code; if (msg->sender == ModeManager) {#ifdef DEBUG dbg << " i: IPC got command = " << cmd << " [" << data.toHex() << "]";#endif if (m_cmdConnected.contains(cmd)) { stopTimer(); notify(cmd); } else switch (cmd) { case CmdStatus: if (m_state != StateNone) send(ResultOk, QByteArray(1, m_state), true); else send(ResultNotImplemented, true); break; case CmdStop: send(ResultOk, true); qApp->quit(); break; case CmdPid: send(ResultOk, QByteArray::number(QApplication::applicationPid()), true); break; default: send(ResultNotImplemented, true); } } break; case ModeManager: result = (enum Result)msg->code; if (msg->sender == ModeApplication) {#ifdef DEBUG dbg << " i: IPC got response = " << result << " [" << data.toHex() << "]";#endif stopTimer(); if (m_resultConnected.contains(result)) notify(result, data); else { switch (result) { case ResultOk: switch (m_sentCmd) { case CmdPid: std::cout << data.data() << std::endl; break; case CmdStop: break; default: std::cout << "Command execution succeeded. Response dump: " << data.toHex().data() << std::endl; break; } break; case ResultNotImplemented: std::cout << "Command not implemented" << std::endl; break; case ResultFail: std::cout << "Error while executing command: " << data.data() << std::endl; break;//.........这里部分代码省略.........
开发者ID:wolandtel,项目名称:terminal,代码行数:101,
示例9: main//.........这里部分代码省略......... pixDisplayWithTitle(pixd, 50, 50, NULL, rp->display); pixaDestroy(&pixa); pixDestroy(&pixs); pixDestroy(&pixg); pixDestroy(&pixt); pixDestroy(&pixd); pixDestroy(&pix1); pixDestroy(&pix2); pixDestroy(&pix3); pixDestroy(&pix4); pixDestroy(&pix5); /* ----------------- Test on 32 bpp rgb ---------------------*/ pixa = pixaCreate(5); pixs = pixRead("fish24.jpg"); pix1 = pixScale(pixs, 0.4, 0.4); AddTextAndSave(pixa, pix1, 1, bmf, textstr[0], L_ADD_BELOW, 0xff000000); pix2 = pixConvertToSubpixelRGB(pixs, 0.4, 0.4, L_SUBPIXEL_ORDER_RGB); AddTextAndSave(pixa, pix2, 0, bmf, textstr[1], L_ADD_BELOW, 0x00ff0000); pix3 = pixConvertToSubpixelRGB(pixs, 0.4, 0.35, L_SUBPIXEL_ORDER_BGR); AddTextAndSave(pixa, pix3, 0, bmf, textstr[2], L_ADD_BELOW, 0x0000ff00); pix4 = pixConvertToSubpixelRGB(pixs, 0.4, 0.45, L_SUBPIXEL_ORDER_VRGB); AddTextAndSave(pixa, pix4, 0, bmf, textstr[3], L_ADD_BELOW, 0x00ff0000); pix5 = pixConvertToSubpixelRGB(pixs, 0.4, 0.4, L_SUBPIXEL_ORDER_VBGR); AddTextAndSave(pixa, pix5, 0, bmf, textstr[4], L_ADD_BELOW, 0x0000ff00); pixt = pixaDisplay(pixa, 0, 0); pixd = pixAddSingleTextblock(pixt, bmftop, "Regression test for subpixel scaling: color", 0xff00ff00, L_ADD_ABOVE, NULL); regTestWritePixAndCheck(rp, pixd, IFF_JFIF_JPEG); /* 1 */ pixDisplayWithTitle(pixd, 50, 350, NULL, rp->display); pixaDestroy(&pixa); pixDestroy(&pixs); pixDestroy(&pixt); pixDestroy(&pixd); pixDestroy(&pix1); pixDestroy(&pix2); pixDestroy(&pix3); pixDestroy(&pix4); pixDestroy(&pix5); bmfDestroy(&bmf); bmfDestroy(&bmftop); /* --------------- Test on images that are initially 1 bpp ------------*/ /* For these, it is better to apply a lowpass filter before scaling */ /* Normal scaling of 8 bpp grayscale */ scalefact = 800. / 2320.; pixs = pixRead("patent.png"); /* sharp, 300 ppi, 1 bpp image */ pix1 = pixConvertTo8(pixs, FALSE); /* use 8 bpp input */ pix2 = pixScale(pix1, scalefact, scalefact); regTestWritePixAndCheck(rp, pix2, IFF_PNG); /* 2 */ /* Subpixel scaling; bad because there is very little aliasing. */ pix3 = pixConvertToSubpixelRGB(pix1, scalefact, scalefact, L_SUBPIXEL_ORDER_RGB); regTestWritePixAndCheck(rp, pix3, IFF_PNG); /* 3 */ /* Get same (bad) result doing subpixel rendering on RGB input */ pix4 = pixConvertTo32(pixs); pix5 = pixConvertToSubpixelRGB(pix4, scalefact, scalefact, L_SUBPIXEL_ORDER_RGB); regTestComparePix(rp, pix3, pix5); /* 4 */ regTestWritePixAndCheck(rp, pix5, IFF_PNG); /* 5 */ /* Now apply a small lowpass filter before scaling. */ makeGaussianKernelSep(2, 2, 1.0, 1.0, &kelx, &kely); startTimer(); pix6 = pixConvolveSep(pix1, kelx, kely, 8, 1); /* normalized */ fprintf(stderr, "Time sep: %7.3f/n", stopTimer()); regTestWritePixAndCheck(rp, pix6, IFF_PNG); /* 6 */ /* Get same lowpass result with non-separated convolution */ kel = makeGaussianKernel(2, 2, 1.0, 1.0); startTimer(); pix7 = pixConvolve(pix1, kel, 8, 1); /* normalized */ fprintf(stderr, "Time non-sep: %7.3f/n", stopTimer()); regTestComparePix(rp, pix6, pix7); /* 7 */ /* Now do the subpixel scaling on this slightly blurred image */ pix8 = pixConvertToSubpixelRGB(pix6, scalefact, scalefact, L_SUBPIXEL_ORDER_RGB); regTestWritePixAndCheck(rp, pix8, IFF_PNG); /* 8 */ kernelDestroy(&kelx); kernelDestroy(&kely); kernelDestroy(&kel); pixDestroy(&pixs); pixDestroy(&pix1); pixDestroy(&pix2); pixDestroy(&pix3); pixDestroy(&pix4); pixDestroy(&pix5); pixDestroy(&pix6); pixDestroy(&pix7); pixDestroy(&pix8); return regTestCleanup(rp);}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:101,
示例10: reopen //============================================================================== String reopen (const BigInteger& inputChannels, const BigInteger& outputChannels, double newSampleRate, int bufferSizeSamples) { String error; JUCE_COREAUDIOLOG ("CoreAudio reopen"); callbacksAllowed = false; stopTimer(); stop (false); activeInputChans = inputChannels; activeInputChans.setRange (inChanNames.size(), activeInputChans.getHighestBit() + 1 - inChanNames.size(), false); activeOutputChans = outputChannels; activeOutputChans.setRange (outChanNames.size(), activeOutputChans.getHighestBit() + 1 - outChanNames.size(), false); numInputChans = activeInputChans.countNumberOfSetBits(); numOutputChans = activeOutputChans.countNumberOfSetBits(); // set sample rate AudioObjectPropertyAddress pa; pa.mSelector = kAudioDevicePropertyNominalSampleRate; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = kAudioObjectPropertyElementMaster; Float64 sr = newSampleRate; if (! OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (sr), &sr))) { error = "Couldn't change sample rate"; } else { // change buffer size UInt32 framesPerBuf = (UInt32) bufferSizeSamples; pa.mSelector = kAudioDevicePropertyBufferFrameSize; if (! OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (framesPerBuf), &framesPerBuf))) { error = "Couldn't change buffer size"; } else { // Annoyingly, after changing the rate and buffer size, some devices fail to // correctly report their new settings until some random time in the future, so // after calling updateDetailsFromDevice, we need to manually bodge these values // to make sure we're using the correct numbers.. updateDetailsFromDevice(); sampleRate = newSampleRate; bufferSize = bufferSizeSamples; if (sampleRates.size() == 0) error = "Device has no available sample-rates"; else if (bufferSizes.size() == 0) error = "Device has no available buffer-sizes"; else if (inputDevice != 0) error = inputDevice->reopen (inputChannels, outputChannels, newSampleRate, bufferSizeSamples); } } callbacksAllowed = true; return error; }
开发者ID:liamlacey,项目名称:JUCE-Translation-File-Generator,代码行数:72,
示例11: mainint main(int argc, char **argv){l_int32 i, j;l_float32 f;l_uint32 redval, greenval;PIX *pixs, *pixd, *pix0, *pix1, *pix2;static char mainName[] = "locminmax_reg"; if (argc != 1) return ERROR_INT("syntax: locminmax_reg", mainName, 1); pixs = pixCreate(500, 500, 8); for (i = 0; i < 500; i++) { for (j = 0; j < 500; j++) { f = 128.0 + 26.3 * sin(0.0438 * (l_float32)i); f += 33.4 * cos(0.0712 * (l_float32)i); f += 18.6 * sin(0.0561 * (l_float32)j); f += 23.6 * cos(0.0327 * (l_float32)j); pixSetPixel(pixs, j, i, (l_int32)f); } } pixDisplay(pixs, 0, 0); pixWrite("/tmp/junkpattern.png", pixs, IFF_PNG); startTimer();/* pixSelectedLocalExtrema(pixs, 1, &pix1, &pix2); */ pixLocalExtrema(pixs, 0, 0, &pix1, &pix2); fprintf(stderr, "Time for extrema: %7.3f/n", stopTimer()); composeRGBPixel(255, 0, 0, &redval); composeRGBPixel(0, 255, 0, &greenval); pixd = pixConvertTo32(pixs); pixPaintThroughMask(pixd, pix2, 0, 0, greenval); pixPaintThroughMask(pixd, pix1, 0, 0, redval); pixDisplay(pixd, 510, 0); pixWrite("/tmp/junkpixd.png", pixd, IFF_PNG); pixDestroy(&pix1); pixDestroy(&pix2); pixDestroy(&pixs); pixDestroy(&pixd); pix0 = pixRead("karen8.jpg"); pixs = pixBlockconv(pix0, 10, 10); pixDisplay(pixs, 0, 400); pixWrite("/tmp/junkconv.png", pixs, IFF_PNG); startTimer();/* pixSelectedLocalExtrema(pixs, 1, &pix1, &pix2); */ pixLocalExtrema(pixs, 50, 100, &pix1, &pix2); fprintf(stderr, "Time for extrema: %7.3f/n", stopTimer()); composeRGBPixel(255, 0, 0, &redval); composeRGBPixel(0, 255, 0, &greenval); pixd = pixConvertTo32(pixs); pixPaintThroughMask(pixd, pix2, 0, 0, greenval); pixPaintThroughMask(pixd, pix1, 0, 0, redval); pixDisplay(pixd, 350, 400); pixWrite("/tmp/junkpixd2.png", pixd, IFF_PNG); pixDestroy(&pix0); pixDestroy(&pix1); pixDestroy(&pix2); pixDestroy(&pixs); pixDestroy(&pixd); return 0;}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:63,
示例12: updateDetailsFromDevice void updateDetailsFromDevice() { stopTimer(); if (deviceID == 0) return; const ScopedLock sl (callbackLock); AudioObjectPropertyAddress pa; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = kAudioObjectPropertyElementMaster; UInt32 isAlive; UInt32 size = sizeof (isAlive); pa.mSelector = kAudioDevicePropertyDeviceIsAlive; if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &isAlive)) && isAlive == 0) return; Float64 sr; size = sizeof (sr); pa.mSelector = kAudioDevicePropertyNominalSampleRate; if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &sr))) sampleRate = sr; UInt32 framesPerBuf; size = sizeof (framesPerBuf); pa.mSelector = kAudioDevicePropertyBufferFrameSize; if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &framesPerBuf))) { bufferSize = (int) framesPerBuf; allocateTempBuffers(); } bufferSizes.clear(); pa.mSelector = kAudioDevicePropertyBufferFrameSizeRange; if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size))) { HeapBlock <AudioValueRange> ranges; ranges.calloc (size, 1); if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, ranges))) { bufferSizes.add ((int) (ranges[0].mMinimum + 15) & ~15); for (int i = 32; i < 2048; i += 32) { for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) { if (i >= ranges[j].mMinimum && i <= ranges[j].mMaximum) { bufferSizes.addIfNotAlreadyThere (i); break; } } } if (bufferSize > 0) bufferSizes.addIfNotAlreadyThere (bufferSize); } } if (bufferSizes.size() == 0 && bufferSize > 0) bufferSizes.add (bufferSize); sampleRates.clear(); const double possibleRates[] = { 44100.0, 48000.0, 88200.0, 96000.0, 176400.0, 192000.0 }; String rates; pa.mSelector = kAudioDevicePropertyAvailableNominalSampleRates; if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size))) { HeapBlock <AudioValueRange> ranges; ranges.calloc (size, 1); if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, ranges))) { for (int i = 0; i < numElementsInArray (possibleRates); ++i) { bool ok = false; for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) if (possibleRates[i] >= ranges[j].mMinimum - 2 && possibleRates[i] <= ranges[j].mMaximum + 2) ok = true; if (ok) { sampleRates.add (possibleRates[i]); rates << possibleRates[i] << ' '; } } } } if (sampleRates.size() == 0 && sampleRate > 0) {//.........这里部分代码省略.........
开发者ID:liamlacey,项目名称:JUCE-Translation-File-Generator,代码行数:101,
示例13: main//.........这里部分代码省略......... pixt2 = pixBlockconvTiled(pixg, 5, 5, j, i); pixEqual(pixt2, pixd, &same); if (!same) { fprintf(stderr," Error for nx = %d, ny = %d/n", j, i); ok = FALSE; } pixDestroy(&pixt2); } } if (ok) fprintf(stderr, "OK: Tiled results identical to pixConvolve()/n"); else fprintf(stderr, "ERROR: Tiled results not identical to pixConvolve()/n"); pixDestroy(&pixs); pixDestroy(&pixg); pixDestroy(&pixd); pixDestroy(&pixt); kernelDestroy(&kel2); /* Do another flat rectangular test; this time with white at edge. * About 1% of the pixels near the image edge differ by 1 between * the pixConvolve() and pixBlockconv(). For what it's worth, * pixConvolve() gives the more accurate result; namely, 255 for * pixels at the edge. */ pix = pixRead("pageseg1.tif"); box = boxCreate(100, 100, 2260, 3160); pixb = pixClipRectangle(pix, box, NULL); pixs = pixScaleToGray4(pixb); kel3 = makeFlatKernel(7, 7, 3, 3); startTimer(); pixt = pixConvolve(pixs, kel3, 8, 1); fprintf(stderr, "Generic convolution time: %5.3f sec/n", stopTimer()); pixSaveTiled(pixt, pixa, 1, 1, 20, 0); pixWrite("/tmp/conv1.png", pixt, IFF_PNG); regTestCheckFile(rp, "/tmp/conv1.png"); /* 10 */ startTimer(); pixt2 = pixBlockconv(pixs, 3, 3); fprintf(stderr, "Flat block convolution time: %5.3f sec/n", stopTimer()); pixSaveTiled(pixt2, pixa, 1, 0, 20, 0); pixWrite("/tmp/conv2.png", pixt2, IFF_PNG); /* ditto */ regTestCheckFile(rp, "/tmp/conv2.png"); /* 11 */ pixCompareGray(pixt, pixt2, L_COMPARE_ABS_DIFF, GPLOT_PNG, NULL, &avediff, &rmsdiff, NULL);#ifndef _WIN32 sleep(1); /* give gnuplot time to write out the file */#else Sleep(1000);#endif /* _WIN32 */ pixp = pixRead("/tmp/grayroot.png"); pixSaveTiled(pixp, pixa, 1, 0, 20, 0); pixWrite("/tmp/conv3.png", pixp, IFF_PNG); regTestCheckFile(rp, "/tmp/conv3.png"); /* 12 */ fprintf(stderr, "Ave diff = %6.4f, RMS diff = %6.4f/n", avediff, rmsdiff); if (avediff <= 0.01) fprintf(stderr, "OK: avediff = %6.4f <= 0.01/n", avediff); else fprintf(stderr, "Bad?: avediff = %6.4f > 0.01/n", avediff); pixDestroy(&pixt); pixDestroy(&pixt2); pixDestroy(&pixs); pixDestroy(&pixp);
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:67,
示例14: corrigeTexto//O(t*(s+d))void corrigeTexto(TipoTexto *Texto, TipoTexto *Dic, TipoTexto *Stopw, char *NomeArqSaida, bool Analise) { stopWatch cronometro; double tempogasto; char NomeArqAnalise[] = "Analise.txt"; FILE *ArqAnalise = fopen (NomeArqAnalise,"a"); if (Analise) startTimer(&cronometro); int t; int indiceMaisProxStopw, indiceMaisProxDic; int indiceMaisProx = 0; //id da string mais próxima da string do texto no dicionário ou stopwords int DEdic=0, DEstopw=0; //Dist C++ stopUpdating函数代码示例 C++ stopThread函数代码示例
|