[FFmpeg-devel] [PATCH 8/9] avcodec/wavpackenc: use lrint instead of floor hack

Paul B Mahol onemda at gmail.com
Wed Dec 2 07:48:30 CET 2015


On 12/2/15, Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavcodec/wavpackenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
> index 977bcf0..6a9b716 100644
> --- a/libavcodec/wavpackenc.c
> +++ b/libavcodec/wavpackenc.c
> @@ -954,7 +954,7 @@ static void analyze_mono(WavPackEncodeContext *s,
> int32_t *samples, int do_sampl
>      memcpy(s->sampleptrs[info.nterms + 1][0], s->sampleptrs[i][0],
> s->block_samples * 4);
>
>      if (s->extra_flags & EXTRA_BRANCHES)
> -        recurse_mono(s, &info, 0, (int) floor(s->delta_decay + 0.5),
> +        recurse_mono(s, &info, 0, lrint(s->delta_decay),
>                       log2mono(s->sampleptrs[0][0], s->block_samples, 0));
>
>      if (s->extra_flags & EXTRA_SORT_FIRST)
> @@ -1773,7 +1773,7 @@ static void analyze_stereo(WavPackEncodeContext *s,
>      memcpy(s->sampleptrs[info.nterms + 1][1], s->sampleptrs[i][1],
> s->block_samples * 4);
>
>      if (s->extra_flags & EXTRA_BRANCHES)
> -        recurse_stereo(s, &info, 0, (int) floor(s->delta_decay + 0.5),
> +        recurse_stereo(s, &info, 0, lrint(s->delta_decay),
>                         log2stereo(s->sampleptrs[0][0], s->sampleptrs[0][1],
>                                    s->block_samples, 0));
>
> --
> 2.6.2

OK if and only if the output is lossless when using those flags.


More information about the ffmpeg-devel mailing list