diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2009-11-22 22:25:58 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2009-11-22 22:25:58 +0000 |
commit | 419b2be813e3391e046858b7e3d5f07a81f3d263 (patch) | |
tree | 54380510fe5ab53072fca9aab7a40f1f63f5f11f /libavcodec/twinvq.c | |
parent | 6c2289b52e63dcab6d8d729b3a75e02df2c02f3e (diff) | |
download | ffmpeg-419b2be813e3391e046858b7e3d5f07a81f3d263.tar.gz |
Make sorting function used in TwinVQ a shared function
Originally committed as revision 20584 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/twinvq.c')
-rw-r--r-- | libavcodec/twinvq.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 814a0b081a..8e198ea100 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -536,17 +536,6 @@ static void rearrange_lsp(int order, float *lsp, float min_dist) } } -static void bubblesort(float *lsp, int lp_order) -{ - int i,j; - - /* sort lsp in ascending order. float bubble agorithm, - O(n) if data already sorted, O(n^2) - otherwise */ - for (i = 0; i < lp_order - 1; i++) - for (j = i; j >= 0 && lsp[j] > lsp[j+1]; j--) - FFSWAP(float, lsp[j], lsp[j+1]); -} - static void decode_lsp(TwinContext *tctx, int lpc_idx1, uint8_t *lpc_idx2, int lpc_hist_idx, float *lsp, float *hist) { @@ -583,7 +572,7 @@ static void decode_lsp(TwinContext *tctx, int lpc_idx1, uint8_t *lpc_idx2, rearrange_lsp(mtab->n_lsp, lsp, 0.0001); rearrange_lsp(mtab->n_lsp, lsp, 0.000095); - bubblesort(lsp, mtab->n_lsp); + ff_sort_nearly_sorted_floats(lsp, mtab->n_lsp); } static void dec_lpc_spectrum_inv(TwinContext *tctx, float *lsp, |