src/media/audio/audio_core/mixer/test/mixer_bitwise_tests.cc
// Can float values flow unchanged (1-1, N-N) thru the system? With 1:1 frame
// conversion, unity scale and no accumulation, we expect bit-equality.
Can float values flow unchanged (1-1, N-N) thru the system. With 1:1 frame
conversion, unity scale and no accumulation, we expect bit-equality.
Can float values flow unchanged ( 1 - 1 N - N ) thru the system . With 1 : 1 frame conversion unity scale and no accumulation we expect bit - equality .
TEST(PassThru, Source_Float) {
  float source[] = {-1.0, 1.0f,      -0.809783935f, 0.603912353f, -0.00888061523f,
                    0.0f, 0.296875f, -0.357757568f};
  float accum[8];
  float expect[] = {-0x08000000, 0x08000000, -0x067A7000, 0x04D4D000,
                    -0x00123000, 0,          0x02600000,  -0x02DCB000};
  NormalizeInt28ToPipelineBitwidth(expect, std::size(expect));
  auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 48000, 1, 48000,
                           Resampler::SampleAndHold);
  DoMix(mixer.get(), source, accum, false, std::size(accum));
  EXPECT_THAT(accum, Pointwise(FloatEq(), expect));
  memset(accum, 0, sizeof(accum));
  mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 4, 48000, 4, 48000,
                      Resampler::SampleAndHold);
  DoMix(mixer.get(), source, accum, false, std::size(accum) / 4);
  EXPECT_THAT(accum, Pointwise(FloatEq(), expect));
}
TEST ( PassThru , Source_Float ) { float source [ ] = { -1.0 , 1.0f , -0.809783935f , 0.603912353f , -0.00888061523f , 0.0f , 0.296875f , -0.357757568f } ; float accum [ 8 ] ; float expect [ ] = { -0x08000000 , 0x08000000 , -0x067A7000 , 0x04D4D000 , -0x00123000 , 0 , 0x02600000 , -0x02DCB000 } ; NormalizeInt28ToPipelineBitwidth ( expect , std :: size ( expect ) ) ; auto mixer = SelectMixer ( fuchsia :: media :: AudioSampleFormat :: FLOAT , 1 , 48000 , 1 , 48000 , Resampler :: SampleAndHold ) ; DoMix ( mixer . get ( ) , source , accum , false , std :: size ( accum ) ) ; EXPECT_THAT ( accum , Pointwise ( FloatEq ( ) , expect ) ) ; memset ( accum , 0 , sizeof ( accum ) ) ; mixer = SelectMixer ( fuchsia :: media :: AudioSampleFormat :: FLOAT , 4 , 48000 , 4 , 48000 , Resampler :: SampleAndHold ) ; DoMix ( mixer . get ( ) , source , accum , false , std :: size ( accum ) / 4 ) ; EXPECT_THAT ( accum , Pointwise ( FloatEq ( ) , expect ) ) ; }
Can float values flow unchanged (1-1, N-N) thru the system?
Can float values flow unchanged ( 1 - 1 N - N ) thru the system?
// Try in 1-channel mode // Now try in 4-channel mode