chore: migrate project into clean repository

This commit is contained in:
yuuux
2026-08-13 16:50:52 +08:00
commit d1d25a09e7
27405 changed files with 9422808 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.20.0)
if (DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(lsc_conn_test)
if (DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(net_conn)
target_link_libraries(app PRIVATE ls_chat)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat)
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,250 @@
#define TAG "lsc_conn_tests"
#include <string.h>
#include "lisa_log.h"
#include "lisa_semaphore.h"
#include "lsc_conn.h"
#include "lsc_errno.h"
#include "unity.h"
#include "lisa_thread.h"
#include "lsc.h"
#define PRODUCT_ID_STRING "ce1dda98-f2b8-46f9-a7b9-8aee214a459b"
#define SECRET_ID_STRING "c684eb9e-ff8f-4264-ad03-0369b38ab793"
#define DEVICE_ID_STRING "F97CE114C70DE8E2"
lisa_semaphore_t *sem_connected;
lisa_semaphore_t *sem_connecting;
lisa_semaphore_t *sem_disconnected;
lisa_semaphore_t *sem_got_token;
size_t total_size, free_size_before, free_size_after;
char g_token[512];
__attribute__((weak)) int net_down(void)
{
return 0;
}
__attribute__((weak)) int net_up(void)
{
return 0;
}
__attribute__((weak)) int net_init(void)
{
return 0;
}
static void _conn_evt_cb(conn_event_e evt, void *data, uint32_t size, void *usr)
{
LISA_NLOGD("[%s] evt:%s ", __FUNCTION__, STRINGS_CONN_EVT(evt));
switch (evt) {
case CONN_AUTH_SUCESS:
strncpy(g_token, (char *)data, size);
lisa_semaphore_give(sem_got_token);
break;
case CONN_CONNECTED:
lisa_semaphore_give(sem_connected);
break;
case CONN_CONNECTING:
lisa_semaphore_give(sem_connecting);
break;
case CONN_DISCONNECTED:
lisa_semaphore_give(sem_disconnected);
break;
default:
break;
}
}
static void test_lsc_conn_mem_leak(void)
{
int ret;
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
lsc_conn_t *conn = lsc_conn_create();
TEST_ASSERT_NOT_EQUAL(NULL, conn);
ret = conn->add_evt_callback(_conn_evt_cb,
CONN_CONNECTED | CONN_CONNECTING | CONN_DISCONNECTED | CONN_AUTH_SUCESS |
CONN_AUTH_FAILD | CONN_DATA_CJSON,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = conn->auth(DEVICE_ID_STRING, PRODUCT_ID_STRING, SECRET_ID_STRING, NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = conn->connect(g_token);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connecting, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_connected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = conn->disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = lsc_conn_destroy(conn);
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT_EQUAL(free_size_before, free_size_after);
}
static void test_lsc_set_host_sta(void)
{
int ret;
bool host_status = false;
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
lsc_conn_t *conn = lsc_conn_create();
TEST_ASSERT_NOT_EQUAL(NULL, conn);
ret = lsc_set_host_status(host_status);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = conn->add_evt_callback(
_conn_evt_cb, CONN_CONNECTED | CONN_DISCONNECTED | CONN_AUTH_SUCESS | CONN_AUTH_FAILD | CONN_DATA_CJSON,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = conn->auth(DEVICE_ID_STRING, PRODUCT_ID_STRING, SECRET_ID_STRING, NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = conn->connect(g_token);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = conn->disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = lsc_conn_destroy(conn);
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT_EQUAL(free_size_before, free_size_after);
}
static void test_lsc_set_host_sta_before_init(void)
{
int ret;
bool host_status = false;
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
ret = lsc_set_host_status(host_status);
TEST_ASSERT_EQUAL(LSC_ERR, ret);
lsc_conn_t *conn = lsc_conn_create();
TEST_ASSERT_NOT_EQUAL(NULL, conn);
ret = conn->add_evt_callback(_conn_evt_cb,
CONN_CONNECTED | CONN_CONNECTING | CONN_DISCONNECTED | CONN_AUTH_SUCESS |
CONN_AUTH_FAILD | CONN_DATA_CJSON,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = conn->auth(DEVICE_ID_STRING, PRODUCT_ID_STRING, SECRET_ID_STRING, NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = conn->connect(g_token);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connecting, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_connected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = conn->disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
// 这个delay必须存在,_conn_evt_cb还在websocket上下文中
lisa_thread_delay(1);
ret = lsc_conn_destroy(conn);
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT_EQUAL(free_size_before, free_size_after);
}
void setUp(void)
{
}
void tearDown(void)
{
}
int main(void)
{
net_init();
net_up();
sem_connected = lisa_semaphore_create(1);
sem_connecting = lisa_semaphore_create(1);
sem_disconnected = lisa_semaphore_create(1);
sem_got_token = lisa_semaphore_create(1);
UNITY_BEGIN();
RUN_TEST(test_lsc_conn_mem_leak);
RUN_TEST(test_lsc_set_host_sta);
RUN_TEST(test_lsc_set_host_sta_before_init);
UNITY_END();
return 0;
}

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
CONFIG_LS_CHAT=y
CONFIG_LISA_LINUX=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,89 @@
# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_PKT_RX_COUNT=600
CONFIG_NET_PKT_TX_COUNT=600
CONFIG_NET_BUF_RX_COUNT=1400
CONFIG_NET_BUF_TX_COUNT=1400
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=25600
CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=25600
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_RESOLVER_MAX_SERVERS=5
CONFIG_DNS_NUM_CONCUR_QUERIES=5
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=4
CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_POSIX_MAX_FDS=10
# CONFIG_WIFI_MGR=y
# CONFIG_WIFI_MGR_WORKQ_STACK=2048
# CONFIG_WIFI_CTRL_STACK_SIZE=2048
# CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_HTTP_CLIENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=n
CONFIG_WIFI=y
CONFIG_WIFI_CSK6=y
CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_WIFI=y
CONFIG_CSK_WIFI_STATION=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=35840
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y
CONFIG_LOG=y
CONFIG_WIFI_LOG_LEVEL_DBG=y
# CONFIG_LISA_HEAP_ARENA_SIZE=1024000
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_MAIN_STACK_SIZE=20480
# CONFIG_MBEDTLS=y
CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_GPIO=y
CONFIG_GPIO_CSK6_CH32V003=y
CONFIG_LS_CHAT=y
CONFIG_HWINFO=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,4 @@
tests:
tests.lsc_conn_tests..linux:
tags: linux
build_only: true

View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.20.0)
if (DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(lsc_test)
if (DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(net_conn)
target_link_libraries(app PRIVATE ls_chat)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat)
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,434 @@
#define TAG "lsc_test"
#include <string.h>
#include "lisa_log.h"
#include "lisa_semaphore.h"
#include "lsc.h"
#include "lsc_errno.h"
#include "unity.h"
#include "lisa_thread.h"
#define PRODUCT_ID_STRING "ce1dda98-f2b8-46f9-a7b9-8aee214a459b"
#define SECRET_ID_STRING "c684eb9e-ff8f-4264-ad03-0369b38ab793"
#define DEVICE_ID_STRING "F97CE114C70DE8E2"
lisa_semaphore_t *sem_connected;
lisa_semaphore_t *sem_disconnected;
lisa_semaphore_t *sem_auth_faild;
lisa_semaphore_t *sem_got_token;
size_t total_size, free_size_before, free_size_after;
char g_token[512];
__attribute__((weak)) int net_down(void)
{
return 0;
}
__attribute__((weak)) int net_up(void)
{
return 0;
}
__attribute__((weak)) int net_init(void)
{
return 0;
}
static void lsc_event_cb(lsc_event_e evt, void *data, uint32_t size, void *usr)
{
switch (evt) {
case LSC_CONNECTED:
lisa_semaphore_give(sem_connected);
break;
case LSC_DISCONNECTED:
lisa_semaphore_give(sem_disconnected);
break;
case LSC_CLOUD_AUTH_FAILD:
lisa_semaphore_give(sem_auth_faild);
break;
case LSC_GOT_TOKEN:
strcpy(g_token, (char *)data);
lisa_semaphore_give(sem_got_token);
break;
default:
break;
}
}
static void test_lsc_init_deinit(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_mem_leak(void)
{
int ret;
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
lisa_thread_delay(2);
ret = lsc_disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_thread_mdelay(500);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT_EQUAL(free_size_before, free_size_after);
}
static void test_lsc_connect_disconnect(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
lisa_thread_delay(2);
ret = lsc_disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_reconnect_set_cfg(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
lisa_thread_delay(2);
ret = lsc_disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_set_config(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_set_cfg_before_init(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_set_config(&cfg);
TEST_ASSERT_EQUAL(LSC_ERR, ret);
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
lisa_thread_delay(2);
ret = lsc_disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_more_set_cfg(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
lisa_thread_delay(2);
ret = lsc_disconnect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_disconnected, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_set_config(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_set_config(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_api_before_init(void)
{
int ret;
ret = lsc_connect();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = lsc_disconnect();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = lsc_remove_callback(lsc_event_cb);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = lsc_music_active();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
char id[16], url[256];
ret = lsc_music_request_url(id, url);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
}
static void test_lsc_connect_with_token(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
.token = g_token,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_lsc_reconnect(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
.if_auto_reconn = true,
.reconn_interval_ms = 2000,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
net_down();
lisa_thread_delay(5);
ret = lisa_semaphore_take(sem_disconnected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
net_up();
ret = lisa_semaphore_take(sem_connected, 5000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lsc_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
void setUp(void)
{
}
void tearDown(void)
{
}
int main(void)
{
net_init();
net_up();
sem_connected = lisa_semaphore_create(1);
sem_disconnected = lisa_semaphore_create(1);
sem_auth_faild = lisa_semaphore_create(1);
sem_got_token = lisa_semaphore_create(1);
UNITY_BEGIN();
RUN_TEST(test_lsc_api_before_init);
RUN_TEST(test_lsc_init_deinit);
RUN_TEST(test_lsc_connect_disconnect);
RUN_TEST(test_lsc_connect_with_token);
#ifdef __ZEPHYR__
RUN_TEST(test_lsc_reconnect);
#endif
RUN_TEST(test_lsc_mem_leak);
RUN_TEST(test_lsc_reconnect_set_cfg);
RUN_TEST(test_lsc_set_cfg_before_init);
RUN_TEST(test_lsc_more_set_cfg);
UNITY_END();
return 0;
}

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
CONFIG_LS_CHAT=y
CONFIG_LISA_LINUX=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,89 @@
# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_PKT_RX_COUNT=600
CONFIG_NET_PKT_TX_COUNT=600
CONFIG_NET_BUF_RX_COUNT=1400
CONFIG_NET_BUF_TX_COUNT=1400
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=25600
CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=25600
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_RESOLVER_MAX_SERVERS=5
CONFIG_DNS_NUM_CONCUR_QUERIES=5
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=4
CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_POSIX_MAX_FDS=10
# CONFIG_WIFI_MGR=y
# CONFIG_WIFI_MGR_WORKQ_STACK=2048
# CONFIG_WIFI_CTRL_STACK_SIZE=2048
# CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_HTTP_CLIENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=n
CONFIG_WIFI=y
CONFIG_WIFI_CSK6=y
CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_WIFI=y
CONFIG_CSK_WIFI_STATION=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=35840
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y
CONFIG_LOG=y
CONFIG_WIFI_LOG_LEVEL_DBG=y
# CONFIG_LISA_HEAP_ARENA_SIZE=1024000
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_MAIN_STACK_SIZE=20480
# CONFIG_MBEDTLS=y
CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_GPIO=y
CONFIG_GPIO_CSK6_CH32V003=y
CONFIG_LS_CHAT=y
CONFIG_HWINFO=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,4 @@
tests:
tests.lsc_tests..linux:
tags: linux
build_only: true

View File

@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.20.0)
if (DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(multi_session_tests)
if (DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(net_conn)
add_subdirectory(resource)
target_link_libraries(app PRIVATE ls_chat)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat)
set(gen_dir ${CMAKE_BINARY_DIR})
generate_inc_file_for_target(${PROJECT_NAME} resource/play_music.pcm ${gen_dir}/play_music.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/last_music.pcm ${gen_dir}/last_music.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/next_music.pcm ${gen_dir}/next_music.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/resume_music.pcm ${gen_dir}/resume_music.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/pause_music.pcm ${gen_dir}/pause_music.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/weather.pcm ${gen_dir}/weather.pcm.inc)
generate_inc_file_for_target(${PROJECT_NAME} resource/test.jpg ${gen_dir}/test.jpg.inc)
target_include_directories(${PROJECT_NAME} PRIVATE ${gen_dir})
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,416 @@
#define TAG "session_voice_tests"
#include "lisa_log.h"
#include "lisa_semaphore.h"
#include "lsc.h"
#include "lsc_session_voice.h"
#include "lsc_session_text.h"
#include "lsc_objrec.h"
#include "lsc_session_request.h"
#include "lsc_errno.h"
#include "unity.h"
#include "lisa_thread.h"
#include "lisa_mem.h"
#include "lsc_stream_text.h"
#define PRODUCT_ID_STRING "ce1dda98-f2b8-46f9-a7b9-8aee214a459b"
#define SECRET_ID_STRING "c684eb9e-ff8f-4264-ad03-0369b38ab793"
#define DEVICE_ID_STRING "F97CE114C70DE8E2"
__attribute__((weak)) int net_down(void)
{
return 0;
}
__attribute__((weak)) int net_up(void)
{
return 0;
}
__attribute__((weak)) int net_init(void)
{
return 0;
}
lisa_semaphore_t *sem_connected;
lisa_semaphore_t *sem_disconnected;
lisa_semaphore_t *sem_auth_faild;
lisa_semaphore_t *sem_got_token;
lisa_semaphore_t *sem_got_vad;
lisa_semaphore_t *sem_got_tts;
lisa_semaphore_t *sem_got_iat;
lisa_semaphore_t *sem_got_reply_url;
lisa_semaphore_t *sem_got_finished;
lisa_semaphore_t *sem_got_music_lists;
lisa_semaphore_t *sem_resume_music;
lisa_semaphore_t *sem_pause_music;
lisa_semaphore_t *sem_next_music;
lisa_semaphore_t *sem_last_music;
// 深圳天气怎么样
static const unsigned char weather_inc_file[] __attribute__((unused)) = {
#include <weather.pcm.inc>
};
// 播放一首歌
static const unsigned char play_music_inc_file[] __attribute__((unused)) = {
#include <play_music.pcm.inc>
};
// 恢复播放
static const unsigned char resume_music_inc_file[] __attribute__((unused)) = {
#include <resume_music.pcm.inc>
};
// 暂停播放
static const unsigned char pause_music_inc_file[] __attribute__((unused)) = {
#include <pause_music.pcm.inc>
};
// 下一首
static const unsigned char next_music_inc_file[] __attribute__((unused)) = {
#include <next_music.pcm.inc>
};
// 上一首
static const unsigned char last_music_inc_file[] __attribute__((unused)) = {
#include <last_music.pcm.inc>
};
// 图片数据
static const uint8_t test_img[] __attribute__((unused)) = {
#include "test.jpg.inc"
};
session_objrec_t objrec_session = NULL;
uint32_t total_size, free_size_before, free_size_after;
char request_url[256];
static void lsc_event_cb(lsc_event_e evt, void *data, uint32_t size, void *usr)
{
switch (evt) {
case LSC_CONNECTED:
lisa_semaphore_give(sem_connected);
break;
case LSC_DISCONNECTED:
lisa_semaphore_give(sem_disconnected);
break;
case LSC_CLOUD_AUTH_FAILD:
lisa_semaphore_give(sem_auth_faild);
break;
case LSC_GOT_TOKEN:
lisa_semaphore_give(sem_got_token);
break;
default:
break;
}
}
static void voice_event_cb(session_voice_event_e evt, void *data, uint32_t size, void *usr)
{
LISA_NLOGI("[%s] evt:0x%x", __FUNCTION__, evt);
switch (evt) {
case SESSION_VOICE_FINISH:
lisa_semaphore_give(sem_got_finished);
break;
case SESSION_VOICE_GOT_VAD:
lisa_semaphore_give(sem_got_vad);
break;
case SESSION_VOICE_TTS:
LISA_NLOGI("tts url:%s", (char *)data);
if (strlen(data) > 10) {
lisa_semaphore_give(sem_got_tts);
}
break;
case SESSION_VOICE_IAT:
LISA_NLOGI("iat:%s", (char *)data);
if (strlen(data)) {
lisa_semaphore_give(sem_got_iat);
}
break;
case SESSION_VOICE_REPLY_URL:
LISA_NLOGI("reply url:%s", (char *)data);
if (strlen(data)) {
lisa_semaphore_give(sem_got_reply_url);
}
break;
case SESSION_VOICE_MUSIC_LISTS: {
session_voice_music_lists_t *item = (session_voice_music_lists_t *)data;
if (item->cnt) {
char music_url[256];
int ret = lsc_music_request_url(item->items[0].id, music_url);
if (ret == LSC_OK) {
lisa_semaphore_give(sem_got_music_lists);
}
}
break;
}
case SESSION_VOICE_MUSIC_INSTR: {
session_voice_music_instr_t *music_instr = (session_voice_music_instr_t *)data;
LISA_NLOGI("music instr:%d", music_instr->instr);
switch (music_instr->instr) {
case SESSION_VOICE_MUSIC_INSTR_REPLAY:
lisa_semaphore_give(sem_resume_music);
break;
case SESSION_VOICE_MUSIC_INSTR_CLOSE:
lisa_semaphore_give(sem_pause_music);
break;
case SESSION_VOICE_MUSIC_INSTR_PAST:
lisa_semaphore_give(sem_last_music);
break;
case SESSION_VOICE_MUSIC_INSTR_NEXT:
lisa_semaphore_give(sem_next_music);
break;
default:
break;
}
break;
}
case SESSION_VOICE_AIUI_CTRL: {
LISA_NLOGI("aiui ctrl:%s", (char *)data);
// 上一首,下一首,暂停播放,恢复播放可能会落阈到AIUI技能中而非音乐技能中
lisa_semaphore_give(sem_resume_music);
lisa_semaphore_give(sem_pause_music);
lisa_semaphore_give(sem_last_music);
lisa_semaphore_give(sem_next_music);
break;
}
default:
break;
}
}
/*
模拟流式产生录音数据,
*/
static int mock_record_audio_stream_send(uint8_t *data, uint32_t size)
{
uint32_t remain_size = size;
uint8_t *ptr = data;
uint32_t send_size = 0;
LISA_NLOGI("[%s] size:%d", __FUNCTION__, size);
int ret = 0;
do {
send_size = (remain_size > 5120) ? 5120 : remain_size;
ret = session_voice_send_audio(ptr, send_size);
lisa_thread_mdelay(100);
ptr += send_size;
remain_size -= send_size;
} while (remain_size > 0);
return ret;
}
static void test_lsc_init(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
}
static void test_session_text_init(void)
{
int ret;
ret = session_text_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_session_objrec_init(void)
{
objrec_session = session_objrec_new();
TEST_ASSERT_NOT_EQUAL(NULL, objrec_session);
}
static void test_session_request_init(void)
{
int ret;
ret = session_request_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_session_voice_init(void)
{
int ret;
ret = session_voice_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = session_voice_add_evt_callback(voice_event_cb,
SESSION_VOICE_GOT_VAD | SESSION_VOICE_TTS | SESSION_VOICE_IAT |
SESSION_VOICE_AIUI_CTRL | SESSION_VOICE_MUSIC_INSTR |
SESSION_VOICE_MUSIC_LISTS | SESSION_VOICE_REPLY_URL |
SESSION_VOICE_DRAW | SESSION_VOICE_FINISH,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
session_voice_config_t config = {
.vad_enable = true,
.device_id = DEVICE_ID_STRING,
.speex_size = 0,
.aue = "raw",
};
ret = session_voice_set_config(&config);
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_session_voice_normal(void)
{
int ret;
session_voice_config_t config = {
.vad_enable = true,
.device_id = DEVICE_ID_STRING,
};
ret = session_voice_set_config(&config);
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_thread_mdelay(500);
ret = session_voice_start();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = mock_record_audio_stream_send((uint8_t *)play_music_inc_file, sizeof(play_music_inc_file));
TEST_ASSERT_NOT_EQUAL(LSC_ERR, ret);
ret = lisa_semaphore_take(sem_got_vad, 8000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_tts, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_iat, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_reply_url, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_music_lists, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_finished, 3000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
}
static void objrec_stream_text_evt_cb_handle(int evt, const char *data, void *user)
{
LISA_NLOGI("sse evt:%d, data:%s", evt, data);
}
static void test_session_objrec_normal(void)
{
int ret = 0;
struct session_objrec_result *result = lisa_mem_alloc(sizeof(struct session_objrec_result));
TEST_ASSERT_NOT_EQUAL(NULL, result);
ret = session_objrec_run(objrec_session, test_img, sizeof(test_img), result, 10 * 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
/* got result, request the text */
struct lsc_stream_text_request_ctx *ctx =
lsc_stream_text_request_new(result->text_url, objrec_stream_text_evt_cb_handle, NULL);
TEST_ASSERT_NOT_EQUAL(NULL, ctx);
ret = lsc_stream_text_request_start(ctx, 10);
TEST_ASSERT_EQUAL(LISA_OK, ret);
}
static void test_session_text_normal(void)
{
int ret = 0;
char temp[] = "清除记忆";
ret = session_text_send(temp);
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_session_request_normal(void)
{
int ret = 0;
char text[] = "深圳天气";
memset((void *)request_url, 0, sizeof(request_url));
ret = session_request_xtts(text, request_url, 30000);
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
void setUp(void)
{
lisa_semaphore_reset(sem_connected);
lisa_semaphore_reset(sem_disconnected);
lisa_semaphore_reset(sem_auth_faild);
lisa_semaphore_reset(sem_got_token);
lisa_semaphore_reset(sem_got_reply_url);
lisa_semaphore_reset(sem_got_iat);
lisa_semaphore_reset(sem_got_tts);
lisa_semaphore_reset(sem_got_vad);
lisa_semaphore_reset(sem_got_music_lists);
lisa_semaphore_reset(sem_resume_music);
lisa_semaphore_reset(sem_pause_music);
lisa_semaphore_reset(sem_next_music);
lisa_semaphore_reset(sem_last_music);
lisa_semaphore_reset(sem_got_finished);
}
void tearDown(void)
{
lisa_mem_info_t info = {0};
lisa_mem_info(&info);
LISA_NLOGI("total size:%d, free size:%d, max alloced size:%d", info.total_size, info.free_size,
info.max_alloced_size);
}
int main(void)
{
net_init();
net_up();
sem_connected = lisa_semaphore_create(1);
sem_disconnected = lisa_semaphore_create(1);
sem_auth_faild = lisa_semaphore_create(1);
sem_got_token = lisa_semaphore_create(1);
sem_got_reply_url = lisa_semaphore_create(1);
sem_got_iat = lisa_semaphore_create(1);
sem_got_tts = lisa_semaphore_create(1);
sem_got_vad = lisa_semaphore_create(1);
sem_got_music_lists = lisa_semaphore_create(1);
sem_resume_music = lisa_semaphore_create(1);
sem_pause_music = lisa_semaphore_create(1);
sem_next_music = lisa_semaphore_create(1);
sem_last_music = lisa_semaphore_create(1);
sem_got_finished = lisa_semaphore_create(1);
UNITY_BEGIN();
RUN_TEST(test_lsc_init);
RUN_TEST(test_session_voice_init);
RUN_TEST(test_session_text_init);
RUN_TEST(test_session_objrec_init);
RUN_TEST(test_session_request_init);
RUN_TEST(test_session_voice_normal);
RUN_TEST(test_session_objrec_normal);
RUN_TEST(test_session_text_normal);
RUN_TEST(test_session_request_normal);
UNITY_END();
return 0;
}

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
CONFIG_LS_CHAT=y
CONFIG_LISA_LINUX=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,89 @@
# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_PKT_RX_COUNT=600
CONFIG_NET_PKT_TX_COUNT=600
CONFIG_NET_BUF_RX_COUNT=1400
CONFIG_NET_BUF_TX_COUNT=1400
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=25600
CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=25600
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_RESOLVER_MAX_SERVERS=5
CONFIG_DNS_NUM_CONCUR_QUERIES=5
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=4
CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_POSIX_MAX_FDS=10
# CONFIG_WIFI_MGR=y
# CONFIG_WIFI_MGR_WORKQ_STACK=2048
# CONFIG_WIFI_CTRL_STACK_SIZE=2048
# CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_HTTP_CLIENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=n
CONFIG_WIFI=y
CONFIG_WIFI_CSK6=y
CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_WIFI=y
CONFIG_CSK_WIFI_STATION=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=35840
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y
CONFIG_LOG=y
CONFIG_WIFI_LOG_LEVEL_DBG=y
# CONFIG_LISA_HEAP_ARENA_SIZE=1024000
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_MAIN_STACK_SIZE=20480
# CONFIG_MBEDTLS=y
CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_GPIO=y
CONFIG_GPIO_CSK6_CH32V003=y
CONFIG_LS_CHAT=y
CONFIG_HWINFO=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,9 @@
set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
generate_inc_file_for_target(app play_music.pcm ${gen_dir}/play_music.pcm.inc)
generate_inc_file_for_target(app last_music.pcm ${gen_dir}/last_music.pcm.inc)
generate_inc_file_for_target(app next_music.pcm ${gen_dir}/next_music.pcm.inc)
generate_inc_file_for_target(app resume_music.pcm ${gen_dir}/resume_music.pcm.inc)
generate_inc_file_for_target(app pause_music.pcm ${gen_dir}/pause_music.pcm.inc)
generate_inc_file_for_target(app weather.pcm ${gen_dir}/weather.pcm.inc)
generate_inc_file_for_target(app test.jpg ${gen_dir}/test.jpg.inc)

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,4 @@
tests:
tests.multi_session_tests..linux:
tags: linux
build_only: true

View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.20.0)
if (DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(session_request_tests)
if (DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(net_conn)
target_link_libraries(app PRIVATE ls_chat)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat)
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,177 @@
#define TAG "session_request_tests"
#include "lisa_log.h"
#include "lisa_semaphore.h"
#include "lisa_thread.h"
#include "lsc.h"
#include "lsc_session_request.h"
#include "lsc_errno.h"
#include "lisa_mem.h"
#include "unity.h"
#include <string.h>
#define PRODUCT_ID_STRING "ce1dda98-f2b8-46f9-a7b9-8aee214a459b"
#define SECRET_ID_STRING "c684eb9e-ff8f-4264-ad03-0369b38ab793"
#define DEVICE_ID_STRING "F97CE114C70DE8E2"
lisa_semaphore_t *sem_connected;
lisa_semaphore_t *sem_disconnected;
lisa_semaphore_t *sem_auth_faild;
lisa_semaphore_t *sem_got_token;
char request_url[256];
__attribute__((weak)) int net_down(void)
{
return 0;
}
__attribute__((weak)) int net_up(void)
{
return 0;
}
__attribute__((weak)) int net_init(void)
{
return 0;
}
static void lsc_event_cb(lsc_event_e evt, void *data, uint32_t size, void *usr)
{
switch (evt) {
case LSC_CONNECTED:
lisa_semaphore_give(sem_connected);
break;
case LSC_DISCONNECTED:
lisa_semaphore_give(sem_disconnected);
break;
case LSC_CLOUD_AUTH_FAILD:
lisa_semaphore_give(sem_auth_faild);
break;
case LSC_GOT_TOKEN:
lisa_semaphore_give(sem_got_token);
break;
default:
break;
}
}
static void test_session_request_init_with_no_lsc_init(void)
{
int ret;
ret = session_request_init();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
}
static void test_session_request_api_before_init(void)
{
int ret;
ret = session_request_deinit();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = session_request_cancel();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
char text[] = "深圳天气";
ret = session_request_xtts(text, request_url, 30000);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
}
static void test_lsc_init(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
}
static void test_session_request_memory_leak(void)
{
size_t total_size;
size_t free_size_before;
size_t free_size_after;
int ret;
// 保障其他流程走完,内存释放
lisa_thread_mdelay(1000);
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
ret = session_request_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
char text[] = "深圳天气";
memset((void *)request_url, 0, sizeof(request_url));
ret = session_request_xtts(text, request_url, 30000);
TEST_ASSERT_EQUAL(LSC_OK, ret);
LISA_NLOGI("get url:%s", request_url);
TEST_ASSERT(strlen(request_url) > 10);
ret = session_request_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
// 保障流程走完,内存释放
lisa_thread_mdelay(1000);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT(free_size_before == free_size_after);
}
void setUp(void)
{
lisa_semaphore_reset(sem_connected);
lisa_semaphore_reset(sem_disconnected);
lisa_semaphore_reset(sem_auth_faild);
lisa_semaphore_reset(sem_got_token);
}
void tearDown(void)
{
}
int main(void)
{
net_init();
net_up();
sem_connected = lisa_semaphore_create(1);
sem_disconnected = lisa_semaphore_create(1);
sem_auth_faild = lisa_semaphore_create(1);
sem_got_token = lisa_semaphore_create(1);
UNITY_BEGIN();
RUN_TEST(test_session_request_init_with_no_lsc_init);
RUN_TEST(test_session_request_api_before_init);
RUN_TEST(test_lsc_init);
RUN_TEST(test_session_request_memory_leak);
UNITY_END();
return 0;
}

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
CONFIG_LS_CHAT=y
CONFIG_LISA_LINUX=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,89 @@
# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_PKT_RX_COUNT=600
CONFIG_NET_PKT_TX_COUNT=600
CONFIG_NET_BUF_RX_COUNT=1400
CONFIG_NET_BUF_TX_COUNT=1400
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=25600
CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=25600
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_RESOLVER_MAX_SERVERS=5
CONFIG_DNS_NUM_CONCUR_QUERIES=5
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=4
CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_POSIX_MAX_FDS=10
# CONFIG_WIFI_MGR=y
# CONFIG_WIFI_MGR_WORKQ_STACK=2048
# CONFIG_WIFI_CTRL_STACK_SIZE=2048
# CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_HTTP_CLIENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=n
CONFIG_WIFI=y
CONFIG_WIFI_CSK6=y
CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_WIFI=y
CONFIG_CSK_WIFI_STATION=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=35840
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y
CONFIG_LOG=y
CONFIG_WIFI_LOG_LEVEL_DBG=y
# CONFIG_LISA_HEAP_ARENA_SIZE=1024000
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_MAIN_STACK_SIZE=20480
# CONFIG_MBEDTLS=y
CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_GPIO=y
CONFIG_GPIO_CSK6_CH32V003=y
CONFIG_LS_CHAT=y
CONFIG_HWINFO=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,4 @@
tests:
tests.session_request_tests..linux:
tags: linux
build_only: true

View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.20.0)
if (DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(session_text_tests)
if (DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(net_conn)
target_link_libraries(app PRIVATE ls_chat)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat)
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,223 @@
#define TAG "session_text_tests"
#include "lisa_log.h"
#include "lisa_semaphore.h"
#include "lisa_thread.h"
#include "lsc.h"
#include "lsc_session_text.h"
#include "lsc_errno.h"
#include "lisa_mem.h"
#include "unity.h"
#define PRODUCT_ID_STRING "ce1dda98-f2b8-46f9-a7b9-8aee214a459b"
#define SECRET_ID_STRING "c684eb9e-ff8f-4264-ad03-0369b38ab793"
#define DEVICE_ID_STRING "F97CE114C70DE8E2"
lisa_semaphore_t *sem_connected;
lisa_semaphore_t *sem_disconnected;
lisa_semaphore_t *sem_auth_faild;
lisa_semaphore_t *sem_got_token;
__attribute__((weak)) int net_down(void)
{
return 0;
}
__attribute__((weak)) int net_up(void)
{
return 0;
}
__attribute__((weak)) int net_init(void)
{
return 0;
}
static void lsc_event_cb(lsc_event_e evt, void *data, uint32_t size, void *usr)
{
switch (evt) {
case LSC_CONNECTED:
lisa_semaphore_give(sem_connected);
break;
case LSC_DISCONNECTED:
lisa_semaphore_give(sem_disconnected);
break;
case LSC_CLOUD_AUTH_FAILD:
lisa_semaphore_give(sem_auth_faild);
break;
case LSC_GOT_TOKEN:
lisa_semaphore_give(sem_got_token);
break;
default:
break;
}
}
static void test_session_text_init_with_no_lsc_init(void)
{
int ret;
ret = session_text_init();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
}
static void test_session_text_api_before_init(void)
{
int ret;
ret = session_text_deinit();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
session_text_config_t config = {0};
ret = session_text_set_config(&config);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = session_text_get_config(&config);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
ret = session_text_cancel();
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
char temp[10] = "test";
ret = session_text_send(temp);
TEST_ASSERT_NOT_EQUAL(LSC_OK, ret);
}
static void test_lsc_init(void)
{
int ret;
lsc_config_t cfg = {
.device_id = DEVICE_ID_STRING,
.product_id = PRODUCT_ID_STRING,
.secret_id = SECRET_ID_STRING,
};
ret = lsc_init(&cfg);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_add_callback(LSC_CONNECTED | LSC_DISCONNECTED | LSC_CLOUD_AUTH_FAILD | LSC_GOT_TOKEN, lsc_event_cb,
NULL);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lsc_connect();
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = lisa_semaphore_take(sem_connected, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
ret = lisa_semaphore_take(sem_got_token, 1000);
TEST_ASSERT_EQUAL(LISA_OK, ret);
}
static void test_session_text_memory_leak(void)
{
size_t total_size;
size_t free_size_before;
size_t free_size_after;
int ret;
// 保障其他流程走完,内存释放
lisa_thread_mdelay(1000);
lisa_mem_get_info(&total_size, &free_size_before);
LISA_NLOGI("before: total-%d free-%d", total_size, free_size_before);
ret = session_text_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
session_text_config_t config = {
.session_timeout_ms = 3000,
};
ret = session_text_set_config(&config);
TEST_ASSERT_EQUAL(LSC_OK, ret);
char temp[] = "清除记忆";
ret = session_text_send(temp);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = session_text_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
lisa_mem_get_info(&total_size, &free_size_after);
LISA_NLOGI("after: total-%d free-%d", total_size, free_size_after);
TEST_ASSERT(free_size_before == free_size_after);
}
static void test_session_text_set_get_config(void)
{
int ret;
ret = session_text_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
session_text_config_t config = {
.session_timeout_ms = 3000,
};
ret = session_text_set_config(&config);
TEST_ASSERT_EQUAL(LSC_OK, ret);
session_text_config_t config_get = {0};
ret = session_text_get_config(&config_get);
TEST_ASSERT_EQUAL(LSC_OK, ret);
TEST_ASSERT(memcmp((void *)&config, (void *)&config_get, sizeof(session_text_config_t)) == 0);
ret = session_text_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
static void test_session_text_normal_send(void)
{
int ret;
ret = session_text_init();
TEST_ASSERT_EQUAL(LSC_OK, ret);
session_text_config_t config = {
.session_timeout_ms = 3000,
};
ret = session_text_set_config(&config);
TEST_ASSERT_EQUAL(LSC_OK, ret);
char temp[] = "清除记忆";
ret = session_text_send(temp);
TEST_ASSERT_EQUAL(LSC_OK, ret);
ret = session_text_deinit();
TEST_ASSERT_EQUAL(LSC_OK, ret);
}
void setUp(void)
{
lisa_semaphore_reset(sem_connected);
lisa_semaphore_reset(sem_disconnected);
lisa_semaphore_reset(sem_auth_faild);
lisa_semaphore_reset(sem_got_token);
}
void tearDown(void)
{
}
int main(void)
{
net_init();
net_up();
sem_connected = lisa_semaphore_create(1);
sem_disconnected = lisa_semaphore_create(1);
sem_auth_faild = lisa_semaphore_create(1);
sem_got_token = lisa_semaphore_create(1);
UNITY_BEGIN();
RUN_TEST(test_session_text_init_with_no_lsc_init);
RUN_TEST(test_session_text_api_before_init);
RUN_TEST(test_lsc_init);
RUN_TEST(test_session_text_memory_leak);
RUN_TEST(test_session_text_set_get_config);
RUN_TEST(test_session_text_normal_send);
UNITY_END();
return 0;
}

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
CONFIG_LS_CHAT=y
CONFIG_LISA_LINUX=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,89 @@
# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_PKT_RX_COUNT=600
CONFIG_NET_PKT_TX_COUNT=600
CONFIG_NET_BUF_RX_COUNT=1400
CONFIG_NET_BUF_TX_COUNT=1400
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=25600
CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=25600
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_RESOLVER_MAX_SERVERS=5
CONFIG_DNS_NUM_CONCUR_QUERIES=5
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=4
CONFIG_NET_MAX_CONN=10
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_POSIX_MAX_FDS=10
# CONFIG_WIFI_MGR=y
# CONFIG_WIFI_MGR_WORKQ_STACK=2048
# CONFIG_WIFI_CTRL_STACK_SIZE=2048
# CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_HTTP_CLIENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=n
CONFIG_WIFI=y
CONFIG_WIFI_CSK6=y
CONFIG_CSK_WIFI_NET_ALLOC_PSRAM=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_WIFI=y
CONFIG_CSK_WIFI_STATION=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NETWORKING=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=35840
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y
CONFIG_LOG=y
CONFIG_WIFI_LOG_LEVEL_DBG=y
# CONFIG_LISA_HEAP_ARENA_SIZE=1024000
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_MAIN_STACK_SIZE=20480
# CONFIG_MBEDTLS=y
CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_GPIO=y
CONFIG_GPIO_CSK6_CH32V003=y
CONFIG_LS_CHAT=y
CONFIG_HWINFO=y
CONFIG_LISA_UNITY=y

View File

@@ -0,0 +1,4 @@
tests:
tests.session_text_tests..linux:
tags: linux
build_only: true

View File

@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.20.0)
if(DEFINED WEST_PYTHON)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
endif()
project(session_voice_encode_tests)
if(DEFINED WEST_PYTHON)
target_sources(app PRIVATE main.c)
add_subdirectory(common/net_conn ${CMAKE_BINARY_DIR}/net_conn)
add_subdirectory(common/resource ${CMAKE_BINARY_DIR}/resource)
add_subdirectory(common/speex-1.2.1 ${CMAKE_BINARY_DIR}/speex-1.2.1)
add_subdirectory(common/ico ${CMAKE_BINARY_DIR}/ico)
target_link_libraries(app PRIVATE ls_chat ico speex)
else()
set(LSCHAT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
set(LISA_BASE ${LSCHAT_BASE}/lisa)
set(ENV{LSCHAT_BASE} ${LSCHAT_BASE})
set(ENV{LISA_BASE} ${LISA_BASE})
include(${LISA_BASE}/lisa.cmake)
add_executable(${PROJECT_NAME} main.c)
add_subdirectory(${LSCHAT_BASE} lschat)
add_subdirectory(common/speex-1.2.1 speex)
add_subdirectory(common/ico ico)
target_link_libraries(${PROJECT_NAME} PRIVATE ls_chat speex ico)
set(gen_dir ${CMAKE_BINARY_DIR})
generate_inc_file_for_target(${PROJECT_NAME} common/resource/weather.pcm ${gen_dir}/weather.pcm.inc)
target_include_directories(${PROJECT_NAME} PRIVATE ${gen_dir})
endif()

View File

@@ -0,0 +1,2 @@
osource "$ZEPHYR_BASE/Kconfig"
osource "$LSCHAT_BASE/Kconfig"

View File

@@ -0,0 +1,13 @@
if(CONFIG_LISA_LINUX)
set(LIB_PLATFORM linux_x86_x64)
elseif(CONFIG_LISA_ZEPHYR)
set(LIB_PLATFORM zephyr)
else()
message(FATAL_ERROR, "Unknown platform")
endif()
set(ICO_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/${LIB_PLATFORM}/libico.a)
add_library(ico STATIC IMPORTED GLOBAL)
set_target_properties(ico PROPERTIES IMPORTED_LOCATION ${ICO_LIB_PATH})
target_include_directories(ico INTERFACE ./inc)

View File

@@ -0,0 +1,17 @@
#ifndef CONFIG_H
#define CONFIG_H
// #define ENC_BITRATE_12K
#define ENC_BITRATE_16K
#define PCM_FRAME_SIZE (640)
#ifdef ENC_BITRATE_12K
#define ENC_BITRATE (12000)
#define ICO_FRAME_SIZE (30)
#elif defined ENC_BITRATE_16K
#define ENC_BITRATE (16000)
#define ICO_FRAME_SIZE (40)
#endif
#endif

View File

@@ -0,0 +1,62 @@
/**
* @brief ico 编解码,用于 ico 与 pcm 数据之间进行语音组包、编码、解码
*
*
*/
#ifndef __ICO_CODEC_H__
#define __ICO_CODEC_H__
#if defined(_WIN32) || defined(_WIN64)
#define DllExport __declspec(dllexport)
#define DllImport __declspec(dllimport)
#else
#define DllExport
#define DllImport
#endif
#include "ivErrorCode.h"
/**
* @brief ico 编码初始化
*
* @return ivStatus
*/
DllExport ivStatus ico_encode_init(void);
/**
* @brief ico 解码初始化
*
* @return ivStatus
*/
DllExport ivStatus ico_decode_init(void);
/**
* @brief ico 编码器重置
*
*/
DllExport void ico_codec_reset(void);
/**
* @brief ico 编码,编码后的数据存放在 enc_data 中
*
* @note 编码前的数据长度需为 640 字节,编码后的数据长度由 outLen 返回(实际输出 outLen 时,需要将 outLen 乘以 2;即最大
* 20*2=40 字节)
*
* @param in 原始 pcm 数据
* @param enc_data 编码后的数据
* @param outLen 编码后的数据长度
* @return ivStatus
*/
DllExport ivStatus ico_codec_encode(short *in, void *enc_data, short *outLen);
/**
* @brief ico 解码,解码后的数据存放在 pcm_data 中
*
* @param in
* @param pcm_data
* @param outLen
* @return ivStatus
*/
DllExport ivStatus ico_codec_decode(void *in, short *pcm_data, short *outLen);
#endif // _ICO_CODEC_H_

View File

@@ -0,0 +1,31 @@
/******************************************************************************
* File Name : ivDebug.h
* Description : InterSound 调试头文件
* Author : pingbu
* Date Of Creation : 2004-03-05
* Platform : Any
* Modification History :
*------------------------------------------------------------------------------
* Date Author Modifications
*------------------------------------------------------------------------------
* 2004-03-05 pingbu Created
******************************************************************************/
#ifndef IFLYTEK_VOICE__2004_03_05__DEBUG__H
#define IFLYTEK_VOICE__2004_03_05__DEBUG__H
#ifdef __cplusplus
extern "C" {
#endif
/*
* 调试功能定义
*/
#define ivAssert(f) IV_ASSERT(f)
#ifdef __cplusplus
}
#endif
#endif /* IFLYTEK_VOICE__2004_03_05__DEBUG__H */

View File

@@ -0,0 +1,264 @@
/*--------------------------------------------------------------+
| | | ivDefine.h - Basic Definitions | |
| | Copyright (c) 1999-2012, ANHUI USTC iFLYTEK CO.,LTD. | | All rights reserved.
| | |
+--------------------------------------------------------------*/
#ifndef IFLYTEK_VOICE__DEFINE__H
#define IFLYTEK_VOICE__DEFINE__H
#include "ivPlatform.h"
#include <limits.h>
#define IV_CHECK_RES_READ 1 /* 是否检查用户回调函数读取资源的成功性 */
/*
* 修饰符
*/
#define ivConst IV_CONST
#define ivStatic IV_STATIC
#ifdef IV_INLINE
#define ivInline IV_STATIC IV_INLINE
#else
#define ivInline IV_STATIC
#endif
#define ivExtern IV_EXTERN
#define ivPtr IV_PTR_PREFIX *
#define ivCPtr ivConst ivPtr
#define ivPtrC ivPtr ivConst
#define ivCPtrC ivConst ivPtr ivConst
#define ivCall IV_CALL_STANDARD /* 非递归的(不可重入的) */
#define ivReentrant IV_CALL_REENTRANT /* 递归的(可重入的) */
#define ivVACall IV_CALL_VAR_ARG /* 支持变参的 */
#define ivProc ivCall ivPtr
/*
* 定义
*/
#define ivNull (0)
/* 布尔类型及其值(须根据平台定制) */
typedef int ivBool;
#define ivTrue (~0)
#define ivFalse (0)
/* 对比类型及其值 */
typedef int ivComp;
#define ivGreater (1)
#define ivEqual (0)
#define ivLesser (-1)
#define ivIsGreater(v) ((v) > 0)
#define ivIsEqual(v) (0 == (v))
#define ivIsLesser(v) ((v) < 0)
/*
* 数据类型
*/
/* 基本值类型 */
typedef signed IV_TYPE_INT8 ivInt8; /* 8-bit */
typedef unsigned IV_TYPE_INT8 ivUInt8; /* 8-bit */
typedef signed IV_TYPE_INT16 ivInt16; /* 16-bit */
typedef unsigned IV_TYPE_INT16 ivUInt16; /* 16-bit */
typedef signed IV_TYPE_INT24 ivInt24; /* 24-bit */
typedef unsigned IV_TYPE_INT24 ivUInt24; /* 24-bit */
typedef signed IV_TYPE_INT32 ivInt32; /* 32-bit */
typedef unsigned IV_TYPE_INT32 ivUInt32; /* 32-bit */
typedef unsigned IV_TYPE_INT64 ivUInt64; /* 32-bit */
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef signed char Word8;
typedef short Word16;
typedef int Word32;
typedef int Flag;
#if INT_MAX == 32767
typedef unsigned int UWord16;
#elif SHRT_MAX == 32767
typedef unsigned short UWord16;
#endif
/* define 32 bit unsigned types for G.722.1 */
#if INT_MAX == 2147483647L
typedef unsigned int UWord32;
#elif LONG_MAX == 2147483647L
typedef unsigned int UWord32;
#endif
#ifdef IV_TYPE_INT48
typedef signed IV_TYPE_INT48 ivInt48; /* 48-bit */
typedef unsigned IV_TYPE_INT48 ivUInt48; /* 48-bit */
#endif
#ifdef IV_TYPE_INT64
typedef signed IV_TYPE_INT64 ivInt64; /* 64-bit */
typedef unsigned IV_TYPE_INT64 ivUInt64; /* 64-bit */
#endif
/* 相应的指针类型 */
typedef ivInt8 ivPtr ivPInt8; /* 8-bit */
typedef ivUInt8 ivPtr ivPUInt8; /* 8-bit */
typedef ivInt16 ivPtr ivPInt16; /* 16-bit */
typedef ivUInt16 ivPtr ivPUInt16; /* 16-bit */
typedef ivInt24 ivPtr ivPInt24; /* 24-bit */
typedef ivUInt24 ivPtr ivPUInt24; /* 24-bit */
typedef ivInt32 ivPtr ivPInt32; /* 32-bit */
typedef ivUInt32 ivPtr ivPUInt32; /* 32-bit */
#ifdef IV_TYPE_INT48
typedef ivInt48 ivPtr ivPInt48; /* 48-bit */
typedef ivUInt48 ivPtr ivPUInt48; /* 48-bit */
#endif
#ifdef IV_TYPE_INT64
typedef ivInt64 ivPtr ivPInt64; /* 64-bit */
typedef ivUInt64 ivPtr ivPUInt64; /* 64-bit */
#endif
/* 常量指针类型 */
typedef ivInt8 ivCPtr ivPCInt8; /* 8-bit */
typedef ivUInt8 ivCPtr ivPCUInt8; /* 8-bit */
typedef ivInt16 ivCPtr ivPCInt16; /* 16-bit */
typedef ivUInt16 ivCPtr ivPCUInt16; /* 16-bit */
typedef ivInt24 ivCPtr ivPCInt24; /* 24-bit */
typedef ivUInt24 ivCPtr ivPCUInt24; /* 24-bit */
typedef ivInt32 ivCPtr ivPCInt32; /* 32-bit */
typedef ivUInt32 ivCPtr ivPCUInt32; /* 32-bit */
#ifdef IV_TYPE_INT48
typedef ivInt48 ivCPtr ivPCInt48; /* 48-bit */
typedef ivUInt48 ivCPtr ivPCUInt48; /* 48-bit */
#endif
#ifdef IV_TYPE_INT64
typedef ivInt64 ivCPtr ivPCInt64; /* 64-bit */
typedef ivUInt64 ivCPtr ivPCUInt64; /* 64-bit */
#endif
#if 0
/* 基本类型 */
typedef signed IV_TYPE_FLT32 ivFlt32; /* 32-bit */
typedef unsigned IV_TYPE_FLT32 ivUFlt32; /* 32-bit */
typedef signed IV_TYPE_FLT64 ivFlt64; /* 64-bit */
typedef unsigned IV_TYPE_FLT64 ivUFlt64; /* 64-bit */
/* 相应的指针类型 */
typedef ivFlt32 ivPtr ivPFlt32; /* 32-bit */
typedef ivUFlt32 ivPtr ivPUFlt32; /* 32-bit */
typedef ivFlt64 ivPtr ivPFlt64; /* 64-bit */
typedef ivUFlt64 ivPtr ivPUFlt64; /* 64-bit */
/* 常量指针类型 */
typedef ivFlt32 ivCPtr ivPCFlt32; /* 32-bit */
typedef ivUFlt32 ivCPtr ivPCUFlt32; /* 32-bit */
typedef ivFlt64 ivCPtr ivPCFlt64; /* 64-bit */
typedef ivUFlt64 ivCPtr ivPCUFlt64; /* 64-bit */
#endif
/* 边界值定义 */
#define IV_SBYTE_MAX (+127)
#define IV_MAX_INT16 (+32767)
#define IV_INT_MAX (+8388607L)
#define IV_MAX_INT32 (+2147483647L)
#define IV_SBYTE_MIN (-IV_SBYTE_MAX - 1)
#define IV_MIN_INT16 (-IV_MAX_INT16 - 1)
#define IV_INT_MIN (-IV_INT_MAX - 1)
#define IV_MIN_INT32 (-IV_MAX_INT32 - 1)
#define IV_BYTE_MAX (0xffU)
#define IV_USHORT_MAX (0xffffU)
#define IV_UINT_MAX (0xffffffUL)
#define IV_ULONG_MAX (0xffffffffUL)
#define IV_CHECK_SATURATE16(x) IV_ASSERT((x) >= IV_MIN_INT16 && (x) <= IV_MAX_INT16)
/* 内存基本单元 */
typedef ivUInt8 ivByte;
typedef ivPUInt8 ivPByte;
typedef ivPCUInt8 ivPCByte;
typedef signed ivInt;
typedef signed ivPtr ivPInt;
typedef signed ivCPtr ivPCInt;
typedef unsigned ivUInt;
typedef unsigned ivPtr ivPUInt;
typedef unsigned ivCPtr ivPCUInt;
/* 指针 */
typedef void ivPtr ivPointer;
typedef void ivCPtr ivCPointer;
/* 句柄 */
typedef ivPointer ivHandle;
/* 地址、尺寸类型 */
typedef IV_TYPE_ADDRESS ivAddress;
typedef IV_TYPE_SIZE ivSize;
/*
* 字符相关定义
*/
/* 字符类型定义 */
typedef ivInt8 ivCharA;
typedef ivUInt16 ivCharW;
#if IV_UNICODE
typedef ivCharW ivChar;
#else
typedef ivCharA ivChar;
#endif
/* 字符串类型定义 */
typedef ivCharA ivPtr ivStrA;
typedef ivCharA ivCPtr ivCStrA;
typedef ivCharW ivPtr ivStrW;
typedef ivCharW ivCPtr ivCStrW;
typedef ivChar ivPtr ivStr;
typedef ivChar ivCPtr ivCStr;
/* 文本常量宏 */
#define ivTextA(s) ((ivCStrA)s)
#define ivTextW(s) ((ivCStrW)L##s)
#if IV_UNICODE
#define ivText(s) ivTextW(s)
#else
#define ivText(s) ivTextA(s)
#endif
/*
* 资源地址、尺寸类型及数据类型大小常量
*/
typedef ivUInt32 ivResAddress;
typedef ivUInt32 ivResSize;
#define ivResSize_Int8 1
#define ivResSize_Int16 2
#define ivResSize_Int32 4
#endif /* !IFLYTEK_VOICE__DEFINE__H */

View File

@@ -0,0 +1,45 @@
/*----------------------------------------------+
| |
| ivErrorCode.h - Basic Definitions |
| |
| Copyright (c) 1999-2012, iFLYTEK Ltd. |
| All rights reserved. |
| |
+----------------------------------------------*/
#ifndef IFLYTEK_VOICE__2012_02_27_ERRORCODE__H
#define IFLYTEK_VOICE__2012_02_27_ERRORCODE__H
#include "ivDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef ivInt32 ivErrID;
typedef ivInt32 ivStatus;
typedef ivInt32 MAEErrID;
typedef ivInt32 ivMAEStatus;
/* General */
#define ivErr_InvArg ((ivStatus)2)
#define ivErr_Failed ((ivStatus)3)
#define ivErr_NotSupport ((ivStatus)4)
#define ivErr_OutOfMemory ((ivStatus)5)
/* For object status */
#define ivErr_InvCall ((ivStatus)6)
#define ivErr_BufferEmpty ((ivStatus)7)
#define ivErr_BufferFull ((ivStatus)8)
#define ivErr_Done ((ivStatus)9) /* <20><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
#ifdef __cplusplus
}
#endif
#define ivErr_OK ((ivStatus)0)
#define ivErr_FALSE ((ivStatus)1)
#define ivSucceeded(hr) ((ivUInt32)(hr) <= 1)
#endif /* !IFLYTEK_VOICE__2008_10_13_ERRORCODE__H */

View File

@@ -0,0 +1,81 @@
/*----------------------------------------------+
| |
| ivPlatform.h - InterSound 4 Platform Config |
| |
| Platform: ADS (ARM) |
| |
| Copyright (c) 1999-2012, iFLYTEK Ltd. |
| All rights reserved. |
| |
+----------------------------------------------*/
/*
* TODO: 在这里包含目标平台程序需要的公共头文件
*/
#ifdef WIN32
// #include <crtdbg.h>
#include <memory.h>
#include <tchar.h>
// #include <windows.h>
#endif
/*
* TODO: 根据目标平台特性修改下面的配置选项
*/
#define IV_UNIT_BITS 8 /* 内存基本单元位数 */
#define IV_BIG_ENDIAN 0 /* 是否是 Big-Endian 字节序 */
#define IV_PTR_GRID 4 /* 最大指针对齐值 */
#define IV_PTR_PREFIX /* 指针修饰关键字(典型取值有 near | far, 可以为空) */
#define IV_CONST const /* 常量关键字(可以为空) */
#define IV_EXTERN extern /* 外部关键字 */
#define IV_STATIC static /* 静态函数关键字(可以为空) */
#define IV_INLINE __inline /* 内联关键字(典型取值有 inline, 可以为空) */
#define IV_CALL_STANDARD /* 普通函数修饰关键字(典型取值有 stdcall | fastcall | pascal, 可以为空) */
#define IV_CALL_REENTRANT /* 递归函数修饰关键字(典型取值有 stdcall | reentrant, 可以为空) */
#define IV_CALL_VAR_ARG /* 变参函数修饰关键字(典型取值有 cdecl, 可以为空) */
#define IV_TYPE_INT8 char /* 8位数据类型 */
#define IV_TYPE_INT16 short /* 16位数据类型 */
#define IV_TYPE_INT24 int /* 24位数据类型 */
#define IV_TYPE_INT32 long /* 32位数据类型 */
#define IV_TYPE_INT64 long long /* 64位数据类型 */
#define IV_TYPE_ADDRESS unsigned int /* 地址数据类型 */
#define IV_TYPE_SIZE unsigned int /* 大小数据类型 */
#define IV_VOLATILE volatile
#define IV_ANSI_MEMORY 0 /* 是否使用 ANSI 内存操作库 */
#define IV_ANSI_STRING 0 /* 是否使用 ANSI 字符串操作库 */
#ifdef _MSC_VER
#include <crtdbg.h>
#else
#define _ASSERT(expr) ((void)0)
#define _ASSERTE(expr) ((void)0)
#endif
#ifdef WIN32
#define IV_ASSERT(exp) _ASSERT(exp) /* 断言操作 */
#else
#define IV_ASSERT(exp)
#endif
#define IV_YIELD /* 空闲操作(在协作式调度系统中应定义为任务切换调用, 可以为空) */
#if defined(DEBUG) || defined(_DEBUG)
#define IV_DEBUG 1 /* 是否支持调试 */
#else
#define IV_DEBUG 0 /* 是否支持调试 */
#endif
/* 根据平台编译选项决定是否以 Unicode 方式构建 */
#if defined(UNICODE) || defined(_UNICODE)
#define IV_UNICODE 1 /* 是否以 Unicode 方式构建 */
#else
#define IV_UNICODE 0 /* 是否以 Unicode 方式构建 */
#endif

View File

@@ -0,0 +1,4 @@
target_sources(app PRIVATE
net_conn.c
)
target_include_directories(app PRIVATE .)

View File

@@ -0,0 +1,119 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/net/net_context.h>
#include <zephyr/net/net_core.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/sys_heap.h>
#include "csk6/csk_wifi.h"
static csk_wifi_event_cb_t wifi_event_cb;
static struct net_mgmt_event_callback dhcp_cb;
K_SEM_DEFINE(ipgot_sem, 0, 1);
static void handler_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV4_DHCP_BOUND) {
return;
}
char buf[NET_IPV4_ADDR_LEN];
printk("Your address: %s\n", net_addr_ntop(AF_INET, &iface->config.dhcpv4.requested_ip, buf, sizeof(buf)));
printk("Lease time: %u seconds\n", iface->config.dhcpv4.lease_time);
printk("Subnet: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->netmask, buf, sizeof(buf)));
printk("Router: %s\n", net_addr_ntop(AF_INET, &iface->config.ip.ipv4->gw, buf, sizeof(buf)));
k_sem_give(&ipgot_sem);
}
static void wifi_event_handler(csk_wifi_event_t events, void *event_data, uint32_t data_len, void *arg)
{
if (events & CSK_WIFI_EVT_STA_CONNECTED) {
printk("[WiFi sta] connected\n");
} else if (events & CSK_WIFI_EVT_STA_DISCONNECTED) {
printk("[WiFi sta] disconnected\n");
} else {
abort();
}
}
int net_init(void)
{
int ret;
csk_wifi_init();
uint8_t mac_addr[6] = {0};
ret = csk_wifi_get_mac(CSK_WIFI_MODE_STA, mac_addr);
if (ret != 0) {
printk("wifi get mac failed, ret: %d\n", ret);
return 0;
}
printk("wifi station mac addr: %x:%x:%x:%x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4], mac_addr[5]);
wifi_event_cb.handler = &wifi_event_handler;
wifi_event_cb.events = CSK_WIFI_EVT_STA_CONNECTED | CSK_WIFI_EVT_STA_DISCONNECTED;
wifi_event_cb.arg = NULL;
csk_wifi_add_callback(&wifi_event_cb);
return 0;
}
int net_up(void)
{
csk_wifi_sta_config_t sta_config = {
.ssid = "mywifi", .pwd = "12345678", .encryption_mode = CSK_WIFI_AUTH_WPA2_PSK};
int retry_count = 0;
csk_wifi_result_t wifi_result;
do {
int ret;
printk("connecting to wifi: %s ...\n", sta_config.ssid);
ret = csk_wifi_sta_connect(&sta_config, &wifi_result, K_FOREVER);
if (ret == 0) {
break;
} else {
if (wifi_result == CSK_WIFI_ERR_STA_FAILED) {
retry_count++;
printk("retry to connecting wifi ... %d\n", retry_count);
} else {
printk("AP not found or invalid password\n");
return 0;
}
}
} while (retry_count < 10);
printk("--------------------------Current AP info-------------------------------\n");
printk("ssid: %s pwd: %s bssid: %s channel: %d rssi: %d\n", sta_config.ssid, sta_config.pwd,
sta_config.bssid, sta_config.channel, sta_config.rssi);
printk("------------------------------------------------------------------------\n");
net_mgmt_init_event_callback(&dhcp_cb, handler_cb, NET_EVENT_IPV4_DHCP_BOUND);
net_mgmt_add_event_callback(&dhcp_cb);
struct net_if *iface = net_if_get_default();
if (!iface) {
printk("wifi interface not available");
return 0;
}
net_dhcpv4_start(iface);
k_sem_take(&ipgot_sem, K_FOREVER);
return 0;
}
int net_down(void)
{
int ret;
csk_wifi_result_t result;
ret = csk_wifi_sta_disconnect(&result, K_FOREVER);
if (ret < 0) {
printk("station disconnect failed, reason code: %d, ret: %d", result, ret);
return -1;
}
net_mgmt_del_event_callback(&dhcp_cb);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int net_init(void);
int net_up(void);
int net_down(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,3 @@
set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
generate_inc_file_for_target(app weather.pcm ${gen_dir}/weather.pcm.inc)

View File

@@ -0,0 +1,13 @@
set(LIB_NAME speex)
file(
GLOB
LIB_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/libspeex/*.c
)
add_library(${LIB_NAME} STATIC ${LIB_SRCS})
target_link_libraries(${LIB_NAME} PRIVATE lisa_os)
target_include_directories(${LIB_NAME} PRIVATE lisa_porting)
target_include_directories(${LIB_NAME} PUBLIC include/speex)
target_include_directories(${LIB_NAME} PUBLIC include)
target_compile_options(${LIB_NAME} PRIVATE -DHAVE_CONFIG_H -Wno-shift-negative-value -Wno-unused-function)

View File

@@ -0,0 +1,3 @@
doc_DATA = manual.pdf
EXTRA_DIST = $(doc_DATA)

View File

@@ -0,0 +1,520 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(docdir)"
DATA = $(doc_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FFT_CFLAGS = @FFT_CFLAGS@
FFT_LIBS = @FFT_LIBS@
FFT_PKGCONFIG = @FFT_PKGCONFIG@
FGREP = @FGREP@
GREP = @GREP@
INCLUDE_STDINT = @INCLUDE_STDINT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE16 = @SIZE16@
SIZE32 = @SIZE32@
SPEEXDSP_CFLAGS = @SPEEXDSP_CFLAGS@
SPEEXDSP_LIBS = @SPEEXDSP_LIBS@
SPEEX_LT_AGE = @SPEEX_LT_AGE@
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
SPEEX_VERSION = @SPEEX_VERSION@
STRIP = @STRIP@
USIZE16 = @USIZE16@
USIZE32 = @USIZE32@
VERSION = @VERSION@
WINMM_LIBS = @WINMM_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
doc_DATA = manual.pdf
EXTRA_DIST = $(doc_DATA)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-docDATA: $(doc_DATA)
@$(NORMAL_INSTALL)
@list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
done
uninstall-docDATA:
@$(NORMAL_UNINSTALL)
@list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-docDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-docDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-docDATA install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-am uninstall-docDATA
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,2 @@
SUBDIRS = speex

View File

@@ -0,0 +1,642 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FFT_CFLAGS = @FFT_CFLAGS@
FFT_LIBS = @FFT_LIBS@
FFT_PKGCONFIG = @FFT_PKGCONFIG@
FGREP = @FGREP@
GREP = @GREP@
INCLUDE_STDINT = @INCLUDE_STDINT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE16 = @SIZE16@
SIZE32 = @SIZE32@
SPEEXDSP_CFLAGS = @SPEEXDSP_CFLAGS@
SPEEXDSP_LIBS = @SPEEXDSP_LIBS@
SPEEX_LT_AGE = @SPEEX_LT_AGE@
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
SPEEX_VERSION = @SPEEX_VERSION@
STRIP = @STRIP@
USIZE16 = @USIZE16@
USIZE32 = @USIZE32@
VERSION = @VERSION@
WINMM_LIBS = @WINMM_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = speex
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign include/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
check-am clean clean-generic clean-libtool cscopelist-am ctags \
ctags-am distclean distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,9 @@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
nodist_pkginclude_HEADERS = speex_config_types.h
pkginclude_HEADERS = speex.h speex_bits.h speex_callbacks.h \
speex_header.h \
speex_stereo.h speex_types.h

View File

@@ -0,0 +1,618 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include/speex
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = speex_config_types.h
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgincludedir)" \
"$(DESTDIR)$(pkgincludedir)"
HEADERS = $(nodist_pkginclude_HEADERS) $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(srcdir)/speex_config_types.h.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FFT_CFLAGS = @FFT_CFLAGS@
FFT_LIBS = @FFT_LIBS@
FFT_PKGCONFIG = @FFT_PKGCONFIG@
FGREP = @FGREP@
GREP = @GREP@
INCLUDE_STDINT = @INCLUDE_STDINT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE16 = @SIZE16@
SIZE32 = @SIZE32@
SPEEXDSP_CFLAGS = @SPEEXDSP_CFLAGS@
SPEEXDSP_LIBS = @SPEEXDSP_LIBS@
SPEEX_LT_AGE = @SPEEX_LT_AGE@
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
SPEEX_VERSION = @SPEEX_VERSION@
STRIP = @STRIP@
USIZE16 = @USIZE16@
USIZE32 = @USIZE32@
VERSION = @VERSION@
WINMM_LIBS = @WINMM_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
nodist_pkginclude_HEADERS = speex_config_types.h
pkginclude_HEADERS = speex.h speex_bits.h speex_callbacks.h \
speex_header.h \
speex_stereo.h speex_types.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/speex/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign include/speex/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
speex_config_types.h: $(top_builddir)/config.status $(srcdir)/speex_config_types.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-nodist_pkgincludeHEADERS: $(nodist_pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-nodist_pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-nodist_pkgincludeHEADERS \
install-pkgincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-nodist_pkgincludeHEADERS \
uninstall-pkgincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man \
install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
install-pkgincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am \
uninstall-nodist_pkgincludeHEADERS uninstall-pkgincludeHEADERS
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,415 @@
/* Copyright (C) 2002-2006 Jean-Marc Valin*/
/**
@file speex.h
@brief Describes the different modes of the codec
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPEEX_H
#define SPEEX_H
/** @defgroup Codec Speex encoder and decoder
* This is the Speex codec itself.
* @{
*/
#include "speex_types.h"
#include "speex_bits.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Values allowed for *ctl() requests */
/** Set enhancement on/off (decoder only) */
#define SPEEX_SET_ENH 0
/** Get enhancement state (decoder only) */
#define SPEEX_GET_ENH 1
/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
/** Obtain frame size used by encoder/decoder */
#define SPEEX_GET_FRAME_SIZE 3
/** Set quality value */
#define SPEEX_SET_QUALITY 4
/** Get current quality setting */
/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
/** Set sub-mode to use */
#define SPEEX_SET_MODE 6
/** Get current sub-mode in use */
#define SPEEX_GET_MODE 7
/** Set low-band sub-mode to use (wideband only)*/
#define SPEEX_SET_LOW_MODE 8
/** Get current low-band mode in use (wideband only)*/
#define SPEEX_GET_LOW_MODE 9
/** Set high-band sub-mode to use (wideband only)*/
#define SPEEX_SET_HIGH_MODE 10
/** Get current high-band mode in use (wideband only)*/
#define SPEEX_GET_HIGH_MODE 11
/** Set VBR on (1) or off (0) */
#define SPEEX_SET_VBR 12
/** Get VBR status (1 for on, 0 for off) */
#define SPEEX_GET_VBR 13
/** Set quality value for VBR encoding (0-10) */
#define SPEEX_SET_VBR_QUALITY 14
/** Get current quality value for VBR encoding (0-10) */
#define SPEEX_GET_VBR_QUALITY 15
/** Set complexity of the encoder (0-10) */
#define SPEEX_SET_COMPLEXITY 16
/** Get current complexity of the encoder (0-10) */
#define SPEEX_GET_COMPLEXITY 17
/** Set bit-rate used by the encoder (or lower) */
#define SPEEX_SET_BITRATE 18
/** Get current bit-rate used by the encoder or decoder */
#define SPEEX_GET_BITRATE 19
/** Define a handler function for in-band Speex request*/
#define SPEEX_SET_HANDLER 20
/** Define a handler function for in-band user-defined request*/
#define SPEEX_SET_USER_HANDLER 22
/** Set sampling rate used in bit-rate computation */
#define SPEEX_SET_SAMPLING_RATE 24
/** Get sampling rate used in bit-rate computation */
#define SPEEX_GET_SAMPLING_RATE 25
/** Reset the encoder/decoder memories to zero*/
#define SPEEX_RESET_STATE 26
/** Get VBR info (mostly used internally) */
#define SPEEX_GET_RELATIVE_QUALITY 29
/** Set VAD status (1 for on, 0 for off) */
#define SPEEX_SET_VAD 30
/** Get VAD status (1 for on, 0 for off) */
#define SPEEX_GET_VAD 31
/** Set Average Bit-Rate (ABR) to n bits per seconds */
#define SPEEX_SET_ABR 32
/** Get Average Bit-Rate (ABR) setting (in bps) */
#define SPEEX_GET_ABR 33
/** Set DTX status (1 for on, 0 for off) */
#define SPEEX_SET_DTX 34
/** Get DTX status (1 for on, 0 for off) */
#define SPEEX_GET_DTX 35
/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */
#define SPEEX_SET_SUBMODE_ENCODING 36
/** Get submode encoding in each frame */
#define SPEEX_GET_SUBMODE_ENCODING 37
/*#define SPEEX_SET_LOOKAHEAD 38*/
/** Returns the lookahead used by Speex separately for an encoder and a decoder.
* Sum encoder and decoder lookahead values to get the total codec lookahead. */
#define SPEEX_GET_LOOKAHEAD 39
/** Sets tuning for packet-loss concealment (expected loss rate) */
#define SPEEX_SET_PLC_TUNING 40
/** Gets tuning for PLC */
#define SPEEX_GET_PLC_TUNING 41
/** Sets the max bit-rate allowed in VBR mode */
#define SPEEX_SET_VBR_MAX_BITRATE 42
/** Gets the max bit-rate allowed in VBR mode */
#define SPEEX_GET_VBR_MAX_BITRATE 43
/** Turn on/off input/output high-pass filtering */
#define SPEEX_SET_HIGHPASS 44
/** Get status of input/output high-pass filtering */
#define SPEEX_GET_HIGHPASS 45
/** Get "activity level" of the last decoded frame, i.e.
how much damage we cause if we remove the frame */
#define SPEEX_GET_ACTIVITY 47
/* Preserving compatibility:*/
/** Equivalent to SPEEX_SET_ENH */
#define SPEEX_SET_PF 0
/** Equivalent to SPEEX_GET_ENH */
#define SPEEX_GET_PF 1
/* Values allowed for mode queries */
/** Query the frame size of a mode */
#define SPEEX_MODE_FRAME_SIZE 0
/** Query the size of an encoded frame for a particular sub-mode */
#define SPEEX_SUBMODE_BITS_PER_FRAME 1
/** Get major Speex version */
#define SPEEX_LIB_GET_MAJOR_VERSION 1
/** Get minor Speex version */
#define SPEEX_LIB_GET_MINOR_VERSION 3
/** Get micro Speex version */
#define SPEEX_LIB_GET_MICRO_VERSION 5
/** Get extra Speex version */
#define SPEEX_LIB_GET_EXTRA_VERSION 7
/** Get Speex version string */
#define SPEEX_LIB_GET_VERSION_STRING 9
/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
#define SPEEX_LIB_GET_ALLOC_FUNC 11
#define SPEEX_LIB_SET_FREE_FUNC 12
#define SPEEX_LIB_GET_FREE_FUNC 13
#define SPEEX_LIB_SET_WARNING_FUNC 14
#define SPEEX_LIB_GET_WARNING_FUNC 15
#define SPEEX_LIB_SET_ERROR_FUNC 16
#define SPEEX_LIB_GET_ERROR_FUNC 17
*/
/** Number of defined modes in Speex */
#define SPEEX_NB_MODES 3
/** modeID for the defined narrowband mode */
#define SPEEX_MODEID_NB 0
/** modeID for the defined wideband mode */
#define SPEEX_MODEID_WB 1
/** modeID for the defined ultra-wideband mode */
#define SPEEX_MODEID_UWB 2
struct SpeexMode;
/* Prototypes for mode function pointers */
/** Encoder state initialization function */
typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
/** Encoder state destruction function */
typedef void (*encoder_destroy_func)(void *st);
/** Main encoding function */
typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
/** Function for controlling the encoder options */
typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
/** Decoder state initialization function */
typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
/** Decoder state destruction function */
typedef void (*decoder_destroy_func)(void *st);
/** Main decoding function */
typedef int (*decode_func)(void *state, SpeexBits *bits, void *out);
/** Function for controlling the decoder options */
typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
/** Query function for a mode */
typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
/** Struct defining a Speex mode */
typedef struct SpeexMode {
/** Pointer to the low-level mode data */
const void *mode;
/** Pointer to the mode query function */
mode_query_func query;
/** The name of the mode (you should not rely on this to identify the mode)*/
const char *modeName;
/**ID of the mode*/
int modeID;
/**Version number of the bitstream (incremented every time we break
bitstream compatibility*/
int bitstream_version;
/** Pointer to encoder initialization function */
encoder_init_func enc_init;
/** Pointer to encoder destruction function */
encoder_destroy_func enc_destroy;
/** Pointer to frame encoding function */
encode_func enc;
/** Pointer to decoder initialization function */
decoder_init_func dec_init;
/** Pointer to decoder destruction function */
decoder_destroy_func dec_destroy;
/** Pointer to frame decoding function */
decode_func dec;
/** ioctl-like requests for encoder */
encoder_ctl_func enc_ctl;
/** ioctl-like requests for decoder */
decoder_ctl_func dec_ctl;
} SpeexMode;
/**
* Returns a handle to a newly created Speex encoder state structure. For now,
* the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes
* may be added. Note that for now if you have more than one channels to
* encode, you need one state per channel.
*
* @param mode The mode to use (either speex_nb_mode or speex_wb.mode)
* @return A newly created encoder state or NULL if state allocation fails
*/
void *speex_encoder_init(const SpeexMode *mode);
/** Frees all resources associated to an existing Speex encoder state.
* @param state Encoder state to be destroyed */
void speex_encoder_destroy(void *state);
/** Uses an existing encoder state to encode one frame of speech pointed to by
"in". The encoded bit-stream is saved in "bits".
@param state Encoder state
@param in Frame that will be encoded with a +-2^15 range. This data MAY be
overwritten by the encoder and should be considered uninitialised
after the call.
@param bits Bit-stream where the data will be written
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise
*/
int speex_encode(void *state, float *in, SpeexBits *bits);
/** Uses an existing encoder state to encode one frame of speech pointed to by
"in". The encoded bit-stream is saved in "bits".
@param state Encoder state
@param in Frame that will be encoded with a +-2^15 range
@param bits Bit-stream where the data will be written
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise
*/
int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
/** Used like the ioctl function to control the encoder parameters
*
* @param state Encoder state
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
*/
int speex_encoder_ctl(void *state, int request, void *ptr);
/** Returns a handle to a newly created decoder state structure. For now,
* the mode argument can be &nb_mode or &wb_mode . In the future, more modes
* may be added. Note that for now if you have more than one channels to
* decode, you need one state per channel.
*
* @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
* @return A newly created decoder state or NULL if state allocation fails
*/
void *speex_decoder_init(const SpeexMode *mode);
/** Frees all resources associated to an existing decoder state.
*
* @param state State to be destroyed
*/
void speex_decoder_destroy(void *state);
/** Uses an existing decoder state to decode one frame of speech from
* bit-stream bits. The output speech is saved written to out.
*
* @param state Decoder state
* @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
* @param out Where to write the decoded frame
* @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
*/
int speex_decode(void *state, SpeexBits *bits, float *out);
/** Uses an existing decoder state to decode one frame of speech from
* bit-stream bits. The output speech is saved written to out.
*
* @param state Decoder state
* @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
* @param out Where to write the decoded frame
* @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
*/
int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
/** Used like the ioctl function to control the encoder parameters
*
* @param state Decoder state
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
*/
int speex_decoder_ctl(void *state, int request, void *ptr);
/** Query function for mode information
*
* @param mode Speex mode
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
*/
int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
/** Functions for controlling the behavior of libspeex
* @param request ioctl-type request (one of the SPEEX_LIB_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
*/
int speex_lib_ctl(int request, void *ptr);
/** Default narrowband mode */
extern const SpeexMode speex_nb_mode;
/** Default wideband mode */
extern const SpeexMode speex_wb_mode;
/** Default "ultra-wideband" mode */
extern const SpeexMode speex_uwb_mode;
/** List of all modes available */
extern const SpeexMode *const speex_mode_list[SPEEX_NB_MODES];
/** Obtain one of the modes available */
const SpeexMode *speex_lib_get_mode(int mode);
#ifndef _WIN32
/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */
#define speex_lib_get_mode(mode) ((mode) == SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode(mode))
#endif
#ifdef __cplusplus
}
#endif
/** @}*/
#endif

View File

@@ -0,0 +1,176 @@
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file speex_bits.h
@brief Handles bit packing/unpacking
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BITS_H
#define BITS_H
/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
* This is the structure that holds the bit-stream when encoding or decoding
* with Speex. It allows some manipulations as well.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/** Bit-packing data structure representing (part of) a bit-stream. */
typedef struct SpeexBits {
char *chars; /**< "raw" data */
int nbBits; /**< Total number of bits stored in the stream*/
int charPtr; /**< Position of the byte "cursor" */
int bitPtr; /**< Position of the bit "cursor" within the current char */
int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */
int overflow; /**< Set to one if we try to read past the valid data */
int buf_size; /**< Allocated size for buffer */
int reserved1; /**< Reserved for future use */
void *reserved2; /**< Reserved for future use */
} SpeexBits;
/** Initializes and allocates resources for a SpeexBits struct */
void speex_bits_init(SpeexBits *bits);
/** Initializes SpeexBits struct using a pre-allocated buffer*/
void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated,
* but this could change in the future.*/
void speex_bits_destroy(SpeexBits *bits);
/** Resets bits to initial value (just after initialization, erasing content)*/
void speex_bits_reset(SpeexBits *bits);
/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
void speex_bits_rewind(SpeexBits *bits);
/** Initializes the bit-stream from the data in an area of memory */
void speex_bits_read_from(SpeexBits *bits, const char *bytes, int len);
/** Append bytes to the bit-stream
*
* @param bits Bit-stream to operate on
* @param bytes pointer to the bytes what will be appended
* @param len Number of bytes of append
*/
void speex_bits_read_whole_bytes(SpeexBits *bits, const char *bytes, int len);
/** Write the content of a bit-stream to an area of memory
*
* @param bits Bit-stream to operate on
* @param bytes Memory location where to write the bits
* @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
* @return Number of bytes written to the "bytes" buffer
*/
int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the
* stream */
int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
/** Append bits to the bit-stream
* @param bits Bit-stream to operate on
* @param data Value to append as integer
* @param nbBits number of bits to consider in "data"
*/
void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
/** Interpret the next bits in the bit-stream as a signed integer
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to interpret
* @return A signed integer represented by the bits read
*/
int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
/** Interpret the next bits in the bit-stream as an unsigned integer
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to interpret
* @return An unsigned integer represented by the bits read
*/
unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
*
* @param bits Bit-stream to operate on
* @return Number of bytes in the stream
*/
int speex_bits_nbytes(SpeexBits *bits);
/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to look for
* @return Value of the bits peeked, interpreted as unsigned
*/
unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
/** Get the value of the next bit in the stream, without modifying the
* "cursor" position
*
* @param bits Bit-stream to operate on
* @return Value of the bit peeked (one bit only)
*/
int speex_bits_peek(SpeexBits *bits);
/** Advances the position of the "bit cursor" in the stream
*
* @param bits Bit-stream to operate on
* @param n Number of bits to advance
*/
void speex_bits_advance(SpeexBits *bits, int n);
/** Returns the number of bits remaining to be read in a stream
*
* @param bits Bit-stream to operate on
* @return Number of bits that can still be read from the stream
*/
int speex_bits_remaining(SpeexBits *bits);
/** Insert a terminator so that the data can be sent as a packet while auto-detecting
* the number of frames in each packet
*
* @param bits Bit-stream to operate on
*/
void speex_bits_insert_terminator(SpeexBits *bits);
#ifdef __cplusplus
}
#endif
/* @} */
#endif

View File

@@ -0,0 +1,131 @@
/* Copyright (C) 2002 Jean-Marc Valin*/
/**
@file speex_callbacks.h
@brief Describes callback handling and in-band signalling
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPEEX_CALLBACKS_H
#define SPEEX_CALLBACKS_H
/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
* @{
*/
#include "speex.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Total number of callbacks */
#define SPEEX_MAX_CALLBACKS 16
/* Describes all the in-band requests */
/*These are 1-bit requests*/
/** Request for perceptual enhancement (1 for on, 0 for off) */
#define SPEEX_INBAND_ENH_REQUEST 0
/** Reserved */
#define SPEEX_INBAND_RESERVED1 1
/*These are 4-bit requests*/
/** Request for a mode change */
#define SPEEX_INBAND_MODE_REQUEST 2
/** Request for a low mode change */
#define SPEEX_INBAND_LOW_MODE_REQUEST 3
/** Request for a high mode change */
#define SPEEX_INBAND_HIGH_MODE_REQUEST 4
/** Request for VBR (1 on, 0 off) */
#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
/** Request to be sent acknowledge */
#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
/** Request for VBR (1 for on, 0 for off) */
#define SPEEX_INBAND_VBR_REQUEST 7
/*These are 8-bit requests*/
/** Send a character in-band */
#define SPEEX_INBAND_CHAR 8
/** Intensity stereo information */
#define SPEEX_INBAND_STEREO 9
/*These are 16-bit requests*/
/** Transmit max bit-rate allowed */
#define SPEEX_INBAND_MAX_BITRATE 10
/*These are 32-bit requests*/
/** Acknowledge packet reception */
#define SPEEX_INBAND_ACKNOWLEDGE 12
/** Callback function type */
typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
/** Callback information */
typedef struct SpeexCallback {
int callback_id; /**< ID associated to the callback */
speex_callback_func func; /**< Callback handler function */
void *data; /**< Data that will be sent to the handler */
void *reserved1; /**< Reserved for future use */
int reserved2; /**< Reserved for future use */
} SpeexCallback;
/** Handle in-band request */
int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
/** Standard handler for mode request (change mode, no questions asked) */
int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for high mode request (change high mode, no questions asked) */
int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for in-band characters (write to stderr) */
int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
/** Default handler for user-defined requests: in this case, just ignore */
int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for low mode request (change low mode, no questions asked) */
int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for VBR request (Set VBR, no questions asked) */
int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */
int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@@ -0,0 +1,11 @@
#ifndef __SPEEX_TYPES_H__
#define __SPEEX_TYPES_H__
#include <stdint.h>
typedef int16_t spx_int16_t;
typedef uint16_t spx_uint16_t;
typedef int32_t spx_int32_t;
typedef uint32_t spx_uint32_t;
#endif

View File

@@ -0,0 +1,12 @@
#ifndef __SPEEX_TYPES_H__
#define __SPEEX_TYPES_H__
@INCLUDE_STDINT@
typedef @SIZE16@ spx_int16_t;
typedef @USIZE16@ spx_uint16_t;
typedef @SIZE32@ spx_int32_t;
typedef @USIZE32@ spx_uint32_t;
#endif

View File

@@ -0,0 +1,93 @@
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file speex_header.h
@brief Describes the Speex header
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPEEX_HEADER_H
#define SPEEX_HEADER_H
/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
* This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
* @{
*/
#include "speex_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct SpeexMode;
/** Length of the Speex header identifier */
#define SPEEX_HEADER_STRING_LENGTH 8
/** Maximum number of characters for encoding the Speex version number in the header */
#define SPEEX_HEADER_VERSION_LENGTH 20
/** Speex header info for file-based formats */
typedef struct SpeexHeader {
char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */
char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */
spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
spx_int32_t rate; /**< Sampling rate used */
spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */
spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
spx_int32_t nb_channels; /**< Number of channels encoded */
spx_int32_t bitrate; /**< Bit-rate used */
spx_int32_t frame_size; /**< Size of frames */
spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */
spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */
spx_int32_t extra_headers; /**< Number of additional headers after the comments */
spx_int32_t reserved1; /**< Reserved for future use, must be zero */
spx_int32_t reserved2; /**< Reserved for future use, must be zero */
} SpeexHeader;
/** Initializes a SpeexHeader using basic information */
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
/** Creates the header packet from the header itself (mostly involves endianness conversion) */
char *speex_header_to_packet(SpeexHeader *header, int *size);
/** Creates a SpeexHeader from a packet */
SpeexHeader *speex_packet_to_header(char *packet, int size);
/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
void speex_header_free(void *ptr);
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@@ -0,0 +1,94 @@
/* Copyright (C) 2002 Jean-Marc Valin*/
/**
@file speex_stereo.h
@brief Describes the handling for intensity stereo
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STEREO_H
#define STEREO_H
/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
* This describes the Speex intensity stereo encoding/decoding
* @{
*/
#include "speex_types.h"
#include "speex_bits.h"
#ifdef __cplusplus
extern "C" {
#endif
/** If you access any of these fields directly, I'll personally come and bite you */
typedef struct SpeexStereoState {
float balance; /**< Left/right balance info */
float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
float smooth_left; /**< Smoothed left channel gain */
float smooth_right; /**< Smoothed right channel gain */
float reserved1; /**< Reserved for future use */
float reserved2; /**< Reserved for future use */
} SpeexStereoState;
/** Deprecated. Use speex_stereo_state_init() instead. */
#define SPEEX_STEREO_STATE_INIT \
{ \
1, .5, 1, 1, 0, 0 \
}
/** Initialise/create a stereo stereo state */
SpeexStereoState *speex_stereo_state_init(void);
/** Reset/re-initialise an already allocated stereo state */
void speex_stereo_state_reset(SpeexStereoState *stereo);
/** Destroy a stereo stereo state */
void speex_stereo_state_destroy(SpeexStereoState *stereo);
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
/** Transforms a mono frame into a stereo frame using intensity stereo info */
void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
/** Transforms a mono frame into a stereo frame using intensity stereo info */
void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo);
/** Callback handler for intensity stereo info */
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@@ -0,0 +1,126 @@
/* speex_types.h taken from libogg */
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
********************************************************************/
/**
@file speex_types.h
@brief Speex types
*/
#ifndef _SPEEX_TYPES_H
#define _SPEEX_TYPES_H
#if defined(_WIN32)
#if defined(__CYGWIN__)
#include <_G_config.h>
typedef _G_int32_t spx_int32_t;
typedef _G_uint32_t spx_uint32_t;
typedef _G_int16_t spx_int16_t;
typedef _G_uint16_t spx_uint16_t;
#elif defined(__MINGW32__)
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;
#elif defined(__MWERKS__)
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
#else
/* MSVC/Borland */
typedef __int32 spx_int32_t;
typedef unsigned __int32 spx_uint32_t;
typedef __int16 spx_int16_t;
typedef unsigned __int16 spx_uint16_t;
#endif
#elif defined(__MACOS__)
#include <sys/types.h>
typedef SInt16 spx_int16_t;
typedef UInt16 spx_uint16_t;
typedef SInt32 spx_int32_t;
typedef UInt32 spx_uint32_t;
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
#include <sys/types.h>
typedef int16_t spx_int16_t;
typedef u_int16_t spx_uint16_t;
typedef int32_t spx_int32_t;
typedef u_int32_t spx_uint32_t;
#elif defined(__BEOS__)
/* Be */
#include <inttypes.h>
typedef int16_t spx_int16_t;
typedef u_int16_t spx_uint16_t;
typedef int32_t spx_int32_t;
typedef u_int32_t spx_uint32_t;
#elif defined(__EMX__)
/* OS/2 GCC */
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;
#elif defined(DJGPP)
/* DJGPP */
typedef short spx_int16_t;
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;
#elif defined(R5900)
/* PS2 EE */
typedef int spx_int32_t;
typedef unsigned spx_uint32_t;
typedef short spx_int16_t;
#elif defined(__SYMBIAN32__)
/* Symbian GCC */
typedef signed short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef signed int spx_int32_t;
typedef unsigned int spx_uint32_t;
#elif defined(CONFIG_TI_C54X) || defined(CONFIG_TI_C55X)
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef long spx_int32_t;
typedef unsigned long spx_uint32_t;
#elif defined(CONFIG_TI_C6X)
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;
#else
#include "speex_config_types.h"
#endif
#endif /* _SPEEX_TYPES_H */

View File

@@ -0,0 +1,53 @@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
if BUILD_VORBIS_PSY
VPSY_SOURCE=vorbis_psy.c
if BUILD_KISS_FFT
FFTSRC=kiss_fft.c _kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h
else
if BUILD_SMALLFT
FFTSRC=smallft.c
else
FFTSRC=
endif
endif
else
VPSY_SOURCE=
FFTSRC=
endif
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include/speex -I$(top_builddir) @OGG_CFLAGS@ @FFT_CFLAGS@
lib_LTLIBRARIES = libspeex.la
# Sources for compilation in the library
libspeex_la_SOURCES = $(VPSY_SOURCE) $(FFTSRC) cb_search.c exc_10_32_table.c exc_8_128_table.c \
filters.c gain_table.c hexc_table.c high_lsp_tables.c lsp.c \
ltp.c speex.c stereo.c vbr.c vq.c bits.c exc_10_16_table.c \
exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c gain_table_lbr.c hexc_10_32_table.c \
lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \
speex_callbacks.c speex_header.c window.c
noinst_HEADERS = arch.h bfin.h cb_search_arm4.h cb_search_bfin.h cb_search_sse.h \
filters.h filters_arm4.h filters_bfin.h filters_sse.h fixed_arm4.h \
fixed_arm5e.h fixed_bfin.h fixed_debug.h lpc.h lpc_bfin.h ltp.h ltp_arm4.h \
ltp_sse.h math_approx.h misc_bfin.h nb_celp.h quant_lsp.h sb_celp.h \
stack_alloc.h vbr.h vq.h vq_arm4.h vq_bfin.h vq_sse.h cb_search.h fftwrap.h \
fixed_generic.h lsp.h lsp_bfin.h ltp_bfin.h modes.h os_support.h \
quant_lsp_bfin.h smallft.h vorbis_psy.h
libspeex_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
libspeex_la_LIBADD = $(LIBM)
if BUILD_BINARIES
noinst_PROGRAMS = testenc testenc_wb testenc_uwb
testenc_SOURCES = testenc.c
testenc_LDADD = libspeex.la $(LIBM)
testenc_wb_SOURCES = testenc_wb.c
testenc_wb_LDADD = libspeex.la $(LIBM)
testenc_uwb_SOURCES = testenc_uwb.c
testenc_uwb_LDADD = libspeex.la $(LIBM)
endif

View File

@@ -0,0 +1,904 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@BUILD_BINARIES_TRUE@noinst_PROGRAMS = testenc$(EXEEXT) \
@BUILD_BINARIES_TRUE@ testenc_wb$(EXEEXT) testenc_uwb$(EXEEXT)
subdir = libspeex
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libspeex_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__libspeex_la_SOURCES_DIST = vorbis_psy.c smallft.c kiss_fft.c \
_kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h \
cb_search.c exc_10_32_table.c exc_8_128_table.c filters.c \
gain_table.c hexc_table.c high_lsp_tables.c lsp.c ltp.c \
speex.c stereo.c vbr.c vq.c bits.c exc_10_16_table.c \
exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c \
gain_table_lbr.c hexc_10_32_table.c lpc.c lsp_tables_nb.c \
modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \
speex_callbacks.c speex_header.c window.c
@BUILD_VORBIS_PSY_TRUE@am__objects_1 = vorbis_psy.lo
@BUILD_KISS_FFT_FALSE@@BUILD_SMALLFT_TRUE@@BUILD_VORBIS_PSY_TRUE@am__objects_2 = smallft.lo
@BUILD_KISS_FFT_TRUE@@BUILD_VORBIS_PSY_TRUE@am__objects_2 = \
@BUILD_KISS_FFT_TRUE@@BUILD_VORBIS_PSY_TRUE@ kiss_fft.lo \
@BUILD_KISS_FFT_TRUE@@BUILD_VORBIS_PSY_TRUE@ kiss_fftr.lo
am_libspeex_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
cb_search.lo exc_10_32_table.lo exc_8_128_table.lo filters.lo \
gain_table.lo hexc_table.lo high_lsp_tables.lo lsp.lo ltp.lo \
speex.lo stereo.lo vbr.lo vq.lo bits.lo exc_10_16_table.lo \
exc_20_32_table.lo exc_5_256_table.lo exc_5_64_table.lo \
gain_table_lbr.lo hexc_10_32_table.lo lpc.lo lsp_tables_nb.lo \
modes.lo modes_wb.lo nb_celp.lo quant_lsp.lo sb_celp.lo \
speex_callbacks.lo speex_header.lo window.lo
libspeex_la_OBJECTS = $(am_libspeex_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libspeex_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libspeex_la_LDFLAGS) $(LDFLAGS) -o $@
am__testenc_SOURCES_DIST = testenc.c
@BUILD_BINARIES_TRUE@am_testenc_OBJECTS = testenc.$(OBJEXT)
testenc_OBJECTS = $(am_testenc_OBJECTS)
@BUILD_BINARIES_TRUE@testenc_DEPENDENCIES = libspeex.la \
@BUILD_BINARIES_TRUE@ $(am__DEPENDENCIES_1)
am__testenc_uwb_SOURCES_DIST = testenc_uwb.c
@BUILD_BINARIES_TRUE@am_testenc_uwb_OBJECTS = testenc_uwb.$(OBJEXT)
testenc_uwb_OBJECTS = $(am_testenc_uwb_OBJECTS)
@BUILD_BINARIES_TRUE@testenc_uwb_DEPENDENCIES = libspeex.la \
@BUILD_BINARIES_TRUE@ $(am__DEPENDENCIES_1)
am__testenc_wb_SOURCES_DIST = testenc_wb.c
@BUILD_BINARIES_TRUE@am_testenc_wb_OBJECTS = testenc_wb.$(OBJEXT)
testenc_wb_OBJECTS = $(am_testenc_wb_OBJECTS)
@BUILD_BINARIES_TRUE@testenc_wb_DEPENDENCIES = libspeex.la \
@BUILD_BINARIES_TRUE@ $(am__DEPENDENCIES_1)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/bits.Plo ./$(DEPDIR)/cb_search.Plo \
./$(DEPDIR)/exc_10_16_table.Plo \
./$(DEPDIR)/exc_10_32_table.Plo \
./$(DEPDIR)/exc_20_32_table.Plo \
./$(DEPDIR)/exc_5_256_table.Plo ./$(DEPDIR)/exc_5_64_table.Plo \
./$(DEPDIR)/exc_8_128_table.Plo ./$(DEPDIR)/filters.Plo \
./$(DEPDIR)/gain_table.Plo ./$(DEPDIR)/gain_table_lbr.Plo \
./$(DEPDIR)/hexc_10_32_table.Plo ./$(DEPDIR)/hexc_table.Plo \
./$(DEPDIR)/high_lsp_tables.Plo ./$(DEPDIR)/kiss_fft.Plo \
./$(DEPDIR)/kiss_fftr.Plo ./$(DEPDIR)/lpc.Plo \
./$(DEPDIR)/lsp.Plo ./$(DEPDIR)/lsp_tables_nb.Plo \
./$(DEPDIR)/ltp.Plo ./$(DEPDIR)/modes.Plo \
./$(DEPDIR)/modes_wb.Plo ./$(DEPDIR)/nb_celp.Plo \
./$(DEPDIR)/quant_lsp.Plo ./$(DEPDIR)/sb_celp.Plo \
./$(DEPDIR)/smallft.Plo ./$(DEPDIR)/speex.Plo \
./$(DEPDIR)/speex_callbacks.Plo ./$(DEPDIR)/speex_header.Plo \
./$(DEPDIR)/stereo.Plo ./$(DEPDIR)/testenc.Po \
./$(DEPDIR)/testenc_uwb.Po ./$(DEPDIR)/testenc_wb.Po \
./$(DEPDIR)/vbr.Plo ./$(DEPDIR)/vorbis_psy.Plo \
./$(DEPDIR)/vq.Plo ./$(DEPDIR)/window.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libspeex_la_SOURCES) $(testenc_SOURCES) \
$(testenc_uwb_SOURCES) $(testenc_wb_SOURCES)
DIST_SOURCES = $(am__libspeex_la_SOURCES_DIST) \
$(am__testenc_SOURCES_DIST) $(am__testenc_uwb_SOURCES_DIST) \
$(am__testenc_wb_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(noinst_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FFT_CFLAGS = @FFT_CFLAGS@
FFT_LIBS = @FFT_LIBS@
FFT_PKGCONFIG = @FFT_PKGCONFIG@
FGREP = @FGREP@
GREP = @GREP@
INCLUDE_STDINT = @INCLUDE_STDINT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE16 = @SIZE16@
SIZE32 = @SIZE32@
SPEEXDSP_CFLAGS = @SPEEXDSP_CFLAGS@
SPEEXDSP_LIBS = @SPEEXDSP_LIBS@
SPEEX_LT_AGE = @SPEEX_LT_AGE@
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
SPEEX_VERSION = @SPEEX_VERSION@
STRIP = @STRIP@
USIZE16 = @USIZE16@
USIZE32 = @USIZE32@
VERSION = @VERSION@
WINMM_LIBS = @WINMM_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@BUILD_VORBIS_PSY_FALSE@VPSY_SOURCE =
@BUILD_VORBIS_PSY_TRUE@VPSY_SOURCE = vorbis_psy.c
@BUILD_KISS_FFT_FALSE@@BUILD_SMALLFT_FALSE@@BUILD_VORBIS_PSY_TRUE@FFTSRC =
@BUILD_KISS_FFT_FALSE@@BUILD_SMALLFT_TRUE@@BUILD_VORBIS_PSY_TRUE@FFTSRC = smallft.c
@BUILD_KISS_FFT_TRUE@@BUILD_VORBIS_PSY_TRUE@FFTSRC = kiss_fft.c _kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h
@BUILD_VORBIS_PSY_FALSE@FFTSRC =
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include/speex -I$(top_builddir) @OGG_CFLAGS@ @FFT_CFLAGS@
lib_LTLIBRARIES = libspeex.la
# Sources for compilation in the library
libspeex_la_SOURCES = $(VPSY_SOURCE) $(FFTSRC) cb_search.c exc_10_32_table.c exc_8_128_table.c \
filters.c gain_table.c hexc_table.c high_lsp_tables.c lsp.c \
ltp.c speex.c stereo.c vbr.c vq.c bits.c exc_10_16_table.c \
exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c gain_table_lbr.c hexc_10_32_table.c \
lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \
speex_callbacks.c speex_header.c window.c
noinst_HEADERS = arch.h bfin.h cb_search_arm4.h cb_search_bfin.h cb_search_sse.h \
filters.h filters_arm4.h filters_bfin.h filters_sse.h fixed_arm4.h \
fixed_arm5e.h fixed_bfin.h fixed_debug.h lpc.h lpc_bfin.h ltp.h ltp_arm4.h \
ltp_sse.h math_approx.h misc_bfin.h nb_celp.h quant_lsp.h sb_celp.h \
stack_alloc.h vbr.h vq.h vq_arm4.h vq_bfin.h vq_sse.h cb_search.h fftwrap.h \
fixed_generic.h lsp.h lsp_bfin.h ltp_bfin.h modes.h os_support.h \
quant_lsp_bfin.h smallft.h vorbis_psy.h
libspeex_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
libspeex_la_LIBADD = $(LIBM)
@BUILD_BINARIES_TRUE@testenc_SOURCES = testenc.c
@BUILD_BINARIES_TRUE@testenc_LDADD = libspeex.la $(LIBM)
@BUILD_BINARIES_TRUE@testenc_wb_SOURCES = testenc_wb.c
@BUILD_BINARIES_TRUE@testenc_wb_LDADD = libspeex.la $(LIBM)
@BUILD_BINARIES_TRUE@testenc_uwb_SOURCES = testenc_uwb.c
@BUILD_BINARIES_TRUE@testenc_uwb_LDADD = libspeex.la $(LIBM)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libspeex/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libspeex/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libspeex.la: $(libspeex_la_OBJECTS) $(libspeex_la_DEPENDENCIES) $(EXTRA_libspeex_la_DEPENDENCIES)
$(AM_V_CCLD)$(libspeex_la_LINK) -rpath $(libdir) $(libspeex_la_OBJECTS) $(libspeex_la_LIBADD) $(LIBS)
testenc$(EXEEXT): $(testenc_OBJECTS) $(testenc_DEPENDENCIES) $(EXTRA_testenc_DEPENDENCIES)
@rm -f testenc$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(testenc_OBJECTS) $(testenc_LDADD) $(LIBS)
testenc_uwb$(EXEEXT): $(testenc_uwb_OBJECTS) $(testenc_uwb_DEPENDENCIES) $(EXTRA_testenc_uwb_DEPENDENCIES)
@rm -f testenc_uwb$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(testenc_uwb_OBJECTS) $(testenc_uwb_LDADD) $(LIBS)
testenc_wb$(EXEEXT): $(testenc_wb_OBJECTS) $(testenc_wb_DEPENDENCIES) $(EXTRA_testenc_wb_DEPENDENCIES)
@rm -f testenc_wb$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(testenc_wb_OBJECTS) $(testenc_wb_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bits.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cb_search.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_10_16_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_10_32_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_20_32_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_5_256_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_5_64_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exc_8_128_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filters.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gain_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gain_table_lbr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexc_10_32_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexc_table.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/high_lsp_tables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kiss_fft.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kiss_fftr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_tables_nb.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modes.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modes_wb.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nb_celp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quant_lsp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sb_celp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smallft.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speex.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speex_callbacks.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speex_header.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stereo.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testenc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testenc_uwb.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testenc_wb.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbis_psy.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vq.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/bits.Plo
-rm -f ./$(DEPDIR)/cb_search.Plo
-rm -f ./$(DEPDIR)/exc_10_16_table.Plo
-rm -f ./$(DEPDIR)/exc_10_32_table.Plo
-rm -f ./$(DEPDIR)/exc_20_32_table.Plo
-rm -f ./$(DEPDIR)/exc_5_256_table.Plo
-rm -f ./$(DEPDIR)/exc_5_64_table.Plo
-rm -f ./$(DEPDIR)/exc_8_128_table.Plo
-rm -f ./$(DEPDIR)/filters.Plo
-rm -f ./$(DEPDIR)/gain_table.Plo
-rm -f ./$(DEPDIR)/gain_table_lbr.Plo
-rm -f ./$(DEPDIR)/hexc_10_32_table.Plo
-rm -f ./$(DEPDIR)/hexc_table.Plo
-rm -f ./$(DEPDIR)/high_lsp_tables.Plo
-rm -f ./$(DEPDIR)/kiss_fft.Plo
-rm -f ./$(DEPDIR)/kiss_fftr.Plo
-rm -f ./$(DEPDIR)/lpc.Plo
-rm -f ./$(DEPDIR)/lsp.Plo
-rm -f ./$(DEPDIR)/lsp_tables_nb.Plo
-rm -f ./$(DEPDIR)/ltp.Plo
-rm -f ./$(DEPDIR)/modes.Plo
-rm -f ./$(DEPDIR)/modes_wb.Plo
-rm -f ./$(DEPDIR)/nb_celp.Plo
-rm -f ./$(DEPDIR)/quant_lsp.Plo
-rm -f ./$(DEPDIR)/sb_celp.Plo
-rm -f ./$(DEPDIR)/smallft.Plo
-rm -f ./$(DEPDIR)/speex.Plo
-rm -f ./$(DEPDIR)/speex_callbacks.Plo
-rm -f ./$(DEPDIR)/speex_header.Plo
-rm -f ./$(DEPDIR)/stereo.Plo
-rm -f ./$(DEPDIR)/testenc.Po
-rm -f ./$(DEPDIR)/testenc_uwb.Po
-rm -f ./$(DEPDIR)/testenc_wb.Po
-rm -f ./$(DEPDIR)/vbr.Plo
-rm -f ./$(DEPDIR)/vorbis_psy.Plo
-rm -f ./$(DEPDIR)/vq.Plo
-rm -f ./$(DEPDIR)/window.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/bits.Plo
-rm -f ./$(DEPDIR)/cb_search.Plo
-rm -f ./$(DEPDIR)/exc_10_16_table.Plo
-rm -f ./$(DEPDIR)/exc_10_32_table.Plo
-rm -f ./$(DEPDIR)/exc_20_32_table.Plo
-rm -f ./$(DEPDIR)/exc_5_256_table.Plo
-rm -f ./$(DEPDIR)/exc_5_64_table.Plo
-rm -f ./$(DEPDIR)/exc_8_128_table.Plo
-rm -f ./$(DEPDIR)/filters.Plo
-rm -f ./$(DEPDIR)/gain_table.Plo
-rm -f ./$(DEPDIR)/gain_table_lbr.Plo
-rm -f ./$(DEPDIR)/hexc_10_32_table.Plo
-rm -f ./$(DEPDIR)/hexc_table.Plo
-rm -f ./$(DEPDIR)/high_lsp_tables.Plo
-rm -f ./$(DEPDIR)/kiss_fft.Plo
-rm -f ./$(DEPDIR)/kiss_fftr.Plo
-rm -f ./$(DEPDIR)/lpc.Plo
-rm -f ./$(DEPDIR)/lsp.Plo
-rm -f ./$(DEPDIR)/lsp_tables_nb.Plo
-rm -f ./$(DEPDIR)/ltp.Plo
-rm -f ./$(DEPDIR)/modes.Plo
-rm -f ./$(DEPDIR)/modes_wb.Plo
-rm -f ./$(DEPDIR)/nb_celp.Plo
-rm -f ./$(DEPDIR)/quant_lsp.Plo
-rm -f ./$(DEPDIR)/sb_celp.Plo
-rm -f ./$(DEPDIR)/smallft.Plo
-rm -f ./$(DEPDIR)/speex.Plo
-rm -f ./$(DEPDIR)/speex_callbacks.Plo
-rm -f ./$(DEPDIR)/speex_header.Plo
-rm -f ./$(DEPDIR)/stereo.Plo
-rm -f ./$(DEPDIR)/testenc.Po
-rm -f ./$(DEPDIR)/testenc_uwb.Po
-rm -f ./$(DEPDIR)/testenc_wb.Po
-rm -f ./$(DEPDIR)/vbr.Plo
-rm -f ./$(DEPDIR)/vorbis_psy.Plo
-rm -f ./$(DEPDIR)/vq.Plo
-rm -f ./$(DEPDIR)/window.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,183 @@
/*
Copyright (c) 2003-2004, Mark Borgerding
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the author nor the names of any contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* kiss_fft.h
defines kiss_fft_scalar as either short or a float type
and defines
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
#include "kiss_fft.h"
#include "math_approx.h"
#define MAXFACTORS 32
/* e.g. an fft of length 128 has 4 factors
as far as kissfft is concerned
4*4*4*2
*/
struct kiss_fft_state {
int nfft;
int inverse;
int factors[2 * MAXFACTORS];
kiss_fft_cpx twiddles[1];
};
/*
Explanation of macros dealing with complex math:
C_MUL(m,a,b) : m = a*b
C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
C_SUB( res, a,b) : res = a - b
C_SUBFROM( res , a) : res -= a
C_ADDTO( res , a) : res += a
* */
#ifdef FIXED_POINT
#include "arch.h"
#define FRACBITS 15
#define SAMPPROD spx_int32_t
#define SAMP_MAX 32767
#define SAMP_MIN -SAMP_MAX
#if defined(CHECK_OVERFLOW)
#define CHECK_OVERFLOW_OP(a, op, b) \
if ((SAMPPROD)(a)op(SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a)op(SAMPPROD)(b) < SAMP_MIN) { \
fprintf(stderr, "WARNING:overflow @ " __FILE__ "(%d): (%d " #op " %d) = %ld\n", __LINE__, (a), (b), \
(SAMPPROD)(a)op(SAMPPROD)(b)); \
}
#endif
#define smul(a, b) ((SAMPPROD)(a) * (b))
#define sround(x) (kiss_fft_scalar)(((x) + (1 << (FRACBITS - 1))) >> FRACBITS)
#define S_MUL(a, b) sround(smul(a, b))
#define C_MUL(m, a, b) \
do { \
(m).r = sround(smul((a).r, (b).r) - smul((a).i, (b).i)); \
(m).i = sround(smul((a).r, (b).i) + smul((a).i, (b).r)); \
} while (0)
#define C_MUL4(m, a, b) \
do { \
(m).r = PSHR32(smul((a).r, (b).r) - smul((a).i, (b).i), 17); \
(m).i = PSHR32(smul((a).r, (b).i) + smul((a).i, (b).r), 17); \
} while (0)
#define DIVSCALAR(x, k) (x) = sround(smul(x, SAMP_MAX / k))
#define C_FIXDIV(c, div) \
do { \
DIVSCALAR((c).r, div); \
DIVSCALAR((c).i, div); \
} while (0)
#define C_MULBYSCALAR(c, s) \
do { \
(c).r = sround(smul((c).r, s)); \
(c).i = sround(smul((c).i, s)); \
} while (0)
#else /* not FIXED_POINT*/
#define S_MUL(a, b) ((a) * (b))
#define C_MUL(m, a, b) \
do { \
(m).r = (a).r * (b).r - (a).i * (b).i; \
(m).i = (a).r * (b).i + (a).i * (b).r; \
} while (0)
#define C_MUL4(m, a, b) C_MUL(m, a, b)
#define C_FIXDIV(c, div) /* NOOP */
#define C_MULBYSCALAR(c, s) \
do { \
(c).r *= (s); \
(c).i *= (s); \
} while (0)
#endif
#ifndef CHECK_OVERFLOW_OP
#define CHECK_OVERFLOW_OP(a, op, b) /* noop */
#endif
#define C_ADD(res, a, b) \
do { \
CHECK_OVERFLOW_OP((a).r, +, (b).r) \
CHECK_OVERFLOW_OP((a).i, +, (b).i) \
(res).r = (a).r + (b).r; \
(res).i = (a).i + (b).i; \
} while (0)
#define C_SUB(res, a, b) \
do { \
CHECK_OVERFLOW_OP((a).r, -, (b).r) \
CHECK_OVERFLOW_OP((a).i, -, (b).i) \
(res).r = (a).r - (b).r; \
(res).i = (a).i - (b).i; \
} while (0)
#define C_ADDTO(res, a) \
do { \
CHECK_OVERFLOW_OP((res).r, +, (a).r) \
CHECK_OVERFLOW_OP((res).i, +, (a).i) \
(res).r += (a).r; \
(res).i += (a).i; \
} while (0)
#define C_SUBFROM(res, a) \
do { \
CHECK_OVERFLOW_OP((res).r, -, (a).r) \
CHECK_OVERFLOW_OP((res).i, -, (a).i) \
(res).r -= (a).r; \
(res).i -= (a).i; \
} while (0)
#ifdef FIXED_POINT
#define KISS_FFT_COS(phase) floor(MIN(32767, MAX(-32767, .5 + 32768 * cos(phase))))
#define KISS_FFT_SIN(phase) floor(MIN(32767, MAX(-32767, .5 + 32768 * sin(phase))))
#define HALF_OF(x) ((x) >> 1)
#elif defined(USE_SIMD)
#define KISS_FFT_COS(phase) _mm_set1_ps(cos(phase))
#define KISS_FFT_SIN(phase) _mm_set1_ps(sin(phase))
#define HALF_OF(x) ((x) * _mm_set1_ps(.5))
#else
#define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
#define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
#define HALF_OF(x) ((x) * .5)
#endif
#define kf_cexp(x, phase) \
do { \
(x)->r = KISS_FFT_COS(phase); \
(x)->i = KISS_FFT_SIN(phase); \
} while (0)
#define kf_cexp2(x, phase) \
do { \
(x)->r = spx_cos_norm((phase)); \
(x)->i = spx_cos_norm((phase) - 32768); \
} while (0)
/* a debugging function */
#define pcpx(c) fprintf(stderr, "%g + %gi\n", (double)((c)->r), (double)((c)->i))

View File

@@ -0,0 +1,228 @@
/* Copyright (C) 2003 Jean-Marc Valin */
/**
@file arch.h
@brief Various architecture definitions Speex
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCH_H
#define ARCH_H
#ifndef SPEEX_VERSION
#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
#define SPEEX_MINOR_VERSION 2 /**< Minor Speex version. */
#define SPEEX_MICRO_VERSION 1 /**< Micro Speex version. */
#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
#define SPEEX_VERSION "speex-1.2.1" /**< Speex version string. */
#endif
/* A couple test to catch stupid option combinations */
#ifdef FIXED_POINT
#ifdef FLOATING_POINT
#error You cannot compile as floating point and fixed point at the same time
#endif
#ifdef _USE_SSE
#error SSE is only for floating-point
#endif
#if ((defined(ARM4_ASM) || defined(ARM4_ASM)) && defined(BFIN_ASM)) || (defined(ARM4_ASM) && defined(ARM5E_ASM))
#error Make up your mind. What CPU do you have?
#endif
#ifdef VORBIS_PSYCHO
#error Vorbis-psy model currently not implemented in fixed-point
#endif
#else
#ifndef FLOATING_POINT
#error You now need to define either FIXED_POINT or FLOATING_POINT
#endif
#if defined(ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
#endif
#ifdef FIXED_POINT_DEBUG
#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
#endif
#endif
#include "speex/speex_types.h"
#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
#define MIN16(a, b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
#define MAX16(a, b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */
#define MIN32(a, b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */
#define MAX32(a, b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */
#ifdef FIXED_POINT
typedef spx_int16_t spx_word16_t;
typedef spx_int32_t spx_word32_t;
typedef spx_word32_t spx_mem_t;
typedef spx_word16_t spx_coef_t;
typedef spx_word16_t spx_lsp_t;
typedef spx_word32_t spx_sig_t;
#define Q15ONE 32767
#define LPC_SCALING 8192
#define SIG_SCALING 16384
#define LSP_SCALING 8192.
#define GAMMA_SCALING 32768.
#define GAIN_SCALING 64
#define GAIN_SCALING_1 0.015625
#define LPC_SHIFT 13
#define LSP_SHIFT 13
#define SIG_SHIFT 14
#define GAIN_SHIFT 6
#define VERY_SMALL 0
#define VERY_LARGE32 ((spx_word32_t)2147483647)
#define VERY_LARGE16 ((spx_word16_t)32767)
#define Q15_ONE ((spx_word16_t)32767)
#ifdef FIXED_DEBUG
#include "fixed_debug.h"
#else
#include "fixed_generic.h"
#ifdef ARM5E_ASM
#include "fixed_arm5e.h"
#elif defined(ARM4_ASM)
#include "fixed_arm4.h"
#elif defined(BFIN_ASM)
#include "fixed_bfin.h"
#endif
#endif
#else
typedef float spx_mem_t;
typedef float spx_coef_t;
typedef float spx_lsp_t;
typedef float spx_sig_t;
typedef float spx_word16_t;
typedef float spx_word32_t;
#define Q15ONE 1.0f
#define LPC_SCALING 1.f
#define SIG_SCALING 1.f
#define LSP_SCALING 1.f
#define GAMMA_SCALING 1.f
#define GAIN_SCALING 1.f
#define GAIN_SCALING_1 1.f
#define VERY_SMALL 1e-15f
#define VERY_LARGE32 1e15f
#define VERY_LARGE16 1e15f
#define Q15_ONE ((spx_word16_t)1.f)
#define QCONST16(x, bits) (x)
#define QCONST32(x, bits) (x)
#define NEG16(x) (-(x))
#define NEG32(x) (-(x))
#define EXTRACT16(x) (x)
#define EXTEND32(x) (x)
#define SHR16(a, shift) (a)
#define SHL16(a, shift) (a)
#define SHR32(a, shift) (a)
#define SHL32(a, shift) (a)
#define PSHR16(a, shift) (a)
#define PSHR32(a, shift) (a)
#define VSHR32(a, shift) (a)
#define SATURATE16(x, a) (x)
#define SATURATE32(x, a) (x)
#define PSHR(a, shift) (a)
#define SHR(a, shift) (a)
#define SHL(a, shift) (a)
#define SATURATE(x, a) (x)
#define ADD16(a, b) ((a) + (b))
#define SUB16(a, b) ((a) - (b))
#define ADD32(a, b) ((a) + (b))
#define SUB32(a, b) ((a) - (b))
#define MULT16_16_16(a, b) ((a) * (b))
#define MULT16_16(a, b) ((spx_word32_t)(a) * (spx_word32_t)(b))
#define MAC16_16(c, a, b) ((c) + (spx_word32_t)(a) * (spx_word32_t)(b))
#define MULT16_32_Q11(a, b) ((a) * (b))
#define MULT16_32_Q13(a, b) ((a) * (b))
#define MULT16_32_Q14(a, b) ((a) * (b))
#define MULT16_32_Q15(a, b) ((a) * (b))
#define MULT16_32_P15(a, b) ((a) * (b))
#define MAC16_32_Q11(c, a, b) ((c) + (a) * (b))
#define MAC16_32_Q15(c, a, b) ((c) + (a) * (b))
#define MAC16_16_Q11(c, a, b) ((c) + (a) * (b))
#define MAC16_16_Q13(c, a, b) ((c) + (a) * (b))
#define MAC16_16_P13(c, a, b) ((c) + (a) * (b))
#define MULT16_16_Q11_32(a, b) ((a) * (b))
#define MULT16_16_Q13(a, b) ((a) * (b))
#define MULT16_16_Q14(a, b) ((a) * (b))
#define MULT16_16_Q15(a, b) ((a) * (b))
#define MULT16_16_P15(a, b) ((a) * (b))
#define MULT16_16_P13(a, b) ((a) * (b))
#define MULT16_16_P14(a, b) ((a) * (b))
#define DIV32_16(a, b) (((spx_word32_t)(a)) / (spx_word16_t)(b))
#define PDIV32_16(a, b) (((spx_word32_t)(a)) / (spx_word16_t)(b))
#define DIV32(a, b) (((spx_word32_t)(a)) / (spx_word32_t)(b))
#define PDIV32(a, b) (((spx_word32_t)(a)) / (spx_word32_t)(b))
#endif
#if defined(CONFIG_TI_C54X) || defined(CONFIG_TI_C55X)
/* 2 on TI C5x DSP */
#define BYTES_PER_CHAR 2
#define BITS_PER_CHAR 16
#define LOG2_BITS_PER_CHAR 4
#else
#define BYTES_PER_CHAR 1
#define BITS_PER_CHAR 8
#define LOG2_BITS_PER_CHAR 3
#endif
#ifdef FIXED_DEBUG
extern long long spx_mips;
#endif
#endif

View File

@@ -0,0 +1,15 @@
/* Common Blackfin assembly defines
*
* Copyright (C) 2005-2009 Analog Devices
*/
#if __GNUC__ <= 3
/* GCC-3.4 and older did not use hardware loops and thus did not have
* register constraints for declaring clobbers.
*/
#define BFIN_HWLOOP0_REGS
#define BFIN_HWLOOP1_REGS
#else
#define BFIN_HWLOOP0_REGS , "LB0", "LT0", "LC0"
#define BFIN_HWLOOP1_REGS , "LB1", "LT1", "LC1"
#endif

View File

@@ -0,0 +1,375 @@
/* Copyright (C) 2002 Jean-Marc Valin
File: speex_bits.c
Handles bit packing/unpacking
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "speex/speex_bits.h"
#include "arch.h"
#include "os_support.h"
/* Maximum size of the bit-stream (for fixed-size allocation) */
#ifndef MAX_CHARS_PER_FRAME
#define MAX_CHARS_PER_FRAME (2000 / BYTES_PER_CHAR)
#endif
EXPORT void speex_bits_init(SpeexBits *bits)
{
bits->chars = (char *)speex_alloc(MAX_CHARS_PER_FRAME);
if (!bits->chars) {
return;
}
bits->buf_size = MAX_CHARS_PER_FRAME;
bits->owner = 1;
speex_bits_reset(bits);
}
EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
{
bits->chars = (char *)buff;
bits->buf_size = buf_size;
bits->owner = 0;
speex_bits_reset(bits);
}
EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
{
bits->chars = (char *)buff;
bits->buf_size = buf_size;
bits->owner = 0;
bits->nbBits = buf_size << LOG2_BITS_PER_CHAR;
bits->charPtr = 0;
bits->bitPtr = 0;
bits->overflow = 0;
}
EXPORT void speex_bits_destroy(SpeexBits *bits)
{
if (bits->owner) {
speex_free(bits->chars);
}
/* Will do something once the allocation is dynamic */
}
EXPORT void speex_bits_reset(SpeexBits *bits)
{
/* We only need to clear the first byte now */
bits->chars[0] = 0;
bits->nbBits = 0;
bits->charPtr = 0;
bits->bitPtr = 0;
bits->overflow = 0;
}
EXPORT void speex_bits_rewind(SpeexBits *bits)
{
bits->charPtr = 0;
bits->bitPtr = 0;
bits->overflow = 0;
}
EXPORT void speex_bits_read_from(SpeexBits *bits, const char *chars, int len)
{
int i;
int nchars = len / BYTES_PER_CHAR;
if (nchars > bits->buf_size) {
speex_notify("Packet is larger than allocated buffer");
if (bits->owner) {
char *tmp = (char *)speex_realloc(bits->chars, nchars);
if (tmp) {
bits->buf_size = nchars;
bits->chars = tmp;
} else {
nchars = bits->buf_size;
speex_warning("Could not resize input buffer: truncating input");
}
} else {
speex_warning("Do not own input buffer: truncating oversize input");
nchars = bits->buf_size;
}
}
#if (BYTES_PER_CHAR == 2)
/* Swap bytes to proper endian order (could be done externally) */
#define HTOLS(A) ((((A) >> 8) & 0xff) | (((A) & 0xff) << 8))
#else
#define HTOLS(A) (A)
#endif
for (i = 0; i < nchars; i++) {
bits->chars[i] = HTOLS(chars[i]);
}
bits->nbBits = nchars << LOG2_BITS_PER_CHAR;
bits->charPtr = 0;
bits->bitPtr = 0;
bits->overflow = 0;
}
static void speex_bits_flush(SpeexBits *bits)
{
int nchars = ((bits->nbBits + BITS_PER_CHAR - 1) >> LOG2_BITS_PER_CHAR);
if (bits->charPtr > 0) {
SPEEX_MOVE(bits->chars, &bits->chars[bits->charPtr], nchars - bits->charPtr);
}
bits->nbBits -= bits->charPtr << LOG2_BITS_PER_CHAR;
bits->charPtr = 0;
}
EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, const char *chars, int nbytes)
{
int i, pos;
int nchars = nbytes / BYTES_PER_CHAR;
if (((bits->nbBits + BITS_PER_CHAR - 1) >> LOG2_BITS_PER_CHAR) + nchars > bits->buf_size) {
/* Packet is larger than allocated buffer */
if (bits->owner) {
char *tmp =
(char *)speex_realloc(bits->chars, (bits->nbBits >> LOG2_BITS_PER_CHAR) + nchars + 1);
if (tmp) {
bits->buf_size = (bits->nbBits >> LOG2_BITS_PER_CHAR) + nchars + 1;
bits->chars = tmp;
} else {
nchars = bits->buf_size - (bits->nbBits >> LOG2_BITS_PER_CHAR) - 1;
speex_warning("Could not resize input buffer: truncating oversize input");
}
} else {
speex_warning("Do not own input buffer: truncating oversize input");
nchars = bits->buf_size;
}
}
speex_bits_flush(bits);
pos = bits->nbBits >> LOG2_BITS_PER_CHAR;
for (i = 0; i < nchars; i++) {
bits->chars[pos + i] = HTOLS(chars[i]);
}
bits->nbBits += nchars << LOG2_BITS_PER_CHAR;
}
EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
{
int i;
int max_nchars = max_nbytes / BYTES_PER_CHAR;
int charPtr, bitPtr, nbBits;
/* Insert terminator, but save the data so we can put it back after */
bitPtr = bits->bitPtr;
charPtr = bits->charPtr;
nbBits = bits->nbBits;
speex_bits_insert_terminator(bits);
bits->bitPtr = bitPtr;
bits->charPtr = charPtr;
bits->nbBits = nbBits;
if (max_nchars > ((bits->nbBits + BITS_PER_CHAR - 1) >> LOG2_BITS_PER_CHAR)) {
max_nchars = ((bits->nbBits + BITS_PER_CHAR - 1) >> LOG2_BITS_PER_CHAR);
}
for (i = 0; i < max_nchars; i++) {
chars[i] = HTOLS(bits->chars[i]);
}
return max_nchars * BYTES_PER_CHAR;
}
EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
{
int max_nchars = max_nbytes / BYTES_PER_CHAR;
int i;
if (max_nchars > ((bits->nbBits) >> LOG2_BITS_PER_CHAR)) {
max_nchars = ((bits->nbBits) >> LOG2_BITS_PER_CHAR);
}
for (i = 0; i < max_nchars; i++) {
chars[i] = HTOLS(bits->chars[i]);
}
if (bits->bitPtr > 0) {
bits->chars[0] = bits->chars[max_nchars];
} else {
bits->chars[0] = 0;
}
bits->charPtr = 0;
bits->nbBits &= (BITS_PER_CHAR - 1);
return max_nchars * BYTES_PER_CHAR;
}
EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
{
unsigned int d = data;
if (bits->charPtr + ((nbBits + bits->bitPtr) >> LOG2_BITS_PER_CHAR) >= bits->buf_size) {
speex_notify("Buffer too small to pack bits");
if (bits->owner) {
int new_nchars = ((bits->buf_size + 5) * 3) >> 1;
char *tmp = (char *)speex_realloc(bits->chars, new_nchars);
if (tmp) {
bits->buf_size = new_nchars;
bits->chars = tmp;
} else {
speex_warning("Could not resize input buffer: not packing");
return;
}
} else {
speex_warning("Do not own input buffer: not packing");
return;
}
}
while (nbBits) {
int bit;
bit = (d >> (nbBits - 1)) & 1;
bits->chars[bits->charPtr] |= bit << (BITS_PER_CHAR - 1 - bits->bitPtr);
bits->bitPtr++;
if (bits->bitPtr == BITS_PER_CHAR) {
bits->bitPtr = 0;
bits->charPtr++;
bits->chars[bits->charPtr] = 0;
}
bits->nbBits++;
nbBits--;
}
}
EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
{
unsigned int d = speex_bits_unpack_unsigned(bits, nbBits);
/* If number is negative */
if (d >> (nbBits - 1)) {
d |= (-1) << nbBits;
}
return d;
}
EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
{
unsigned int d = 0;
if ((bits->charPtr << LOG2_BITS_PER_CHAR) + bits->bitPtr + nbBits > bits->nbBits) {
bits->overflow = 1;
}
if (bits->overflow) {
return 0;
}
while (nbBits) {
d <<= 1;
d |= (bits->chars[bits->charPtr] >> (BITS_PER_CHAR - 1 - bits->bitPtr)) & 1;
bits->bitPtr++;
if (bits->bitPtr == BITS_PER_CHAR) {
bits->bitPtr = 0;
bits->charPtr++;
}
nbBits--;
}
return d;
}
EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
{
unsigned int d = 0;
int bitPtr, charPtr;
char *chars;
if ((bits->charPtr << LOG2_BITS_PER_CHAR) + bits->bitPtr + nbBits > bits->nbBits) {
bits->overflow = 1;
}
if (bits->overflow) {
return 0;
}
bitPtr = bits->bitPtr;
charPtr = bits->charPtr;
chars = bits->chars;
while (nbBits) {
d <<= 1;
d |= (chars[charPtr] >> (BITS_PER_CHAR - 1 - bitPtr)) & 1;
bitPtr++;
if (bitPtr == BITS_PER_CHAR) {
bitPtr = 0;
charPtr++;
}
nbBits--;
}
return d;
}
EXPORT int speex_bits_peek(SpeexBits *bits)
{
if ((bits->charPtr << LOG2_BITS_PER_CHAR) + bits->bitPtr + 1 > bits->nbBits) {
bits->overflow = 1;
}
if (bits->overflow) {
return 0;
}
return (bits->chars[bits->charPtr] >> (BITS_PER_CHAR - 1 - bits->bitPtr)) & 1;
}
EXPORT void speex_bits_advance(SpeexBits *bits, int n)
{
if (((bits->charPtr << LOG2_BITS_PER_CHAR) + bits->bitPtr + n > bits->nbBits) || bits->overflow) {
bits->overflow = 1;
return;
}
bits->charPtr += (bits->bitPtr + n) >> LOG2_BITS_PER_CHAR; /* divide by BITS_PER_CHAR */
bits->bitPtr = (bits->bitPtr + n) & (BITS_PER_CHAR - 1); /* modulo by BITS_PER_CHAR */
}
EXPORT int speex_bits_remaining(SpeexBits *bits)
{
if (bits->overflow) {
return -1;
} else {
return bits->nbBits - ((bits->charPtr << LOG2_BITS_PER_CHAR) + bits->bitPtr);
}
}
EXPORT int speex_bits_nbytes(SpeexBits *bits)
{
return ((bits->nbBits + BITS_PER_CHAR - 1) >> LOG2_BITS_PER_CHAR);
}
EXPORT void speex_bits_insert_terminator(SpeexBits *bits)
{
if (bits->bitPtr) {
speex_bits_pack(bits, 0, 1);
}
while (bits->bitPtr) {
speex_bits_pack(bits, 1, 1);
}
}

View File

@@ -0,0 +1,608 @@
/* Copyright (C) 2002-2006 Jean-Marc Valin
File: cb_search.c
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cb_search.h"
#include "filters.h"
#include "stack_alloc.h"
#include "vq.h"
#include "arch.h"
#include "math_approx.h"
#include "os_support.h"
#ifdef _USE_SSE
#include "cb_search_sse.h"
#elif defined(ARM4_ASM) || defined(ARM5E_ASM)
#include "cb_search_arm4.h"
#elif defined(BFIN_ASM)
#include "cb_search_bfin.h"
#endif
#ifndef DISABLE_ENCODER
#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp,
spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size,
char *stack)
{
int i, j, k;
VARDECL(spx_word16_t * shape);
ALLOC(shape, subvect_size, spx_word16_t);
for (i = 0; i < shape_cb_size; i++) {
spx_word16_t *res;
res = resp + i * subvect_size;
for (k = 0; k < subvect_size; k++) {
shape[k] = (spx_word16_t)shape_cb[i * subvect_size + k];
}
E[i] = 0;
/* Compute codeword response using convolution with impulse response */
for (j = 0; j < subvect_size; j++) {
spx_word32_t resj = 0;
spx_word16_t res16;
for (k = 0; k <= j; k++) {
resj = MAC16_16(resj, shape[k], r[j - k]);
}
#ifdef FIXED_POINT
res16 = EXTRACT16(SHR32(resj, 13));
#else
res16 = 0.03125f * resj;
#endif
/* Compute codeword energy */
E[i] = MAC16_16(E[i], res16, res16);
res[j] = res16;
/*printf ("%d\n", (int)res[j]);*/
}
}
}
#endif
#ifndef OVERRIDE_TARGET_UPDATE
static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
{
int n;
for (n = 0; n < len; n++) {
t[n] = SUB16(t[n], PSHR32(MULT16_16(g, r[n]), 13));
}
}
#endif
static void split_cb_search_shape_sign_N1(spx_word16_t target[], /* target vector */
spx_coef_t ak[], /* LPCs for this subframe */
spx_coef_t awk1[], /* Weighted LPCs for this subframe */
spx_coef_t awk2[], /* Weighted LPCs for this subframe */
const void *par, /* Codebook/search parameters*/
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc, spx_word16_t *r, SpeexBits *bits, char *stack,
int update_target)
{
int i, j, m, q;
VARDECL(spx_word16_t * resp);
#ifdef _USE_SSE
VARDECL(__m128 * resp2);
VARDECL(__m128 * E);
#else
spx_word16_t *resp2;
VARDECL(spx_word32_t * E);
#endif
VARDECL(spx_word16_t * t);
VARDECL(spx_sig_t * e);
const signed char *shape_cb;
int shape_cb_size, subvect_size, nb_subvect;
const split_cb_params *params;
int best_index;
spx_word32_t best_dist;
int have_sign;
params = (const split_cb_params *)par;
subvect_size = params->subvect_size;
nb_subvect = params->nb_subvect;
shape_cb_size = 1 << params->shape_bits;
shape_cb = params->shape_cb;
have_sign = params->have_sign;
ALLOC(resp, shape_cb_size * subvect_size, spx_word16_t);
#ifdef _USE_SSE
ALLOC(resp2, (shape_cb_size * subvect_size) >> 2, __m128);
ALLOC(E, shape_cb_size >> 2, __m128);
#else
resp2 = resp;
ALLOC(E, shape_cb_size, spx_word32_t);
#endif
ALLOC(t, nsf, spx_word16_t);
ALLOC(e, nsf, spx_sig_t);
/* FIXME: Do we still need to copy the target? */
SPEEX_COPY(t, target, nsf);
compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
for (i = 0; i < nb_subvect; i++) {
spx_word16_t *x = t + subvect_size * i;
/*Find new n-best based on previous n-best j*/
#ifndef DISABLE_WIDEBAND
if (have_sign) {
vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
} else
#endif /* DISABLE_WIDEBAND */
vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
speex_bits_pack(bits, best_index, params->shape_bits + have_sign);
{
int rind;
spx_word16_t *res;
spx_word16_t sign = 1;
rind = best_index;
if (rind >= shape_cb_size) {
sign = -1;
rind -= shape_cb_size;
}
res = resp + rind * subvect_size;
if (sign > 0) {
for (m = 0; m < subvect_size; m++) {
t[subvect_size * i + m] = SUB16(t[subvect_size * i + m], res[m]);
}
} else {
for (m = 0; m < subvect_size; m++) {
t[subvect_size * i + m] = ADD16(t[subvect_size * i + m], res[m]);
}
}
#ifdef FIXED_POINT
if (sign == 1) {
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] =
SHL32(EXTEND32(shape_cb[rind * subvect_size + j]), SIG_SHIFT - 5);
}
} else {
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] = NEG32(
SHL32(EXTEND32(shape_cb[rind * subvect_size + j]), SIG_SHIFT - 5));
}
}
#else
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] = sign * 0.03125 * shape_cb[rind * subvect_size + j];
}
#endif
}
for (m = 0; m < subvect_size; m++) {
spx_word16_t g;
int rind;
spx_word16_t sign = 1;
rind = best_index;
if (rind >= shape_cb_size) {
sign = -1;
rind -= shape_cb_size;
}
q = subvect_size - m;
#ifdef FIXED_POINT
g = sign * shape_cb[rind * subvect_size + m];
#else
g = sign * 0.03125 * shape_cb[rind * subvect_size + m];
#endif
target_update(t + subvect_size * (i + 1), g, r + q, nsf - subvect_size * (i + 1));
}
}
/* Update excitation */
/* FIXME: We could update the excitation directly above */
for (j = 0; j < nsf; j++) {
exc[j] = ADD32(exc[j], e[j]);
}
/* Update target: only update target if necessary */
if (update_target) {
VARDECL(spx_word16_t * r2);
ALLOC(r2, nsf, spx_word16_t);
for (j = 0; j < nsf; j++) {
r2[j] = EXTRACT16(PSHR32(e[j], 6));
}
syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf, p, stack);
for (j = 0; j < nsf; j++) {
target[j] = SUB16(target[j], PSHR16(r2[j], 2));
}
}
}
void split_cb_search_shape_sign(spx_word16_t target[], /* target vector */
spx_coef_t ak[], /* LPCs for this subframe */
spx_coef_t awk1[], /* Weighted LPCs for this subframe */
spx_coef_t awk2[], /* Weighted LPCs for this subframe */
const void *par, /* Codebook/search parameters*/
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc, spx_word16_t *r, SpeexBits *bits, char *stack, int complexity,
int update_target)
{
int i, j, k, m, n, q;
VARDECL(spx_word16_t * resp);
#ifdef _USE_SSE
VARDECL(__m128 * resp2);
VARDECL(__m128 * E);
#else
spx_word16_t *resp2;
VARDECL(spx_word32_t * E);
#endif
VARDECL(spx_word16_t * t);
VARDECL(spx_sig_t * e);
VARDECL(spx_word16_t * tmp);
VARDECL(spx_word32_t * ndist);
VARDECL(spx_word32_t * odist);
VARDECL(int *itmp);
VARDECL(spx_word16_t * *ot2);
VARDECL(spx_word16_t * *nt2);
spx_word16_t **ot, **nt;
VARDECL(int **nind);
VARDECL(int **oind);
VARDECL(int *ind);
const signed char *shape_cb;
int shape_cb_size, subvect_size, nb_subvect;
const split_cb_params *params;
int N = 2;
VARDECL(int *best_index);
VARDECL(spx_word32_t * best_dist);
VARDECL(int *best_nind);
VARDECL(int *best_ntarget);
int have_sign;
N = complexity;
if (N > 10) {
N = 10;
}
/* Complexity isn't as important for the codebooks as it is for the pitch */
N = (2 * N) / 3;
if (N < 1) {
N = 1;
}
if (N == 1) {
split_cb_search_shape_sign_N1(target, ak, awk1, awk2, par, p, nsf, exc, r, bits, stack, update_target);
return;
}
ALLOC(ot2, N, spx_word16_t *);
ALLOC(nt2, N, spx_word16_t *);
ALLOC(oind, N, int *);
ALLOC(nind, N, int *);
params = (const split_cb_params *)par;
subvect_size = params->subvect_size;
nb_subvect = params->nb_subvect;
shape_cb_size = 1 << params->shape_bits;
shape_cb = params->shape_cb;
have_sign = params->have_sign;
ALLOC(resp, shape_cb_size * subvect_size, spx_word16_t);
#ifdef _USE_SSE
ALLOC(resp2, (shape_cb_size * subvect_size) >> 2, __m128);
ALLOC(E, shape_cb_size >> 2, __m128);
#else
resp2 = resp;
ALLOC(E, shape_cb_size, spx_word32_t);
#endif
ALLOC(t, nsf, spx_word16_t);
ALLOC(e, nsf, spx_sig_t);
ALLOC(ind, nb_subvect, int);
ALLOC(tmp, 2 * N * nsf, spx_word16_t);
for (i = 0; i < N; i++) {
ot2[i] = tmp + 2 * i * nsf;
nt2[i] = tmp + (2 * i + 1) * nsf;
}
ot = ot2;
nt = nt2;
ALLOC(best_index, N, int);
ALLOC(best_dist, N, spx_word32_t);
ALLOC(best_nind, N, int);
ALLOC(best_ntarget, N, int);
ALLOC(ndist, N, spx_word32_t);
ALLOC(odist, N, spx_word32_t);
ALLOC(itmp, 2 * N * nb_subvect, int);
for (i = 0; i < N; i++) {
nind[i] = itmp + 2 * i * nb_subvect;
oind[i] = itmp + (2 * i + 1) * nb_subvect;
}
SPEEX_COPY(t, target, nsf);
for (j = 0; j < N; j++) {
SPEEX_COPY(&ot[j][0], t, nsf);
}
/* Pre-compute codewords response and energy */
compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
for (j = 0; j < N; j++) {
odist[j] = 0;
}
/*For all subvectors*/
for (i = 0; i < nb_subvect; i++) {
/*"erase" nbest list*/
for (j = 0; j < N; j++) {
ndist[j] = VERY_LARGE32;
}
/* This is not strictly necessary, but it provides an additonal safety
to prevent crashes in case something goes wrong in the previous
steps (e.g. NaNs) */
for (j = 0; j < N; j++) {
best_nind[j] = best_ntarget[j] = 0;
}
/*For all n-bests of previous subvector*/
for (j = 0; j < N; j++) {
spx_word16_t *x = ot[j] + subvect_size * i;
spx_word32_t tener = 0;
for (m = 0; m < subvect_size; m++) {
tener = MAC16_16(tener, x[m], x[m]);
}
#ifdef FIXED_POINT
tener = SHR32(tener, 1);
#else
tener *= .5;
#endif
/*Find new n-best based on previous n-best j*/
#ifndef DISABLE_WIDEBAND
if (have_sign) {
vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist,
stack);
} else
#endif /* DISABLE_WIDEBAND */
vq_nbest(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack);
/*For all new n-bests*/
for (k = 0; k < N; k++) {
/* Compute total distance (including previous sub-vectors */
spx_word32_t err = ADD32(ADD32(odist[j], best_dist[k]), tener);
/*update n-best list*/
if (err < ndist[N - 1]) {
for (m = 0; m < N; m++) {
if (err < ndist[m]) {
for (n = N - 1; n > m; n--) {
ndist[n] = ndist[n - 1];
best_nind[n] = best_nind[n - 1];
best_ntarget[n] = best_ntarget[n - 1];
}
/* n is equal to m here, so they're interchangeable */
ndist[m] = err;
best_nind[n] = best_index[k];
best_ntarget[n] = j;
break;
}
}
}
}
if (i == 0) {
break;
}
}
for (j = 0; j < N; j++) {
/*previous target (we don't care what happened before*/
for (m = (i + 1) * subvect_size; m < nsf; m++) {
nt[j][m] = ot[best_ntarget[j]][m];
}
/* New code: update the rest of the target only if it's worth it */
for (m = 0; m < subvect_size; m++) {
spx_word16_t g;
int rind;
spx_word16_t sign = 1;
rind = best_nind[j];
if (rind >= shape_cb_size) {
sign = -1;
rind -= shape_cb_size;
}
q = subvect_size - m;
#ifdef FIXED_POINT
g = sign * shape_cb[rind * subvect_size + m];
#else
g = sign * 0.03125 * shape_cb[rind * subvect_size + m];
#endif
target_update(nt[j] + subvect_size * (i + 1), g, r + q, nsf - subvect_size * (i + 1));
}
for (q = 0; q < nb_subvect; q++) {
nind[j][q] = oind[best_ntarget[j]][q];
}
nind[j][i] = best_nind[j];
}
/*update old-new data*/
/* just swap pointers instead of a long copy */
{
spx_word16_t **tmp2;
tmp2 = ot;
ot = nt;
nt = tmp2;
}
for (j = 0; j < N; j++) {
for (m = 0; m < nb_subvect; m++) {
oind[j][m] = nind[j][m];
}
}
for (j = 0; j < N; j++) {
odist[j] = ndist[j];
}
}
/*save indices*/
for (i = 0; i < nb_subvect; i++) {
ind[i] = nind[0][i];
speex_bits_pack(bits, ind[i], params->shape_bits + have_sign);
}
/* Put everything back together */
for (i = 0; i < nb_subvect; i++) {
int rind;
spx_word16_t sign = 1;
rind = ind[i];
if (rind >= shape_cb_size) {
sign = -1;
rind -= shape_cb_size;
}
#ifdef FIXED_POINT
if (sign == 1) {
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] =
SHL32(EXTEND32(shape_cb[rind * subvect_size + j]), SIG_SHIFT - 5);
}
} else {
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] =
NEG32(SHL32(EXTEND32(shape_cb[rind * subvect_size + j]), SIG_SHIFT - 5));
}
}
#else
for (j = 0; j < subvect_size; j++) {
e[subvect_size * i + j] = sign * 0.03125 * shape_cb[rind * subvect_size + j];
}
#endif
}
/* Update excitation */
for (j = 0; j < nsf; j++) {
exc[j] = ADD32(exc[j], e[j]);
}
/* Update target: only update target if necessary */
if (update_target) {
VARDECL(spx_word16_t * r2);
ALLOC(r2, nsf, spx_word16_t);
for (j = 0; j < nsf; j++) {
r2[j] = EXTRACT16(PSHR32(e[j], 6));
}
syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf, p, stack);
for (j = 0; j < nsf; j++) {
target[j] = SUB16(target[j], PSHR16(r2[j], 2));
}
}
}
#endif /* DISABLE_ENCODER */
#ifndef DISABLE_DECODER
void split_cb_shape_sign_unquant(spx_sig_t *exc, const void *par, /* non-overlapping codebook */
int nsf, /* number of samples in subframe */
SpeexBits *bits, char *stack, spx_uint32_t *seed)
{
int i, j;
VARDECL(int *ind);
VARDECL(int *signs);
const signed char *shape_cb;
int subvect_size, nb_subvect;
const split_cb_params *params;
int have_sign;
params = (const split_cb_params *)par;
subvect_size = params->subvect_size;
nb_subvect = params->nb_subvect;
shape_cb = params->shape_cb;
have_sign = params->have_sign;
ALLOC(ind, nb_subvect, int);
ALLOC(signs, nb_subvect, int);
/* Decode codewords and gains */
for (i = 0; i < nb_subvect; i++) {
if (have_sign) {
signs[i] = speex_bits_unpack_unsigned(bits, 1);
} else {
signs[i] = 0;
}
ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
}
/* Compute decoded excitation */
for (i = 0; i < nb_subvect; i++) {
spx_word16_t s = 1;
if (signs[i]) {
s = -1;
}
#ifdef FIXED_POINT
if (s == 1) {
for (j = 0; j < subvect_size; j++) {
exc[subvect_size * i + j] =
SHL32(EXTEND32(shape_cb[ind[i] * subvect_size + j]), SIG_SHIFT - 5);
}
} else {
for (j = 0; j < subvect_size; j++) {
exc[subvect_size * i + j] =
NEG32(SHL32(EXTEND32(shape_cb[ind[i] * subvect_size + j]), SIG_SHIFT - 5));
}
}
#else
for (j = 0; j < subvect_size; j++) {
exc[subvect_size * i + j] += s * 0.03125 * shape_cb[ind[i] * subvect_size + j];
}
#endif
}
}
#endif /* DISABLE_DECODER */
#ifndef DISABLE_ENCODER
void noise_codebook_quant(spx_word16_t target[], /* target vector */
spx_coef_t ak[], /* LPCs for this subframe */
spx_coef_t awk1[], /* Weighted LPCs for this subframe */
spx_coef_t awk2[], /* Weighted LPCs for this subframe */
const void *par, /* Codebook/search parameters*/
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc, spx_word16_t *r, SpeexBits *bits, char *stack, int complexity,
int update_target)
{
int i;
VARDECL(spx_word16_t * tmp);
ALLOC(tmp, nsf, spx_word16_t);
residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack);
for (i = 0; i < nsf; i++) {
exc[i] += SHL32(EXTEND32(tmp[i]), 8);
}
SPEEX_MEMSET(target, 0, nsf);
}
#endif /* DISABLE_ENCODER */
#ifndef DISABLE_DECODER
void noise_codebook_unquant(spx_sig_t *exc, const void *par, /* non-overlapping codebook */
int nsf, /* number of samples in subframe */
SpeexBits *bits, char *stack, spx_uint32_t *seed)
{
int i;
/* FIXME: This is bad, but I don't think the function ever gets called anyway */
for (i = 0; i < nsf; i++) {
exc[i] = SHL32(EXTEND32(speex_rand(1, seed)), SIG_SHIFT);
}
}
#endif /* DISABLE_DECODER */

View File

@@ -0,0 +1,78 @@
/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
/**
@file cb_search.h
@brief Overlapped codebook search
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CB_SEARCH_H
#define CB_SEARCH_H
#include "speex/speex_bits.h"
#include "arch.h"
/** Split codebook parameters. */
typedef struct split_cb_params {
int subvect_size;
int nb_subvect;
const signed char *shape_cb;
int shape_bits;
int have_sign;
} split_cb_params;
void split_cb_search_shape_sign(spx_word16_t target[], /* target vector */
spx_coef_t ak[], /* LPCs for this subframe */
spx_coef_t awk1[], /* Weighted LPCs for this subframe */
spx_coef_t awk2[], /* Weighted LPCs for this subframe */
const void *par, /* Codebook/search parameters */
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc, spx_word16_t *r, SpeexBits *bits, char *stack, int complexity,
int update_target);
void split_cb_shape_sign_unquant(spx_sig_t *exc, const void *par, /* non-overlapping codebook */
int nsf, /* number of samples in subframe */
SpeexBits *bits, char *stack, spx_uint32_t *seed);
void noise_codebook_quant(spx_word16_t target[], /* target vector */
spx_coef_t ak[], /* LPCs for this subframe */
spx_coef_t awk1[], /* Weighted LPCs for this subframe */
spx_coef_t awk2[], /* Weighted LPCs for this subframe */
const void *par, /* Codebook/search parameters */
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc, spx_word16_t *r, SpeexBits *bits, char *stack, int complexity,
int update_target);
void noise_codebook_unquant(spx_sig_t *exc, const void *par, /* non-overlapping codebook */
int nsf, /* number of samples in subframe */
SpeexBits *bits, char *stack, spx_uint32_t *seed);
#endif

View File

@@ -0,0 +1,137 @@
/* Copyright (C) 2004 Jean-Marc Valin */
/**
@file cb_search_arm4.h
@brief Fixed codebook functions (ARM4 version)
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* This optimization is temporaly disabled until it is fixed to account for the fact
that "r" is now a 16-bit array */
#if 0
#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
{
int i, j, k;
//const signed char *shape;
for (i=0;i<shape_cb_size;i+=4)
{
//shape = shape_cb;
E[0]=0;
E[1]=0;
E[2]=0;
E[3]=0;
/* Compute codeword response using convolution with impulse response */
for(j=0;j<subvect_size;j++)
{
#if 1
spx_word16_t *res;
res = resp+j;
spx_word32_t resj0,resj1,resj2,resj3;
spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
__asm__ __volatile__ (
"mov %0, #0 \n\t"
"mov %1, #0 \n\t"
"mov %2, #0 \n\t"
"mov %3, #0 \n\t"
".weighted%=: \n\t"
"ldrsb %8, [%6] \n\t"
"ldr %10, [%5], #-4 \n\t"
"mov %9, %6 \n\t"
"ldrsb %11, [%9, %7]! \n\t"
"mla %0, %10, %8, %0 \n\t"
"ldrsb %8, [%9, %7]! \n\t"
"mla %1, %10, %11, %1 \n\t"
"ldrsb %11, [%9, %7]! \n\t"
"mla %2, %10, %8, %2 \n\t"
"subs %4, %4, #1 \n\t"
"mla %3, %10, %11, %3 \n\t"
"add %6, %6, #1 \n\t"
"bne .weighted%= \n\t"
: "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3),
"=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
"=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8)
: "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size)
: "cc", "memory");
#else
spx_word16_t *res;
res = resp+j;
spx_word32_t resj0=0;
spx_word32_t resj1=0;
spx_word32_t resj2=0;
spx_word32_t resj3=0;
for (k=0;k<=j;k++)
{
const signed char *shape=shape_cb+k;
resj0 = MAC16_16(resj0,*shape,r[j-k]);
shape += subvect_size;
resj1 = MAC16_16(resj1,*shape,r[j-k]);
shape += subvect_size;
resj2 = MAC16_16(resj2,*shape,r[j-k]);
shape += subvect_size;
resj3 = MAC16_16(resj3,*shape,r[j-k]);
shape += subvect_size;
}
#endif
#ifdef FIXED_POINT
resj0 = SHR(resj0, 11);
resj1 = SHR(resj1, 11);
resj2 = SHR(resj2, 11);
resj3 = SHR(resj3, 11);
#else
resj0 *= 0.03125;
resj1 *= 0.03125;
resj2 *= 0.03125;
resj3 *= 0.03125;
#endif
/* Compute codeword energy */
E[0]=ADD32(E[0],MULT16_16(resj0,resj0));
E[1]=ADD32(E[1],MULT16_16(resj1,resj1));
E[2]=ADD32(E[2],MULT16_16(resj2,resj2));
E[3]=ADD32(E[3],MULT16_16(resj3,resj3));
*res = resj0;
res += subvect_size;
*res = resj1;
res += subvect_size;
*res = resj2;
res += subvect_size;
*res = resj3;
res += subvect_size;
}
resp += subvect_size<<2;
shape_cb += subvect_size<<2;
E+=4;
}
}
#endif

View File

@@ -0,0 +1,107 @@
/* Copyright (C) 2005 Analog Devices */
/**
@author Jean-Marc Valin
@file cb_search_bfin.h
@brief Fixed codebook functions (Blackfin version)
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "bfin.h"
#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp,
spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
{
int i;
for (i = 0; i < shape_cb_size; i++) {
__asm__ __volatile__("P0 = %0;\n\t"
"LC0 = P0;\n\t"
"P1 = %1;\n\t"
"P2 = %2;\n\t"
"P3 = %3;\n\t"
"P0 = 1;\n\t"
"L0 = 0;\n\t"
"L1 = 0;\n\t"
"R2 = 0;\n\t"
"A1 = 0;\n\t"
"LOOP outter%= LC0;\n\t"
"LOOP_BEGIN outter%=;\n\t"
"A0 = 0;\n\t"
"P4 = P1;\n\t"
"I1 = P2;\n\t"
"R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
"LOOP inner%= LC1 = P0;\n\t"
"LOOP_BEGIN inner%=;\n\t"
"A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
"LOOP_END inner%=;\n\t"
"R0 = A0;\n\t"
"R0 >>>= 13;\n\t"
"A1 += R0.L*R0.L (IS);\n\t"
"W[P3++] = R0;\n\t"
"P0 += 1;\n\t"
"P2 += 2;\n\t"
"LOOP_END outter%=;\n\t"
"P4 = %4;\n\t"
"R1 = A1;\n\t"
"[P4] = R1;\n\t"
:
: "m"(subvect_size), "m"(shape_cb), "m"(r), "m"(resp), "m"(E)
: "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", "L1",
"A0", "A1", "memory", "ASTAT" BFIN_HWLOOP0_REGS BFIN_HWLOOP1_REGS);
shape_cb += subvect_size;
resp += subvect_size;
E++;
}
}
#define OVERRIDE_TARGET_UPDATE
static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
{
if (!len) {
return;
}
__asm__ __volatile__("I0 = %0;\n\t"
"I1 = %1;\n\t"
"L0 = 0;\n\t"
"L1 = 0;\n\t"
"R2 = 4096;\n\t"
"LOOP tupdate%= LC0 = %3;\n\t"
"LOOP_BEGIN tupdate%=;\n\t"
"R0.L = W[I0] || R1.L = W[I1++];\n\t"
"R1 = (A1 = R1.L*%2.L) (IS);\n\t"
"R1 = R1 + R2;\n\t"
"R1 >>>= 13;\n\t"
"R0.L = R0.L - R1.L;\n\t"
"W[I0++] = R0.L;\n\t"
"LOOP_END tupdate%=;\n\t"
:
: "a"(t), "a"(r), "d"(g), "a"(len)
: "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1", "ASTAT" BFIN_HWLOOP0_REGS);
}

View File

@@ -0,0 +1,86 @@
/* Copyright (C) 2004 Jean-Marc Valin */
/**
@file cb_search_sse.h
@brief Fixed codebook functions (SSE version)
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <xmmintrin.h>
static inline void _spx_mm_getr_ps(__m128 U, float *__Z, float *__Y, float *__X, float *__W)
{
union {
float __a[4];
__m128 __v;
} __u;
__u.__v = U;
*__Z = __u.__a[0];
*__Y = __u.__a[1];
*__X = __u.__a[2];
*__W = __u.__a[3];
}
#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *_r, float *resp, __m128 *resp2,
__m128 *E, int shape_cb_size, int subvect_size, char *stack)
{
int i, j, k;
__m128 resj, EE;
VARDECL(__m128 * r);
VARDECL(__m128 * shape);
ALLOC(r, subvect_size, __m128);
ALLOC(shape, subvect_size, __m128);
for (j = 0; j < subvect_size; j++) {
r[j] = _mm_load_ps1(_r + j);
}
for (i = 0; i < shape_cb_size; i += 4) {
float *_res = resp + i * subvect_size;
const signed char *_shape = shape_cb + i * subvect_size;
EE = _mm_setzero_ps();
for (j = 0; j < subvect_size; j++) {
shape[j] = _mm_setr_ps(0.03125 * _shape[j], 0.03125 * _shape[subvect_size + j],
0.03125 * _shape[2 * subvect_size + j],
0.03125 * _shape[3 * subvect_size + j]);
}
for (j = 0; j < subvect_size; j++) {
resj = _mm_setzero_ps();
for (k = 0; k <= j; k++) {
resj = _mm_add_ps(resj, _mm_mul_ps(shape[k], r[j - k]));
}
_spx_mm_getr_ps(resj, _res + j, _res + subvect_size + j, _res + 2 * subvect_size + j,
_res + 3 * subvect_size + j);
*resp2++ = resj;
EE = _mm_add_ps(EE, _mm_mul_ps(resj, resj));
}
E[i >> 2] = EE;
}
}

View File

@@ -0,0 +1,41 @@
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_16_table.c
Codebook for excitation in narrowband CELP mode (3200 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const signed char exc_10_16_table[160] = {
22, 39, 14, 44, 11, 35, -2, 23, -4, 6, 46, -28, 13, -27, -23, 12, 4, 20, -5, 9,
37, -18, -23, 23, 0, 9, -6, -20, 4, -1, -17, -5, -4, 17, 0, 1, 9, -2, 1, 2,
2, -12, 8, -25, 39, 15, 9, 16, -55, -11, 9, 11, 5, 10, -2, -60, 8, 13, -6, 11,
-16, 27, -47, -12, 11, 1, 16, -7, 9, -3, -29, 9, -14, 25, -19, 34, 36, 12, 40, -10,
-3, -24, -14, -37, -21, -35, -2, -36, 3, -6, 67, 28, 6, -17, -3, -12, -16, -15, -17, -7,
-59, -36, -13, 1, 7, 1, 2, 10, 2, 11, 13, 10, 8, -2, 7, 3, 5, 4, 2, 2,
-3, -8, 4, -5, 6, 7, -42, 15, 35, -2, -46, 38, 28, -20, -9, 1, 7, -3, 0, -2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -15, -28, 52, 32, 5, -5, -17, -20, -10, -1};

View File

@@ -0,0 +1,48 @@
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_32_table.c
Codebook for excitation in narrowband CELP mode (4000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const signed char exc_10_32_table[320] = {
7, 17, 17, 27, 25, 22, 12, 4, -3, 0, 28, -36, 39, -24, -15, 3, -9, 15, -5, 10, 31, -28,
11, 31, -21, 9, -11, -11, -2, -7, -25, 14, -22, 31, 4, -14, 19, -12, 14, -5, 4, -7, 4, -5,
9, 0, -2, 42, -47, -16, 1, 8, 0, 9, 23, -57, 0, 28, -11, 6, -31, 55, -45, 3, -5, 4,
2, -2, 4, -7, -3, 6, -2, 7, -3, 12, 5, 8, 54, -10, 8, -7, -8, -24, -25, -27, -14, -5,
8, 5, 44, 23, 5, -9, -11, -11, -13, -9, -12, -8, -29, -8, -22, 6, -15, 3, -12, -1, -5, -3,
34, -1, 29, -16, 17, -4, 12, 2, 1, 4, -2, -4, 2, -1, 11, -3, -52, 28, 30, -9, -32, 25,
44, -20, -24, 4, 6, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -25, -10, 22, 29,
13, -13, -22, -13, -4, 0, -4, -16, 10, 15, -36, -24, 28, 25, -1, -3, 66, -33, -11, -15, 6, 0,
3, 4, -2, 5, 24, -20, -47, 29, 19, -2, -4, -1, 0, -1, -2, 3, 1, 8, -11, 5, 5, -57,
28, 28, 0, -16, 4, -4, 12, -6, -1, 2, -20, 61, -9, 24, -22, -42, 29, 6, 17, 8, 4, 2,
-65, 15, 8, 10, 5, 6, 5, 3, 2, -2, -3, 5, -9, 4, -5, 23, 13, 23, -3, -63, 3, -5,
-4, -6, 0, -3, 23, -36, -46, 9, 5, 5, 8, 4, 9, -5, 1, -3, 10, 1, -6, 10, -11, 24,
-47, 31, 22, -12, 14, -10, 6, 11, -7, -7, 7, -31, 51, -12, -6, 7, 6, -17, 9, -11, -20, 52,
-19, 3, -6, -6, -8, -5, 23, -41, 37, 1, -21, 10, -14, 8, 7, 5, -15, -15, 23, 39, -26, -33,
7, 2, -32, -30, -21, -8, 4, 12, 17, 15, 14, 11};

View File

@@ -0,0 +1,63 @@
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_20_32_table.c
Codebook for excitation in narrowband CELP mode (2000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const signed char exc_20_32_table[640] = {
12, 32, 25, 46, 36, 33, 9, 14, -3, 6, 1, -8, 0, -10, -5, -7, -7, -7, -5, -5, 31, -27,
24, -32, -4, 10, -11, 21, -3, 19, 23, -9, 22, 24, -10, -1, -10, -13, -7, -11, 42, -33, 31, 19,
-8, 0, -10, -16, 1, -21, -17, 10, -8, 14, 8, 4, 11, -2, 5, -2, -33, 11, -16, 33, 11, -4,
9, -4, 11, 2, 6, -5, 8, -5, 11, -4, -6, 26, -36, -16, 0, 4, -2, -8, 12, 6, -1, 34,
-46, -22, 9, 9, 21, 9, 5, -66, -5, 26, 2, 10, 13, 2, 19, 9, 12, -81, 3, 13, 13, 0,
-14, 22, -35, 6, -7, -4, 6, -6, 10, -6, -31, 38, -33, 0, -10, -11, 5, -12, 12, -17, 5, 0,
-6, 13, -9, 10, 8, 25, 33, 2, -12, 8, -6, 10, -2, 21, 7, 17, 43, 5, 11, -7, -9, -20,
-36, -20, -23, -4, -4, -3, 27, -9, -9, -49, -39, -38, -11, -9, 6, 5, 23, 25, 5, 3, 3, 4,
1, 2, -3, -1, 87, 39, 17, -21, -9, -19, -9, -15, -13, -14, -17, -11, -10, -11, -8, -6, -1, -3,
-3, -1, -54, -34, -27, -8, -11, -4, -5, 0, 0, 4, 8, 6, 9, 7, 9, 7, 6, 5, 5, 5,
48, 10, 19, -10, 12, -1, 9, -3, 2, 5, -3, 2, -2, -2, 0, -2, -26, 6, 9, -7, -16, -9,
2, 7, 7, -5, -43, 11, 22, -11, -9, 34, 37, -15, -13, -6, 1, -1, 1, 1, -64, 56, 52, -11,
-27, 5, 4, 3, 1, 2, 1, 3, -1, -4, -4, -10, -7, -4, -4, 2, -1, -7, -7, -12, -10, -15,
-9, -5, -5, -11, -16, -13, 6, 16, 4, -13, -16, -10, -4, 2, -47, -13, 25, 47, 19, -14, -20, -8,
-17, 0, -3, -13, 1, 6, -17, -14, 15, 1, 10, 6, -24, 0, -10, 19, -69, -8, 14, 49, 17, -5,
33, -29, 3, -4, 0, 2, -8, 5, -6, 2, 120, -56, -12, -47, 23, -9, 6, -5, 1, 2, -5, 1,
-10, 4, -1, -1, 4, -1, 0, -3, 30, -52, -67, 30, 22, 11, -1, -4, 3, 0, 7, 2, 0, 1,
-10, -4, -8, -13, 5, 1, 1, -1, 5, 13, -9, -3, -10, -62, 22, 48, -4, -6, 2, 3, 5, 1,
1, 4, 1, 13, 3, -20, 10, -9, 13, -2, -4, 9, -20, 44, -1, 20, -32, -67, 19, 0, 28, 11,
8, 2, -11, 15, -19, -53, 31, 2, 34, 10, 6, -4, -58, 8, 10, 13, 14, 1, 12, 2, 0, 0,
-128, 37, -8, 44, -9, 26, -3, 18, 2, 6, 11, -1, 9, 1, 5, 3, 0, 1, 1, 2, 12, 3,
-2, -3, 7, 25, 9, 18, -6, -37, 3, -8, -16, 3, -10, -7, 17, -34, -44, 11, 17, -15, -3, -16,
-1, -13, 11, -46, -65, -2, 8, 13, 2, 4, 4, 5, 15, 5, 9, 6, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, 19, -12, 12, -28, 38, 29, -1,
12, 2, 5, 23, -10, 3, 4, -15, 21, -4, 3, 3, 6, 17, -9, -4, -8, -20, 26, 5, -10, 6,
1, -19, 18, -15, -12, 47, -6, -2, -7, -9, -1, -17, -2, -2, -14, 30, -14, 2, -7, -4, -1, -12,
11, -25, 16, -3, -12, 11, -7, 7, -17, 1, 19, -28, 31, -7, -10, 7, -10, 3, 12, 5, -16, 6,
24, 41, -29, -54, 0, 1, 7, -1, 5, -6, 13, 10, -4, -8, 8, -9, -27, -53, -38, -1, 10, 19,
17, 16, 12, 12, 0, 3, -7, -4, 13, 12, -31, -14, 6, -5, 3, 5, 17, 43, 50, 25, 10, 1,
-6, -2};

Some files were not shown because too many files have changed in this diff Show More