int process_write_regs(struct lwp *l, const struct reg *regs) { struct frame *frame = process_frame(l); /* * in the hp300 machdep.c _write_regs, PC alignment wasn't * checked. If an odd address is placed in the PC and the * program is allowed to run, it will cause an Address Error * which will be transmitted to the process by a SIGBUS. * No reasonable debugger would let this happen, but * it's not our problem. */ /* * XXX * in hp300 machdep.c, it just cleared/set these bits * automatically. here, we barf. well-written programs * shouldn't munge them. */ if ((regs->r_sr & PSL_USERCLR) != 0 || (regs->r_sr & PSL_USERSET) != PSL_USERSET) return EPERM; memcpy(frame->f_regs, regs->r_regs, sizeof(frame->f_regs)); frame->f_sr = regs->r_sr; frame->f_pc = regs->r_pc; return 0; }
int main(unsigned long long speid, unsigned long long argp, unsigned long long envp) { int i = 0; ppu_data_t ppu_data __attribute__ ((aligned(16))); tag_id = mfc_tag_reserve(); if (tag_id == MFC_TAG_INVALID){ printf("SPU: ERROR can't allocate tag ID\n"); return -1; } /* Obtin prin DMA structura cu pointeri, nr de frame-uri si spe_id */ dprintf("SPU: am intrat in spu %llx %lu %llx\n", speid, sizeof(ppu_data_t), envp); mfc_get((void*)&ppu_data, argp, (uint32_t)envp, tag_id, 0, 0); waittag(tag_id); dprintf("SPU: speid:%llx got struct\n", speid); dprintf("SPU: speid:%llx id:%02d input:%p big_img:%p num_frms:%d\n", speid, ppu_data.spe_id, ppu_data.input, ppu_data.big_image, ppu_data.num_frames); speid = speid; /* Frame processing goes here */ for (i = 0; i < ppu_data.num_frames; ++i) { process_frame(ppu_data, i); } return 0; }
static int get_data(const char* dbpath, struct record_history *hist, libusb_device_handle *dev_handle) { /* The buffer size is arbitrary */ uint_fast8_t buffer[512] = {0}; uint_fast8_t *bufptr = &buffer[0]; int transferred; /* The call here is blocking and we did set an infinite timeout. The * device is sending wait message regularly, so we can just loop on * this without consumming CPU nor needing to poll(). */ const int ret = libusb_bulk_transfer(dev_handle, BULK_EP_IN, buffer, sizeof(buffer), &transferred, 0); if (ret) { fprintf(stderr, "ERROR: bulk_read returned %d (%s)\n", ret, libusb_strerror(ret)); return -1; } DPRINTF(2, "read %d bytes.\n", transferred); /* incomplete frames are resent */ int nb_frames = transferred / FRAME_SIZE; DPRINTF(2, "Treat nb frames: %d\n", nb_frames); while (nb_frames--) { if (process_frame(dbpath, bufptr, hist, dev_handle)) { fprintf(stderr, "ERROR: process detected an error.\n"); return -1; } bufptr += FRAME_SIZE; } return 0; }
void OnsetDetectionFunction::process(int signal_size, sample* signal, int odf_size, sample* odf) { sample odf_max = 0.0; int sample_offset = 0; int frame = 0; while(sample_offset <= signal_size - frame_size) { odf[frame] = process_frame(frame_size, &signal[sample_offset]); /* keep track of the maximum so we can normalise later */ if(odf[frame] > odf_max) { odf_max = odf[frame]; } sample_offset += hop_size; frame++; } /* normalise ODF */ if(odf_max) { for(int i = 0; i < odf_size; i++) { odf[i] /= odf_max; } } }
/* * cpu_upcall: * * Send an an upcall to userland. */ void cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas, void *ap, void *sp, sa_upcall_t upcall) { struct trapframe *tf; struct saframe *sf, frame; tf = process_frame(l); /* Finally, copy out the rest of the frame. */ #if 0 /* First 4 args in regs (see below). */ frame.sa_type = type; frame.sa_sas = sas; frame.sa_events = nevents; frame.sa_interrupted = ninterrupted; #endif frame.sa_arg = ap; sf = (struct saframe *)sp - 1; if (copyout(&frame, sf, sizeof(frame)) != 0) { /* Copying onto the stack didn't work. Die. */ sigexit(l, SIGILL); /* NOTREACHED */ } tf->tf_r0 = type; tf->tf_r1 = (int) sas; tf->tf_r2 = nevents; tf->tf_r3 = ninterrupted; tf->tf_pc = (int) upcall; tf->tf_usr_sp = (int) sf; tf->tf_usr_lr = 0; /* no return */ }
static int io_loop(int dev_id) { int ret; usb_dev_handle *hdev = g_devices[dev_id].hdev; int epin = g_devices[dev_id].epin; unsigned char buffer[512]; unsigned char word[11]; memset(buffer, 0, sizeof(buffer)); memset(word, 0, sizeof(word)); while(1) { memset(buffer, 0, sizeof(buffer)); ret = usb_bulk_read(hdev, epin, (char*)buffer, sizeof(buffer), 10000); if(ret < 0) { printf("bulk_read returned %d (%s)\n", ret, usb_strerror()); return -1; } // printf("read %d bytes: \n", ret); unsigned char *bufptr = (unsigned char *)buffer; int nb_words = ret/11; // incomplete words are resent while(nb_words--) { memcpy(word, bufptr, 11); bufptr+=11; process_frame(dev_id, word); } } return 0; }
// Undo and redo commands void UndoBuffer::undo() { if (locked) return; if (history_position == 0) { set_status("Nothing to undo"); return; } StatusDelay delay("Undoing " + undo_action()); // Undo most recent command bool have_command = history[history_position - 1].has_command(); bool ok = process_command(history_position - 1); if (ok && history_position > 1) { if (!have_command) process_frame(history_position - 2); process_pos(history_position - 2); process_state(history_position - 2); } if (!ok) delay.outcome = "failed"; history_position--; done(&delay); }
void UndoBuffer::redo() { if (locked) return; if (history_position >= history.size()) { set_status("Nothing to redo"); return; } StatusDelay delay("Redoing " + redo_action()); // Redo next command and restore state bool have_command = history[history_position].has_command(); process_state(history_position); if (!have_command) process_frame(history_position); process_pos(history_position); bool ok = process_command(history_position); if (!ok) delay.outcome = "failed"; history_position++; done(&delay); }
PVideoFrame __stdcall ShapeMask::GetFrame(int n, IScriptEnvironment* env) { int colorspace; if (vi.IsRGB24()) colorspace = RGB24; else if (vi.IsRGB32()) colorspace = RGB32; else if (vi.IsYUY2()) colorspace = YUV2; else if (vi.IsYV12()) colorspace = YV12; else raiseError(env, "Unsupported color space, must be one of RGB24, RGB32, YUV2 or YV12"); PClip srcClip = toGrayScale(env, child); PVideoFrame src = srcClip->GetFrame(n, env); PVideoFrame dst = env->NewVideoFrame(vi); const uchar* srcp = src->GetReadPtr(); const int src_pitch = src->GetPitch(); const int bpp = vi.BitsPerPixel(); uchar* retp; // No change to the source pixels in the process steps, so ok to cast to non-const // returns a 1 channel gray scale image which needs to be converted to whatever format the source clip is in. retp = process_frame((uchar*)srcp, vi.width, vi.height, src_pitch, colorspace, threshold, minarea, rectonly); if (vi.IsPlanar()) copyPlanar(retp, dst, bpp); else if (vi.IsYUY2()) copyYUY2(retp, dst); else copyRGB(retp, dst, bpp); delete retp; return dst; }
int process_write_regs(struct proc *p, struct reg *regs) { struct trapframe *tf = process_frame(p); KASSERT(tf != NULL); bcopy((caddr_t)regs->r, (caddr_t)&tf->tf_r0, sizeof(regs->r)); tf->tf_usr_sp = regs->r_sp; tf->tf_usr_lr = regs->r_lr; #ifdef __PROG32 tf->tf_pc = regs->r_pc; tf->tf_spsr &= ~PSR_FLAGS; tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS; #ifdef DIAGNOSTIC if ((tf->tf_spsr & PSR_MODE) == PSR_USR32_MODE && tf->tf_spsr & I32_bit) panic("process_write_regs: Interrupts blocked in user process"); #endif #else /* __PROG26 */ if ((regs->r_pc & (R15_MODE | R15_IRQ_DISABLE | R15_FIQ_DISABLE)) != 0) return EPERM; tf->tf_r15 = regs->r_pc; #endif return(0); }
int process_read_regs(struct lwp *l, struct reg *regs) { struct trapframe *tf = process_frame(l); #ifdef VM86 if (tf->tf_eflags & PSL_VM) { regs->r_gs = tf->tf_vm86_gs; regs->r_fs = tf->tf_vm86_fs; regs->r_es = tf->tf_vm86_es; regs->r_ds = tf->tf_vm86_ds; regs->r_eflags = get_vflags(l); } else #endif { regs->r_gs = tf->tf_gs & 0xffff; regs->r_fs = tf->tf_fs & 0xffff; regs->r_es = tf->tf_es & 0xffff; regs->r_ds = tf->tf_ds & 0xffff; regs->r_eflags = tf->tf_eflags; } regs->r_edi = tf->tf_edi; regs->r_esi = tf->tf_esi; regs->r_ebp = tf->tf_ebp; regs->r_ebx = tf->tf_ebx; regs->r_edx = tf->tf_edx; regs->r_ecx = tf->tf_ecx; regs->r_eax = tf->tf_eax; regs->r_eip = tf->tf_eip; regs->r_cs = tf->tf_cs & 0xffff; regs->r_esp = tf->tf_esp; regs->r_ss = tf->tf_ss & 0xffff; return (0); }
int process_read_regs(struct proc *p, struct reg *regs) { struct trapframe *tf = process_frame(p); regs->r_rdi = tf->tf_rdi; regs->r_rsi = tf->tf_rsi; regs->r_rdx = tf->tf_rdx; regs->r_rcx = tf->tf_rcx; regs->r_r8 = tf->tf_r8; regs->r_r9 = tf->tf_r9; regs->r_r10 = tf->tf_r10; regs->r_r11 = tf->tf_r11; regs->r_r12 = tf->tf_r12; regs->r_r13 = tf->tf_r13; regs->r_r14 = tf->tf_r14; regs->r_r15 = tf->tf_r15; regs->r_rbp = tf->tf_rbp; regs->r_rbx = tf->tf_rbx; regs->r_rax = tf->tf_rax; regs->r_rsp = tf->tf_rsp; regs->r_rip = tf->tf_rip; regs->r_rflags = tf->tf_rflags; regs->r_cs = tf->tf_cs; regs->r_ss = tf->tf_ss; regs->r_ds = tf->tf_ds; regs->r_es = tf->tf_es; regs->r_fs = tf->tf_fs; regs->r_gs = tf->tf_gs; return (0); }
int process_stream(uint8_t* (get_frame)(int*, int*, int*), int (*process_frame)(uint8_t*, int, int, int)) { int stop; uint8_t* frame; int nrows, ncols, ldim; // stop = 0; while(!stop) { int key = 0; // get the pressed key ... key = getch(); // frame = get_frame(&nrows, &ncols, &ldim); // if(key=='q') stop = 1; else if(!frame) usleep(10000); else process_frame(frame, nrows, ncols, ldim); } // return 1; }
/* * Like process_read_regs() but for old struct reg w/out r_gbr. */ static int process_machdep_read_regs40(struct lwp *l, struct __reg40 *regs) { struct trapframe *tf = process_frame(l); regs->r_spc = tf->tf_spc; regs->r_ssr = tf->tf_ssr; /* no r_gbr in struct __reg40 */ regs->r_macl = tf->tf_macl; regs->r_mach = tf->tf_mach; regs->r_pr = tf->tf_pr; regs->r_r14 = tf->tf_r14; regs->r_r13 = tf->tf_r13; regs->r_r12 = tf->tf_r12; regs->r_r11 = tf->tf_r11; regs->r_r10 = tf->tf_r10; regs->r_r9 = tf->tf_r9; regs->r_r8 = tf->tf_r8; regs->r_r7 = tf->tf_r7; regs->r_r6 = tf->tf_r6; regs->r_r5 = tf->tf_r5; regs->r_r4 = tf->tf_r4; regs->r_r3 = tf->tf_r3; regs->r_r2 = tf->tf_r2; regs->r_r1 = tf->tf_r1; regs->r_r0 = tf->tf_r0; regs->r_r15 = tf->tf_r15; return 0; }
int process_read_regs(struct lwp *l, struct reg *regs) { struct trapframe *tf = process_frame(l); regs->r_spc = tf->tf_spc; regs->r_ssr = tf->tf_ssr; regs->r_gbr = tf->tf_gbr; regs->r_macl = tf->tf_macl; regs->r_mach = tf->tf_mach; regs->r_pr = tf->tf_pr; regs->r_r14 = tf->tf_r14; regs->r_r13 = tf->tf_r13; regs->r_r12 = tf->tf_r12; regs->r_r11 = tf->tf_r11; regs->r_r10 = tf->tf_r10; regs->r_r9 = tf->tf_r9; regs->r_r8 = tf->tf_r8; regs->r_r7 = tf->tf_r7; regs->r_r6 = tf->tf_r6; regs->r_r5 = tf->tf_r5; regs->r_r4 = tf->tf_r4; regs->r_r3 = tf->tf_r3; regs->r_r2 = tf->tf_r2; regs->r_r1 = tf->tf_r1; regs->r_r0 = tf->tf_r0; regs->r_r15 = tf->tf_r15; return (0); }
/********************************** Main routine ************************************/ void main() { int k; // used in various for loops /* Initialize and zero fill arrays */ inbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Input array */ outbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Output array */ inframe = (float *) calloc(FFTLEN, sizeof(float)); /* Array for processing*/ outframe = (float *) calloc(FFTLEN, sizeof(float)); /* Array for processing*/ inwin = (float *) calloc(FFTLEN, sizeof(float)); /* Input window */ outwin = (float *) calloc(FFTLEN, sizeof(float)); /* Output window */ /* initialize board and the audio port */ init_hardware(); /* initialize hardware interrupts */ init_HWI(); /* initialize algorithm constants */ for (k=0; k<FFTLEN; k++) { inwin[k] = sqrt((1.0-WINCONST*cos(PI*(2*k+1)/FFTLEN))/OVERSAMP); outwin[k] = inwin[k]; } ingain=INGAIN; outgain=OUTGAIN; /* main loop, wait for interrupt */ while(1) process_frame(); }
int sys_sigreturn(struct proc *p, void *v, register_t *retval) { struct sys_sigreturn_args /* { syscallarg(struct sigcontext *) sigcntxp; } */ *uap = v; struct sigcontext *scp, context; struct trapframe *tf; /* * we do a rather scary test in userland */ if (v == NULL) return (EFAULT); /* * The trampoline code hands us the context. * It is unsafe to keep track of it ourselves, in the event that a * program jumps out of a signal handler. */ scp = SCARG(uap, sigcntxp); if (copyin((caddr_t)scp, &context, sizeof(*scp)) != 0) return (EFAULT); /* * Make sure the processor mode has not been tampered with and * interrupts have not been disabled. */ if ((context.sc_spsr & PSR_MODE) != PSR_USR32_MODE || (context.sc_spsr & (PSR_I | PSR_F)) != 0) return (EINVAL); /* Restore register context. */ tf = process_frame(p); tf->tf_r0 = context.sc_r0; tf->tf_r1 = context.sc_r1; tf->tf_r2 = context.sc_r2; tf->tf_r3 = context.sc_r3; tf->tf_r4 = context.sc_r4; tf->tf_r5 = context.sc_r5; tf->tf_r6 = context.sc_r6; tf->tf_r7 = context.sc_r7; tf->tf_r8 = context.sc_r8; tf->tf_r9 = context.sc_r9; tf->tf_r10 = context.sc_r10; tf->tf_r11 = context.sc_r11; tf->tf_r12 = context.sc_r12; tf->tf_usr_sp = context.sc_usr_sp; tf->tf_usr_lr = context.sc_usr_lr; tf->tf_svc_lr = context.sc_svc_lr; tf->tf_pc = context.sc_pc; tf->tf_spsr = context.sc_spsr; /* Restore signal mask. */ p->p_sigmask = context.sc_mask & ~sigcantmask; return (EJUSTRETURN); }
void DetectorsComparisonTestApplication::main_loop() { int num_iterations = 0; const int num_iterations_for_timing = 10; double cumulated_processing_time = 0; double start_wall_time = omp_get_wtime(); bool video_input_is_available = false; video_input_is_available = directory_input_p->next_frame(); // for each input image while(video_input_is_available) { // update video input -- const AbstractVideoInput::input_image_view_t & input_view = directory_input_p->get_image(); const double start_processing_wall_time = omp_get_wtime(); printf("Processing image %s\n", directory_input_p->get_image_name().c_str()); // compute the channel responses and comparison statistics -- process_frame(input_view); cumulated_processing_time += omp_get_wtime() - start_processing_wall_time; // print timing information -- num_iterations += 1; if((num_iterations % num_iterations_for_timing) == 0) { printf("Average iteration speed %.4lf [Hz] (in the last %i iterations)\n", num_iterations_for_timing / (omp_get_wtime() - start_wall_time) , num_iterations_for_timing ); start_wall_time = omp_get_wtime(); // we reset timer } // retrieve the next test image -- video_input_is_available = directory_input_p->next_frame(); } // end of "while video input" // print global timing information -- printf("Processed a total of %i input frames\n", num_iterations); if(cumulated_processing_time > 0) { printf("Average objects detection speed per iteration %.2lf [Hz] (in the last %i iterations)\n", num_iterations / cumulated_processing_time , num_iterations ); } // compute test results -- printf("\n"); check_computed_statistics(); save_channel_statistics(); return; }
int process_set_pc(struct lwp *l, void *addr) { struct trapframe *tf = process_frame(l); tf->tf_eip = (int)addr; return (0); }
/********************************** Main routine ************************************/ void main() { int k; // used in various for loops /* Initialise and zero fill arrays */ inbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Input array */ outbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Output array */ inframe = (float *) calloc(FFTLEN, sizeof(float)); /* Array for processing*/ outframe = (float *) calloc(FFTLEN, sizeof(float)); /* Array for processing*/ inwin = (float *) calloc(FFTLEN, sizeof(float)); /* Input window */ outwin = (float *) calloc(FFTLEN, sizeof(float)); /* Output window */ M1 = (float *) calloc(FFTLEN, sizeof(float)); /* Used for storage of past noise spectra */ M2 = (float *) calloc(FFTLEN, sizeof(float)); /* Used for storage of past noise spectra */ M3 = (float *) calloc(FFTLEN, sizeof(float)); /* Used for storage of past noise spectra */ M4 = (float *) calloc(FFTLEN, sizeof(float)); /* Used for storage of past noise spectra */ /* Initialise board and the audio port */ init_hardware(); /* Initialise hardware interrupts */ init_HWI(); /* Initialise algorithm constants */ for (k=0;k<FFTLEN;k++) { inwin[k] = sqrt((1.0-WINCONST*cos(PI*(2*k+1)/FFTLEN))/OVERSAMP); outwin[k] = inwin[k]; //init custom variables here X[k] = 0; M1[k] = 0; M2[k] = 0; M3[k] = 0; M4[k] = 0; #if (((optim1)||(optim2))==1) Ptm1[k] = 0; #endif #if ((optim3)==1) Ntm1[k] = 0; #endif #if (optim6 == 0) lpfcoef[k] = 1; #endif //end of custom added variables } ingain=INGAIN; outgain=OUTGAIN; /* main loop, wait for interrupt */ while(1) process_frame(); }
int process_read_regs(struct lwp *l, struct reg *regs) { struct frame *frame = process_frame(l); memcpy(regs->r_regs, frame->f_regs, sizeof(frame->f_regs)); regs->r_sr = frame->f_sr; regs->r_pc = frame->f_pc; return 0; }
int process_set_pc(struct proc *p, caddr_t addr) { struct trapframe *tf = process_frame(p); if ((u_int64_t)addr > VM_MAXUSER_ADDRESS) return EINVAL; tf->tf_rip = (u_int64_t)addr; return (0); }
int process_write_regs(struct lwp *l, const struct reg *regs) { struct trapframe *tf = process_frame(l); #ifdef VM86 if (regs->r_eflags & PSL_VM) { void syscall_vm86(struct trapframe *); tf->tf_vm86_gs = regs->r_gs; tf->tf_vm86_fs = regs->r_fs; tf->tf_vm86_es = regs->r_es; tf->tf_vm86_ds = regs->r_ds; set_vflags(l, regs->r_eflags); /* * Make sure that attempts at system calls from vm86 * mode die horribly. */ l->l_proc->p_md.md_syscall = syscall_vm86; } else #endif { /* * Check for security violations. */ if (((regs->r_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 || !USERMODE(regs->r_cs, regs->r_eflags)) return (EINVAL); tf->tf_gs = regs->r_gs; tf->tf_fs = regs->r_fs; tf->tf_es = regs->r_es; tf->tf_ds = regs->r_ds; #ifdef VM86 /* Restore normal syscall handler */ if (tf->tf_eflags & PSL_VM) (*l->l_proc->p_emul->e_syscall_intern)(l->l_proc); #endif tf->tf_eflags = regs->r_eflags; } tf->tf_edi = regs->r_edi; tf->tf_esi = regs->r_esi; tf->tf_ebp = regs->r_ebp; tf->tf_ebx = regs->r_ebx; tf->tf_edx = regs->r_edx; tf->tf_ecx = regs->r_ecx; tf->tf_eax = regs->r_eax; tf->tf_eip = regs->r_eip; tf->tf_cs = regs->r_cs; tf->tf_esp = regs->r_esp; tf->tf_ss = regs->r_ss; return (0); }
int process_sstep(struct lwp *l, int sstep) { struct frame *frame = process_frame(l); if (sstep) frame->f_sr |= PSL_T; else frame->f_sr &= ~PSL_T; return 0; }
int process_sstep(struct proc *p, int sstep) { struct trapframe *tf = process_frame(p); if (sstep) tf->tf_rflags |= PSL_T; else tf->tf_rflags &= ~PSL_T; return (0); }
int process_sstep(struct lwp *l, int sstep) { struct trapframe *tf = process_frame(l); if (sstep) tf->tf_eflags |= PSL_T; else tf->tf_eflags &= ~PSL_T; return (0); }
/********************************** Main routine ************************************/ void main() { int k; // used in various for loops /* Initialize and zero fill arrays */ inbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Input array */ outbuffer = (float *) calloc(CIRCBUF, sizeof(float)); /* Output array */ inframe = (complex *) calloc(FFTLEN, sizeof(complex)); /* Array for processing*/ outframe = (float *) calloc(FFTLEN, sizeof(float)); /* Array for processing*/ inwin = (float *) calloc(FFTLEN, sizeof(float)); /* Input window */ outwin = (float *) calloc(FFTLEN, sizeof(float)); /* Output window */ frame_mag = (float *) calloc(FFTLEN, sizeof(float)); N = (float *) calloc(FFTLEN, sizeof(float)); last_frame = (complex *) calloc(FFTLEN, sizeof(float)); last_last_frame = (complex *) calloc(FFTLEN, sizeof(float)); last_frame_mag = (float *) calloc(FFTLEN, sizeof(float)); last_N = (float *) calloc(FFTLEN, sizeof(float)); last_P = (float *) calloc(FFTLEN, sizeof(float)); P = (float *) calloc(FFTLEN, sizeof(float)); last_PP = (float *) calloc(FFTLEN, sizeof(float)); PP = (float *) calloc(FFTLEN, sizeof(float)); //RNRbuffer = (complex *) calloc(FFTLEN, sizeof(complex)); //out_buff = (complex*)calloc(FFTLEN, sizeof(complex)); //speech_prob = (float*)calloc(FFTLEN, sizeof(float)); //local_min = (float*)calloc(FFTLEN, sizeof(float)); //subfactor = (float*)calloc(FFTLEN, sizeof(float)); K = exp(-TFRAME / tau); /* initialize board and the audio port */ init_hardware(); init_buffer(); /* initialize hardware interrupts */ init_HWI(); /* initialize algorithm constants */ for (k = 0; k < FFTLEN; k++) { inwin[k] = sqrt((1.0 - WINCONST * cos(PI * (2 * k + 1) / FFTLEN)) / OVERSAMP); outwin[k] = inwin[k]; } ingain = INGAIN; outgain = OUTGAIN; //puts("test\n"); /* main loop, wait for interrupt */ while (1) process_frame(); }
int process_string(const char* str) { LOGI("Processing string '%s'", str); if (isalpha(*str)) { if (current_sprite == NULL) { current_sprite = &sprites[0]; nframes = 0; } else { current_sprite->animation.ntracks = 4; current_sprite->animation.tracks = malloc(current_sprite->animation.ntracks * sizeof(animation_track_t)); init_track(TRACK_SPRITE_IMAGE, ATT_UINT32, ATI_LINEAR, image_frames); init_track(TRACK_SPRITE_OFFSET, ATT_VEC3F, ATI_LINEAR, offset_frames); init_track(TRACK_SPRITE_SCALE, ATT_VEC3F, ATI_LINEAR, scale_frames); init_track(TRACK_SPRITE_ROTATION, ATT_QUAT, ATI_LINEAR, rotation_frames); current_sprite->nsprite_names = nframes; current_sprite->sprite_names = malloc(nframes * sizeof(sprite_id_t)); memcpy(current_sprite->sprite_names, image_names, nframes * sizeof(sprite_id_t)); ++current_sprite; nframes = 0; } return process_sprite(current_sprite, str); } else if (isspace(*str)) { const char* ptr = str + 1; while (isspace(*ptr)) ++ptr; if (*ptr == '\n' || *ptr == '\0') { // EOL or EOF ocurred return 0; } if (current_sprite != NULL) { return process_frame(current_sprite, ptr); } } else if (*str == '#') { // skip comment return 0; } return -1; }
bool UndoBuffer::process_frame(int entry) { assert(OK()); locked = true; current_entry = entry; bool ok = process_frame(history[entry]); locked = false; return ok; }
void * getframe(struct proc *p, int sig, int *onstack) { struct sigctx *ctx = &p->p_sigctx; struct trapframe *tf = process_frame(l); /* Do we need to jump onto the signal stack? */ *onstack = (ctx->ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; if (*onstack) return (char *)ctx->ps_sigstk.ss_sp + ctx->ps_sigstk.ss_size; return (void *)tf->tf_usr_sp; }