public override int inverse2(Block vb, Object i, Object memo, float[] fout) { LookFloor0 look = (LookFloor0)i; InfoFloor0 info = look.vi; if (memo != null) { float[] lsp = (float[])memo; float amp = lsp[look.m]; Lsp.lsp_to_curve(fout, look.linearmap, look.n, look.ln, lsp, look.m, amp, info.ampdB); return(1); } for (int j = 0; j < look.n; j++) { fout[j] = 0.0f; } return(0); }
override public int inverse2(Block vb, Object i, Object memo, float[] fout) { //System.err.println("Floor0.inverse "+i.getClass()+"]"); LookFloor0 look = (LookFloor0)i; InfoFloor0 info = look.vi; if (memo != null) { float[] lsp = (float[])memo; float amp = lsp[look.m]; Lsp.lsp_to_curve(fout, look.linearmap, look.n, look.ln, lsp, look.m, amp, info.ampdB); return(1); } // eop: // memset(out,0,sizeof(float)*look->n); for (int j = 0; j < look.n; j++) { fout[j] = 0.0f; } return(0); }
internal int inverse(Block vb, Object i, float[] fout) { //System.err.println("Floor0.inverse "+i.getClass()+"]"); LookFloor0 look = (LookFloor0)i; InfoFloor0 info = look.vi; int ampraw = vb.opb.read(info.ampbits); if (ampraw > 0) { // also handles the -1 out of data case int maxval = (1 << info.ampbits) - 1; float amp = (float)ampraw / maxval * info.ampdB; int booknum = vb.opb.read(Util.ilog(info.numbooks)); if (booknum != -1 && booknum < info.numbooks) { lock (this) { if (lsp == null || lsp.Length < look.m) { lsp = new float[look.m]; } else { for (int j = 0; j < look.m; j++) { lsp[j] = 0.0f; } } CodeBook b = vb.vd.fullbooks[info.books[booknum]]; float last = 0.0f; for (int j = 0; j < look.m; j++) { fout[j] = 0.0f; } for (int j = 0; j < look.m; j += b.dim) { if (b.decodevs(lsp, j, vb.opb, 1, -1) == -1) { for (int k = 0; k < look.n; k++) { fout[k] = 0.0f; } return(0); } } for (int j = 0; j < look.m;) { for (int k = 0; k < b.dim; k++, j++) { lsp[j] += last; } last = lsp[j - 1]; } // take the coefficients back to a spectral envelope curve Lsp.lsp_to_curve(fout, look.linearmap, look.n, look.ln, lsp, look.m, amp, info.ampdB); return(1); } } } return(0); }