[FFmpeg-cvslog] avcodec/flacenc: Fix Invalid Rice order

George Boyle git at videolan.org
Fri Jun 19 11:06:03 CEST 2015


ffmpeg | branch: release/2.6 | George Boyle <george at thebuds.net> | Tue Jun 16 08:25:01 2015 +0100| [d9dd0cbe632e7b4b0b1652b13112bb805e737522] | committer: Carl Eugen Hoyos

avcodec/flacenc: Fix Invalid Rice order

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.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 2469ed32c81ebf2347e6883091c566724b286167)

Conflicts:
	libavcodec/flacenc.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9dd0cbe632e7b4b0b1652b13112bb805e737522
---

 libavcodec/flacenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 9786782..78bd36a 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -663,7 +663,7 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
     bits[pmin] = UINT32_MAX;
     for (i = pmax; ; ) {
         bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order);
-        if (bits[i] < bits[opt_porder]) {
+        if (bits[i] < bits[opt_porder] || pmax == pmin) {
             opt_porder = i;
             *rc = tmp_rc;
         }



More information about the ffmpeg-cvslog mailing list