Boost logo

Boost :

From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-06-16 13:27:35


Ok so should this function?

gray32f_view_t noise =
        interleaved_view( width, height
                     , (gray32f_pixel_t*) &pBuffer[0]
                     , width * sizeof(float) // bytes per scanline
     );

gray32f_view_t src = subimage_view(noise,0,0,half_width,half_height);

copy_pixels( flipped_left_right_view(src),
subimage_view(noise,half_width,0,half_width,half_height) );

copy_pixels( flipped_up_down_view(src),
subimage_view(noise,0,half_height,half_width,half_height) );

copy_pixels( transposed_view(src),
subimage_view(noise,half_width,half_height,half_width,half_height) );

Christian Henning wrote:
> Michael,
>
> here is my version of your algorithm. Please have a look:
>
> std::vector<float> buffer( 1024 * 1024 );
> //GenerateNoise( pBuffer, 1024, 1024 )
>
> gray32f_view_t src = interleaved_view( 1024, 1024
> , (gray32f_pixel_t*) &buffer.front()
> , 1024 * 4 // bytes per scanline
> );
>
> for( int y = 0; y < src.height(); ++y )
> {
> gray32f_view_t::x_iterator src_it = src.row_begin( y );
>
> float ycopy = y;
> if(y > 511)
> {
> ycopy = 511 - std::abs( 512.f - ycopy );
> }
>
> for( int x = 0; x < src.width(); ++x )
> {
> float xcopy = x;
>
> if(x > 511)
> {
> xcopy = 511 - std::abs( 512.f - xcopy );
> }
>
> src_it[x] = src[xcopy][ycopy];
> }
> }
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk