// our main method for processing images // should return a surface no matter what in the future static PyObject* pygoom_process(PyObject *self, PyObject *args) { if (init == 0) { if (data_import_init() == 0) { goomInfo = goom_init(width, height); init = 1; } else { data_import_clean(); return RAISE(PyExc_ValueError, "Error initializing mmap"); } } if (mmap_area->count > counter || mmap_area->count < counter) { counter = mmap_area->count; #ifdef USE_FASTMEMCPY fast_memcpy(data, mmap_area + sizeof(data_t), 2048); #else memcpy(data, mmap_area + sizeof(data_t), 2048); #endif #ifdef VERBOSE printf ("goomInfo=%p, data=%p, FXMODE=%d, fps=%.1f, songtitle=%s, message=%s\n", goomInfo, data, FXMODE, fps, songtitle, message); #endif render_data = goom_update(goomInfo, data, FXMODE, fps, songtitle, message); if (!render_data) { data_import_clean(); return RAISE(PyExc_ValueError, "Goom didn't give any result!"); } if (!surf) { return RAISE(PyExc_ValueError, "Resolution not set"); } #ifdef USE_FASTMEMCPY fast_memcpy(surf->pixels, render_data, width * height * sizeof(uint32_t)); #else memcpy(surf->pixels, render_data, width * height * sizeof(uint32_t)); #endif } return Py_BuildValue("O", PySurface_New(surf)); }
// our main method for processing images // should return a surface no matter what in the future static PyObject* pympav_process() { if(!sharedfile) { RAISE(PyExc_ValueError, "Export file not set"); } if (init == 0) { if (data_import_init() == 0) { goom_init(width, height, cinema); goom_setAsmUse(1); init = 1; } else { data_import_clean(); RAISE(PyExc_ValueError, "Error initializing mmap"); } } // This probably needs to be cleaned up if(mmap_area->count > counter) { //printf("Missed %i sound updates", mmap_area->count-counter); counter = mmap_area->count; memcpy( data, ((void *)mmap_area) + sizeof( data_t ), 2048 ); render_data = goom_update( data, 0, FXMODE, NULL, NULL); if(!render_data) { data_import_clean(); RAISE(PyExc_ValueError, "Goom didn't give any result!"); } } if(pysurf) { memcpy( pysurf->surf->pixels, render_data, width * height * sizeof(uint32_t) ); return (PySurfaceObject*)pysurf; } RETURN_NONE; }