示例#1
0
/** Returns a human-readable string representing this PathMatcherEntry, for easier debugging */
String PathMatcherEntry :: ToString() const
{
   String ret;
   if (_parser()) ret += _parser()->ToString().Prepend("Parser=[").Append("]");
   if (_filter())
   {
      char buf[128]; muscleSprintf(buf, "%sfilter=%p", ret.HasChars()?" ":"", _filter());
      ret += buf;
   }
   return ret;
}
示例#2
0
	NormalMap(const Image& input, Extractor extractor)
#endif
	 : Filter(input, _filter(), extractor)
	{
		this->_format = PixelDataFormat::RGBA;
		this->_internal = PixelDataInternalFormat::RGBA16F;
	}
/* When the mode changes the current object may get invisible,
 * get a new visible one */
PUBLIC
void *
Jdb_kobject_list::get_valid(void *o)
{
  if (!_filter)
    return o;

  if (_filter && _filter(static_cast<Kobject*>(o)))
    return o;
  return get_first();
}
示例#4
0
	TransformComponents(const Image& input, const Mat4d& matrix)
	 : Filtered(
		input,
		_filter(matrix),
		typename Filtered::DefaultSampler(),
		typename Filtered::FromRGB()
	)
	{
		this->_format = PixelDataFormat::RGB;
		this->_internal = PixelDataInternalFormat::RGB;
	}
PRIVATE inline NOEXPORT
Kobject *
Jdb_kobject_list::prev(Kobject *obj)
{
  if (!obj)
    return 0;

  Kobject_dbg::Iterator o = Kobject_dbg::Kobject_list::iter(obj->dbg_info());

  do
    {
      --o;
      if (o == Kobject_dbg::end())
	return 0;
    }
  while (_filter && !_filter(Kobject::from_dbg(*o)));
  return Kobject::from_dbg(*o);
}
示例#6
0
veComponent::veComponent()
	: USE_VE_PTR_INIT
	, _filter(veEvent::VE_ALL_EVENT)
    , _isEnabled(true)
    , _updateOrder(0)
{
}

veComponent::~veComponent()
{

}

bool veComponent::onAttachToNode(veNode *node)
{
    auto nIter = std::find(_attachedNodeList.begin(), _attachedNodeList.end(), node);
    if (nIter != _attachedNodeList.end()) return false;
	_attachedNodeList.push_back(node);
	node->getSceneManager()->addComponent(this);
    return true;
}
NdrNodeDiscoveryResultVec
_NdrFilesystemDiscoveryPlugin::DiscoverNodes(const Context& context)
{
    auto result = NdrFsHelpersDiscoverNodes(
        _searchPaths, _allowedExtensions, _followSymlinks, &context
    );

    if (_filter) {
        auto j = result.begin();
        for (auto i = j; i != result.end(); ++i) {
            // If we pass the filter and any previous haven't then move.
            if (_filter(*i)) {
                if (j != i) {
                    *j = std::move(*i);
                }
                ++j;
            }
        }
        result.erase(j, result.end());
    }

    return result;
}
void Bloomfilters::generateFilter() {

//    _parameters;

    delete &(_parameters);

    bloom_parameters _parameters;

    QByteArray k2 = _k.toLatin1();
    const char *k3 = k2.data();
    _parameters.maximum_number_of_hashes=atoi(k3);
    _parameters.minimum_number_of_hashes=atoi(k3);
    _parameters.maximum_size = strtoull (k3, NULL, 10);
    _parameters.minimum_size = strtoull (k3, NULL, 10);

    _parameters.projected_element_count = 1000;

    // Maximum tolerable false positive probability? (0,1)
    _parameters.false_positive_probability = 0.0001; // 1 in 10000

    // Simple randomizer (optional)
    _parameters.random_seed = 0xA5A5A5A5;

    if (!_parameters)
    {
    }

    _parameters.compute_optimal_parameters();


//     _filter=bloom_filter::bloom_filter(_parameters);
//    _filter(_parameters);
    delete &(_filter) ;
    bloom_filter _filter(_parameters);
    _filter_charged=true;
}
/**
* @details
* Method to run the channeliser.
*
* The channeliser performs channelisation of a number of sub-bands containing
* a complex time series.
*
* Parallelisation, by means of openMP threads, is carried out by splitting
* the sub-bands as evenly as possible between threads.
*
* @param[in]  timeSeries 	Buffer of time samples to be channelised.
* @param[out] spectrum	 	Set of spectra produced.
*/
void PPFChanneliser::run(const TimeSeriesDataSetC32* timeSeries,
        SpectrumDataSetC32* spectra)
{
    // Perform a number of sanity checks on the input data.
    _checkData(timeSeries);

    // Make local copies of the data dimensions.
    unsigned nSubbands      = timeSeries->nSubbands();
    unsigned nPolarisations = timeSeries->nPolarisations();
    unsigned nTimeBlocks    = timeSeries->nTimeBlocks();
    unsigned nTimesPerBlock = timeSeries->nTimesPerBlock();

    // Resize the output spectra blob (if required).
    spectra->resize(nTimeBlocks, nSubbands, nPolarisations, _nChannels);

    // Set the timing parameters - Only need the timestamp of the first packet
    // for this version of the Channeliser.
    spectra->setLofarTimestamp(timeSeries->getLofarTimestamp());
    spectra->setBlockRate(timeSeries->getBlockRate() * _nChannels);

    const float* coeffs = &_coeffs[0];
    unsigned threadId = 0, nThreads = 0, start = 0, end = 0;
    Complex *workBuffer = 0, *filteredSamples = 0;
    Complex const * timeData = 0;
    const Complex* timeStart = timeSeries->constData();
    Complex* spectraStart = spectra->data();

    if (_nChannels == 1)
    {
         // Loop over data to be channelised.
         for (unsigned subband = 0; subband < nSubbands; ++subband)
         {
             for (unsigned pol = 0; pol < nPolarisations; ++pol)
             {
                 for (unsigned block = 0; block < nTimeBlocks; ++block)
                 {
                     // Get pointer to time series array.
                     unsigned index = timeSeries->index(subband, nTimesPerBlock,
                                  pol, nPolarisations, block, nTimeBlocks);
                     timeData = &timeStart[index];
                     for (unsigned t = 0; t < nTimesPerBlock; ++t) {
                         // FFT the filtered sub-band data to form a new spectrum.
                         unsigned indexSpectra = spectra->index(subband, nSubbands,
                                 pol, nPolarisations, (nTimesPerBlock*block)+t, _nChannels);
//                         spectraStart = &spectra->data()[indexSpectra];
                         spectraStart[indexSpectra] = timeData[t];
                     }
                 }
             }
         }

    } else {
        // Set up work buffers (if required).
        unsigned nFilterTaps = _ppfCoeffs.nTaps();
        if (!_buffersInitialised)
            _setupWorkBuffers(nSubbands, nPolarisations, _nChannels, nFilterTaps);

        // Channeliser processing.
        #pragma omp parallel \
            shared(nTimeBlocks, nPolarisations, nSubbands, nFilterTaps, coeffs,\
                    timeStart, spectraStart) \
            private(threadId, nThreads, start, end, workBuffer, filteredSamples, \
                    timeData)
        {
            threadId = omp_get_thread_num();
            nThreads = omp_get_num_threads();

            // Assign processing threads in a round robin fashion to subbands.
            _assign_threads(start, end, nSubbands, nThreads, threadId);

            // Pointer to work buffer for the thread.
            filteredSamples = &_filteredData[threadId][0];

            // Loop over data to be channelised.
            for (unsigned subband = start; subband < end; ++subband)
            {
                for (unsigned pol = 0; pol < nPolarisations; ++pol)
                {
                    for (unsigned block = 0; block < nTimeBlocks; ++block)
                    {
                        // Get pointer to time series array.
                        unsigned index = timeSeries->index(subband, nTimesPerBlock,
                                     pol, nPolarisations, block, nTimeBlocks);
                        timeData = &timeStart[index];

                        // Get a pointer to the work buffer.
                        workBuffer = &(_workBuffer[subband * nPolarisations + pol])[0];

                        // Update buffered (lagged) data for the sub-band.
                        _updateBuffer(timeData, _nChannels, nFilterTaps, workBuffer);

                        // Apply the PPF.
                        _filter(workBuffer, nFilterTaps, _nChannels, coeffs, filteredSamples);

                        // FFT the filtered sub-band data to form a new spectrum.
                        unsigned indexSpectra = spectra->index(subband, nSubbands,
                                pol, nPolarisations, block, _nChannels);
                        _fft(filteredSamples, &spectraStart[indexSpectra]);
                    }
                }
            }

        } // end of parallel region.

    }

}
示例#10
0
文件: cut.c 项目: wosayttn/aos
int cut_main(int argc, char **argv)
{
    int         i = 0, j = 0, cnt = 0;
    char        tmpbuf[128];
    char       *pos;

    if (0 == _parse_arg(argc, argv)) {
        return 0;
    }

    if (argc >= 2 && !strcmp(argv[1], "--debug")) {
        _debug_opt = 1;
        argc --;
        argv ++;
    }

    _filter(argc, argv);

    for (; i < cut.ccnt_total; i++) {
        pos = tmpbuf;

        cut.ccur = cut.clist[i];
        if (cut.ccur->skip) {
            continue;
        }

        memset(tmpbuf, 0, sizeof(tmpbuf));
        pos += cut_snprintf(pos,
                            sizeof(tmpbuf),
                            "TEST [%02d/%02d] %s.%s ",
                            ++cnt,
                            cut.ccnt_total - cut.ccnt_skip,
                            cut.ccur->sname,
                            cut.ccur->cname);
        for (j = 80 - strlen(tmpbuf); j >= 0; --j) {
            pos += sprintf(pos, "%s", ".");
        }
        if (_debug_opt) {
            pos += sprintf(pos, " [%sEXEC%s]\n", COL_YEL, COL_DEF);
            cut_printf("%s", tmpbuf);
            pos -= 19;
        }
        TRY {
            if (cut.ccur->setup)
            {
                cut.ccur->setup(cut.ccur->data);
            }
            cut.ccur->run((struct cut_case *)(cut.ccur->data));
            if (cut.ccur->teardown)
            {
                cut.ccur->teardown(cut.ccur->data);
            }

            pos += sprintf(pos, " [%sSUCC%s]\n", COL_GRE, COL_DEF);
            cut_printf("%s", tmpbuf);

            cut.ccnt_pass++;
            continue;
        }
        EXCEPT {

            pos += sprintf(pos, " [%sFAIL%s]\n", COL_RED, COL_DEF);
            cut_printf("%s", tmpbuf);

            cut.ccnt_fail++;
            continue;
        }
    }

    cut_printf("===========================================================================\n");
    if (cut.ccnt_fail > 0) {
        cut_printf("FAIL LIST:\n");
        for (i = 0; i < cut.ccnt_fail; i++) {
            cut_printf("  [%02d] %s\n", i + 1, cut.cerrmsg[i]);
            cut_free(cut.cerrmsg[i]);
        }
        cut_printf("---------------------------------------------------------------------------\n");
    }
    cut_printf("SUMMARY:\n" \
               "     TOTAL:    %d\n" \
               "   SKIPPED:    %d\n" \
               "   MATCHED:    %d\n" \
               "      PASS:    %d\n" \
               "    FAILED:    %d\n", cut.ccnt_total, cut.ccnt_skip,
               cut.ccnt_total - cut.ccnt_skip, cut.ccnt_pass, cut.ccnt_fail);
    cut_printf("===========================================================================\n");

    return cut.ccnt_fail;

}