diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-12 04:02:09 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-12 04:02:09 +0300 |
commit | eea92133a16e7e0a837ad680afd4a05d08683a61 (patch) | |
tree | 5b7dab8bc94dd988746bd1a0973c5fa65b184484 /libavcodec/mqcdec.c | |
parent | b395fd3de7dab14841b3c7898aaea04d29c11bc7 (diff) |
avcodec/mqcdec: Support raw bypass and non reseting init
Some broken code that used the old mqc is removed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mqcdec.c')
-rw-r--r-- | libavcodec/mqcdec.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libavcodec/mqcdec.c b/libavcodec/mqcdec.c index 362506992a..aebc36f1b8 100644 --- a/libavcodec/mqcdec.c +++ b/libavcodec/mqcdec.c @@ -68,18 +68,32 @@ static int exchange(MqcState *mqc, uint8_t *cxstate, int lps) return d; } -void ff_mqc_initdec(MqcState *mqc, uint8_t *bp) +void ff_mqc_initdec(MqcState *mqc, uint8_t *bp, int raw, int reset) { - ff_mqc_init_contexts(mqc); + if (reset) + ff_mqc_init_contexts(mqc); mqc->bp = bp; mqc->c = (*mqc->bp ^ 0xff) << 16; bytein(mqc); mqc->c = mqc->c << 7; mqc->a = 0x8000; + mqc->raw = raw; +} + +static int mqc_decode_bypass(MqcState *mqc) { + int bit = !(mqc->c & 0x40000000); + if (!(mqc->c & 0xff)) { + mqc->c -= 0x100; + bytein(mqc); + } + mqc->c += mqc->c; + return bit; } int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate) { + if (mqc->raw) + return mqc_decode_bypass(mqc); mqc->a -= ff_mqc_qe[*cxstate]; if ((mqc->c >> 16) < mqc->a) { if (mqc->a & 0x8000) |