[vlc-devel] [PATCH 4/19] packetizer/startcode_helper: prep for multi-simd
Lyndon Brown
jnqnfe at gmail.com
Thu Sep 24 21:35:49 CEST 2020
From: Lyndon Brown <jnqnfe at gmail.com>
Date: Thu, 24 Sep 2020 18:37:16 +0100
Subject: packetizer/startcode_helper: prep for multi-simd
- prep startcode_FindAnnexB() to more simply support multiple SIMD
implementations.
- adjust the test unit per that change, and itself to properly
support testing each simd implementation.
diff --git a/modules/packetizer/startcode_helper.h b/modules/packetizer/startcode_helper.h
index b01a56e238..41ba9b2fbf 100644
--- a/modules/packetizer/startcode_helper.h
+++ b/modules/packetizer/startcode_helper.h
@@ -150,16 +150,13 @@ static inline const uint8_t * startcode_FindAnnexB_Bits( const uint8_t *p, const
}
#undef TRY_MATCH
-#ifdef CAN_COMPILE_SSE2
static inline const uint8_t * startcode_FindAnnexB( const uint8_t *p, const uint8_t *end )
{
+#ifdef CAN_COMPILE_SSE2
if (vlc_CPU_SSE2())
return startcode_FindAnnexB_SSE2(p, end);
- else
- return startcode_FindAnnexB_Bits(p, end);
-}
-#else
- #define startcode_FindAnnexB startcode_FindAnnexB_Bits
#endif
+ return startcode_FindAnnexB_Bits(p, end);
+}
#endif
diff --git a/test/modules/packetizer/helpers.c b/test/modules/packetizer/helpers.c
index 0ef5e5db48..475644d2ad 100644
--- a/test/modules/packetizer/helpers.c
+++ b/test/modules/packetizer/helpers.c
@@ -26,6 +26,7 @@
#include <assert.h>
#include <vlc_common.h>
+#include <vlc_cpu.h>
#include <vlc_block.h>
#include <vlc_block_helper.h>
@@ -77,15 +78,20 @@ static int run_annexb_sets( const uint8_t *p_set, const uint8_t *p_end,
return i_ret;
/* Perform same tests on simd optimized code */
- if( startcode_FindAnnexB_Bits != startcode_FindAnnexB )
+#ifdef CAN_COMPILE_SSE2
+ if (vlc_CPU_SSE2())
{
- printf("checking asm:\n");
+ printf("checking sse2 simd asm:\n");
i_ret = check_set( p_set, p_end, p_results, i_results, i_results_offset,
- startcode_FindAnnexB );
+ startcode_FindAnnexB_SSE2 );
if( i_ret != 0 )
return i_ret;
}
- else printf("asm not built in, skipping test:\n");
+ else
+ printf("CPU does not support sse2 simd, skipping test:\n");
+#else
+ printf("sse2 simd asm not built in, skipping test:\n");
+#endif
return 0;
}
More information about the vlc-devel
mailing list