mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
feat(mn7): Reduce MultiNet7 internal RAM
This commit is contained in:
parent
147ba76054
commit
742fb70dc1
@ -4,6 +4,10 @@
|
||||
- Available storage is less than the remaining flash space on IDF v5.0.
|
||||
If you can not map model partition successfully, please check the left free storage by `spi_flash_mmap_get_free_pages(ESP_PARTITION_MMAP_DATA)` or update IDF to v5.1 or later.
|
||||
|
||||
# unreleased
|
||||
- Reduce Internal RAM of multinet7
|
||||
- Update benchmark
|
||||
|
||||
## 1.5.0
|
||||
- Add esp32c6 tts lib
|
||||
- Return the volume of wake word audio when one wake word is detected
|
||||
|
||||
@ -153,6 +153,8 @@ Resource Consumption
|
||||
+-------------+-------------+-------------+-------------+-------------+
|
||||
| MultiNet 6 | 32 KB | 4100 KB | 12 ms | 32 ms |
|
||||
+-------------+-------------+-------------+-------------+-------------+
|
||||
| MultiNet 7 | 20 KB | 3000 KB | 11 ms | 32 ms |
|
||||
+-------------+-------------+-------------+-------------+-------------+
|
||||
|
||||
Word Error Rate Performance Test
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,6 +12,14 @@ static esp_mn_node_t *esp_mn_root = NULL;
|
||||
const static esp_mn_iface_t *esp_mn_model_handle = NULL;
|
||||
static model_iface_data_t *esp_mn_model_data = NULL;
|
||||
|
||||
void *_esp_mn_calloc_(int n, int size)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
return heap_caps_calloc(n, size, MALLOC_CAP_SPIRAM);
|
||||
#else
|
||||
return calloc(n, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define ESP_RETURN_ON_FALSE(a, err_code, log_tag, format, ...) do { \
|
||||
if (!(a)) { \
|
||||
@ -130,7 +138,11 @@ esp_err_t esp_mn_commands_add(int command_id, char *string)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
#ifdef CONFIG_SR_MN_EN_MULTINET7_QUANT
|
||||
phrase->phonemes = phonemes;
|
||||
int phoneme_len = strlen(phonemes);
|
||||
phrase->phonemes = _esp_mn_calloc_(phoneme_len+1, sizeof(char));
|
||||
memcpy(phrase->phonemes, phonemes, phoneme_len);
|
||||
phrase->phonemes[phoneme_len] = '\0';
|
||||
free(phonemes);
|
||||
#endif
|
||||
esp_mn_node_t *new_node = esp_mn_node_alloc(phrase);
|
||||
while (temp->next != NULL) {
|
||||
@ -168,7 +180,11 @@ esp_err_t esp_mn_commands_modify(char *old_string, char *new_string)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
#ifdef CONFIG_SR_MN_EN_MULTINET7_QUANT
|
||||
phrase->phonemes = phonemes;
|
||||
int phoneme_len = strlen(phonemes);
|
||||
phrase->phonemes = _esp_mn_calloc_(phoneme_len+1, sizeof(char));
|
||||
memcpy(phrase->phonemes, phonemes, phoneme_len);
|
||||
phrase->phonemes[phoneme_len] = '\0';
|
||||
free(phonemes);
|
||||
#endif
|
||||
esp_mn_phrase_free(temp->phrase);
|
||||
temp->phrase = phrase;
|
||||
@ -297,15 +313,6 @@ void esp_mn_active_commands_print(void)
|
||||
ESP_LOGI(TAG, "---------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
void *_esp_mn_calloc_(int n, int size)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
return heap_caps_calloc(n, size, MALLOC_CAP_SPIRAM);
|
||||
#else
|
||||
return calloc(n, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
esp_mn_phrase_t *esp_mn_phrase_alloc(int command_id, char *string)
|
||||
{
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user