Loading media/libeffects/lvm/lib/Android.bp +0 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,6 @@ cc_library_static { "Bundle/src/LVM_Control.cpp", "Bundle/src/LVM_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Init.cpp", "SpectrumAnalyzer/src/LVPSA_Init.cpp", "SpectrumAnalyzer/src/LVPSA_Memory.cpp", "SpectrumAnalyzer/src/LVPSA_Process.cpp", "SpectrumAnalyzer/src/LVPSA_Process.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp", Loading media/libeffects/lvm/lib/Bass/lib/LVDBE.h +17 −83 Original line number Original line Diff line number Diff line Loading @@ -69,9 +69,6 @@ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ /* Memory table*/ #define LVDBE_NR_MEMORY_REGIONS 4 /* Number of memory regions */ /* Bass Enhancement effect level */ /* Bass Enhancement effect level */ #define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */ #define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */ #define LVDBE_EFFECT_06DB 6 #define LVDBE_EFFECT_06DB 6 Loading Loading @@ -112,25 +109,12 @@ typedef enum LVDBE_VOLUME_MAX = LVM_MAXINT_32 LVDBE_VOLUME_MAX = LVM_MAXINT_32 } LVDBE_Volume_en; } LVDBE_Volume_en; /* Memory Types */ typedef enum { LVDBE_PERSISTENT = 0, LVDBE_PERSISTENT_DATA = 1, LVDBE_PERSISTENT_COEF = 2, LVDBE_SCRATCH = 3, LVDBE_MEMORY_MAX = LVM_MAXINT_32 } LVDBE_MemoryTypes_en; /* Function return status */ /* Function return status */ typedef enum typedef enum { { LVDBE_SUCCESS = 0, /* Successful return from a routine */ LVDBE_SUCCESS = 0, /* Successful return from a routine */ LVDBE_ALIGNMENTERROR = 1, /* Memory alignment error */ LVDBE_NULLADDRESS = 1, /* NULL allocation address */ LVDBE_NULLADDRESS = 2, /* NULL allocation address */ LVDBE_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */ LVDBE_TOOMANYSAMPLES = 3, /* Maximum block size exceeded */ LVDBE_SIZEERROR = 4, /* Incorrect structure size */ LVDBE_STATUS_MAX = LVM_MAXINT_32 LVDBE_STATUS_MAX = LVM_MAXINT_32 } LVDBE_ReturnStatus_en; } LVDBE_ReturnStatus_en; Loading Loading @@ -213,21 +197,6 @@ typedef enum /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ /* Memory region definition */ typedef struct { LVM_UINT32 Size; /* Region size in bytes */ LVM_UINT16 Alignment; /* Region alignment in bytes */ LVDBE_MemoryTypes_en Type; /* Region type */ void *pBaseAddress; /* Pointer to the region base address */ } LVDBE_MemoryRegion_t; /* Memory table containing the region definitions */ typedef struct { LVDBE_MemoryRegion_t Region[LVDBE_NR_MEMORY_REGIONS]; /* One definition for each region */ } LVDBE_MemTab_t; /* Parameter structure */ /* Parameter structure */ typedef struct typedef struct { { Loading Loading @@ -259,75 +228,40 @@ typedef struct /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Memory */ /* FUNCTION: LVDBE_Init */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* This function is used for memory allocation and free. It can be called in */ /* Create and initialisation function for the Bass Enhancement module */ /* two ways: */ /* */ /* hInstance = NULL Returns the memory requirements */ /* hInstance = Instance handle Returns the memory requirements and */ /* allocated base addresses for the instance */ /* */ /* When this function is called for memory allocation (hInstance=NULL) the memory */ /* base address pointers are NULL on return. */ /* */ /* When the function is called for free (hInstance = Instance Handle) the memory */ /* table returns the allocated memory and base addresses used during initialisation. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance Handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to an empty memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* pCapabilities Pointer to the default capabilites */ /* pScratch Pointer to the bundle scratch buffer */ /* */ /* */ /* RETURNS: */ /* RETURNS: */ /* LVDBE_SUCCESS Succeeded */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer - malloc failure */ /* */ /* */ /* NOTES: */ /* NOTES: */ /* 1. This function may be interrupted by the LVDBE_Process function */ /* 1. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance, LVDBE_Capabilities_t *pCapabilities, LVDBE_MemTab_t *pMemoryTable, void *pScratch); LVDBE_Capabilities_t *pCapabilities); /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Init */ /* FUNCTION: LVDBE_DeInit */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* Create and initialisation function for the Bass Enhancement module */ /* Free the memories created during LVDBE_Init including instance handle */ /* */ /* This function can be used to create an algorithm instance by calling with */ /* hInstance set to NULL. In this case the algorithm returns the new instance */ /* handle. */ /* */ /* This function can be used to force a full re-initialisation of the algorithm */ /* by calling with hInstance = Instance Handle. In this case the memory table */ /* should be correct for the instance, this can be ensured by calling the function */ /* LVDBE_Memory before calling this function. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to the memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* */ /* RETURNS: */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer */ /* */ /* NOTES: */ /* 1. The instance handle is the pointer to the base address of the first memory */ /* region. */ /* 2. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ void LVDBE_DeInit(LVDBE_Handle_t *phInstance); LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities); /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ Loading media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp +58 −139 Original line number Original line Diff line number Diff line Loading @@ -20,176 +20,60 @@ /* Includes */ /* Includes */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ #include <stdlib.h> #include "LVDBE.h" #include "LVDBE.h" #include "LVDBE_Private.h" #include "LVDBE_Private.h" /****************************************************************************************/ /* */ /* FUNCTION: LVDBE_Memory */ /* */ /* DESCRIPTION: */ /* This function is used for memory allocation and free. It can be called in */ /* two ways: */ /* */ /* hInstance = NULL Returns the memory requirements */ /* hInstance = Instance handle Returns the memory requirements and */ /* allocated base addresses for the instance */ /* */ /* When this function is called for memory allocation (hInstance=NULL) the memory */ /* base address pointers are NULL on return. */ /* */ /* When the function is called for free (hInstance = Instance Handle) the memory */ /* table returns the allocated memory and base addresses used during initialisation. */ /* */ /* PARAMETERS: */ /* hInstance Instance Handle */ /* pMemoryTable Pointer to an empty memory definition table */ /* pCapabilities Pointer to the instance capabilities */ /* */ /* RETURNS: */ /* LVDBE_SUCCESS Succeeded */ /* */ /* NOTES: */ /* 1. This function may be interrupted by the LVDBE_Process function */ /* */ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities) { LVM_UINT32 ScratchSize; LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)hInstance; /* * Fill in the memory table */ if (hInstance == LVM_NULL) { /* * Instance memory */ pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Size = sizeof(LVDBE_Instance_t); pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Alignment = LVDBE_INSTANCE_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Type = LVDBE_PERSISTENT; pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress = LVM_NULL; /* * Data memory */ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_FLOAT_t); pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL; /* * Coef memory */ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_FLOAT_t); pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL; /* * Scratch memory */ ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_FLOAT) * \ pCapabilities->MaxBlockSize); pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL; } else { /* Read back memory allocation table */ *pMemoryTable = pInstance->MemoryTable; } return(LVDBE_SUCCESS); } /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Init */ /* FUNCTION: LVDBE_Init */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* Create and initialisation function for the Dynamic Bass Enhancement module */ /* Create and initialisation function for the Bass Enhancement module */ /* */ /* This function can be used to create an algorithm instance by calling with */ /* hInstance set to NULL. In this case the algorithm returns the new instance */ /* handle. */ /* */ /* This function can be used to force a full re-initialisation of the algorithm */ /* by calling with hInstance = Instance Handle. In this case the memory table */ /* should be correct for the instance, this can be ensured by calling the function */ /* DBE_Memory before calling this function. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to the memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* pCapabilities Pointer to the instance capabilities */ /* pScratch Pointer to the bundle scratch buffer */ /* */ /* */ /* RETURNS: */ /* RETURNS: */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer - malloc failure */ /* LVDBE_NULLADDRESS Instance or scratch memory has a NULL pointer */ /* */ /* */ /* NOTES: */ /* NOTES: */ /* 1. The instance handle is the pointer to the base address of the first memory */ /* 1. This function must not be interrupted by the LVDBE_Process function */ /* region. */ /* 2. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities, LVDBE_Capabilities_t *pCapabilities) void *pScratch) { { LVDBE_Instance_t *pInstance; LVDBE_Instance_t *pInstance; LVMixer3_1St_FLOAT_st *pMixer_Instance; LVMixer3_1St_FLOAT_st *pMixer_Instance; LVMixer3_2St_FLOAT_st *pBypassMixer_Instance; LVMixer3_2St_FLOAT_st *pBypassMixer_Instance; LVM_FLOAT MixGain; LVM_FLOAT MixGain; LVM_INT16 i; /* /* * Set the instance handle if not already initialised * Create the instance handle if not already initialised */ */ if (*phInstance == LVM_NULL) if (*phInstance == LVM_NULL) { { *phInstance = (LVDBE_Handle_t)pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress; *phInstance = calloc(1, sizeof(*pInstance)); } } pInstance =(LVDBE_Instance_t *)*phInstance; if (*phInstance == LVM_NULL) /* * Check the memory table for NULL pointers and incorrectly aligned data */ for (i=0; i<LVDBE_NR_MEMORY_REGIONS; i++) { if (pMemoryTable->Region[i].Size!=0) { if (pMemoryTable->Region[i].pBaseAddress==LVM_NULL) { { return(LVDBE_NULLADDRESS); return LVDBE_NULLADDRESS; } if (((uintptr_t)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){ return(LVDBE_ALIGNMENTERROR); } } } } pInstance =(LVDBE_Instance_t *)*phInstance; /* /* * Save the memory table in the instance structure * Save the memory table in the instance structure */ */ pInstance->Capabilities = *pCapabilities; pInstance->Capabilities = *pCapabilities; /* pInstance->pScratch = pScratch; * Save the memory table in the instance structure */ pInstance->MemoryTable = *pMemoryTable; /* /* * Set the default instance parameters * Set the default instance parameters Loading @@ -204,12 +88,18 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, pInstance->Params.VolumedB = 0; pInstance->Params.VolumedB = 0; /* /* * Set pointer to data and coef memory * Create pointer to data and coef memory */ */ pInstance->pData = pInstance->pData = (LVDBE_Data_FLOAT_t *)calloc(1, sizeof(*(pInstance->pData))); (LVDBE_Data_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress; if (pInstance->pData == NULL) pInstance->pCoef = { (LVDBE_Coef_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress; return LVDBE_NULLADDRESS; } pInstance->pCoef = (LVDBE_Coef_FLOAT_t *)calloc(1, sizeof(*(pInstance->pCoef))); if (pInstance->pCoef == NULL) { return LVDBE_NULLADDRESS; } /* /* * Initialise the filters * Initialise the filters Loading Loading @@ -278,3 +168,32 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, return(LVDBE_SUCCESS); return(LVDBE_SUCCESS); } } /****************************************************************************************/ /* */ /* FUNCTION: LVDBE_DeInit */ /* */ /* DESCRIPTION: */ /* Free the memories created during LVDBE_Init including instance handle */ /* */ /* PARAMETERS: */ /* phInstance Pointer to instance handle */ /* */ /****************************************************************************************/ void LVDBE_DeInit(LVDBE_Handle_t *phInstance) { LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)*phInstance; if (pInstance == LVM_NULL) { return; } if (pInstance->pData != LVM_NULL) { free(pInstance->pData); pInstance->pData = LVM_NULL; } if (pInstance->pCoef != LVM_NULL) { free(pInstance->pCoef); pInstance->pCoef = LVM_NULL; } free(pInstance); *phInstance = LVM_NULL; } media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h +1 −15 Original line number Original line Diff line number Diff line Loading @@ -47,20 +47,6 @@ /* General */ /* General */ #define LVDBE_INVALID 0xFFFF /* Invalid init parameter */ #define LVDBE_INVALID 0xFFFF /* Invalid init parameter */ /* Memory */ #define LVDBE_MEMREGION_INSTANCE 0 /* Offset to the instance memory region */ #define LVDBE_MEMREGION_PERSISTENT_DATA 1 /* Offset to persistent data memory region */ #define LVDBE_MEMREGION_PERSISTENT_COEF 2 /* Offset to persistent coefficient region */ #define LVDBE_MEMREGION_SCRATCH 3 /* Offset to data scratch memory region */ #define LVDBE_INSTANCE_ALIGN 4 /* 32-bit alignment for structures */ #define LVDBE_PERSISTENT_DATA_ALIGN 4 /* 32-bit alignment for data */ #define LVDBE_PERSISTENT_COEF_ALIGN 4 /* 32-bit alignment for coef */ #define LVDBE_SCRATCH_ALIGN 4 /* 32-bit alignment for long data */ /* Number of buffers required for inplace processing */ #define LVDBE_SCRATCHBUFFERS_INPLACE (LVM_MAX_CHANNELS * 3) #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 */ Loading Loading @@ -96,13 +82,13 @@ typedef struct typedef struct typedef struct { { /* Public parameters */ /* Public parameters */ LVDBE_MemTab_t MemoryTable; /* Instance memory allocation table */ LVDBE_Params_t Params; /* Instance parameters */ LVDBE_Params_t Params; /* Instance parameters */ LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ /* Data and coefficient pointers */ /* Data and coefficient pointers */ LVDBE_Data_FLOAT_t *pData; /* Instance data */ LVDBE_Data_FLOAT_t *pData; /* Instance data */ LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ void *pScratch; /* scratch pointer */ } LVDBE_Instance_t; } LVDBE_Instance_t; /****************************************************************************************/ /****************************************************************************************/ Loading media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp +1 −2 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
media/libeffects/lvm/lib/Android.bp +0 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,6 @@ cc_library_static { "Bundle/src/LVM_Control.cpp", "Bundle/src/LVM_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Control.cpp", "SpectrumAnalyzer/src/LVPSA_Init.cpp", "SpectrumAnalyzer/src/LVPSA_Init.cpp", "SpectrumAnalyzer/src/LVPSA_Memory.cpp", "SpectrumAnalyzer/src/LVPSA_Process.cpp", "SpectrumAnalyzer/src/LVPSA_Process.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp", "SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp", Loading
media/libeffects/lvm/lib/Bass/lib/LVDBE.h +17 −83 Original line number Original line Diff line number Diff line Loading @@ -69,9 +69,6 @@ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ /* Memory table*/ #define LVDBE_NR_MEMORY_REGIONS 4 /* Number of memory regions */ /* Bass Enhancement effect level */ /* Bass Enhancement effect level */ #define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */ #define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */ #define LVDBE_EFFECT_06DB 6 #define LVDBE_EFFECT_06DB 6 Loading Loading @@ -112,25 +109,12 @@ typedef enum LVDBE_VOLUME_MAX = LVM_MAXINT_32 LVDBE_VOLUME_MAX = LVM_MAXINT_32 } LVDBE_Volume_en; } LVDBE_Volume_en; /* Memory Types */ typedef enum { LVDBE_PERSISTENT = 0, LVDBE_PERSISTENT_DATA = 1, LVDBE_PERSISTENT_COEF = 2, LVDBE_SCRATCH = 3, LVDBE_MEMORY_MAX = LVM_MAXINT_32 } LVDBE_MemoryTypes_en; /* Function return status */ /* Function return status */ typedef enum typedef enum { { LVDBE_SUCCESS = 0, /* Successful return from a routine */ LVDBE_SUCCESS = 0, /* Successful return from a routine */ LVDBE_ALIGNMENTERROR = 1, /* Memory alignment error */ LVDBE_NULLADDRESS = 1, /* NULL allocation address */ LVDBE_NULLADDRESS = 2, /* NULL allocation address */ LVDBE_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */ LVDBE_TOOMANYSAMPLES = 3, /* Maximum block size exceeded */ LVDBE_SIZEERROR = 4, /* Incorrect structure size */ LVDBE_STATUS_MAX = LVM_MAXINT_32 LVDBE_STATUS_MAX = LVM_MAXINT_32 } LVDBE_ReturnStatus_en; } LVDBE_ReturnStatus_en; Loading Loading @@ -213,21 +197,6 @@ typedef enum /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ /* Memory region definition */ typedef struct { LVM_UINT32 Size; /* Region size in bytes */ LVM_UINT16 Alignment; /* Region alignment in bytes */ LVDBE_MemoryTypes_en Type; /* Region type */ void *pBaseAddress; /* Pointer to the region base address */ } LVDBE_MemoryRegion_t; /* Memory table containing the region definitions */ typedef struct { LVDBE_MemoryRegion_t Region[LVDBE_NR_MEMORY_REGIONS]; /* One definition for each region */ } LVDBE_MemTab_t; /* Parameter structure */ /* Parameter structure */ typedef struct typedef struct { { Loading Loading @@ -259,75 +228,40 @@ typedef struct /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Memory */ /* FUNCTION: LVDBE_Init */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* This function is used for memory allocation and free. It can be called in */ /* Create and initialisation function for the Bass Enhancement module */ /* two ways: */ /* */ /* hInstance = NULL Returns the memory requirements */ /* hInstance = Instance handle Returns the memory requirements and */ /* allocated base addresses for the instance */ /* */ /* When this function is called for memory allocation (hInstance=NULL) the memory */ /* base address pointers are NULL on return. */ /* */ /* When the function is called for free (hInstance = Instance Handle) the memory */ /* table returns the allocated memory and base addresses used during initialisation. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance Handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to an empty memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* pCapabilities Pointer to the default capabilites */ /* pScratch Pointer to the bundle scratch buffer */ /* */ /* */ /* RETURNS: */ /* RETURNS: */ /* LVDBE_SUCCESS Succeeded */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer - malloc failure */ /* */ /* */ /* NOTES: */ /* NOTES: */ /* 1. This function may be interrupted by the LVDBE_Process function */ /* 1. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance, LVDBE_Capabilities_t *pCapabilities, LVDBE_MemTab_t *pMemoryTable, void *pScratch); LVDBE_Capabilities_t *pCapabilities); /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Init */ /* FUNCTION: LVDBE_DeInit */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* Create and initialisation function for the Bass Enhancement module */ /* Free the memories created during LVDBE_Init including instance handle */ /* */ /* This function can be used to create an algorithm instance by calling with */ /* hInstance set to NULL. In this case the algorithm returns the new instance */ /* handle. */ /* */ /* This function can be used to force a full re-initialisation of the algorithm */ /* by calling with hInstance = Instance Handle. In this case the memory table */ /* should be correct for the instance, this can be ensured by calling the function */ /* LVDBE_Memory before calling this function. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to the memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* */ /* RETURNS: */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer */ /* */ /* NOTES: */ /* 1. The instance handle is the pointer to the base address of the first memory */ /* region. */ /* 2. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ void LVDBE_DeInit(LVDBE_Handle_t *phInstance); LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities); /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ Loading
media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp +58 −139 Original line number Original line Diff line number Diff line Loading @@ -20,176 +20,60 @@ /* Includes */ /* Includes */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ #include <stdlib.h> #include "LVDBE.h" #include "LVDBE.h" #include "LVDBE_Private.h" #include "LVDBE_Private.h" /****************************************************************************************/ /* */ /* FUNCTION: LVDBE_Memory */ /* */ /* DESCRIPTION: */ /* This function is used for memory allocation and free. It can be called in */ /* two ways: */ /* */ /* hInstance = NULL Returns the memory requirements */ /* hInstance = Instance handle Returns the memory requirements and */ /* allocated base addresses for the instance */ /* */ /* When this function is called for memory allocation (hInstance=NULL) the memory */ /* base address pointers are NULL on return. */ /* */ /* When the function is called for free (hInstance = Instance Handle) the memory */ /* table returns the allocated memory and base addresses used during initialisation. */ /* */ /* PARAMETERS: */ /* hInstance Instance Handle */ /* pMemoryTable Pointer to an empty memory definition table */ /* pCapabilities Pointer to the instance capabilities */ /* */ /* RETURNS: */ /* LVDBE_SUCCESS Succeeded */ /* */ /* NOTES: */ /* 1. This function may be interrupted by the LVDBE_Process function */ /* */ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities) { LVM_UINT32 ScratchSize; LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)hInstance; /* * Fill in the memory table */ if (hInstance == LVM_NULL) { /* * Instance memory */ pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Size = sizeof(LVDBE_Instance_t); pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Alignment = LVDBE_INSTANCE_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Type = LVDBE_PERSISTENT; pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress = LVM_NULL; /* * Data memory */ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_FLOAT_t); pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL; /* * Coef memory */ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_FLOAT_t); pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF; pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL; /* * Scratch memory */ ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_FLOAT) * \ pCapabilities->MaxBlockSize); pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH; pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL; } else { /* Read back memory allocation table */ *pMemoryTable = pInstance->MemoryTable; } return(LVDBE_SUCCESS); } /****************************************************************************************/ /****************************************************************************************/ /* */ /* */ /* FUNCTION: LVDBE_Init */ /* FUNCTION: LVDBE_Init */ /* */ /* */ /* DESCRIPTION: */ /* DESCRIPTION: */ /* Create and initialisation function for the Dynamic Bass Enhancement module */ /* Create and initialisation function for the Bass Enhancement module */ /* */ /* This function can be used to create an algorithm instance by calling with */ /* hInstance set to NULL. In this case the algorithm returns the new instance */ /* handle. */ /* */ /* This function can be used to force a full re-initialisation of the algorithm */ /* by calling with hInstance = Instance Handle. In this case the memory table */ /* should be correct for the instance, this can be ensured by calling the function */ /* DBE_Memory before calling this function. */ /* */ /* */ /* PARAMETERS: */ /* PARAMETERS: */ /* hInstance Instance handle */ /* phInstance Pointer to instance handle */ /* pMemoryTable Pointer to the memory definition table */ /* pCapabilities Pointer to the initialisation capabilities */ /* pCapabilities Pointer to the instance capabilities */ /* pScratch Pointer to the bundle scratch buffer */ /* */ /* */ /* RETURNS: */ /* RETURNS: */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_SUCCESS Initialisation succeeded */ /* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */ /* LVDBE_NULLADDRESS One or more memory has a NULL pointer - malloc failure */ /* LVDBE_NULLADDRESS Instance or scratch memory has a NULL pointer */ /* */ /* */ /* NOTES: */ /* NOTES: */ /* 1. The instance handle is the pointer to the base address of the first memory */ /* 1. This function must not be interrupted by the LVDBE_Process function */ /* region. */ /* 2. This function must not be interrupted by the LVDBE_Process function */ /* */ /* */ /****************************************************************************************/ /****************************************************************************************/ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, LVDBE_MemTab_t *pMemoryTable, LVDBE_Capabilities_t *pCapabilities, LVDBE_Capabilities_t *pCapabilities) void *pScratch) { { LVDBE_Instance_t *pInstance; LVDBE_Instance_t *pInstance; LVMixer3_1St_FLOAT_st *pMixer_Instance; LVMixer3_1St_FLOAT_st *pMixer_Instance; LVMixer3_2St_FLOAT_st *pBypassMixer_Instance; LVMixer3_2St_FLOAT_st *pBypassMixer_Instance; LVM_FLOAT MixGain; LVM_FLOAT MixGain; LVM_INT16 i; /* /* * Set the instance handle if not already initialised * Create the instance handle if not already initialised */ */ if (*phInstance == LVM_NULL) if (*phInstance == LVM_NULL) { { *phInstance = (LVDBE_Handle_t)pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress; *phInstance = calloc(1, sizeof(*pInstance)); } } pInstance =(LVDBE_Instance_t *)*phInstance; if (*phInstance == LVM_NULL) /* * Check the memory table for NULL pointers and incorrectly aligned data */ for (i=0; i<LVDBE_NR_MEMORY_REGIONS; i++) { if (pMemoryTable->Region[i].Size!=0) { if (pMemoryTable->Region[i].pBaseAddress==LVM_NULL) { { return(LVDBE_NULLADDRESS); return LVDBE_NULLADDRESS; } if (((uintptr_t)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){ return(LVDBE_ALIGNMENTERROR); } } } } pInstance =(LVDBE_Instance_t *)*phInstance; /* /* * Save the memory table in the instance structure * Save the memory table in the instance structure */ */ pInstance->Capabilities = *pCapabilities; pInstance->Capabilities = *pCapabilities; /* pInstance->pScratch = pScratch; * Save the memory table in the instance structure */ pInstance->MemoryTable = *pMemoryTable; /* /* * Set the default instance parameters * Set the default instance parameters Loading @@ -204,12 +88,18 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, pInstance->Params.VolumedB = 0; pInstance->Params.VolumedB = 0; /* /* * Set pointer to data and coef memory * Create pointer to data and coef memory */ */ pInstance->pData = pInstance->pData = (LVDBE_Data_FLOAT_t *)calloc(1, sizeof(*(pInstance->pData))); (LVDBE_Data_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress; if (pInstance->pData == NULL) pInstance->pCoef = { (LVDBE_Coef_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress; return LVDBE_NULLADDRESS; } pInstance->pCoef = (LVDBE_Coef_FLOAT_t *)calloc(1, sizeof(*(pInstance->pCoef))); if (pInstance->pCoef == NULL) { return LVDBE_NULLADDRESS; } /* /* * Initialise the filters * Initialise the filters Loading Loading @@ -278,3 +168,32 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, return(LVDBE_SUCCESS); return(LVDBE_SUCCESS); } } /****************************************************************************************/ /* */ /* FUNCTION: LVDBE_DeInit */ /* */ /* DESCRIPTION: */ /* Free the memories created during LVDBE_Init including instance handle */ /* */ /* PARAMETERS: */ /* phInstance Pointer to instance handle */ /* */ /****************************************************************************************/ void LVDBE_DeInit(LVDBE_Handle_t *phInstance) { LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)*phInstance; if (pInstance == LVM_NULL) { return; } if (pInstance->pData != LVM_NULL) { free(pInstance->pData); pInstance->pData = LVM_NULL; } if (pInstance->pCoef != LVM_NULL) { free(pInstance->pCoef); pInstance->pCoef = LVM_NULL; } free(pInstance); *phInstance = LVM_NULL; }
media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h +1 −15 Original line number Original line Diff line number Diff line Loading @@ -47,20 +47,6 @@ /* General */ /* General */ #define LVDBE_INVALID 0xFFFF /* Invalid init parameter */ #define LVDBE_INVALID 0xFFFF /* Invalid init parameter */ /* Memory */ #define LVDBE_MEMREGION_INSTANCE 0 /* Offset to the instance memory region */ #define LVDBE_MEMREGION_PERSISTENT_DATA 1 /* Offset to persistent data memory region */ #define LVDBE_MEMREGION_PERSISTENT_COEF 2 /* Offset to persistent coefficient region */ #define LVDBE_MEMREGION_SCRATCH 3 /* Offset to data scratch memory region */ #define LVDBE_INSTANCE_ALIGN 4 /* 32-bit alignment for structures */ #define LVDBE_PERSISTENT_DATA_ALIGN 4 /* 32-bit alignment for data */ #define LVDBE_PERSISTENT_COEF_ALIGN 4 /* 32-bit alignment for coef */ #define LVDBE_SCRATCH_ALIGN 4 /* 32-bit alignment for long data */ /* Number of buffers required for inplace processing */ #define LVDBE_SCRATCHBUFFERS_INPLACE (LVM_MAX_CHANNELS * 3) #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 */ Loading Loading @@ -96,13 +82,13 @@ typedef struct typedef struct typedef struct { { /* Public parameters */ /* Public parameters */ LVDBE_MemTab_t MemoryTable; /* Instance memory allocation table */ LVDBE_Params_t Params; /* Instance parameters */ LVDBE_Params_t Params; /* Instance parameters */ LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ /* Data and coefficient pointers */ /* Data and coefficient pointers */ LVDBE_Data_FLOAT_t *pData; /* Instance data */ LVDBE_Data_FLOAT_t *pData; /* Instance data */ LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ void *pScratch; /* scratch pointer */ } LVDBE_Instance_t; } LVDBE_Instance_t; /****************************************************************************************/ /****************************************************************************************/ Loading
media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp +1 −2 File changed.Preview size limit exceeded, changes collapsed. Show changes