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

Commit a68cdcb2 authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'gingerbread' into gingerbread-release

parents 940f410a a1754133
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ extern "C" {
#define LVDBE_PERSISTENT_COEF_ALIGN      4       /* 32-bit alignment for coef */
#define LVDBE_PERSISTENT_COEF_ALIGN      4       /* 32-bit alignment for coef */
#define LVDBE_SCRATCH_ALIGN              4       /* 32-bit alignment for long data */
#define LVDBE_SCRATCH_ALIGN              4       /* 32-bit alignment for long data */


#define LVDBE_SCRATCHBUFFERS_INPLACE     4       /* Number of buffers required for inplace processing */
#define LVDBE_SCRATCHBUFFERS_INPLACE     6       /* Number of buffers required for inplace processing */


#define LVDBE_MIXER_TC                   5       /* Mixer time  */
#define LVDBE_MIXER_TC                   5       /* Mixer time  */
#define LVDBE_BYPASS_MIXER_TC            100     /* Bypass mixer time */
#define LVDBE_BYPASS_MIXER_TC            100     /* Bypass mixer time */
+1 −6
Original line number Original line Diff line number Diff line
@@ -496,7 +496,6 @@ LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
     * Update the bypass mixer time constant
     * Update the bypass mixer time constant
     */
     */
    if((pPrivate->NewParams.SampleRate   != pPrivate->CurrentParams.SampleRate)   ||
    if((pPrivate->NewParams.SampleRate   != pPrivate->CurrentParams.SampleRate)   ||
       (pPrivate->NewParams.SourceFormat != pPrivate->CurrentParams.SourceFormat) ||
       (pPrivate->bFirstControl          == LVM_TRUE))
       (pPrivate->bFirstControl          == LVM_TRUE))
    {
    {
        LVM_UINT16   NumChannels = 1;                       /* Assume MONO format */
        LVM_UINT16   NumChannels = 1;                       /* Assume MONO format */
@@ -508,11 +507,7 @@ LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
        pPrivate->FeedbackMixer[2].Alpha=Alpha;
        pPrivate->FeedbackMixer[2].Alpha=Alpha;
        pPrivate->FeedbackMixer[3].Alpha=Alpha;
        pPrivate->FeedbackMixer[3].Alpha=Alpha;


        if (pPrivate->NewParams.SourceFormat != LVM_MONO)
        NumChannels = 2;                                    /* Always stereo output */
        {
            /* Stereo or Mono-in-Stereo format data */
            NumChannels = 2;
        }
        pPrivate->BypassMixer.Alpha1 = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
        pPrivate->BypassMixer.Alpha1 = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
        pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
        pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
        pPrivate->GainMixer.Alpha    = pPrivate->BypassMixer.Alpha1;
        pPrivate->GainMixer.Alpha    = pPrivate->BypassMixer.Alpha1;
+55 −111
Original line number Original line Diff line number Diff line
@@ -54,7 +54,8 @@ LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
   LVREV_Instance_st     *pLVREV_Private = (LVREV_Instance_st *)hInstance;
   LVREV_Instance_st     *pLVREV_Private = (LVREV_Instance_st *)hInstance;
   LVM_INT32             *pInput  = (LVM_INT32 *)pInData;
   LVM_INT32             *pInput  = (LVM_INT32 *)pInData;
   LVM_INT32             *pOutput = pOutData;
   LVM_INT32             *pOutput = pOutData;
   LVM_INT32             SamplesToProcess, RemainingSamples, format;
   LVM_INT32             SamplesToProcess, RemainingSamples;
   LVM_INT32             format = 1;


    /*
    /*
     * Check for error conditions
     * Check for error conditions
@@ -66,7 +67,6 @@ LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
        return LVREV_NULLADDRESS;
        return LVREV_NULLADDRESS;
    }
    }



    /*
    /*
     * Apply the new controls settings if required
     * Apply the new controls settings if required
     */
     */
@@ -95,45 +95,41 @@ LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
        return LVREV_SUCCESS;
        return LVREV_SUCCESS;
    }
    }


    RemainingSamples = (LVM_INT32)NumSamples;

    format = 1;
    if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
    {
        format = 2;
    }

    while (RemainingSamples!=0)
    {
    /*
    /*
     * If OFF copy and reformat the data as necessary
     * If OFF copy and reformat the data as necessary
     */
     */
    if (pLVREV_Private->CurrentParams.OperatingMode == LVM_MODE_OFF)
    if (pLVREV_Private->CurrentParams.OperatingMode == LVM_MODE_OFF)
    {
    {
            if((pInput != pOutput) || (pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO))
        if(pInput != pOutput)
        {
        {
            /*
            /*
                 * Copy the data to the output buffer
             * Copy the data to the output buffer, convert to stereo is required
             */
             */


                if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
            if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
                {
                MonoTo2I_32(pInput, pOutput, NumSamples);
                    RemainingSamples = (RemainingSamples << 1);           /* Stereo data */
            } else {
                }

                Copy_16((LVM_INT16 *)pInput,
                Copy_16((LVM_INT16 *)pInput,
                        (LVM_INT16 *)pOutput,
                        (LVM_INT16 *)pOutput,
                        (LVM_INT16)(RemainingSamples << 1));
                        (LVM_INT16)(NumSamples << 2)); // 32 bit data, stereo
            }
        }
        }


            RemainingSamples = 0;
        return LVREV_SUCCESS;
    }
    }


    RemainingSamples = (LVM_INT32)NumSamples;

    if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
    {
        format = 2;
    }

    while (RemainingSamples!=0)
    {
        /*
        /*
         * Process the data
         * Process the data
         */
         */
        else
        {


        if(RemainingSamples >  pLVREV_Private->MaxBlkLen)
        if(RemainingSamples >  pLVREV_Private->MaxBlkLen)
        {
        {
@@ -149,8 +145,7 @@ LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
        ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
        ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);


        pInput  = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
        pInput  = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
            pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*format));
        pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2));      // Always stereo output
        }
    }
    }


    return LVREV_SUCCESS;
    return LVREV_SUCCESS;
@@ -420,26 +415,13 @@ void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPriv
                            pPrivate->pScratchDelayLine[1],
                            pPrivate->pScratchDelayLine[1],
                            (LVM_INT16)NumSamples);
                            (LVM_INT16)NumSamples);


             if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)

             {
            JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
            JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
                           pPrivate->pScratchDelayLine[1],
                           pPrivate->pScratchDelayLine[1],
                           pTemp,
                           pTemp,
                           (LVM_INT16)NumSamples);
                           (LVM_INT16)NumSamples);


             }
             else
             {
                 Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
                                pPrivate->pScratchDelayLine[0],
                                (LVM_INT16)NumSamples);


                /*Apply 3-dB gain in-order to compensate for the gain change in stereo mode*/
                Mult3s_32x16(pPrivate->pScratchDelayLine[0],
                             LVREV_MIN3DB,
                             pTemp,
                             (LVM_INT16)NumSamples);
             }
            break;
            break;
        case LVREV_DELAYLINES_2:
        case LVREV_DELAYLINES_2:


@@ -447,49 +429,25 @@ void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPriv
                      (LVM_INT16*)pScratch,
                      (LVM_INT16*)pScratch,
                      (LVM_INT16)(NumSamples << 1));
                      (LVM_INT16)(NumSamples << 1));




             if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
             {

            Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0],
            Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0],
                            -0x8000,
                            -0x8000,
                            pScratch,
                            pScratch,
                            (LVM_INT16)NumSamples);
                            (LVM_INT16)NumSamples);
             }


             Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
             Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
                            pPrivate->pScratchDelayLine[0],
                            pPrivate->pScratchDelayLine[0],
                            (LVM_INT16)NumSamples);
                            (LVM_INT16)NumSamples);




             if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
             {
             JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
             JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
                            pScratch,
                            pScratch,
                            pTemp,
                            pTemp,
                            (LVM_INT16)NumSamples);
                            (LVM_INT16)NumSamples);
             }
             else
             {
                Copy_16(    (LVM_INT16*)pPrivate->pScratchDelayLine[0],
                            (LVM_INT16*)pTemp,
                            (LVM_INT16)(NumSamples << 1));

             }
            break;
            break;
        case LVREV_DELAYLINES_1:
        case LVREV_DELAYLINES_1:
            if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
            {

            MonoTo2I_32(pPrivate->pScratchDelayLine[0],
            MonoTo2I_32(pPrivate->pScratchDelayLine[0],
                        pTemp,
                        pTemp,
                        (LVM_INT16)NumSamples);
                        (LVM_INT16)NumSamples);
            }
            else
            {
                pTemp = pPrivate->pScratchDelayLine[0];
            }
            break;
            break;
        default:
        default:
            break;
            break;
@@ -499,30 +457,15 @@ void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPriv
    /*
    /*
     *  Dry/wet mixer
     *  Dry/wet mixer
     */
     */
    if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
    {
        size = (LVM_INT16)(NumSamples << 1);
    }
    else
    {
        size = (LVM_INT16)NumSamples;
    }


    size = (LVM_INT16)(NumSamples << 1);
    MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
    MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
                           pInput,
                           pTemp,
                           pTemp,
                           pTemp,
                           pOutput,
                           pOutput,
                           size);
                           size);


    /* Apply Gain*/
    /* Apply Gain*/
    if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
    {
        size = (LVM_INT16)(NumSamples << 1);
    }
    else
    {
        size = (LVM_INT16)NumSamples;
    }


    Shift_Sat_v32xv32 (LVREV_OUTPUTGAIN_SHIFT,
    Shift_Sat_v32xv32 (LVREV_OUTPUTGAIN_SHIFT,
                       pOutput,
                       pOutput,
@@ -533,6 +476,7 @@ void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPriv
                           pOutput,
                           pOutput,
                           pOutput,
                           pOutput,
                           size);
                           size);

    return;
    return;
}
}


+12 −17
Original line number Original line Diff line number Diff line
@@ -431,26 +431,15 @@ int process( LVM_INT16 *pIn,
        pContext->InFrames32[i] = (LVM_INT32)pIn[i]<<8;
        pContext->InFrames32[i] = (LVM_INT32)pIn[i]<<8;
    }
    }


     // If the input was MONO, convert to STEREO
    if(pContext->config.inputCfg.channels == CHANNEL_MONO){
        //LOGV("\tConverting Output from MONO to STEREO");
        MonoTo2I_32(pContext->InFrames32, pContext->InFrames32, frameCount);
    }

    //LOGV("\tProcess, frames: %d, InFormat: %d(MONO=%d), OutFormat: %d(STEREO=%d)",
    //frameCount, pContext->config.inputCfg.channels, CHANNEL_MONO,
    //pContext->config.outputCfg.channels, CHANNEL_STEREO);

    if (pContext->preset && pContext->curPreset == REVERB_PRESET_NONE) {
    if (pContext->preset && pContext->curPreset == REVERB_PRESET_NONE) {
        memset(pContext->OutFrames32, 0, frameCount * sizeof(LVM_INT32) * 2); //always stereo here
        memset(pContext->OutFrames32, 0, frameCount * sizeof(LVM_INT32) * 2); //always stereo here
    } else {
    } else {
        if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
        if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
            memset(pContext->InFrames32,
            memset(pContext->InFrames32,0,frameCount * sizeof(LVM_INT32) * samplesPerFrame);
                   0,
            LOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
                   frameCount * sizeof(LVM_INT32) * 2); //always stereo here
        }
        }


        /* Process the samples */
        /* Process the samples, producing a stereo output */
        LvmStatus = LVREV_Process(pContext->hInstance,      /* Instance handle */
        LvmStatus = LVREV_Process(pContext->hInstance,      /* Instance handle */
                                  pContext->InFrames32,     /* Input buffer */
                                  pContext->InFrames32,     /* Input buffer */
                                  pContext->OutFrames32,    /* Output buffer */
                                  pContext->OutFrames32,    /* Output buffer */
@@ -677,7 +666,7 @@ int Reverb_init(ReverbContext *pContext){


    /* Set the capabilities */
    /* Set the capabilities */
    InstParams.MaxBlockSize  = MAX_CALL_SIZE;
    InstParams.MaxBlockSize  = MAX_CALL_SIZE;
    InstParams.SourceFormat  = LVM_STEREO;
    InstParams.SourceFormat  = LVM_STEREO;          // Max format, could be mono during process
    InstParams.NumDelays     = LVREV_DELAYLINES_4;
    InstParams.NumDelays     = LVREV_DELAYLINES_4;


    /* Allocate memory, forcing alignment */
    /* Allocate memory, forcing alignment */
@@ -742,7 +731,12 @@ int Reverb_init(ReverbContext *pContext){
    /* General parameters */
    /* General parameters */
    params.OperatingMode  = LVM_MODE_ON;
    params.OperatingMode  = LVM_MODE_ON;
    params.SampleRate     = LVM_FS_44100;
    params.SampleRate     = LVM_FS_44100;

    if(pContext->config.inputCfg.channels == CHANNEL_MONO){
        params.SourceFormat   = LVM_MONO;
    } else {
        params.SourceFormat   = LVM_STEREO;
        params.SourceFormat   = LVM_STEREO;
    }


    /* Reverb parameters */
    /* Reverb parameters */
    params.Level          = 0;
    params.Level          = 0;
@@ -1790,8 +1784,9 @@ extern "C" int Reverb_process(effect_interface_t self,
    if (pContext->bEnabled == LVM_FALSE){
    if (pContext->bEnabled == LVM_FALSE){
        if( pContext->SamplesToExitCount > 0){
        if( pContext->SamplesToExitCount > 0){
            pContext->SamplesToExitCount -= outBuffer->frameCount;
            pContext->SamplesToExitCount -= outBuffer->frameCount;
            LOGV("\tReverb_process() Effect is being stopped %d", pContext->SamplesToExitCount);
        }else{
        }else{
            LOGV("\tReverb_process() ERROR Effect is not enabled %d", pContext->SamplesToExitCount);
            LOGV("\tReverb_process() Effect is being stopped");
            return -ENODATA;
            return -ENODATA;
        }
        }
    }
    }
+39 −37
Original line number Original line Diff line number Diff line
@@ -459,7 +459,8 @@ private:


MP3Extractor::MP3Extractor(
MP3Extractor::MP3Extractor(
        const sp<DataSource> &source, const sp<AMessage> &meta)
        const sp<DataSource> &source, const sp<AMessage> &meta)
    : mDataSource(source),
    : mInitCheck(NO_INIT),
      mDataSource(source),
      mFirstFramePos(-1),
      mFirstFramePos(-1),
      mFixedHeader(0),
      mFixedHeader(0),
      mByteNumber(0) {
      mByteNumber(0) {
@@ -480,10 +481,13 @@ MP3Extractor::MP3Extractor(
        success = true;
        success = true;
    } else {
    } else {
        success = Resync(mDataSource, 0, &pos, &header);
        success = Resync(mDataSource, 0, &pos, &header);
        CHECK(success);
    }
    }


    if (success) {
    if (!success) {
        // mInitCheck will remain NO_INIT
        return;
    }

    mFirstFramePos = pos;
    mFirstFramePos = pos;
    mFixedHeader = header;
    mFixedHeader = header;


@@ -515,18 +519,16 @@ MP3Extractor::MP3Extractor(
                    8000LL * (fileSize - mFirstFramePos) / bitrate);
                    8000LL * (fileSize - mFirstFramePos) / bitrate);
        }
        }
    }
    }
    }
}


MP3Extractor::~MP3Extractor() {
    mInitCheck = OK;
}
}


size_t MP3Extractor::countTracks() {
size_t MP3Extractor::countTracks() {
    return (mFirstFramePos < 0) ? 0 : 1;
    return mInitCheck != OK ? 0 : 1;
}
}


sp<MediaSource> MP3Extractor::getTrack(size_t index) {
sp<MediaSource> MP3Extractor::getTrack(size_t index) {
    if (mFirstFramePos < 0 || index != 0) {
    if (mInitCheck != OK || index != 0) {
        return NULL;
        return NULL;
    }
    }


@@ -536,7 +538,7 @@ sp<MediaSource> MP3Extractor::getTrack(size_t index) {
}
}


sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) {
sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) {
    if (mFirstFramePos < 0 || index != 0) {
    if (mInitCheck != OK || index != 0) {
        return NULL;
        return NULL;
    }
    }


@@ -713,7 +715,7 @@ status_t MP3Source::read(
sp<MetaData> MP3Extractor::getMetaData() {
sp<MetaData> MP3Extractor::getMetaData() {
    sp<MetaData> meta = new MetaData;
    sp<MetaData> meta = new MetaData;


    if (mFirstFramePos < 0) {
    if (mInitCheck != OK) {
        return meta;
        return meta;
    }
    }


Loading