[FFmpeg-devel] [PATCH] avcodec/flacenc: Invalid Rice order

Michael Niedermayer michaelni at gmx.at
Tue Jun 16 13:02:12 CEST 2015


On Tue, Jun 16, 2015 at 08:25:01AM +0100, George Boyle wrote:
> Fixes ticket #4628.
> 
> The problem arose, in the sample file at least, in the last block where the
> minimum and maximum Rice partition orders were both 0. In that case, and any
> other where pmax == pmin, the original UINT32_MAX placeholder value for
> bits[opt_porder] was getting overwritten before the comparison to check if the
> current partition order is a new optimal, so the correct partition order and
> RiceContext params were not being set.
> 
> Regression test sample to be added to `$(SAMPLES)/audio-reference/`:
> http://thebuds.net/chorusnoise_2ch_44kHz_s16.wav
> 
> Signed-off-by: George Boyle <george at thebuds.net>
> ---
>  libavcodec/flacenc.c | 2 +-
>  tests/fate/flac.mak  | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
> index cdfeaf8..29bd999 100644
> --- a/libavcodec/flacenc.c
> +++ b/libavcodec/flacenc.c
> @@ -705,7 +705,7 @@ static uint64_t calc_rice_params(RiceContext *rc,
>      bits[pmin] = UINT32_MAX;
>      for (i = pmax; ; ) {
>          bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order, kmax, exact);
> -        if (bits[i] < bits[opt_porder]) {
> +        if (bits[i] < bits[opt_porder] || pmax == pmin) {
>              opt_porder = i;
>              *rc = tmp_rc;
>          }

bugfix applied

fate sample uploaded

fate test not applied as some of the clients need 24h to sync the
samples
please post a patch that contains the remaining 2 hunks in >24h

also for future fate tests, small samples are preferred to keep the
fate testsuite manageable size wise

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150616/224607be/attachment.asc>


More information about the ffmpeg-devel mailing list