From: Thomas D. <tj...@us...> - 2006-10-26 15:08:57
|
Update of /cvsroot/dirac/compress/libdirac_encoder In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv6985/libdirac_encoder Modified Files: seq_compress.cpp frame_compress.cpp Log Message: Made operation of retired picture list comply with specification: only reference pictures are signalled to be retired and non-reference pictures are retired by the decoder once they are displayed. Clarified frame type parameters so as to be sure they always agree. This will need further refactoring. Reference frames are now cleaned from the buffer _after_ being the current frame has been decoded, as per the spec. This allows slightly more flexible GOP structures. Index: frame_compress.cpp =================================================================== RCS file: /cvsroot/dirac/compress/libdirac_encoder/frame_compress.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** frame_compress.cpp 26 Jun 2006 16:43:17 -0000 1.22 --- frame_compress.cpp 26 Oct 2006 15:07:49 -0000 1.23 *************** *** 106,123 **** if ( m_is_a_cut ) { - my_frame.SetFrameType (INTRA_FRAME); if (my_frame.GetFparams().FSort().IsRef()) - { - my_frame.SetFrameSort (FrameSort::IntraNonRefFrameSort()); - my_frame.SetReferenceType (NON_REFERENCE_FRAME); - } - else - { my_frame.SetFrameSort (FrameSort::IntraRefFrameSort()); ! my_frame.SetReferenceType (REFERENCE_FRAME); ! } if ( m_encparams.Verbose() ) ! std::cerr<<std::endl<<"Cut detected and I-frame inserted!"; } --- 106,116 ---- if ( m_is_a_cut ) { if (my_frame.GetFparams().FSort().IsRef()) my_frame.SetFrameSort (FrameSort::IntraRefFrameSort()); ! else ! my_frame.SetFrameSort (FrameSort::IntraNonRefFrameSort()); if ( m_encparams.Verbose() ) ! std::cout<<std::endl<<"Cut detected and I-frame inserted!"; } *************** *** 228,232 **** //finally clip the data to keep it in range ! my_buffer.GetFrame(fnum).Clip(); }//?m_skipped --- 221,225 ---- //finally clip the data to keep it in range ! my_buffer.GetFrame( fnum ).Clip(); }//?m_skipped *************** *** 264,268 **** if ( m_encparams.Verbose() ) ! std::cerr<<std::endl<<m_intra_ratio<<"% of blocks are intra "; // Check the size of SAD errors across reference 1 --- 257,261 ---- if ( m_encparams.Verbose() ) ! std::cout<<std::endl<<m_intra_ratio<<"% of blocks are intra "; // Check the size of SAD errors across reference 1 Index: seq_compress.cpp =================================================================== RCS file: /cvsroot/dirac/compress/libdirac_encoder/seq_compress.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** seq_compress.cpp 19 Jun 2006 17:34:13 -0000 1.27 --- seq_compress.cpp 26 Oct 2006 15:07:49 -0000 1.28 *************** *** 211,214 **** --- 211,215 ---- m_show_fnum = std::max( m_current_code_fnum - m_delay , 0 ); + // Flag saying we're ready to encode bool can_encode = false; *************** *** 219,233 **** { // We haven't coded everything, so compress the next frame - // If we're not at the beginning, clean the buffer - if ( m_current_code_fnum != 0 ) - { - m_fbuffer->Clean( m_show_fnum, m_current_display_fnum ); - m_origbuffer->Clean( m_show_fnum, m_current_display_fnum ); - } - if ( m_encparams.Verbose() ) { ! std::cerr<<std::endl<<std::endl<<"Compressing frame "<<m_current_code_fnum<<", "; ! std::cerr<<m_current_display_fnum<<" in display order"; } --- 220,227 ---- { // We haven't coded everything, so compress the next frame if ( m_encparams.Verbose() ) { ! std::cout<<std::endl<<std::endl<<"Compressing frame "<<m_current_code_fnum<<", "; ! std::cout<<m_current_display_fnum<<" in display order"; } *************** *** 265,269 **** m_qmonitor.UpdateModel( m_fbuffer->GetFrame( m_current_display_fnum ) , m_origbuffer->GetFrame( m_current_display_fnum ) ); - if ( m_encparams.Verbose() ) --- 259,262 ---- *************** *** 275,282 **** m_current_code_fnum++; } // Return the latest frame that can be shown ! return m_fbuffer->GetFrame(m_show_fnum); } --- 268,281 ---- m_current_code_fnum++; + // If we're not at the beginning, clean the buffer + if ( m_current_code_fnum != 0 ) + { + m_fbuffer->Clean( m_show_fnum, m_current_display_fnum ); + m_origbuffer->Clean( m_show_fnum, m_current_display_fnum ); + } } // Return the latest frame that can be shown ! return m_fbuffer->GetFrame(m_show_fnum ); } *************** *** 315,331 **** { ! // std::cerr<<"Total bits for sequence="<<m_encparams.BitsOut().SequenceBytes() * 8; ! // std::cerr<<" ( "<<m_encparams.BitsOut().SequenceHeadBytes() * 8<<" header )"; ! // std::cerr<<std::endl<<"Of these: "<<std::endl<<std::endl; ! // std::cerr<<m_encparams.BitsOut().ComponentBytes( Y_COMP ) * 8<<" were Y, "; ! // std::cerr<<std::endl<<m_encparams.BitsOut().ComponentBytes( U_COMP ) * 8<<" were U, "; ! // std::cerr<<std::endl<<m_encparams.BitsOut().ComponentBytes( V_COMP ) * 8<<" were V, and "; ! // std::cerr<<std::endl<<m_encparams.BitsOut().MVBytes() * 8<<" were motion vector data."; if ( m_encparams.LocalDecode() ) m_qmonitor.WriteLog(); ! std::cerr<<std::endl; } --- 314,330 ---- { ! // std::cout<<"Total bits for sequence="<<m_encparams.BitsOut().SequenceBytes() * 8; ! // std::cout<<" ( "<<m_encparams.BitsOut().SequenceHeadBytes() * 8<<" header )"; ! // std::cout<<std::endl<<"Of these: "<<std::endl<<std::endl; ! // std::cout<<m_encparams.BitsOut().ComponentBytes( Y_COMP ) * 8<<" were Y, "; ! // std::cout<<std::endl<<m_encparams.BitsOut().ComponentBytes( U_COMP ) * 8<<" were U, "; ! // std::cout<<std::endl<<m_encparams.BitsOut().ComponentBytes( V_COMP ) * 8<<" were V, and "; ! // std::cout<<std::endl<<m_encparams.BitsOut().MVBytes() * 8<<" were motion vector data."; if ( m_encparams.LocalDecode() ) m_qmonitor.WriteLog(); ! std::cout<<std::endl; } *************** *** 339,368 **** // unsigned int unit_head_bits = foutput.MVHeadBytes() * 8; ! // std::cerr<<std::endl<<"Number of MV bits="<<unit_bits; ! // std::cerr<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( Y_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( Y_COMP ) * 8; ! // std::cerr<<std::endl<<"Number of bits for Y="<<unit_bits; ! // std::cerr<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( U_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( U_COMP ) * 8; ! // std::cerr<<std::endl<<"Number of bits for U="<<unit_bits; ! // std::cerr<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( V_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( V_COMP ) * 8; ! // std::cerr<<std::endl<<"Number of bits for V="<<unit_bits; ! // std::cerr<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.FrameBytes() * 8; // unit_head_bits = foutput.FrameHeadBytes() * 8; ! // std::cerr<<std::endl<<std::endl<<"Total frame bits="<<unit_bits; ! // std::cerr<<" ( "<<unit_head_bits<<" header bits)"<<std::endl<<std::endl; } --- 338,367 ---- // unsigned int unit_head_bits = foutput.MVHeadBytes() * 8; ! // std::cout<<std::endl<<"Number of MV bits="<<unit_bits; ! // std::cout<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( Y_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( Y_COMP ) * 8; ! // std::cout<<std::endl<<"Number of bits for Y="<<unit_bits; ! // std::cout<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( U_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( U_COMP ) * 8; ! // std::cout<<std::endl<<"Number of bits for U="<<unit_bits; ! // std::cout<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.ComponentBytes( V_COMP ) * 8; // unit_head_bits = foutput.ComponentHeadBytes( V_COMP ) * 8; ! // std::cout<<std::endl<<"Number of bits for V="<<unit_bits; ! // std::cout<<" ( "<<unit_head_bits<<" header bits)"; // unit_bits = foutput.FrameBytes() * 8; // unit_head_bits = foutput.FrameHeadBytes() * 8; ! // std::cout<<std::endl<<std::endl<<"Total frame bits="<<unit_bits; ! // std::cout<<" ( "<<unit_head_bits<<" header bits)"<<std::endl<<std::endl; } |