[FFmpeg-devel] [PATCH] WMA Lossless: reset channel residues between subframes

Jakub Stachowski qbast at go2.pl
Thu Apr 12 00:24:30 CEST 2012


Attached patch fixes bug #1055. It causes channel residues to be reset 
to 0 if they are not decoded from bitstream (is_channel_coded==0). 
Without the patch, residues from last decoded subframe would be used, 
which causes bursts of random noise in silent part of some files.
I am not sure if channel residues should not be reset in case of raw pcm 
tiles, however I don't have any test file for that.
-------------- next part --------------
From 72366348ddc2ddf327774cdff69e62c8d7cb8d20 Mon Sep 17 00:00:00 2001
From: Jakub Stachowski <qbast at go2.pl>
Date: Wed, 11 Apr 2012 23:36:07 +0200
Subject: [PATCH] Reset residues to 0 if they were not decoded from bitstream.
 If channel residues are have not been decoded from bitstream, they should be 
 initialized to 0 instead of using values from previous subframe. This causes 
 bursts of noise in silent parts of some files.
 This patch fixes bug #1055

 libavcodec/wmalosslessdec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index ab7af95..e511443 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -955,7 +955,8 @@ static int decode_subframe(WmallDecodeCtx *s)
                     use_normal_update_speed(s, i);
                 revert_cdlms(s, i, 0, subframe_len);
-            }
+            } else
+                memset(s->channel_residues, 0, sizeof(s->channel_residues));
     if (s->do_mclms)
         revert_mclms(s, subframe_len);

More information about the ffmpeg-devel mailing list