|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83606 - trunk/libs/gil/toolbox/test
From: chhenning_at_[hidden]
Date: 2013-03-27 14:56:24
Author: chhenning
Date: 2013-03-27 14:56:23 EDT (Wed, 27 Mar 2013)
New Revision: 83606
URL: http://svn.boost.org/trac/boost/changeset/83606
Log:
Test cases for subsampled_image and ycbcr color space.
Text files modified:
trunk/libs/gil/toolbox/test/get_num_bits.cpp | 1
trunk/libs/gil/toolbox/test/subsampled_image.cpp | 42 ++++++++++++++++++++++++++++++++-------
2 files changed, 34 insertions(+), 9 deletions(-)
Modified: trunk/libs/gil/toolbox/test/get_num_bits.cpp
==============================================================================
--- trunk/libs/gil/toolbox/test/get_num_bits.cpp (original)
+++ trunk/libs/gil/toolbox/test/get_num_bits.cpp 2013-03-27 14:56:23 EDT (Wed, 27 Mar 2013)
@@ -37,7 +37,6 @@
BOOST_STATIC_ASSERT( get_num_bits< channel_type< gray8_image_t::view_t::value_type >::type >::value == 8 );
BOOST_STATIC_ASSERT( get_num_bits< channel_type< rgba32_image_t::view_t::value_type >::type >::value == 32 );
-
}
BOOST_AUTO_TEST_SUITE_END()
Modified: trunk/libs/gil/toolbox/test/subsampled_image.cpp
==============================================================================
--- trunk/libs/gil/toolbox/test/subsampled_image.cpp (original)
+++ trunk/libs/gil/toolbox/test/subsampled_image.cpp 2013-03-27 14:56:23 EDT (Wed, 27 Mar 2013)
@@ -5,8 +5,6 @@
/// \brief Unit test for subsampled_image type.
-#include "stdafx.h"
-
#include <boost/test/unit_test.hpp>
#include <boost/gil/gil_all.hpp>
@@ -19,16 +17,19 @@
using namespace boost;
using namespace gil;
-
BOOST_AUTO_TEST_SUITE( subsampled_image_test_suite )
BOOST_AUTO_TEST_CASE( subsampled_image_test )
{
{
- ycbcr8_pixel_t a;
+ ycbcr_601_8_pixel_t a( 10, 20, 30 );
rgb8_pixel_t b;
+ bgr8_pixel_t c;
color_convert( a, b );
+ color_convert( a, c );
+ BOOST_ASSERT( static_equal( b, c ));
+
color_convert( b, a );
}
@@ -36,15 +37,40 @@
typedef rgb8_pixel_t pixel_t;
typedef subsampled_image< pixel_t > image_t;
- image_t img( 640, 480
- , 640, 480
- , 640, 480
- );
+ image_t img( 640, 480 );
fill_pixels( view( img )
, pixel_t( 10, 20, 30 )
);
}
+
+ {
+ typedef ycbcr_601_8_pixel_t pixel_t;
+ typedef subsampled_image< pixel_t > image_t;
+
+ std::size_t y_width = 640;
+ std::size_t y_height = 480;
+ std::size_t vx_ssfactor = 2;
+ std::size_t vy_ssfactor = 2;
+ std::size_t ux_ssfactor = 2;
+ std::size_t uy_ssfactor = 2;
+
+ std::size_t image_size = ( y_width * y_height )
+ + ( y_width / vx_ssfactor ) * ( y_height / vy_ssfactor )
+ + ( y_width / ux_ssfactor ) * ( y_height / uy_ssfactor );
+
+ vector< unsigned char > data( image_size );
+
+ image_t::view_t v = subsampled_view< pixel_t >( y_width
+ , y_height
+ , &data.front()
+ , vx_ssfactor
+ , vy_ssfactor
+ , ux_ssfactor
+ , uy_ssfactor
+ );
+ rgb8_pixel_t p = *v.xy_at( 0, 0 );
+ }
}
BOOST_AUTO_TEST_SUITE_END()
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