changeset 1029:804cc05a3f61 libavcodec

C implementation of the median deinterlacer (seems to be the only one that generates tolerable output for anime) so it will work on non-MMX architectures. Someone should optimize it better eventually.
author rfelker
date Thu, 23 Jan 2003 04:19:24 +0000
parents e76fb91de4cc
children 801f2739264a
files libpostproc/postprocess.c libpostproc/postprocess_template.c
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpostproc/postprocess.c	Thu Jan 23 01:20:47 2003 +0000
+++ b/libpostproc/postprocess.c	Thu Jan 23 04:19:24 2003 +0000
@@ -34,7 +34,7 @@
 LinIpolDeinterlace	e		E	E*
 CubicIpolDeinterlace	a		e	e*
 LinBlendDeinterlace	e		E	E*
-MedianDeinterlace#	 	Ec	Ec
+MedianDeinterlace#	E	Ec	Ec
 TempDeNoiser#		E		e	e
 
 * i dont have a 3dnow CPU -> its untested, but noone said it doesnt work so it seems to work
--- a/libpostproc/postprocess_template.c	Thu Jan 23 01:20:47 2003 +0000
+++ b/libpostproc/postprocess_template.c	Thu Jan 23 04:19:24 2003 +0000
@@ -1889,19 +1889,24 @@
 	);
 #endif // MMX
 #else
-	//FIXME
-	int x;
+	int x, y;
 	src+= 4*stride;
+	// FIXME - there should be a way to do a few columns in parallel like w/mmx
 	for(x=0; x<8; x++)
 	{
-		src[0       ] = (src[0       ] + 2*src[stride  ] + src[stride*2])>>2;
-		src[stride  ] = (src[stride  ] + 2*src[stride*2] + src[stride*3])>>2;
-		src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2;
-		src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2;
-		src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2;
-		src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2;
-		src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2;
-		src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2;
+		uint8_t *colsrc = src;
+		for (y=0; y<4; y++)
+		{
+			int a, b, c, d, e, f;
+			a = colsrc[0       ];
+			b = colsrc[stride  ];
+			c = colsrc[stride*2];
+			d = (a-b)>>31;
+			e = (b-c)>>31;
+			f = (c-a)>>31;
+			colsrc[stride  ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
+			colsrc += stride*2;
+		}
 		src++;
 	}
 #endif