Jeroen's suggestion to minimise processing delay for 700C, also updated Octave and...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jan 2017 20:24:30 +0000 (20:24 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jan 2017 20:24:30 +0000 (20:24 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2976 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/tnewamp1.m
codec2-dev/src/codec2.c
codec2-dev/unittest/tnewamp1.c

index 402eec12d436dc2d4c7044249810514cd29630a4..be6788ed7cda52252acf73d234d30c784a5f2f8b 100644 (file)
@@ -108,7 +108,10 @@ function tnewamp1(input_prefix)
   voicing_left = 0;
   left_vec = zeros(1,K);
 
-  for f=1:M:frames   
+  % decoder runs on every M-th frame, 25Hz frame rate, offset at
+  % start is to minimise processing delay (thanks Jeroen!)
+
+  for f=M:M:frames   
 
     if voicing(f)
       index = encode_log_Wo(model(f,1), 6);
index a82a12c42ef4acb7386784a150058bd890cc2f62..fe7d80f0c3013add9f215dd40c0fd0f499a85302 100644 (file)
@@ -1797,7 +1797,9 @@ void codec2_encode_700c(struct CODEC2 *c2, unsigned char * bits, short speech[])
 
     memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
 
-    analyse_one_frame(c2, &model, speech);
+    for(i=0; i<M; i++) {
+        analyse_one_frame(c2, &model, &speech[i*N_SAMP]);
+    }
 
     int K = 20;
     float rate_K_vec[K], mean;
@@ -1812,10 +1814,6 @@ void codec2_encode_700c(struct CODEC2 *c2, unsigned char * bits, short speech[])
                              rate_K_vec_no_mean,
                              rate_K_vec_no_mean_);
 
-    for(i=1; i<M; i++) {
-        analyse_one_frame(c2, &model, &speech[i*N_SAMP]);
-    }
-
     pack_natural_or_gray(bits, &nbit, indexes[0], 9, 0);
     pack_natural_or_gray(bits, &nbit, indexes[1], 9, 0);
     pack_natural_or_gray(bits, &nbit, indexes[2], 4, 0);
index 6c12eb27a41962e04472af967de381bfb98f933e..93791efd3691da464e5a0874f62ab233a95633f5 100644 (file)
@@ -184,10 +184,11 @@ int main(int argc, char *argv[]) {
     voicing_left = 0;
     Wo_left = 2.0*M_PI/100.0;
 
-    /* decoder runs on every M-th frame, 25Hz frame rate */
+    /* decoder runs on every M-th frame, 25Hz frame rate, offset at
+       start is to minimise processing delay (thanks Jeroen!) */
 
     fprintf(stderr,"\n");
-    for(f=0; f<FRAMES; f+=M) {
+    for(f=M-1; f<FRAMES; f+=M) {
 
         float a_interpolated_surface_[M][K];
         newamp1_indexes_to_model(model__,