From: Anuradha S. <asu...@us...> - 2007-08-21 12:46:43
|
Update of /cvsroot/dirac/compress/libdirac_common In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv7589/libdirac_common Modified Files: frame_buffer.cpp Log Message: Fix errors reported by valgrind where unitialiased data was being read from upconverted arrays. The upconverter uses the actual frame dimensions and not the padded dimensions whereas the ME engine uses the padded dimensions which is resulting in unitialised data reads. The motion estimation frame buffer now holds the actual frames rather than the padded frames to overcome this problem. Index: frame_buffer.cpp =================================================================== RCS file: /cvsroot/dirac/compress/libdirac_common/frame_buffer.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** frame_buffer.cpp 10 Jun 2007 14:00:41 -0000 1.19 --- frame_buffer.cpp 21 Aug 2007 12:46:36 -0000 1.20 *************** *** 322,325 **** --- 322,330 ---- {// Put a new frame onto the top of the stack using built-in frame parameters // with frame number frame_num + + // if frame is present - return + if (IsFrameAvail(frame_num)) + return; + m_fparams.SetFrameNum(frame_num); if ( m_fparams.FSort().IsRef() ) *************** *** 356,359 **** --- 361,368 ---- {// Put a new frame onto the top of the stack + // if frame is present - return + if (IsFrameAvail(fp.FrameNum())) + return; + if ( fp.FSort().IsRef() ) m_ref_count++; *************** *** 387,421 **** void FrameBuffer::PushFrame( const Frame& frame ) { ! if ( frame.GetFparams().FSort().IsRef() ) ! m_ref_count++; ! ! // Put a copy of a new frame onto the top of the stack ! ! int new_frame_pos = -1; ! // First check if an unused frame is available in the buffer ! for (int i = 0; i < (int)m_frame_in_use.size(); ++i) ! { ! if (m_frame_in_use[i] == false) ! { ! *m_frame_data[i] = frame; ! new_frame_pos = i; ! m_frame_in_use[i] = true; ! break; ! } ! } ! if (new_frame_pos == -1) ! { ! // No unused frames in buffer. Allocate a new frame ! Frame* fptr = new Frame( frame ); ! // Add the frame to the buffer ! m_frame_data.push_back(fptr); ! new_frame_pos = m_frame_data.size()-1; ! m_frame_in_use.push_back(true); ! } ! // Put the frame number into the index table ! std::pair<unsigned int,unsigned int> tmp_pair(frame.GetFparams().FrameNum() , new_frame_pos); ! m_fnum_map.insert(tmp_pair); } --- 396,408 ---- void FrameBuffer::PushFrame( const Frame& frame ) { ! int fnum = frame.GetFparams().FrameNum(); ! SetFrameParams( fnum ); ! PushFrame(fnum); ! bool is_present; ! Frame &f = GetFrame(frame.GetFparams().FrameNum(), is_present); ! if(is_present) ! frame.CopyContents(f); } |