From 6bcdffc905f4efa1cd95fb096d73d89d87ef849a Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 10 Jan 2011 14:00:20 +0000 Subject: [PATCH] bug 1362: fixed dimension ordering in post-transpose beamformed data --- RTCP/CNProc/src/BeamFormer.cc | 26 +++++++++---------- .../include/Interface/BeamFormedData.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/RTCP/CNProc/src/BeamFormer.cc b/RTCP/CNProc/src/BeamFormer.cc index 98735c0ab08..9869350c1eb 100644 --- a/RTCP/CNProc/src/BeamFormer.cc +++ b/RTCP/CNProc/src/BeamFormer.cc @@ -619,8 +619,8 @@ void BeamFormer::preTransposeBeams( const BeamFormedData *in, PreTransposeBeamFo void BeamFormer::postTransposeBeams( const TransposedBeamFormedData *in, FinalBeamFormedData *out, unsigned sb ) { ASSERT( in->samples.shape()[0] > sb ); - ASSERT( in->samples.shape()[1] == itsNrChannels ); - ASSERT( in->samples.shape()[2] >= itsNrSamplesPerIntegration / itsIntegrationSteps ); + ASSERT( in->samples.shape()[1] >= itsNrSamplesPerIntegration / itsIntegrationSteps ); + ASSERT( in->samples.shape()[2] == itsNrChannels ); ASSERT( out->samples.shape()[0] >= itsNrSamplesPerIntegration / itsIntegrationSteps ); ASSERT( out->samples.shape()[1] > sb ); @@ -632,23 +632,23 @@ void BeamFormer::postTransposeBeams( const TransposedBeamFormedData *in, FinalBe /* reference implementation */ for (unsigned c = 0; c < itsNrChannels; c++) { for (unsigned t = 0; t < itsNrSamplesPerIntegration / itsIntegrationSteps; t++) { - out->samples[t][sb][c] = in->samples[sb][c][t]; + out->samples[t][sb][c] = in->samples[sb][t][c]; } } #else - /* in_stride == 1 */ - unsigned out_stride = &out->samples[1][0][0] - &out->samples[0][0][0]; + unsigned allChannelSize = itsNrChannels * sizeof in->samples[0][0][0]; - for (unsigned c = 0; c < itsNrChannels; c++) { - const fcomplex *inb = &in->samples[sb][c][0]; - fcomplex *outb = &out->samples[0][sb][c]; + const fcomplex *inb = &in->samples[sb][0][0]; + unsigned in_stride = &in->samples[sb][1][0] - &in->samples[sb][0][0]; - for (unsigned t = 0; t < itsNrSamplesPerIntegration / itsIntegrationSteps; t++) { - *outb = *inb; + fcomplex *outb = &out->samples[0][sb][0]; + unsigned out_stride = &out->samples[1][sb][0] - &out->samples[0][sb][0]; - inb++; - outb += out_stride; - } + for (unsigned t = 0; t < itsNrSamplesPerIntegration / itsIntegrationSteps; t++) { + memcpy( outb, inb, allChannelSize ); + + inb += in_stride; + outb += out_stride; } #endif } diff --git a/RTCP/Interface/include/Interface/BeamFormedData.h b/RTCP/Interface/include/Interface/BeamFormedData.h index 339084ae1d9..19cda09a2fa 100644 --- a/RTCP/Interface/include/Interface/BeamFormedData.h +++ b/RTCP/Interface/include/Interface/BeamFormedData.h @@ -87,7 +87,7 @@ inline PreTransposeBeamFormedData::PreTransposeBeamFormedData(unsigned nrBeams, inline TransposedBeamFormedData::TransposedBeamFormedData(unsigned nrSubbands, unsigned nrChannels, unsigned nrSamplesPerIntegration) : - SuperType(false,boost::extents[nrSubbands][nrChannels][nrSamplesPerIntegration | 2], nrSubbands) + SuperType(false,boost::extents[nrSubbands][nrSamplesPerIntegration | 2][nrChannels], nrSubbands) { } -- GitLab