[FFmpeg-cvslog] qdm2: Conceal broken samples
Luca Barbato
git at videolan.org
Sun Sep 22 13:51:08 CEST 2013
ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Tue Jul 9 14:59:33 2013 +0200| [57efb6d94ceb42780577210616d30c98d89f6765] | committer: Luca Barbato
qdm2: Conceal broken samples
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 4ecdb5ed44591aba8a0ddb7d443cace836f761f6)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
Conflicts:
libavcodec/qdm2.c
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57efb6d94ceb42780577210616d30c98d89f6765
---
libavcodec/qdm2.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 365f717..1a07623 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -498,7 +498,8 @@ static void build_sb_samples_from_noise (QDM2Context *q, int sb)
* @param channels number of channels
* @param coding_method q->coding_method[0][0][0]
*/
-static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
+static int fix_coding_method_array(int sb, int channels,
+ sb_int8_array coding_method)
{
int j,k;
int ch;
@@ -507,8 +508,10 @@ static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_
for (ch = 0; ch < channels; ch++) {
for (j = 0; j < 64; ) {
- if((coding_method[ch][sb][j] - 8) > 22) {
- run = 1;
+ if (coding_method[ch][sb][j] < 8)
+ return -1;
+ if ((coding_method[ch][sb][j] - 8) > 22) {
+ run = 1;
case_val = 8;
} else {
switch (switchtable[coding_method[ch][sb][j]-8]) {
@@ -533,6 +536,7 @@ static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_
j += run;
}
}
+ return 0;
}
@@ -802,7 +806,11 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
q->coding_method[0][sb][j] = q->coding_method[1][sb][j];
- fix_coding_method_array(sb, q->nb_channels, q->coding_method);
+ if (fix_coding_method_array(sb, q->nb_channels,
+ q->coding_method)) {
+ build_sb_samples_from_noise(q, sb);
+ continue;
+ }
channels = 1;
}
More information about the ffmpeg-cvslog
mailing list