On Mon, May 18, 2015 at 09:21:30PM -0400, Ronald S. Bultje wrote: > Hi, > > On Mon, May 18, 2015 at 7:53 AM, Michael Niedermayer <michae...@gmx.at> > wrote: > > > This improves compression but only by a very small bit > > possibly it could be improved by exactly calculating the number of bits > > that would be needed > > > > Signed-off-by: Michael Niedermayer <michae...@gmx.at> > > --- > > libavcodec/lpc.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 47 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c > > index deb02e7..930e526 100644 > > --- a/libavcodec/lpc.c > > +++ b/libavcodec/lpc.c > > @@ -135,6 +135,51 @@ static void quantize_lpc_coefs(double *lpc_in, int > > order, int precision, > > *shift = sh; > > } > > > > +static void quantize_lpc_coefs2(double *lpc_in, int order, int precision, > > + int32_t *lpc_out, int *shift, int > > max_shift, > > + int zero_shift, const int32_t *samples, > > int len) > > +{ > > + int allsteps = 1; > > + int i, j, step, improved; > > + int64_t best_score = INT64_MAX; > > + int32_t qmax; > > + > > + qmax = (1 << (precision - 1)) - 1; > > + > > + quantize_lpc_coefs(lpc_in, order, precision, lpc_out, shift, > > max_shift, zero_shift); > > + > > + for (i=0; i<order; i++) > > + allsteps *= 3; > > + > > + do { > > + improved = 0; > > + for (step = 0; step < allsteps; step++) { > > + int tmp = step; > > + int32_t lpc_try[MAX_LPC_ORDER]; > > + int64_t score = 0; > > + for (i=0; i<order; i++) { > > + lpc_try[i] = av_clip(lpc_out[i] + ((tmp + 1) % 3) - 1, > > -qmax, qmax); > > + tmp /= 3; > > + } > > + for (j=order; j<len; j++) { > > + int64_t v = 0; > > + for (i=0; i<order; i++) { > > + v += samples[j - 1 - i] * (int64_t)lpc_try[i]; > > + } > > + v >>= *shift; > > + v -= samples[j]; > > + score += FFABS(v); > > + } > > + if (score < best_score) { > > + best_score = score; > > + memcpy(lpc_out, lpc_try, sizeof(*lpc_out) * order); > > +// improved=1; > > + } > > +// av_log(0,0, "score %Ld\n", best_score); > > + } > > + } while(improved); > > > > Is it intentional that improved is read-only?
it didnt improve compression when enabled but made the code even slower next thing to try would likely be to use a more accurate scoring than sum of abs diff [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel