... | ... |
@@ -22,6 +22,7 @@ |
22 | 22 |
#include "libavutil/intreadwrite.h" |
23 | 23 |
#include "avcodec.h" |
24 | 24 |
#include "adx.h" |
25 |
+#include "get_bits.h" |
|
25 | 26 |
|
26 | 27 |
/** |
27 | 28 |
* @file |
... | ... |
@@ -48,24 +49,16 @@ static av_cold int adx_decode_init(AVCodecContext *avctx) |
48 | 48 |
static void adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch) |
49 | 49 |
{ |
50 | 50 |
ADXChannelState *prev = &c->prev[ch]; |
51 |
+ GetBitContext gb; |
|
51 | 52 |
int scale = AV_RB16(in); |
52 | 53 |
int i; |
53 | 54 |
int s0, s1, s2, d; |
54 | 55 |
|
55 |
- in += 2; |
|
56 |
+ init_get_bits(&gb, in + 2, (18 - 2) * 8); |
|
56 | 57 |
s1 = prev->s1; |
57 | 58 |
s2 = prev->s2; |
58 |
- for (i = 0; i < 16; i++) { |
|
59 |
- d = in[i]; |
|
60 |
- d = (signed char)d >> 4; |
|
61 |
- s0 = (BASEVOL * d * scale + SCALE1 * s1 - SCALE2 * s2) >> 14; |
|
62 |
- s2 = s1; |
|
63 |
- s1 = av_clip_int16(s0); |
|
64 |
- *out = s1; |
|
65 |
- out += c->channels; |
|
66 |
- |
|
67 |
- d = in[i]; |
|
68 |
- d = (signed char)(d << 4) >> 4; |
|
59 |
+ for (i = 0; i < 32; i++) { |
|
60 |
+ d = get_sbits(&gb, 4); |
|
69 | 61 |
s0 = (BASEVOL * d * scale + SCALE1 * s1 - SCALE2 * s2) >> 14; |
70 | 62 |
s2 = s1; |
71 | 63 |
s1 = av_clip_int16(s0); |