[Freeswitch-svn] [commit] r2453 - in freeswitch/trunk/src/mod/codecs: mod_g723 mod_g726

Freeswitch SVN brian at freeswitch.org
Wed Aug 30 12:31:36 EDT 2006


Author: brian
Date: Wed Aug 30 12:31:35 2006
New Revision: 2453

Added:
   freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723_1.c
      - copied, changed from r2452, /freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723.c
Removed:
   freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723.c
Modified:
   freeswitch/trunk/src/mod/codecs/mod_g726/mod_g726.c

Log:
fix name

Copied: freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723_1.c (from r2452, /freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723.c)
==============================================================================
--- /freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g723/mod_g723_1.c	Wed Aug 30 12:31:35 2006
@@ -46,7 +46,7 @@
 
 enum Crate WrkRate = Rate63;
 
-static const char modname[] = "mod_g723";
+static const char modname[] = "mod_g723_1";
 
 struct g723_context {
 	struct cod_state encoder_object;

Modified: freeswitch/trunk/src/mod/codecs/mod_g726/mod_g726.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g726/mod_g726.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g726/mod_g726.c	Wed Aug 30 12:31:35 2006
@@ -43,6 +43,7 @@
 	uint8_t bits_per_frame;
 	uint8_t bits;
 	uint8_t bbits;
+	uint8_t ecount;
 	uint8_t d_bits;
 	uint8_t d_bbits;
 	uint8_t dcount;
@@ -131,12 +132,15 @@
 
 		for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
 			int edata = encoder(*ddp, AUDIO_ENCODING_LINEAR, context);
-
+			
+			
+			handle->ecount++;
 			if (!handle->bbits) {
 				*handle->ptr = edata;
 			} else if ((handle->bbits + handle->bits_per_frame) <= BITS_IN_A_BYTE) {
-				*handle->ptr <<= handle->bits_per_frame;
-				*handle->ptr |= edata;
+				printf ("WTF %d\n", BITS_IN_A_BYTE - (handle->bits_per_frame * handle->ecount));
+				*handle->ptr += (edata << (BITS_IN_A_BYTE - (handle->bits_per_frame * handle->ecount)));
+				handle->ecount = 0;
 			} else {
 				int remain, next, rdata, ndata;
 
@@ -145,16 +149,11 @@
 				rdata = edata;
 				ndata = edata;
 
-				rdata >>= remain;
-				*handle->ptr <<= remain;
-				*handle->ptr |= rdata;
-
-				handle->ptr++;
-				
-				ndata &= (1 << next) - 1;
+				*handle->ptr += (edata << remain);
 				*handle->ptr = ndata;
 
 				handle->bbits = 0;
+				handle->ecount = 0;
 			}
 			handle->bits += handle->bits_per_frame;
 			handle->bbits += handle->bits_per_frame;



More information about the Freeswitch-svn mailing list