[vlc-commits] chroma: copy: add asserts
Thomas Guillem
git at videolan.org
Fri Nov 17 10:23:25 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov 16 12:09:49 2017 +0100| [f4299fbb0d459fc6bba1780b549b44107e5b63c4] | committer: Thomas Guillem
chroma: copy: add asserts
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f4299fbb0d459fc6bba1780b549b44107e5b63c4
---
modules/video_chroma/copy.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index d2ce2bc517..6b5629196f 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -33,6 +33,18 @@
#include "copy.h"
+#define ASSERT_PLANE(i) assert(src[i]); \
+ assert(src_pitch[i])
+
+#define ASSERT_2PLANES \
+ assert(dst); \
+ ASSERT_PLANE(0); \
+ ASSERT_PLANE(1); \
+ assert(height)
+
+#define ASSERT_3PLANES ASSERT_2PLANES; \
+ ASSERT_PLANE(2)
+
int CopyInitCache(copy_cache_t *cache, unsigned width)
{
#ifdef CAN_COMPILE_SSE2
@@ -556,6 +568,7 @@ void Copy420_SP_to_SP(picture_t *dst, const uint8_t *src[static 2],
const size_t src_pitch[static 2], unsigned height,
const copy_cache_t *cache)
{
+ ASSERT_2PLANES;
#ifdef CAN_COMPILE_SSE2
unsigned cpu = vlc_CPU();
if (vlc_CPU_SSE2())
@@ -575,6 +588,7 @@ void Copy420_SP_to_P(picture_t *dst, const uint8_t *src[static 2],
const size_t src_pitch[static 2], unsigned height,
const copy_cache_t *cache)
{
+ ASSERT_2PLANES;
#ifdef CAN_COMPILE_SSE2
unsigned cpu = vlc_CPU();
@@ -595,6 +609,7 @@ void Copy420_P_to_SP(picture_t *dst, const uint8_t *src[static 3],
const size_t src_pitch[static 3], unsigned height,
const copy_cache_t *cache)
{
+ ASSERT_3PLANES;
#ifdef CAN_COMPILE_SSE2
unsigned cpu = vlc_CPU();
if (vlc_CPU_SSE2())
@@ -674,6 +689,7 @@ void Copy420_P_to_P(picture_t *dst, const uint8_t *src[static 3],
const size_t src_pitch[static 3], unsigned height,
const copy_cache_t *cache)
{
+ ASSERT_3PLANES;
#ifdef CAN_COMPILE_SSE2
unsigned cpu = vlc_CPU();
if (vlc_CPU_SSE2())
More information about the vlc-commits
mailing list