Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64083 - sandbox/gil/boost/gil/extension/io2
From: dsaritz_at_[hidden]
Date: 2010-07-17 05:30:54


Author: psiha
Date: 2010-07-17 05:30:54 EDT (Sat, 17 Jul 2010)
New Revision: 64083
URL: http://svn.boost.org/trac/boost/changeset/64083

Log:
Minor libjpeg_image::closest_gil_supported_format() member function optimization.
Minor other changes.
Text files modified:
   sandbox/gil/boost/gil/extension/io2/libjpeg_private_base.hpp | 38 +++++++++++++++++++++-----------------
   1 files changed, 21 insertions(+), 17 deletions(-)

Modified: sandbox/gil/boost/gil/extension/io2/libjpeg_private_base.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/libjpeg_private_base.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/libjpeg_private_base.hpp 2010-07-17 05:30:54 EDT (Sat, 17 Jul 2010)
@@ -43,7 +43,6 @@
 
 BOOST_STATIC_ASSERT( BITS_IN_JSAMPLE == 8 );
 
-
 template <typename Pixel, bool isPlanar>
 struct gil_to_libjpeg_format : mpl::integral_c<J_COLOR_SPACE, JCS_UNKNOWN> {};
 
@@ -242,23 +241,28 @@
 
     format_t closest_gil_supported_format() const
     {
- switch ( format() )
+ format_t const current_format( format() );
+ #ifdef _DEBUG
+ switch ( current_format )
         {
- case JCS_RGB :
- case JCS_YCbCr:
- return JCS_RGB;
-
- case JCS_CMYK:
- case JCS_YCCK:
- return JCS_CMYK;
+ default:
+ BOOST_ASSERT( !"Unknown format code." );
 
+ case JCS_RGB :
+ case JCS_YCbCr :
+ case JCS_CMYK :
+ case JCS_YCCK :
             case JCS_GRAYSCALE:
- return JCS_GRAYSCALE;
+ case JCS_UNKNOWN :
+ break;
+ }
+ #endif
 
- default:
- BOOST_ASSERT( format() == JCS_UNKNOWN );
- BOOST_ASSERT( !"Unknown format." );
- return JCS_UNKNOWN;
+ switch ( current_format )
+ {
+ case JCS_YCbCr: return JCS_RGB ;
+ case JCS_YCCK : return JCS_CMYK ;
+ default : return current_format;
         }
     }
 
@@ -275,7 +279,7 @@
             case JCS_GRAYSCALE: return 1;
             case JCS_CMYK : return 2;
             default:
- BOOST_ASSERT( !"Should not get reached." ); __assume( false );
+ BOOST_ASSERT( closest_gil_supported_format == JCS_UNKNOWN );
                 return unsupported_format;
         }
     }
@@ -380,7 +384,7 @@
     void generic_convert_to_prepared_view( TargetView const & view, Converter const & converter ) const
     {
         typedef typename MyView::value_type pixel_t;
- std::size_t const scanline_length( decompressor().image_width * decompressor().num_components );
+ std::size_t const scanline_length ( decompressor().image_width * decompressor().num_components );
         scoped_ptr<JSAMPLE> const p_scanline_buffer( new JSAMPLE[ scanline_length ] );
         JSAMPROW scanline ( p_scanline_buffer.get() );
         JSAMPROW const scanlineEnd( scanline + scanline_length );
@@ -426,7 +430,7 @@
         }
     }
 
- void copy_to_prepared_view( view_data_t const & view_data ) const
+ void raw_copy_to_prepared_view( view_data_t const & view_data ) const
     {
         BOOST_ASSERT( view_data.width_ == static_cast<unsigned int>( dimensions().x ) );
         BOOST_ASSERT( view_data.height_ == static_cast<unsigned int>( dimensions().y ) );


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk