]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/lsp.h
Make lsp2polyf() function non-static for upcoming usage in SIPR
[ffmpeg] / libavcodec / lsp.h
index 9aee5fad7dba058e551099e9bbf85ca428bb692a..c3aee7b7dca012df30589a77e8e86b8228214cb9 100644 (file)
@@ -50,7 +50,7 @@ void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, in
  * @param min_spacing    minimum distance between two consecutive lsf values
  * @param                size size of the lsf vector
  */
-void ff_set_min_dist_lsf(float *lsf, float min_spacing, int order);
+void ff_set_min_dist_lsf(float *lsf, double min_spacing, int order);
 
 /**
  * \brief Convert LSF to LSP
@@ -80,14 +80,40 @@ void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order);
  */
 void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order);
 
+
+#define MAX_LP_HALF_ORDER 8
+
 /**
  * Reconstructs LPC coefficients from the line spectral pair frequencies.
  *
  * @param lsp line spectral pairs in cosine domain
  * @param lpc linear predictive coding coefficients
+ * @param lp_half_order half the number of the amount of LPCs to be
+ *        reconstructed, need to be smaller or equal to MAX_LP_HALF_ORDER
+ *
+ * @note buffers should have a minimux size of 2*lp_half_order elements.
  *
  * TIA/EIA/IS-733 2.4.3.3.5
  */
-void ff_acelp_lspd2lpc(const double *lsp, float *lpc);
+void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order);
+
+/**
+ * Sort values in ascending order.
+ *
+ * @note O(n) if data already sorted, O(n^2) - otherwise
+ */
+void ff_sort_nearly_sorted_floats(float *vals, int len);
+
+/**
+ * Computes the Pa / (1 + z(-1)) or Qa / (1 - z(-1)) coefficients
+ * needed for LSP to LPC conversion.
+ * We only need to calculate the 6 first elements of the polynomial.
+ *
+ * @param lsp line spectral pairs in cosine domain
+ * @param f [out] polynomial input/output as a vector
+ *
+ * TIA/EIA/IS-733 2.4.3.3.5-1/2
+ */
+void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order);
 
 #endif /* AVCODEC_LSP_H */