Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e541269b authored by Andy Hung's avatar Andy Hung
Browse files

Use new channel count functions for audio masks



Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3
Signed-off-by: default avatarAndy Hung <hunga@google.com>
parent 7c96d53a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ void Downmix_testIndexComputation(uint32_t mask) {
        hasBacks = true;
    }

    const int numChan = popcount(mask);
    const int numChan = audio_channel_count_from_out_mask(mask);
    const bool hasFC = ((mask & AUDIO_CHANNEL_OUT_FRONT_CENTER) == AUDIO_CHANNEL_OUT_FRONT_CENTER);
    const bool hasLFE =
            ((mask & AUDIO_CHANNEL_OUT_LOW_FREQUENCY) == AUDIO_CHANNEL_OUT_LOW_FREQUENCY);
@@ -629,7 +629,8 @@ int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bo
            ALOGE("Downmix_Configure error: input channel mask can't be 0");
            return -EINVAL;
        }
        pDownmixer->input_channel_count = popcount(pConfig->inputCfg.channels);
        pDownmixer->input_channel_count =
                audio_channel_count_from_out_mask(pConfig->inputCfg.channels);
    }

    Downmix_Reset(pDownmixer, init);
@@ -997,7 +998,7 @@ bool Downmix_foldGeneric(
        hasBacks = true;
    }

    const int numChan = popcount(mask);
    const int numChan = audio_channel_count_from_out_mask(mask);
    const bool hasFC = ((mask & AUDIO_CHANNEL_OUT_FRONT_CENTER) == AUDIO_CHANNEL_OUT_FRONT_CENTER);
    const bool hasLFE =
            ((mask & AUDIO_CHANNEL_OUT_LOW_FREQUENCY) == AUDIO_CHANNEL_OUT_LOW_FREQUENCY);
+3 −3
Original line number Diff line number Diff line
@@ -879,8 +879,8 @@ int Session_ReleaseEffect(preproc_session_t *session,
int Session_SetConfig(preproc_session_t *session, effect_config_t *config)
{
    uint32_t sr;
    uint32_t inCnl = popcount(config->inputCfg.channels);
    uint32_t outCnl = popcount(config->outputCfg.channels);
    uint32_t inCnl = audio_channel_count_from_out_mask(config->inputCfg.channels);
    uint32_t outCnl = audio_channel_count_from_out_mask(config->outputCfg.channels);

    if (config->inputCfg.samplingRate != config->outputCfg.samplingRate ||
        config->inputCfg.format != config->outputCfg.format ||
@@ -1035,7 +1035,7 @@ int Session_SetReverseConfig(preproc_session_t *session, effect_config_t *config
            config->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT) {
        return -EINVAL;
    }
    uint32_t inCnl = popcount(config->inputCfg.channels);
    uint32_t inCnl = audio_channel_count_from_out_mask(config->inputCfg.channels);
    int status = session->apm->set_num_reverse_channels(inCnl);
    if (status < 0) {
        return -EINVAL;
+2 −1
Original line number Diff line number Diff line
@@ -207,7 +207,8 @@ int Visualizer_init(VisualizerContext *pContext)
    pContext->mScalingMode = VISUALIZER_SCALING_MODE_NORMALIZED;

    // measurement initialization
    pContext->mChannelCount = popcount(pContext->mConfig.inputCfg.channels);
    pContext->mChannelCount =
            audio_channel_count_from_out_mask(pContext->mConfig.inputCfg.channels);
    pContext->mMeasurementMode = MEASUREMENT_MODE_NONE;
    pContext->mMeasurementWindowSizeInBuffers = MEASUREMENT_WINDOW_MAX_SIZE_IN_BUFFERS;
    pContext->mMeasurementBufferIdx = 0;
+3 −2
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ status_t AudioRecord::getMinFrameCount(

    // We double the size of input buffer for ping pong use of record buffer.
    // Assumes audio_is_linear_pcm(format)
    if ((*frameCount = (size * 2) / (popcount(channelMask) * audio_bytes_per_sample(format))) == 0) {
    if ((*frameCount = (size * 2) / (audio_channel_count_from_in_mask(channelMask) *
            audio_bytes_per_sample(format))) == 0) {
        ALOGE("Unsupported configuration: sampleRate %u, format %#x, channelMask %#x",
            sampleRate, format, channelMask);
        return BAD_VALUE;
@@ -193,7 +194,7 @@ status_t AudioRecord::set(
        return BAD_VALUE;
    }
    mChannelMask = channelMask;
    uint32_t channelCount = popcount(channelMask);
    uint32_t channelCount = audio_channel_count_from_in_mask(channelMask);
    mChannelCount = channelCount;

    if (audio_is_linear_pcm(format)) {
+1 −1
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ status_t AudioTrack::set(
        return BAD_VALUE;
    }
    mChannelMask = channelMask;
    uint32_t channelCount = popcount(channelMask);
    uint32_t channelCount = audio_channel_count_from_out_mask(channelMask);
    mChannelCount = channelCount;

    // AudioFlinger does not currently support 8-bit data in shared memory
Loading