aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qdm2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-04 12:29:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-04 12:29:25 +0200
commitacc665f22c5c2cb8a507c6ca49756995a4742038 (patch)
tree436f81743d3a5dbc3d8be31743e27bb49e2a3d51 /libavcodec/qdm2.c
parenta55db1fc497dfa30e9f0596f8bb203f7645d17b7 (diff)
parent4c223fe519174f0d7086f4698e9f7b9840cf15e9 (diff)
downloadffmpeg-acc665f22c5c2cb8a507c6ca49756995a4742038.tar.gz
Merge remote-tracking branch 'qatar/release/0.5' into release/0.5
* qatar/release/0.5: Bump version number for 0.5.9 release. png: check bit depth for PAL8/Y400A pixel formats. tqi: Pass errors from the MB decoder eatqi: move "block" variable into context to ensure sufficient alignment for idct_put for compilers/architectures that can not align stack variables that much. This is also consistent with similar code in eatgq.c ea: check chunk_size for validity. vfwcap: Include windows.h before vfw.h since the latter requires defines from the former. Patch by kemuri <kemuri9 at gmail dot com> mingw32: merge checks for mingw-w64 and mingw32-runtime >= 3.15 into one mingw32: properly check if vfw capture is supported by the system headers Replace every usage of -lvfw32 with what is particularly necessary for that case: Avisynth -> -lavifil32 VFW Cap -> -lavicap32 Patch by kemuri <kemuri9 at gmail dot com> configure: properly check for mingw-w64 through installed headers. mingw-w64 can also target 32-bit code. qdm2: clip array indices returned by qdm2_get_vlc(). kmvc: Check palsize. adpcm: ADPCM Electronic Arts has always two channels h264: Add check for invalid chroma_format_idc dpcm: ignore extra unpaired bytes in stereo streams. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r--libavcodec/qdm2.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 8567ea8acf..e2f1a87033 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -905,9 +905,13 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 30:
- if (BITS_LEFT(length,gb) >= 4)
- samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)];
- else
+ if (BITS_LEFT(length,gb) >= 4) {
+ unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
+ if (index < FF_ARRAY_ELEMS(type30_dequant)) {
+ samples[0] = type30_dequant[index];
+ } else
+ samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
+ } else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
run = 1;
@@ -921,8 +925,12 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
type34_predictor = samples[0];
type34_first = 0;
} else {
- samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor;
- type34_predictor = samples[0];
+ unsigned index = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1);
+ if (index < FF_ARRAY_ELEMS(type34_delta)) {
+ samples[0] = type34_delta[index] / type34_div + type34_predictor;
+ type34_predictor = samples[0];
+ } else
+ samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
} else {
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);