set up start conditions in Octave and C, tests passing OK, time to build up Codec...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Jan 2017 02:51:43 +0000 (02:51 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Jan 2017 02:51:43 +0000 (02:51 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2960 01035d8c-6547-0410-b346-abe4f91aad63

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

index d405090f1e082f5279ec6f93c89bcef753bc0476..6adc9348e7e62aea973dcecf868af889cd236201 100644 (file)
@@ -96,6 +96,10 @@ function tnewamp1(input_prefix)
   model_ = zeros(frames, max_amp+2);
   voicing_ = zeros(1,frames);
   H = zeros(frames, max_amp);
+  model_(1,1) = Wo_left = 2*pi/100;
+  voicing_left = 0;
+  left_vec = zeros(1,K);
+
   for f=1:M:frames   
     if voicing(f)
       index = encode_log_Wo(model(f,1), 6);
@@ -108,14 +112,15 @@ function tnewamp1(input_prefix)
     end
 
     if f > M
-      Wo1 = model_(f-M,1);
-      Wo2 = model_(f,1);
-      [Wo_ avoicing_] = interp_Wo_v(Wo1, Wo2, voicing(f-M), voicing(f));
+      %Wo1 = model_(f-M,1);
+      Wo_right = model_(f,1);
+      voicing_right = voicing(f);
+      [Wo_ avoicing_] = interp_Wo_v(Wo_left, Wo_right, voicing_left, voicing_right);
       model_(f-M:f-1,1) = Wo_;
       voicing_(f-M:f-1) = avoicing_;
       model_(f-M:f-1,2) = floor(pi ./ model_(f-M:f-1,1)); % calculate L for each interpolated Wo
 
-      left_vec = rate_K_surface_(f-M,:);
+      %left_vec = rate_K_surface_(f-M,:);
       right_vec = rate_K_surface_(f,:);
       sample_points = [f-M f];
       resample_points = f-M:f-1;
@@ -132,6 +137,12 @@ function tnewamp1(input_prefix)
         end  
    
       end
+
+      % update for next time
+
+      Wo_left = Wo_right;
+      voicing_left = voicing_right;
+      left_vec = right_vec;
     end
   end
 
index b385cf4c0c2ec50ec68efb755f52dbc5123b3aec..50161100f16caad5f3ee9ffda1b34c0ed06dd8d0 100644 (file)
@@ -170,6 +170,7 @@ int main(int argc, char *argv[]) {
     float Wo_left;
     int   voicing_left;
 
+    /*
     for(k=0; k<K; k++)
         prev_rate_K_vec_[k] = rate_K_surface_[0][k];
 
@@ -183,6 +184,12 @@ int main(int argc, char *argv[]) {
     }
 
     Wo_left = model_octave_[0][0];
+    */
+
+    for(k=0; k<K; k++)
+        prev_rate_K_vec_[k] = 0.0;
+    voicing_left = 0;
+    Wo_left = 2.0*M_PI/100.0;
 
     for(f=0; f<FRAMES; f+=M) {
 
@@ -200,18 +207,18 @@ int main(int argc, char *argv[]) {
                                      phase_fft_inv_cfg,
                                      &indexes[f][0]);
 
+            /* store test vectors */
+
             for(i=f-M, m=0; i<f; i++,m++) {
                 model_octave_[i][0] = model__[m].Wo;
                 model_octave_[i][1] = model__[m].L; 
                 voicing_[i] = model__[m].voiced;
             }
 
-            /* back to rate L, synth phase */
-
             int j;
             for(i=f-M, j=0; i<f; i++,j++) {
                 for(m=1; m<=model__[j].L; m++) {
-                    model_octave_[i][m+1] = model__[j].A[m]; // = model_.A[m];
+                    model_octave_[i][m+1] = model__[j].A[m]; 
                     H[i][m-1] = HH[j][m];// aH[m];
                 }
             }