CVS: rdesktop rdpsnd_dsp.c,1.19,1.20

Michael Gernoth <[email protected]> Mon, 02 Oct 2006 01:01:27 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7325

Modified Files:
	rdpsnd_dsp.c 
Log Message:
add (disabled) real linear resampler. quality is currently not as good
as previous simpler implementation, but will be improved


Index: rdpsnd_dsp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_dsp.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rdpsnd_dsp.c	1 Oct 2006 23:42:14 -0000	1.19
--- rdpsnd_dsp.c	2 Oct 2006 08:01:24 -0000	1.20
***************
*** 301,304 ****
--- 301,307 ----
  	{
  		int source = (i * 1000) / ratio1k;
+ #if 0				/* Partial for linear resampler */
+ 		int part = (i * 100000) / ratio1k - source * 100;
+ #endif
  		int j;
  
***************
*** 306,309 ****
--- 309,350 ----
  			break;
  
+ #if 0				/* Linear resampling, TODO: soundquality fixes */
+ 		if (samplewidth == 1)
+ 		{
+ 			sint8 cval1, cval2;
+ 			for (j = 0; j < resample_to_channels; j++)
+ 			{
+ 				memcpy(&cval1,
+ 				       in + (source * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), samplewidth);
+ 				memcpy(&cval2,
+ 				       in + ((source + 1) * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), samplewidth);
+ 
+ 				cval1 += (cval2 * part) / 100;
+ 
+ 				memcpy(*out + (i * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), &cval1, samplewidth);
+ 			}
+ 		}
+ 		else
+ 		{
+ 			sint16 sval1, sval2;
+ 			for (j = 0; j < resample_to_channels; j++)
+ 			{
+ 				memcpy(&sval1,
+ 				       in + (source * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), samplewidth);
+ 				memcpy(&sval2,
+ 				       in + ((source + 1) * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), samplewidth);
+ 
+ 				sval1 += (sval2 * part) / 100;
+ 
+ 				memcpy(*out + (i * resample_to_channels * samplewidth) +
+ 				       (samplewidth * j), &sval1, samplewidth);
+ 			}
+ 		}
+ #else /* Nearest neighbor search */
  		for (j = 0; j < resample_to_channels; j++)
  		{
***************
*** 312,315 ****
--- 353,357 ----
  			       (samplewidth * j), samplewidth);
  		}
+ #endif
  	}
  	outsize = i * resample_to_channels * samplewidth;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV