Пример #1
0
int main()
{
	test();
    hello();
}
Пример #2
0
int main (void) {
   hello ();
   return 0;
}
Пример #3
0
int main(int argc, const char * argv[])
{
    IplImage * image = 0;
    IplImage * src=0;
    
    /*FILE *f;
    //for (int k=0; k<10; k++) {
        
        
        char name[13];
        sprintf(name,"img.jpg");
        f=fopen("/users/madmoron/img.jpg", "r");
    //f=fopen(name, "w");
    
        
        
        fclose(f);*/
    //}
    //std::ofstream ;//<"test.txt">; //создать
    
    //ofs.close();
    
    const char * filename = argc == 2 ? argv[1] : "/users/madmoron/Desktop/img.jpg";
    // получаем картинку
    image = cvLoadImage(filename,1);
    // клонируем картинку
    src = cvCloneImage(image);
    
    printf("[i] image: %s\n", filename);
    assert( src != 0 );
    
    // окно для отображения картинки
    //cvNamedWindow("original",CV_WINDOW_AUTOSIZE);
    
    // показываем картинку
    //cvShowImage("original",image);
    
    // выводим в консоль информацию о картинке
    printf( "[i] channels:    %d\n",        image->nChannels );
    printf( "[i] pixel depth: %d bits\n",   image->depth );
    printf( "[i] width:       %d pixels\n", image->width );
    printf( "[i] height:      %d pixels\n", image->height );
    printf( "[i] image size:  %d bytes\n",  image->imageSize );
    printf( "[i] width step:  %d bytes\n",  image->widthStep );
    
    // ждём нажатия клавиши
    //cvWaitKey(0);
    
    
    // пробегаемся по всем пикселям изображения
    int *** arrImage=new int **[image->height];
    for( int y=0; y<image->height; y++ ) {
        char * ptr = (char *) (image->imageData + y * image->widthStep);
        arrImage[y]=new int * [image->width];
        for( int x=0; x<image->width; x++ ) {
            arrImage[y][x]=new int[3];
            // 3 канала
             
            arrImage[y][x][0]=(int)ptr[3*x];
            if (arrImage[y][x][0]<0) arrImage[y][x][0]+=256;
            //printf("%d",(int)ptr[3*x]);
            // B - синий
            arrImage[y][x][1]=(int)ptr[3*x+1];
            if (arrImage[y][x][1]<0) arrImage[y][x][1]+=256;
            // G - зелёный
            arrImage[y][x][2] = (int)ptr[3*x+2];
            if (arrImage[y][x][2]<0) arrImage[y][x][2]+=256;
            // R - красный
        }
    }
    printf("%d %d %d \n%d %d %d",arrImage[0][0][2],arrImage[0][0][1],arrImage[0][0][0],arrImage[1][1][2],arrImage[1][1][1],arrImage[1][1][0]);
    
    //printf("%d",arrImage[0][0][0]);
    
    //int *** newArrImage
    
    //cartoonFilter(arrImage, image->width, image->height, arrImage);
    
    //Cartoon::cartoonFilter(arrImage, <#int height#>, <#int width#>, <#int ***newArrImage#>)
    
    Cartoon::cartoonFilter(arrImage, image->width, image->height, arrImage);
    
    // собрать новое изображение
    
    for( int y=0; y<src->height; y++ ) {
        char * ptr = (char *) (src->imageData + y * src->widthStep);
        for (int x=0; x<src->width; x++) {
            ptr[3*x]=(char)(arrImage[y][x][0]);     // blue
            if (ptr[3*x]>127) ptr[3*x]-=256;
            ptr[3*x+1]=(char)(arrImage[y][x][1]);   // green
            if (ptr[3*x+1]>127) ptr[3*x+1]-=256;
            ptr[3*x+2]=(char)(arrImage[y][x][2]);   // red
            if (ptr[3*x+2]>127) ptr[3*x+2]-=256;
            
        }
    }
    
    
    cvSaveImage("/users/madmoron/Desktop/img2.jpg", src, 0);
    
   
    
    
    hello();
    
    
    // освобождаем ресурсы
    cvReleaseImage(& image);
    cvReleaseImage(& src);
    // удаляем окно
    //cvDestroyWindow("original");
    return 0;

}
Пример #4
0
void main1(){
   hello(", i am main1,i am using libhello");   
}
Пример #5
0
Файл: rcd.c Проект: joeshaw/rcd
int
main (int argc, const char **argv)
{
    GMainLoop *main_loop;
    struct sigaction sig_action;
    const char *config_file;
    char *python_path;

    g_thread_init (NULL);
    g_type_init ();

    rcd_executable_name = g_strdup (argv[0]);

    rcd_options_parse (argc, argv);

    if (rcd_options_get_show_version ()) {
        g_print ("%s\n", rcd_about_name ());
        g_print ("%s\n\n", rcd_about_copyright ());
        exit (0);
    }

    config_file = rcd_options_get_config_file ();
    if (config_file && !g_file_test (config_file, G_FILE_TEST_EXISTS)) {
        g_printerr ("Unable to find config file '%s'\n", config_file);
        g_printerr ("rcd aborting\n");

        exit (-1);
    }

    root_check ();
    if (!rcd_options_get_late_background ())
        daemonize ();

    /* Set up SIGTERM and SIGQUIT handlers */
    sig_action.sa_handler = signal_handler;
    sigemptyset (&sig_action.sa_mask);
    sig_action.sa_flags = 0;
    sigaction (SIGINT,  &sig_action, NULL);
    sigaction (SIGTERM, &sig_action, NULL);
    sigaction (SIGQUIT, &sig_action, NULL);

    /* Set up SIGHUP handler. */
    sig_action.sa_handler = sighup_handler;
    sigemptyset (&sig_action.sa_mask);
    sig_action.sa_flags = 0;
    sigaction (SIGHUP, &sig_action, NULL);
    
    /* If it looks like rcd-buddy is in the right place, set up
       handlers for crashes */
    python_path = g_find_program_in_path ("python");
    if (python_path != NULL
        && g_file_test (SHAREDIR "/rcd-buddy", G_FILE_TEST_EXISTS)) {
        sig_action.sa_handler = crash_handler;
        sigaction (SIGSEGV, &sig_action, NULL);
        sigaction (SIGFPE,  &sig_action, NULL);
        sigaction (SIGBUS,  &sig_action, NULL);
        sigaction (SIGABRT, &sig_action, NULL);
    }
    g_free (python_path);

    rcd_privileges_init ();

    initialize_logging ();

    /* Check to see if the password file is secure.
       If it isn't, a big warning will go out to the log file. */
    rcd_identity_password_file_is_secure ();

    /* Set the GPG keyring for package verification */
    rc_verification_set_keyring (SHAREDIR "/rcd.gpg");

    /* Create mid and secret */
    if (!g_file_test (SYSCONFDIR "/mcookie", G_FILE_TEST_EXISTS))
        rcd_create_uuid (SYSCONFDIR "/mcookie");

    if (!g_file_test (SYSCONFDIR "/partnernet", G_FILE_TEST_EXISTS))
        rcd_create_uuid (SYSCONFDIR "/partnernet");

    /* Add memory usage watcher */
    rcd_heartbeat_register_func (heartbeat_memory_monitor, NULL);

    initialize_rc_packman ();
    initialize_rc_services ();
    initialize_rc_world ();
    initialize_rpc ();

    if (!rcd_options_get_no_modules_flag ())
        rcd_module_init ();

    /* We can't daemonize any later than this, so hopefully module
       initialization won't be slow. */
    if (rcd_options_get_late_background ()) {
        
        rc_debug (RC_DEBUG_LEVEL_ALWAYS, "Running daemon in background.");
        daemonize ();

        /* We need to reinit logging, since the file descriptor gets closed
           when we daemonize. */
        rcd_log_reinit ();

        /* Say hello again, so it gets stored in the log file. */
        hello ();
    }

    rcd_rpc_local_server_start ();

    if (rcd_prefs_get_remote_server_enabled ()) {
        if (!rcd_rpc_remote_server_start ())
            exit (-1);
    }

    initialize_data ();
    
    /* No heartbeat if we have initialized from a dump file. */
    if (rcd_options_get_dump_file () == NULL)
        rcd_heartbeat_start ();

    main_loop = g_main_loop_new (NULL, TRUE);
    g_main_loop_run (main_loop);

    /*
     * We'll never reach here, because we'll exit() out in
     * rcd-shutdown.c.
     */
    g_assert_not_reached ();

    return 0;
} /* main */
Пример #6
0
	hello fromJSON(const char *json) {
		return hello();	
	}
Пример #7
0
void test_hello(void)
{
   TEST_ASSERT_EQUAL_STRING("Hello, World!", hello());
}
Пример #8
0
  TEST(Routing, callbacks)
  {
    zmq::context_t context(1);
    zmq::socket_t alphaSocket(context, ZMQ_PAIR);
    zmq::socket_t betaSocket(context, ZMQ_PAIR);
    std::unique_ptr<zmq::socket_t> alphaSocketRouter(new zmq::socket_t(context, ZMQ_PAIR));
    std::unique_ptr<zmq::socket_t> betaSocketRouter(new zmq::socket_t(context, ZMQ_PAIR));
    alphaSocket.bind("tcp://*:5555");
    betaSocket.bind("tcp://*:5556");
    alphaSocketRouter->connect("tcp://localhost:5555");
    betaSocketRouter->connect("tcp://localhost:5556");

    SocketRouter router;

    router.add_socket(SocketID::ALPHA, alphaSocketRouter);
    router.add_socket(SocketID::BETA, betaSocketRouter);

    Message hello(HELLO);
    Message heartbeat(HEARTBEAT);
    Message problemspec(PROBLEMSPEC);
    Message jobrequest(JOBREQUEST);
    Message job(JOB);
    Message jobswap(JOBSWAP);
    Message alldone(ALLDONE);
    Message goodbye(GOODBYE);

    auto fwdToBeta = [&] (const Message&m)
    { router.send(SocketID::BETA, m);};
    // Bind functionality to the router
    router(SocketID::ALPHA).onRcvHELLO.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvHEARTBEAT.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvPROBLEMSPEC.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvJOBREQUEST.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvJOB.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvJOBSWAP.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvALLDONE.connect(fwdToBeta);
    router(SocketID::ALPHA).onRcvGOODBYE.connect(fwdToBeta);

    router.start(10);//ms per poll
    send(alphaSocket, hello);
    Message rhello = receive(betaSocket);
    send(alphaSocket, heartbeat);
    Message rheartbeat = receive(betaSocket);
    send(alphaSocket, problemspec);
    Message rproblemspec = receive(betaSocket);
    send(alphaSocket, jobrequest);
    Message rjobrequest = receive(betaSocket);
    send(alphaSocket, job);
    Message rjob = receive(betaSocket);
    send(alphaSocket, jobswap);
    Message rjobswap = receive(betaSocket);
    send(alphaSocket, alldone);
    Message ralldone = receive(betaSocket);
    send(alphaSocket, goodbye);
    Message rgoodbye = receive(betaSocket);

    router.stop();
    ASSERT_EQ(hello, rhello);
    ASSERT_EQ(heartbeat, rheartbeat);
    ASSERT_EQ(problemspec, rproblemspec);
    ASSERT_EQ(jobrequest, rjobrequest);
    ASSERT_EQ(job, rjob);
    ASSERT_EQ(jobswap, rjobswap);
    ASSERT_EQ(alldone, ralldone);
    ASSERT_EQ(goodbye, rgoodbye);
  }
	virtual void filter_on_open( const tcode::io::ip::address& addr ){
		//LOG_T("ECHO2" , "filter_on_open %s" , addr.ip().c_str() );
        tcode::byte_buffer hello(10);
        hello.write_msg( "Hello");
        fire_filter_do_write(hello); 
	}
Пример #10
0
void liblibrary2(void) {
    printf("liblibrary2\n");
    hello();
}
Пример #11
0
/* Wrapper called by iocsh, selects the argument types that hello needs */
static void helloCallFunc(const iocshArgBuf *args) {
    hello(args[0].sval);
}
Пример #12
0
Файл: hello2.c Проект: laumann/C
int
main(int argc, char **argv)
{
  printf("%s, %s!\n", hello(), world());
  return 0;
}
Пример #13
0
/*
 * Initial boot sequence.
 */
static
void
boot(void)
{
	/*
	 * The order of these is important!
	 * Don't go changing it without thinking about the consequences.
	 *
	 * Among other things, be aware that console output gets
	 * buffered up at first and does not actually appear until
	 * mainbus_bootstrap() attaches the console device. This can
	 * be remarkably confusing if a bug occurs at this point. So
	 * don't put new code before mainbus_bootstrap if you don't
	 * absolutely have to.
	 *
	 * Also note that the buffer for this is only 1k. If you
	 * overflow it, the system will crash without printing
	 * anything at all. You can make it larger though (it's in
	 * dev/generic/console.c).
	 */

	hello();
	kprintf("\n");
	kprintf("OS/161 base system version %s\n", BASE_VERSION);
	kprintf("%s", harvard_copyright);
	kprintf("\n");

	kprintf("fassel system version %s (%s #%d)\n", 
		GROUP_VERSION, buildconfig, buildversion);
	kprintf("\n");

	/* Early initialization. */
	ram_bootstrap();
	proc_bootstrap();
	thread_bootstrap();
	hardclock_bootstrap();
	vfs_bootstrap();

	/* Probe and initialize devices. Interrupts should come on. */
	kprintf("Device probe...\n");
	KASSERT(curthread->t_curspl > 0);
	mainbus_bootstrap();
	KASSERT(curthread->t_curspl == 0);
	/* Now do pseudo-devices. */
	pseudoconfig();
	kprintf("\n");

	/* Late phase of initialization. */
	vm_bootstrap();
	kprintf_bootstrap();
	thread_start_cpus();

	/* Default bootfs - but ignore failure, in case emu0 doesn't exist */
	vfs_setbootfs("emu0");


	/*
	 * Make sure various things aren't screwed up.
	 */
	COMPILE_ASSERT(sizeof(userptr_t) == sizeof(char *));
	COMPILE_ASSERT(sizeof(*(userptr_t)0) == sizeof(char));
}
Пример #14
0
int main(int argc, char **argv, char **envp)
{
	hello();
}
Пример #15
0
int main(int argc, char* argv[]) {
	hello();
	world();
	return 0;
}
Пример #16
0
Файл: pop3.c Проект: npe9/harvey
void
main(int argc, char **argv)
{
	int fd;
	char *arg, cmdbuf[1024];
	Cmd *c;

	rfork(RFNAMEG);
	Binit(&in, 0, OREAD);
	Binit(&out, 1, OWRITE);

	ARGBEGIN{
	case 'a':
		loggedin = 1;
		if(readmbox(EARGF(usage())) < 0)
			exits(nil);
		break;
	case 'd':
		debug++;
		if((fd = create(EARGF(usage()), OWRITE, 0666)) >= 0 && fd != 2){
			dup(fd, 2);
			close(fd);
		}
		break;
	case 'p':
		passwordinclear = 1;
		break;
	case 'r':
		strecpy(tmpaddr, tmpaddr+sizeof tmpaddr, EARGF(usage()));
		if(arg = strchr(tmpaddr, '!'))
			*arg = '\0';
		peeraddr = tmpaddr;
		break;
	case 't':
		tlscert = readcert(EARGF(usage()), &ntlscert);
		if(tlscert == nil){
			senderr("cannot read TLS certificate: %r");
			exits(nil);
		}
		break;
	}ARGEND

	/* do before TLS */
	if(peeraddr == nil)
		peeraddr = remoteaddr(0,0);

	hello();

	while(Bflush(&out), getcrnl(cmdbuf, sizeof cmdbuf) > 0){
		arg = nextarg(cmdbuf);
		for(c=cmdtab; c->name; c++)
			if(cistrcmp(c->name, cmdbuf) == 0)
				break;
		if(c->name == 0){
			senderr("unknown command %s", cmdbuf);
			continue;
		}
		if(c->needauth && !loggedin){
			senderr("%s requires authentication", cmdbuf);
			continue;
		}
		(*c->f)(arg);
	}
	exits(nil);
}
Пример #17
0
int
main(int argc, char *argv[])
{
	printf("%s", hello());
	return 0;
}
Пример #18
0
Файл: main.c Проект: qqttrr/os
int main() {
	hello();
}
Пример #19
0
int
cexp_main1(int argc, char **argv, void (*callback)(int argc, char **argv, CexpContext ctx))
{
CexpContextRec		context;	/* the public parts of this instance's context */
CexpContext			myContext;
char				*line=0, *prompt=0, *tmp;
char				*symfile=0, *script=0;
int					rval=CEXP_MAIN_INVAL_ARG, quiet=0;
MyGetOptCtxtRec		oc={0}; /* must be initialized */
int					opt;
#ifdef HAVE_TECLA
#define	rl_context  context.gl
#else
#define rl_context  0
#endif
char				optstr[]={
						'h',
						'v',
						's',':',
						'a',':',
						'p',':',
#ifdef YYDEBUG
						'd',
#endif
						'q',
						'\0'
					};

context.prompt = 0;
context.parser = 0;

while ((opt=mygetopt_r(argc, argv, optstr,&oc))>=0) {
	switch (opt) {
		default:  fprintf(stderr,"Unknown Option %c\n",opt);
		case 'h': usage(argv[0]);
		case 'v': version(argv[0]);
			return 0;

#ifdef YYDEBUG
		case 'd': cexpdebug=1;
			break;
#endif
		case 'q': quiet=1;
			break;
		case 's': symfile=oc.optarg;
			break;
		case 'a': cexpBuiltinCpuArch = oc.optarg;
			break;

		case 'p': free(context.prompt); context.prompt = strdup(oc.optarg);
			break;
	}
}

if (argc>oc.optind)
	script=argv[oc.optind];

/* make sure vital code is initialized */

{
	static int initialized=0;
	cexpContextRunOnce(&initialized, cexpInit);
}

if (!cexpSystemModule) {
	if (!symfile) {
		/* try to find a builtin table */
		if ( !cexpModuleLoad(0,0) )
			fprintf(stderr,"No builtin symbol table -- need a symbol file argument\n");
	} else if (!cexpModuleLoad(symfile,"SYSTEM"))
		fprintf(stderr,"Unable to load system symbol table\n");
	if (!cexpSystemModule) {
		usage(argv[0]);
		return CEXP_MAIN_NO_SYMS;
	}
}

#ifdef USE_MDBG
mdbgInit();
#endif

/* initialize the public context */
context.next=0;
#ifdef HAVE_BFD_DISASSEMBLER
{
	extern void cexpDisassemblerInit();
	cexpDisassemblerInit(&context.dinfo, stdout);
}
#endif

cexpContextGetCurrent(&myContext);

if (!myContext) {
	/* topmost frame */
#ifdef HAVE_TECLA
	context.gl = new_GetLine(200,2000);
	if (!context.gl) {
		fprintf(stderr,"Unable to create line editor\n");
		return CEXP_MAIN_NO_MEM;
	}
	/* mute warnings about being unable to 
	 * read ~/.teclarc
	 */
	gl_configure_getline(context.gl,0,0,0);
#endif
	/* register first instance running in this thread's context; */
	cexpContextRegister();
	if (!quiet)
		hello();
} else {
#ifdef HAVE_TECLA
	/* re-use caller's line editor */
	context.gl = myContext->gl;
#endif
}
/* push our frame to the top */
context.next = myContext;
myContext	 = &context;
cexpContextSetCurrent(myContext);

/* See if there is an ancestor with a local prompt
 * and inherit
 */
if ( !context.prompt && context.next && context.next->prompt )
	context.prompt = strdup(context.next->prompt);

do {
	if (!(context.parser=cexpCreateParserCtx(quiet ? 0 : stdout))) {
		fprintf(stderr,"Unable to create parser context\n");
		usage(argv[0]);
		rval = CEXP_MAIN_NO_MEM;
		goto cleanup;
	}

#ifdef HAVE_TECLA
	{
	CPL_MATCH_FN(cexpSymComplete);
	gl_customize_completion(context.gl, context.parser, cexpSymComplete);
	}
#endif

	if (cexpSigHandlerInstaller)
		cexpSigHandlerInstaller(sighandler);

	if (!(rval=setjmp(context.jbuf))) {
		/* call them back to pass the jmpbuf */
		if (callback)
			callback(argc, argv, &context);
	
		if (script) {
			if ( (rval = process_script(context.parser, script, quiet)) )
				goto cleanup;
		} else {

			while ( (line=readline_r(
							checkPrompt( &context, &prompt, argc > 0 ? argv[0] : "Cexp" ),
							rl_context)) ) {
				/* skip empty lines */
				if (*line) {
					if ( '<' == *(tmp=skipsp(line)) ) {
						process_script(context.parser,tmp+1,quiet);
					} else {
						/* interactively process this line */
						cexpResetParserCtx(context.parser,line);
						cexpparse((void*)context.parser);
						add_history(line);
					}
				}
				free(line); line=0;
			}
		}
		
	} else {
			fprintf(stderr,"\nOops, exception caught\n");
			/* setjmp passes 0: first time
			 *               1: longjmp(buf,0) or longjmp(buf,1)
			 *           other: longjmp(buf,other)
			 */
			rval = (rval<2 ? -1 : CEXP_MAIN_KILLED);
	}
	
cleanup:
		script=0;	/* become interactive if script is killed */
		free(line);   			line=0;
		free(prompt);           prompt=0;
		cexpFreeParserCtx(context.parser); context.parser=0;
	
} while (-1==rval);

free(context.prompt);

/* pop our stack context from the chained list anchored 
 * at the running thread
 */
myContext = myContext->next;
cexpContextSetCurrent(myContext);
if ( ! myContext ) {
	/* we'll exit the topmost instance */
#ifdef HAVE_TECLA
	del_GetLine(context.gl);
#endif
	cexpContextUnregister();
}

return rval;
}
Пример #20
0
int main()
{
  Hello hello("Offord");
  hello.sayHello(10);
}
Пример #21
0
Файл: assh.cpp Проект: bsdf/assh
int main (int argc, char **argv)
{
	hello();
	int code = run_shell(argc, argv);
	return code;
}
Пример #22
0
int foo(void)
{
    return hello();
}
Пример #23
0
int
main (void)
{
  hello ("world");
  return 0;
}
Пример #24
0
int main() {
  hello();
  world();
  return 0;
}
Пример #25
0
int main()
{
    hello();
    return 0;
}
Пример #26
0
int main(void) {
    hello();
    exit();
}
Пример #27
0
void Hello::Sayhello() {
    std::cout<<hello()<<std::endl;
}
Пример #28
0
void TestInterface::async_eb_eventBaseAsync(
    std::unique_ptr<StringCob> callback) {
  std::unique_ptr<std::string> hello(new std::string("hello world"));
  callback->result(std::move(hello));
}
Пример #29
0
JNIEXPORT void JNICALL Java_com_example_hellohalide_CameraPreview_processFrame(
    JNIEnv *env, jobject obj, jbyteArray jSrc, jint j_w, jint j_h, jint j_orientation, jobject surf) {

    const int w = j_w, h = j_h, orientation = j_orientation;

    halide_start_clock(NULL);
    halide_set_error_handler(handler);

    unsigned char *src = (unsigned char *)env->GetByteArrayElements(jSrc, NULL);
    if (!src) {
        LOGD("src is null\n");
        return;
    }

    LOGD("[output window size] j_w = %d, j_h = %d", j_w, j_h);
    LOGD("[src array length] jSrc.length = %d", env->GetArrayLength(jSrc));

    ANativeWindow *win = ANativeWindow_fromSurface(env, surf);


    static bool first_call = true;
    static unsigned counter = 0;
    static unsigned times[16];
    if (first_call) {
        LOGD("According to Halide, host system has %d cpus\n", halide_host_cpu_count());
        LOGD("Resetting buffer format");
        ANativeWindow_setBuffersGeometry(win, w, h, 0);
        first_call = false;
        for (int t = 0; t < 16; t++) times[t] = 0;
    }

    ANativeWindow_Buffer buf;
    ARect rect = {0, 0, w, h};

    if (int err = ANativeWindow_lock(win, &buf, NULL)) {
        LOGD("ANativeWindow_lock failed with error code %d\n", err);
        return;
    }

    uint8_t *dst = (uint8_t *)buf.bits;

    // If we're using opencl, use the gpu backend for it.
#if COMPILING_FOR_OPENCL
    halide_opencl_set_device_type("gpu");
#endif

    // Make these static so that we can reuse device allocations across frames.
    static halide_buffer_t srcBuf = {0};
    static halide_dimension_t srcDim[2];
    static halide_buffer_t dstBuf = {0};
    static halide_dimension_t dstDim[2];

    if (dst) {
        srcBuf.host = (uint8_t *)src;
        srcBuf.set_host_dirty();
        srcBuf.dim = srcDim;
        srcBuf.dim[0].min = 0;
        srcBuf.dim[0].extent = w;
        srcBuf.dim[0].stride = 1;
        srcBuf.dim[1].min = 0;
        srcBuf.dim[1].extent = h;
        srcBuf.dim[1].stride = w;
        srcBuf.type = halide_type_of<uint8_t>();

        if (orientation >= 180) {
            // Camera sensor is probably upside down (e.g. Nexus 5x)
            srcBuf.host += w*h-1;
            srcBuf.dim[0].stride = -1;
            srcBuf.dim[1].stride = -w;
        }

        dstBuf.host = dst;
        dstBuf.dim = dstDim;
        dstBuf.dim[0].min = 0;
        dstBuf.dim[0].extent = w;
        dstBuf.dim[0].stride = 1;
        dstBuf.dim[1].min = 0;
        dstBuf.dim[1].extent = h;
        dstBuf.dim[1].stride = w;
        dstBuf.type = halide_type_of<uint8_t>();

        // Just set chroma to gray.
        memset(dst + w*h, 128, (w*h)/2);

        int64_t t1 = halide_current_time_ns();
        hello(&srcBuf, &dstBuf);

        halide_copy_to_host(NULL, &dstBuf);

        int64_t t2 = halide_current_time_ns();
        unsigned elapsed_us = (t2 - t1)/1000;


        times[counter & 15] = elapsed_us;
        counter++;
        unsigned min = times[0];
        for (int i = 1; i < 16; i++) {
            if (times[i] < min) min = times[i];
        }
        LOGD("Time taken: %d (%d)", elapsed_us, min);
    }

    ANativeWindow_unlockAndPost(win);
    ANativeWindow_release(win);

    env->ReleaseByteArrayElements(jSrc, (jbyte *)src, 0);
}
Пример #30
0
void TERMWINDOWMEMBER greeting(void)
	{
	MRO.Verbose = FALSE;

	if (loggedIn)
		{
		terminate(FALSE);
		}

	OC.Echo = BOTH;
	OC.setio();

	setdefaultconfig(FALSE);

	pause(10);

	cls(SCROLL_SAVE);

	doccr();

	StatusLine.Update(WC_TWp);

	if (modStat)
		{
		if (cfg.connectwait)
			{
			CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(84));

			pause(cfg.connectwait * 100);

			if (w)
				{
				destroyCitWindow(w, FALSE);
				}
			}

		CommPort->FlushInput();
		}

	// make sure we want to talk to this baud rate
	if (modStat && (CommPort->GetModemSpeed() < cfg.minbaud))
		{
		dispBlb(B_TOOLOW);

		CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

		Hangup();
		pause(200);

		if (w)
			{
			destroyCitWindow(w, FALSE);
			}
		}
	else
		{
		OC.User.SetCanControlD(TRUE);

		// set terminal
		autoansi();

		OC.SetOutFlag(OUTOK);

		if (modStat || debug)
			{
			hello();
			doCR();
			}

		OC.SetOutFlag(OUTOK);

		mPrintfCR(getmsg(683), cfg.nodeTitle, cfg.nodeRegion, cfg.nodeCountry);
		mPrintfCR(getmsg(682), cfg.softverb, *cfg.softverb ? spc : ns, programName, version);
		mPrintf(pcts, Author);

#if VERSION != RELEASE
		doCR();
#ifndef HARRY
		CRCRmPrintfCR(" 2=== 1NOTE02 ===0");
#else
        CRCRmPrintfCR(" 2=== NOTE ===0");
#endif
#ifndef NDEBUG
		CRmPrintf("This BBS is running pre-release software.  Because this is a test version ");
		mPrintf("of the software, it has extra code to assure that things are running as ");
		mPrintf("they should.  This may cause a noticeable slow-down in the operation of ");
		mPrintf("the board.  Also, because this is pre-release software, it may contain ");
		mPrintf("bugs that could cause a loss of data.  This is not likely, but it is best ");
		mPrintfCR("to be aware of potential problems before they surprise you.");
#else
		mPrintf("This BBS is running pre-release software.  Because this is pre-release ");
		mPrintf("software, it may contain ");
		mPrintf("bugs that could cause a loss of data.  This is not likely, but it is best ");
		mPrintfCR("to be aware of potential problems before they surprise you.");
#endif
#ifndef HARRY
		CRmPrintfCR(" 2=== 1NOTE02 ===0");
#else
        CRmPrintfCR(" 2=== NOTE ===0");
#endif
#endif


		char dtstr[80];
		strftime(dtstr, 79, cfg.vdatestamp, 0l);

		doCR();
		CRmPrintf(pcts, dtstr);

		if (!cfg.forcelogin)
			{
			CRmPrintf(getmsg(677));
			CRmPrintf(getmsg(678));
			CRmPrintf(getmsg(679));
			}

		CurrentRoom->Load(LOBBY);
		checkdir();
		thisRoom = LOBBY;

		const ulong messages = Talley->MessagesInRoom(thisRoom);

		CRmPrintfCR(getmsg(144), ltoac(messages), (messages == 1) ? cfg.Lmsg_nym : cfg.Lmsgs_nym);

		CommPort->FlushInput();
		}
	}