Commit 00e7e778 authored by Simon Morlat's avatar Simon Morlat

fix build on linux/arvm7+neon

parent 7babb44d
......@@ -252,11 +252,10 @@ void rotate_down_scale_plane_neon_clockwise(int wDest, int hDest, int full_width
int hSrc = down_scale?wDest*2:wDest;
int wSrc = down_scale?hDest*2:hDest;
int src_incr = full_width*src_block_width;
int x,y;
dst += wDest - dest_block_width;
int y,x;
for (y=0; y<hSrc; y+=src_block_width) {
uint8_t* dst2 = dst;
for (x=0; x<wSrc; x+=src_block_width) {
......@@ -282,10 +281,10 @@ void rotate_down_scale_plane_neon_anticlockwise(int wDest, int hDest, int full_w
int hSrc = down_scale?wDest*2:wDest;
int wSrc = down_scale?hDest*2:hDest;
int src_incr = full_width*src_block_width;
int x,y;
dst += wDest * (hDest - dest_block_width);
int y,x;
for (y=0; y<hSrc; y+=src_block_width) {
uint8_t* dst2 = dst;
for (x=0; x<wSrc; x+=src_block_width) {
......@@ -313,7 +312,7 @@ void rotate_down_scale_cbcr_to_cr_cb(int wDest, int hDest, int full_width, uint8
int signed_dst_stride;
int incr;
int y_step=down_scale?2:1;
int x,y;
if (clockWise) {
/* ms_warning("start writing destination buffer from top right");*/
......@@ -329,7 +328,6 @@ void rotate_down_scale_cbcr_to_cr_cb(int wDest, int hDest, int full_width, uint8
signed_dst_stride = -wDest;
}
int x,y;
for (y=0; y<hSrc; y+=y_step) {
uint8_t* cb_dst2 = cb_dst;
uint8_t* cr_dst2 = cr_dst;
......
......@@ -16,8 +16,8 @@ mediastreamer2_tester_SOURCES= \
mediastreamer2_adaptive_tester.c \
mediastreamer2_audio_stream_tester.c \
mediastreamer2_framework_tester.c \
mediastreamer2_player_tester.c
mediastreamer2_player_tester.c \
mediastreamer2_neon_tester.c
AM_CPPFLAGS=\
-I$(top_srcdir)/ \
......
......@@ -194,15 +194,21 @@ spx_int32_t ms_inner_product_neon_intrinsics(const spx_int16_t *a, const spx_int
static void inner_product_test(void) {
#ifdef SPEEX_LIB_CPU_FEATURE_NEON
#define SAMPLE_SIZE 64 /* has to be %8 and < 64 ! */
#define ITERATIONS 1000000
static spx_int16_t test_sample[SAMPLE_SIZE];
static spx_int16_t test_sample2[SAMPLE_SIZE];
int length = SAMPLE_SIZE;
uint64_t soft_ms, neon_ms;
int i;
volatile spx_int32_t non_neon_result;
volatile spx_int32_t neon_result;
float percent_off;
bool_t fast_enough;
// put some values to process
for( int i = 0; i<SAMPLE_SIZE; i++){
for( i = 0; i<SAMPLE_SIZE; i++){
test_sample[i] = ortp_random() % 16384;
test_sample2[i] = ortp_random() % 16384;
}
......@@ -212,8 +218,7 @@ static void inner_product_test(void) {
// disable neon & perform inner product
libspeex_cpu_features &= ~SPEEX_LIB_CPU_FEATURE_NEON;
volatile spx_int32_t non_neon_result;
int i = ITERATIONS;
i = ITERATIONS;
{
uint64_t start = ms_get_cur_time_ms();
while (i--) {
......@@ -225,7 +230,6 @@ static void inner_product_test(void) {
// enable neon and perform the same operation
libspeex_cpu_features |= SPEEX_LIB_CPU_FEATURE_NEON;
i = ITERATIONS;
volatile spx_int32_t neon_result;
{
uint64_t start = ms_get_cur_time_ms();
while (i--) {
......@@ -234,11 +238,11 @@ static void inner_product_test(void) {
neon_ms = ms_get_cur_time_ms() - start;
}
float percent_off = ((float)abs(non_neon_result-neon_result))/MAX(non_neon_result, neon_result)*100;
ms_debug("XCode: %10d, NON Neon: %10d - diff: %d - percent off: %f",
percent_off = ((float)abs(non_neon_result-neon_result))/MAX(non_neon_result, neon_result)*100;
ms_debug("%10d, NON Neon: %10d - diff: %d - percent off: %f",
non_neon_result, neon_result, abs(non_neon_result-neon_result), percent_off);
bool_t fast_enough = (float)neon_ms < (float)soft_ms/5;
fast_enough = (float)neon_ms < (float)soft_ms/5;
// we expect the result to be very similar and at least 5 times faster with NEON
CU_ASSERT(percent_off < 1.0);
......@@ -247,7 +251,9 @@ static void inner_product_test(void) {
if( !fast_enough ){
ms_error("NEON not fast enough it seems");
}
#else
ms_warning("Test skipped, not using the speex from git://git.linphone.org/speex.git with NEON support");
#endif
}
......
......@@ -194,7 +194,9 @@ static void test_complete_message_handler(const CU_pTest pTest,
}
static void test_all_tests_complete_message_handler(const CU_pFailureRecord pFailure) {
#ifdef HAVE_CU_GET_SUITE
ms_warning("\n\n %s",CU_get_run_results_string());
#endif
}
static void test_suite_init_failure_message_handler(const CU_pSuite pSuite) {
......@@ -208,9 +210,13 @@ static void test_suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
ms_warning("Suite [%s] Test [%s]", pSuite->pName,pTest->pName);
}
#ifdef HAVE_CU_GET_SUITE
static void test_suite_start_message_handler(const CU_pSuite pSuite) {
ms_warning("Suite [%s]", pSuite->pName);
}
#endif
int mediastreamer2_tester_run_tests(const char *suite_name, const char *test_name) {
int ret;
......@@ -220,8 +226,9 @@ int mediastreamer2_tester_run_tests(const char *suite_name, const char *test_nam
CU_set_all_test_complete_handler(test_all_tests_complete_message_handler);
CU_set_suite_init_failure_handler(test_suite_init_failure_message_handler);
CU_set_suite_cleanup_failure_handler(test_suite_cleanup_failure_message_handler);
#ifdef HAVE_CU_GET_SUITE
CU_set_suite_start_handler(test_suite_start_message_handler);
#endif
if( xml ){
xml_tmp_file = ms_strdup_printf("%s.tmp", xml_file);
CU_set_output_filename(xml_tmp_file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment