_XBool _XHIKCamera::upDateFrame() { if(!m_isInited) return XFalse; if(isNewFrame() && m_isWork != 0) {//更新贴图数据 memcpy(m_dataRGBOut,m_dataRGB,m_buffSize); m_cameraTex.updateTexture(m_dataRGBOut); return XTrue; } return XFalse; }
// This code was in main... // This isn't generalized enough to justify this function-name // just not ready to delete it completely // Returns TRUE if there's a change to the frameBuffer image // (so a refresh can be scheduled, if so desired) // a/o v71: This is called in the main loop // w/ REFRESH_ON_CHANGE: // * The fb_updater() function (e.g. tet_update) is only called // after the frame-refresh is complete // (if there are several refreshes, it waits until they're all // done) // It *also* waits for a delay *after the refreshes* before // fb_updater() is called... (this may be a little redundant?) // w/o: // * The fb_updater() function is called at the beginning of a new // frame (once) to attempt to only update the framebuffer at a // time when it won't refresh the screen with only half of the // framebuffer itself updated. void frameBufferUpdate(void) { #if(defined(FB_REFRESH_ON_CHANGE) && FB_REFRESH_ON_CHANGE) // static uint8_t lastUpdated = FALSE; static fb_timer_t fbLastUpdateTime = 0; //Because the dmsTimer is running somewhat arbitarily, this "200ms" // isn't particularly accurate... if(updateFrame) { fbLastUpdateTime = fb_getTime(); return; } // Since lastUpdateTime is updated each time this function is called // with updateFrame != 0, this test will fail until 100ms after the // last refresh. // (a/o v71 this has changed, it was in an else, and this else-case // handled multiple-refresh. That should now be handled in // endOfFrameHandler()) if(fb_isItTime(&fbLastUpdateTime, FB_REFRESH_ON_CHANGE_DELAY)) { int16_t fb_changedTillRow = fb_updater(); //call fb_updater() // and ONLY REFRESH if there's been a change to the frameBuffer if(fb_changedTillRow != -1) { #if(defined(PARTIAL_REFRESH) && PARTIAL_REFRESH) extern uint16_t stopRefreshAtRow; //This must be +1 to account for the length of the last pixel // possibly 2 to help clear out ghosting stopRefreshAtRow = (fb_changedTillRow+2) * V_COUNT / FB_HEIGHT; #endif restartFrameUpdate(); //updateFrame = FB_REFRESH_ON_CHANGE_COUNT; } } #else if(isNewFrame()) { fb_updater(); } #endif }
bool SecondLevelBuffer::writeData(DataCell* datacell) { if(datacell->m_sqNum<0) { //printf("inserting data sqnum error\n"); return false; } EnterCriticalSection( &CS); int size=m_Frames.size(); bool isnew=false; FrameCell * cframe=isNewFrame(datacell,&isnew); if(isnew) { if(m_Frames.size()==0&&datacell->m_FrameType!=PPS) { LeaveCriticalSection( &CS); return false; } checkFrameComplete(datacell->m_topsqNum); FrameCell fcell; if(datacell->m_FrameType==::IFRAME)m_currentGOPPos=0; fcell.init(datacell,m_currentGOPPos,datacell->m_FrameType); fcell.m_base=datacell->m_sqNum; m_currentGOPPos++; m_Frames.push_back(fcell); //printf("%d\n",m_Frames.size()); //printf("leave cs\n"); LeaveCriticalSection( &CS); return true; } else { if(cframe!=NULL) { cframe->addData(datacell,cframe->m_base); LeaveCriticalSection( &CS); return true; } else { LeaveCriticalSection( &CS); return false; } } }