* @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
*/
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 */