[Mplayer-cvslog] CVS: main/postproc swscale.c,1.84,1.85

Michael Niedermayer michael at mplayer.dev.hu
Fri Feb 22 16:24:22 CET 2002


Update of /cvsroot/mplayer/main/postproc
In directory mplayer:/var/tmp.root/cvs-serv4901

Modified Files:
	swscale.c 
Log Message:
use assert.h
more assertions


Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- swscale.c	21 Feb 2002 19:41:50 -0000	1.84
+++ swscale.c	22 Feb 2002 15:24:19 -0000	1.85
@@ -52,6 +52,7 @@
 #include <stdio.h>
 #include "../config.h"
 #include "../mangle.h"
+#include <assert.h>
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
 #endif
@@ -76,7 +77,7 @@
 #define RET 0xC3 //near return opcode for X86
 
 #ifdef MP_DEBUG
-#define ASSERT(x) if(!(x)) { printf("ASSERT " #x " failed\n"); *((int*)0)=0; }
+#define ASSERT(x) assert(x);
 #else
 #define ASSERT(x) ;
 #endif
@@ -806,6 +807,8 @@
 	else // downscale
 	{
 		int xDstInSrc;
+		ASSERT(dstW <= srcW)
+
 		if(flags&SWS_BICUBIC)	filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW);
 		else if(flags&SWS_X)	filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW);
 		else if(flags&SWS_AREA)	filterSize= (int)ceil(1 + 1.0*srcW / (double)dstW);
@@ -858,9 +861,11 @@
 	/* apply src & dst Filter to filter -> filter2
 	   free(filter);
 	*/
+	ASSERT(filterSize>0)
 	filter2Size= filterSize;
 	if(srcFilter) filter2Size+= srcFilter->length - 1;
 	if(dstFilter) filter2Size+= dstFilter->length - 1;
+	ASSERT(filter2Size>0)
 	filter2= (double*)memalign(8, filter2Size*dstW*sizeof(double));
 
 	for(i=0; i<dstW; i++)
@@ -929,7 +934,9 @@
 		if(min>minFilterSize) minFilterSize= min;
 	}
 
+	ASSERT(minFilterSize > 0)
 	filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
+	ASSERT(filterSize > 0)
 	filter= (double*)memalign(8, filterSize*dstW*sizeof(double));
 	*outFilterSize= filterSize;
 
@@ -948,7 +955,6 @@
 	}
 	free(filter2); filter2=NULL;
 	
-	ASSERT(filterSize > 0)
 
 	//FIXME try to align filterpos if possible
 




More information about the MPlayer-cvslog mailing list