Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJai Luthra <me@jailuthra.in>2016-08-23 00:02:04 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-28 12:18:16 +0300
commit0c023d181e581a0299d96a5edf7a736bdc66dc43 (patch)
treef990de96906d8b42e527017c911e5d355b73c489 /libavcodec/lpc.c
parent88bcdf109a449d302bec977997af83e1462bca6c (diff)
lavc/lpc: Add min_shift parameter in LPC
The min_shift parameter is needed by the MLP encoder Signed-off-by: Jai Luthra <me@jailuthra.in> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/lpc.c')
-rw-r--r--libavcodec/lpc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 052aeaa191..f8da1e1266 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -93,7 +93,8 @@ static void lpc_compute_autocorr_c(const double *data, int len, int lag,
* Quantize LPC coefficients
*/
static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
- int32_t *lpc_out, int *shift, int max_shift, int zero_shift)
+ int32_t *lpc_out, int *shift, int min_shift,
+ int max_shift, int zero_shift)
{
int i;
double cmax, error;
@@ -118,7 +119,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
/* calculate level shift which scales max coeff to available bits */
sh = max_shift;
- while((cmax * (1 << sh) > qmax) && (sh > 0)) {
+ while((cmax * (1 << sh) > qmax) && (sh > min_shift)) {
sh--;
}
@@ -201,7 +202,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
int max_order, int precision,
int32_t coefs[][MAX_LPC_ORDER], int *shift,
enum FFLPCType lpc_type, int lpc_passes,
- int omethod, int max_shift, int zero_shift)
+ int omethod, int min_shift, int max_shift, int zero_shift)
{
double autoc[MAX_LPC_ORDER+1];
double ref[MAX_LPC_ORDER] = { 0 };
@@ -284,10 +285,12 @@ int ff_lpc_calc_coefs(LPCContext *s,
if(omethod == ORDER_METHOD_EST) {
opt_order = estimate_best_order(ref, min_order, max_order);
i = opt_order-1;
- quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift);
+ quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i],
+ min_shift, max_shift, zero_shift);
} else {
for(i=min_order-1; i<max_order; i++) {
- quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift);
+ quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i],
+ min_shift, max_shift, zero_shift);
}
}