CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/27 18:52:58
Modified files: . : ChangeLog server : stream.cpp stream.h Log message: * server/stream.{cpp,h}: inlined align(), cleanups in read_uint(). CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4126&r2=1.4127 http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.cpp?cvsroot=gnash&r1=1.30&r2=1.31 http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.h?cvsroot=gnash&r1=1.26&r2=1.27 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4126 retrieving revision 1.4127 diff -u -b -r1.4126 -r1.4127 --- ChangeLog 27 Aug 2007 18:39:19 -0000 1.4126 +++ ChangeLog 27 Aug 2007 18:52:57 -0000 1.4127 @@ -1,5 +1,9 @@ 2007-08-28 Sandro Santilli <[EMAIL PROTECTED]> + * server/stream.{cpp,h}: inlined align(), cleanups in read_uint(). + +2007-08-28 Sandro Santilli <[EMAIL PROTECTED]> + * server/parser/shape_character_def.cpp (read): use ints for twips values, convert to float only when needed (construction of the edges and paths). [last patch was bogus] Index: server/stream.cpp =================================================================== RCS file: /sources/gnash/gnash/server/stream.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -b -r1.30 -r1.31 --- server/stream.cpp 27 Aug 2007 16:19:31 -0000 1.30 +++ server/stream.cpp 27 Aug 2007 18:52:58 -0000 1.31 @@ -75,16 +75,18 @@ // should be 24, check why htf_sweet.swf fails this assertion assert(bitcount <= 32); - uint32_t value = 0; #define OPTIMIZE_FOR_MULTIBYTE_BITS_READ 1 #ifdef OPTIMIZE_FOR_MULTIBYTE_BITS_READ + // Optimization for multibyte read if ( bitcount > m_unused_bits ) { typedef unsigned char byte; + uint32_t value = 0; + if (m_unused_bits) // Consume all the unused bits. { int unusedMask = (1 << m_unused_bits)-1; @@ -120,9 +122,10 @@ m_unused_bits = 0; } + return value; + } - else - { + if (!m_unused_bits) { m_current_byte = m_input->read_byte(); @@ -136,8 +139,8 @@ if (bitcount == m_unused_bits) { // Consume all the unused bits. - value |= (m_current_byte&unusedMask); m_unused_bits = 0; + return (m_current_byte&unusedMask); } else { @@ -145,12 +148,13 @@ // Consume some of the unused bits. m_unused_bits -= bitcount; - value |= ((m_current_byte&unusedMask) >> m_unused_bits); - } + return ((m_current_byte&unusedMask) >> m_unused_bits); } #else // ndef OPTIMIZE_FOR_MULTIBYTE_BITS_READ + uint32_t value = 0; + unsigned short bits_needed = bitcount; do { @@ -190,10 +194,11 @@ } } while (bits_needed > 0); -#endif // ndef OPTIMIZE_FOR_MULTIBYTE_BITS_READ //std::cerr << "Returning value: " << value << " unused bits: " << (int)m_unused_bits << std::endl; return value; +#endif // ndef OPTIMIZE_FOR_MULTIBYTE_BITS_READ + } @@ -249,8 +254,6 @@ return static_cast<float> (m_input->read_le32()); } - void stream::align() { m_unused_bits = 0; m_current_byte = 0; } - uint8_t stream::read_u8() { align(); return m_input->read_byte(); } int8_t stream::read_s8() { align(); return m_input->read_byte(); } uint16_t stream::read_u16() Index: server/stream.h =================================================================== RCS file: /sources/gnash/gnash/server/stream.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -b -r1.26 -r1.27 --- server/stream.h 27 Aug 2007 12:09:05 -0000 1.26 +++ server/stream.h 27 Aug 2007 18:52:58 -0000 1.27 @@ -72,8 +72,12 @@ float read_float(); /// \brief - /// Correct for any unused bits from a uint read. - void align(); + /// Discard any left-over bits from previous bit reads + void align() + { + m_unused_bits=0; + // m_current_byte = 0; // this is not needed + } unsigned read(char *buf, unsigned count); uint8_t read_u8(); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit