本文整理汇总了C++中preprocess函数的典型用法代码示例。如果您正苦于以下问题:C++ preprocess函数的具体用法?C++ preprocess怎么用?C++ preprocess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preprocess函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: printNumberOfMirrorStrings
void printNumberOfMirrorStrings (char * s)
{
int max = 0, i, C = 0, R = 0, n = 0;
i = 0;
while (s[i++])
n++;
char * T = preprocess (s, n);
n = 0;
i = 0;
while (T[i++])
n++;
int * P = (int *) malloc (n * sizeof (int));
int max_arr[3001] = {0};
for (i = 0; i < n; i++)
P[i] = 0;
for (i = 1; i < n-1; i++)
{
int i_mirror = C - (i - C);
P[i] = (R > i) ? min (R - i, P[i_mirror]) : 0;
while (T[i + 1 + P[i]] == T[i - 1 - P[i]])
P[i]++;
if (i + P[i] > R)
{
C = i;
R = i + P[i];
}
}
for (i = 1; i < n-1; i++)
{
if (P[i] > max)
{
max = P[i];
}
max_arr[P[i]]++;
}
printf ("%d %d\n", max, max_arr[max]);
free (P);
free (T);
}
开发者ID:asm123,项目名称:Codechef,代码行数:49,代码来源:msubstr_manacher.c
示例2: testConstructDFA2
void testConstructDFA2(){
regexps = malloc(sizeof(struct REentry));
char *s = "(a|b)*abb(a|b)*";
regexps->regexp = malloc(strlen(s));
strcpy(regexps->regexp, s);
regexps->action = "printf;";
regexps->next = NULL;
preprocess();
constructNFA();
constructDFA();
printDFATransTable();
destroyDFA();
destroyNFA();
destroyGraph();
}
开发者ID:ZeyuMi,项目名称:MiLex,代码行数:15,代码来源:dfaConstructortest.c
示例3: printLCAs
// Prints LCAs for given queries q[0..m-1] in a tree
// with given root
void printLCAs(Node *root, Query q[], int m)
{
// Allocate memory for V subsets and nodes
struct subset * subsets = new subset[V+1];
// Creates subsets and colors them WHITE
initialise(subsets);
// Preprocess the tree
preprocess(root, subsets);
// Perform a tree walk to process the LCA queries
// offline
lcaWalk(root->data , q, m, subsets);
}
开发者ID:gbelwariar,项目名称:Self-Made-Projects,代码行数:17,代码来源:Tarjan_Offline_Least_Common_Ancestor_Algorithm.cpp
示例4: test_compute_inf_timeslot
static void test_compute_inf_timeslot(void) {
init_test_exam();
exam *test_exams[] = {exam1, exam2, exam3, exam4,
exam5, exam6, exam7, exam8};
init_test_array_exams(8, test_exams);
preprocess(exams);
CU_ASSERT_EQUAL(compute_inf_timeslot(exam1, exams), 0);
CU_ASSERT_EQUAL(compute_inf_timeslot(exam7, exams), 0);
/* Schedule Exam 1 at timeslot 2 (index 1)*/
exams->data[0]->timeslot = 1;
CU_ASSERT_EQUAL(compute_inf_timeslot(exams->data[0], exams), 0);
/* First timeslot expected for Exam 7 (depends on Exam 1) : 3 (index 2) */
CU_ASSERT_EQUAL(compute_inf_timeslot(exams->data[6], exams), 2);
clean_array_exams();
}
开发者ID:Kent1,项目名称:Horaires,代码行数:15,代码来源:graph_heuristics_test.c
示例5: visit
void DeclarationValidator::visit(Declaration* declaration)
{
bool testDataOk;
QJson::Parser parser;
QVariantMap testData = parser.parse(preprocess(declaration->comment()), &testDataOk).toMap();
if (!testDataOk)
{
d->testsPassed = false;
qDebug() << "Error parsing test data for declaration on line" << declaration->range().start.line + 1;
qDebug() << "Parser error on comment line" << parser.errorLine() << "was" << parser.errorString();
return;
}
if (!KDevelop::runTests(testData, declaration))
d->testsPassed = false;
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:15,代码来源:declarationvalidator.cpp
示例6: preprocess
void Oscillator::process() {
preprocess();
int i = 0;
if (input(kReset)->source->triggered &&
input(kReset)->source->trigger_value == kVoiceReset) {
int trigger_offset = input(kReset)->source->trigger_offset;
for (; i < trigger_offset; ++i)
tick(i);
offset_ = 0.0;
}
for (; i < buffer_size_; ++i)
tick(i);
}
开发者ID:yoyz,项目名称:audio,代码行数:15,代码来源:twytch_oscillator.cpp
示例7: testConstructNFA3
void testConstructNFA3(){
regexps = malloc(sizeof(struct REentry));
char *s = "(a|b)*abb(a|b)*";
regexps->regexp = malloc(strlen(s));
strcpy(regexps->regexp, s);
regexps->action = "printf;";
regexps->next = malloc(sizeof(struct REentry));
s = "(a|b)+abc(a|b|c)?";
regexps->next->regexp = malloc(strlen(s));
strcpy(regexps->next->regexp, s);
regexps->next->action = "donothing";
preprocess();
constructNFA();
printGraph();
destroyNFA();
}
开发者ID:ZeyuMi,项目名称:MiLex,代码行数:16,代码来源:nfaConstructortest.c
示例8: main
int main(void)
{
preprocess();
scanf("%d", &tests);
for(int t = 0; t < tests; ++ t)
{
scanf("%d", &bits);
word[bits] = 0;
for(int b = 0; b < bits; ++ b)
scanf(" %c", &word[b]);
solve();
}
return 0;
}
开发者ID:Neverous,项目名称:ii-mia,代码行数:16,代码来源:homeworks1.cpp
示例9: preprocess
void UvdState::processK1(K1 k1)
{
preprocess(k1.ri.time);
if (k1.ri.confidence == 3)
{
m_recvStats.k1Conf3Lines++;
}
else
{
m_recvStats.k1Conf4Lines++;
}
OccurrenceRecord record;
if (m_pendingOccurrences.count(k1.tailNumber) == 0)
{
record.tailNumber = k1.tailNumber;
record.firstTime = k1.ri.time;
record.lastTime = k1.ri.time;
m_pendingOccurrences[k1.tailNumber] = record;
}
else
{
record = m_pendingOccurrences[k1.tailNumber];
if (record.lastTime + 100.0 < k1.ri.time)
{
// finalize old occurrence
lock();
m_occurrences.push_back(record);
unlock();
// and replace with new
record.tailNumber = k1.tailNumber;
record.firstTime = k1.ri.time;
record.lastTime = k1.ri.time;
}
else
{
record.lastTime = k1.ri.time;
}
m_pendingOccurrences[k1.tailNumber] = record;
}
postprocess(k1.ri.time);
}
开发者ID:rcg17,项目名称:uvdg-cocoa,代码行数:46,代码来源:UvdState.cpp
示例10: Point
//---------------------------------------------------------------------------------------
Mat PAN::getcontours(vector<vector<Point>> &finalcontours,int parameter,String database){
Mat img;
finalcontours._Pop_back_n(finalcontours.size());
Image image=PAN::Image(&img, 0, 0, 0, 0, Point(0, 0));
Mat mod;
if (parameter == 1){ mod = preprocess(panimage.img, &image, REMOVE_EMBLEM,database); }//used for cropping the image
else if (parameter == 2){ mod = panimage.img->clone(); }
int erosion_size = 4/parameter;
Mat element = getStructuringElement(MORPH_RECT, Size(2 * erosion_size + 1, 2 * erosion_size + 1), Point(erosion_size, erosion_size));
*image.img = mod.clone();
int kernel_size = 3;
int threshold = 81;
int ratio = 2/parameter;
int lowThreshold = 100;
if (image.img->channels() >= 2){ cvtColor(*image.img, *image.img, CV_BGR2GRAY); }
adaptiveThreshold(*image.img, *image.img, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, threshold, threshold);
erode(*image.img, *image.img, element);
blur(*image.img, *image.img, Size(kernel_size, kernel_size));
Canny(*image.img, *image.img, lowThreshold, lowThreshold*(2*ratio+1), 3, true);
vector<vector<Point>> contours;
findContours(*image.img, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, Point(0, 0));
for (unsigned int i = 0; i< contours.size(); i++){
if (contours[i].size()>80 && contours[i].size() < 1000){
vector<Point>temp = contours[i];
if (parameter == 1){
if (checktext(temp) == 1){ finalcontours.push_back(temp); }
}
else if (parameter == 2){
if (checksign(temp) == 1){
finalcontours.push_back(temp);
}
}
}
}
RNG rng(1235);
for (unsigned int i = 0; i<finalcontours.size(); i++){
Scalar color = Scalar(rng.uniform(150, 255), rng.uniform(150, 255), rng.uniform(150, 255));
drawContours(*image.img, finalcontours, i, color, 2, 8);
}
//imshow("output", *image.img);
//waitKey();
return mod;
}
开发者ID:Pranavgulati,项目名称:VeriSmart,代码行数:47,代码来源:PAN.cpp
示例11: test_get_first_exam
static void test_get_first_exam(void) {
init_test_exam();
exam *test_exams[] = {exam1, exam2, exam3, exam4,
exam5, exam6, exam7, exam8};
init_test_array_exams(8, test_exams);
preprocess(exams);
exam *first = get_first_exam(exams, MAX_TIMESLOT);
/* Initially, lower sat degree is Exam 4 */
CU_ASSERT_PTR_EQUAL(first, exams->data[3]);
/* Assign Exam 4 */
exams->data[3]->timeslot = 2;
first = get_first_exam(exams, MAX_TIMESLOT);
/* Tie break between Exam 2, 5 and 6.
* Exam 5 has the most students enrolled */
CU_ASSERT_PTR_EQUAL(first, exams->data[4]);
clean_array_exams();
}
开发者ID:Kent1,项目名称:Horaires,代码行数:17,代码来源:graph_heuristics_test.c
示例12: main
int main(int argc, char** argv) {
char* sourceFileName = argv[1];
FILE* source = fopen(sourceFileName, "r");
preprocess(source);
SymbolList* symlist = getSymbols();
Symbol* symbols = symlist->symbols;
// printf("Number of symbols: %d\n", symlist->size);
// for (int i = 0; i < symlist->size; i++) {
// printf("\n\n");
// printSymbol(symbols);
// symbols++;
// }
FILE* datasection = fopen("binarydata.txt", "w+");
printDataSection(datasection, symlist);
fclose(source);
}
开发者ID:tophep,项目名称:mips-assembler,代码行数:17,代码来源:testcase.c
示例13: cl_process
/* OpenCL processing function */
static cl_int
cl_process (GeglOperation *op,
cl_mem in_tex,
cl_mem out_tex,
size_t global_worksize,
const GeglRectangle *roi,
int level)
{
/* Retrieve a pointer to GeglChantO structure which contains all the
* chanted properties
*/
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
const gfloat *coeffs = o->chant_data;
cl_int cl_err = 0;
if (! coeffs)
{
coeffs = o->chant_data = preprocess (o);
}
if (!cl_data)
{
const char *kernel_name[] = {"kernel_temp", NULL};
cl_data = gegl_cl_compile_and_build (kernel_source, kernel_name);
}
if (!cl_data) return 1;
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 0, sizeof(cl_mem), (void*)&in_tex);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 1, sizeof(cl_mem), (void*)&out_tex);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 2, sizeof(cl_float), (void*)&coeffs[0]);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 3, sizeof(cl_float), (void*)&coeffs[1]);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 4, sizeof(cl_float), (void*)&coeffs[2]);
if (cl_err != CL_SUCCESS) return cl_err;
cl_err = gegl_clEnqueueNDRangeKernel(gegl_cl_get_command_queue (),
cl_data->kernel[0], 1,
NULL, &global_worksize, NULL,
0, NULL, NULL);
if (cl_err != CL_SUCCESS) return cl_err;
return cl_err;
}
开发者ID:AjayRamanathan,项目名称:gegl,代码行数:46,代码来源:color-temperature.c
示例14: MOPO_ASSERT
void Oscillator::process() {
MOPO_ASSERT(inputMatchesBufferSize(kFrequency));
MOPO_ASSERT(inputMatchesBufferSize(kPhase));
preprocess();
int i = 0;
if (input(kReset)->source->triggered &&
input(kReset)->source->trigger_value == kVoiceReset) {
int trigger_offset = input(kReset)->source->trigger_offset;
for (; i < trigger_offset; ++i)
tick(i);
offset_ = 0.0;
}
for (; i < buffer_size_; ++i)
tick(i);
}
开发者ID:mtytel,项目名称:mopo,代码行数:18,代码来源:oscillator.cpp
示例15: main
int main(void)
{
preprocess();
scanf("%lld", &tests);
for(long long int t = 0; t < tests; ++ t)
{
scanf("%lld %lld", &numbers, &subset);
for(long long int n = 0; n < numbers; ++ n)
{
scanf("%lld", &number[n]);
number[n] %= MOD;
}
printf("Case #%lld: %lld\n", t + 1, solve(numbers, subset));
}
return 0;
}
开发者ID:Neverous,项目名称:individual,代码行数:18,代码来源:card.cpp
示例16: clear
Barcode& Barcode2dBase::build( const std::string& rawData,
double w,
double h )
{
std::string cookedData; /* Preprocessed data */
Matrix<bool> encodedData; /* Encoded data matrix */
clear();
if ( rawData.empty() )
{
setIsEmpty( true );
setIsDataValid( false );
setWidth( 0 );
setHeight( 0 );
}
else
{
setIsEmpty( false );
if ( !validate( rawData ) )
{
setIsDataValid( false );
setWidth( 0 );
setHeight( 0 );
}
else
{
setIsDataValid( true );
cookedData = preprocess( rawData );
encode( cookedData, encodedData );
vectorize( encodedData, w, h );
setWidth( w );
setHeight( h );
}
}
return *this;
}
开发者ID:bigboss888,项目名称:glabels-qt,代码行数:44,代码来源:Barcode2dBase.cpp
示例17: apply
virtual void apply (vector<cv::Mat> const &images, vector<float> *ft) {
int batch = shape[0];
CHECK(!images.empty()) << "must input >= 1 images";
CHECK(images.size() <= batch) << "Too many input images.";
if (fcn()) { // for FCN, we need to resize network according to image size
cv::Size sz = images[0].size();
for (unsigned i = 1; i < images.size(); ++i) {
CHECK(images[i].size() == sz) << "all images must be the same size";
}
int input_height = input_blob->shape(2);
int input_width = input_blob->shape(3);
if ((input_width != sz.width)
|| (input_height != sz.height)) {
input_blob->Reshape(shape[0], shape[1], sz.height, sz.width);
net.Reshape();
}
}
float *input_data = input_blob->mutable_cpu_data();
float *e = preprocess(images, input_data);
CHECK(e -input_data <= input_blob->count());
net.ForwardPrefilled();
// compute output dimension
int dim = 0;
for (auto const &b: output_blobs) {
int d = b->count() / batch;
LOG(INFO) << "output: " << b->shape_string();
dim += d;
}
LOG(INFO) << "output size " << images.size() << " x " << dim;
ft->resize(images.size() * dim); // total output size
int off = 0;
for (auto const &b: output_blobs) {
int blob_dim = b->count() / batch;
float const *from_begin = b->cpu_data();
for (int i = 0; i < images.size(); ++i) {
float const *from_end = from_begin + blob_dim;
std::copy(from_begin, from_end, &ft->at(i * dim + off));
from_begin = from_end;
}
off += blob_dim;
}
CHECK(off == dim);
}
开发者ID:aaalgo,项目名称:xnn,代码行数:44,代码来源:caffe.cpp
示例18: preprocess
char *longestPalindrome(char *s) {
char *T = preprocess(s);
int n = strlen(T);
int *P = malloc(n * sizeof(int));
memset(P, 0, n * sizeof(int));
int C = 0, R = 0;
for (int i = 1; i < n - 1; i++) {
int i_mirror = 2 * C - i; // equals to i' = C - (i-C)
P[i] = (R > i) ? (R - i < P[i_mirror] ? R - i : P[i_mirror]) : 0;
// Attempt to expand palindrome centered at i
while (T[i + 1 + P[i]] == T[i - 1 - P[i]])
P[i]++;
// If palindrome centered at i expand past R,
// adjust center based on expanded palindrome.
if (i + P[i] > R) {
C = i;
R = i + P[i];
}
}
// Find the maximum element in P.
int maxLen = 0;
int centerIndex = 0;
for (int i = 1; i < n - 1; i++) {
if (P[i] > maxLen) {
maxLen = P[i];
centerIndex = i;
}
}
char *pld = malloc((maxLen + 1) * sizeof(char));
for (int i = 0; i < maxLen; i++) {
pld[i] = T[centerIndex - maxLen + 2 * i + 1] + 'a';
//pld[i] = 'a' + i + P[i];
}
pld[maxLen] = 0;
free(T);
free(P);
return pld;
}
开发者ID:aaa1616,项目名称:Fairy,代码行数:44,代码来源:largestnum.c
示例19: Q_D
void AbstractProcessor::run()
{
Q_D(AbstractProcessor);
if (!d->query.isValid()) {
qWarning() << "Warning: the query is not valid";
setError(tr("The query is not valid"));
emit error();
return;
}
PreprocessorData &preprocessorData = d->query.preprocessorData();
bool ok = false;
switch (d->processingTask) {
case Preprocessing:
preprocessorData.setPostData(processPostData(preprocessorData.data()));
ok = preprocess();
if (ok) {
emit preprocessingFinished(d->needLoading);
} else {
emit error();
}
break;
case PostProcessing:
if (!d->dataSource) {
qWarning() << "Warning: no data source provided";
setError(tr("No data source provided"));
emit error();
return;
}
ok = processDataSource(d->dataSource);
d->dataSource->deleteLater();
if (ok) {
emit postProcessingFinished();
} else {
emit error();
}
break;
default:
qWarning() << "Warning: no processing task set";
setError(tr("No processing task set"));
emit error();
return;
}
}
开发者ID:SfietKonstantin,项目名称:qfb,代码行数:44,代码来源:abstractprocessor.cpp
示例20: main
int main(int argc, char *argv[], char *env[])
{
IplImage *src;
struct intern_bitmap *bm;
int i;
/* Argumente testen */
if (argc == 1) {
printf("usage: \n\t%s <ein Bild>\n",argv[0]);
return 1;
}
/* init OpenCV */
#ifdef DEBUG
cvInitSystem(argc, argv);
#endif
for (i = 1; i < argc; i++ ) {
/* Bild Lesen */
src = cvLoadImage(argv[i], CV_LOAD_IMAGE_GRAYSCALE);
if (!src) {
printf("Error: cvLoadImage()\n");
return 1;
}
/* das original Bild anzeigen */
#ifdef DEBUG
cvNamedWindow("Demo Window", CV_WINDOW_AUTOSIZE);
cvShowImage("Demo Window", src);
cvWaitKey(-1);
cvDestroyWindow("Demo Window");
#endif
bm = preprocess(src);
ocr_bestpassend(bm, ergebnis, ERGEBNIS_LAENGE);
bm_release(bm);
cvReleaseData(src);
printf("Ergebnis: %s\n", ergebnis);
}
return 0;
}
开发者ID:dgreceanu,项目名称:schnell-ocr,代码行数:44,代码来源:tester.cpp
注:本文中的preprocess函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论