diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index 1cee019ddd..25561ec2d7 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -22,7 +22,7 @@ * @file indeo2.c * Intel Indeo 2 decoder. */ - +#define ALT_BITSTREAM_READER_LE #include "avcodec.h" #include "bitstream.h" #include "indeo2data.h" @@ -156,10 +156,10 @@ static int ir2_decode_frame(AVCodecContext *avctx, s->decode_delta = buf[18]; /* decide whether frame uses deltas or not */ - +#ifndef ALT_BITSTREAM_READER_LE for (i = 0; i < buf_size; i++) buf[i] = ff_reverse[buf[i]]; - +#endif start = 48; /* hardcoded for now */ init_get_bits(&s->gb, buf + start, buf_size - start); @@ -198,8 +198,12 @@ static int ir2_decode_init(AVCodecContext *avctx){ if (!ir2_vlc.table) init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, &ir2_codes[0][1], 4, 2, - &ir2_codes[0][0], 4, 2, 1); - +#ifdef ALT_BITSTREAM_READER_LE + &ir2_codes[0][0], 4, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); +#else + &ir2_codes[0][0], 4, 2, INIT_VLC_USE_STATIC); +#endif + return 0; } diff --git a/libavcodec/indeo2data.h b/libavcodec/indeo2data.h index f58b8415fd..58e7e48dc8 100644 --- a/libavcodec/indeo2data.h +++ b/libavcodec/indeo2data.h @@ -1,5 +1,43 @@ #define IR2_CODES 143 static const uint16_t ir2_codes[IR2_CODES][2] = { +#ifdef ALT_BITSTREAM_READER_LE +{0x0000, 3}, {0x0004, 3}, {0x0006, 3}, {0x0001, 5}, +{0x0009, 5}, {0x0019, 5}, {0x000D, 5}, {0x001D, 5}, +{0x0023, 6}, {0x0013, 6}, {0x0033, 6}, {0x000B, 6}, +{0x002B, 6}, {0x001B, 6}, {0x0007, 8}, {0x0087, 8}, +{0x0027, 8}, {0x00A7, 8}, {0x0067, 8}, {0x00E7, 8}, +{0x0097, 8}, {0x0057, 8}, {0x0037, 8}, {0x00B7, 8}, +{0x00F7, 8}, {0x000F, 9}, {0x008F, 9}, {0x018F, 9}, +{0x014F, 9}, {0x00CF, 9}, {0x002F, 9}, {0x012F, 9}, +{0x01AF, 9}, {0x006F, 9}, {0x00EF, 9}, {0x01EF, 9}, +{0x001F, 10}, {0x021F, 10}, {0x011F, 10}, {0x031F, 10}, +{0x009F, 10}, {0x029F, 10}, {0x019F, 10}, {0x039F, 10}, +{0x005F, 10}, {0x025F, 10}, {0x015F, 10}, {0x035F, 10}, +{0x00DF, 10}, {0x02DF, 10}, {0x01DF, 10}, {0x03DF, 10}, +{0x003F, 13}, {0x103F, 13}, {0x083F, 13}, {0x183F, 13}, +{0x043F, 13}, {0x143F, 13}, {0x0C3F, 13}, {0x1C3F, 13}, +{0x023F, 13}, {0x123F, 13}, {0x0A3F, 13}, {0x1A3F, 13}, +{0x063F, 13}, {0x163F, 13}, {0x0E3F, 13}, {0x1E3F, 13}, +{0x013F, 13}, {0x113F, 13}, {0x093F, 13}, {0x193F, 13}, +{0x053F, 13}, {0x153F, 13}, {0x0D3F, 13}, {0x1D3F, 13}, +{0x033F, 13}, {0x133F, 13}, {0x0B3F, 13}, {0x1B3F, 13}, +{0x073F, 13}, {0x173F, 13}, {0x0F3F, 13}, {0x1F3F, 13}, +{0x00BF, 13}, {0x10BF, 13}, {0x08BF, 13}, {0x18BF, 13}, +{0x04BF, 13}, {0x14BF, 13}, {0x0CBF, 13}, {0x1CBF, 13}, +{0x02BF, 13}, {0x12BF, 13}, {0x0ABF, 13}, {0x1ABF, 13}, +{0x06BF, 13}, {0x16BF, 13}, {0x0EBF, 13}, {0x1EBF, 13}, +{0x01BF, 13}, {0x11BF, 13}, {0x09BF, 13}, {0x19BF, 13}, +{0x05BF, 13}, {0x15BF, 13}, {0x0DBF, 13}, {0x1DBF, 13}, +{0x03BF, 13}, {0x13BF, 13}, {0x0BBF, 13}, {0x1BBF, 13}, +{0x07BF, 13}, {0x17BF, 13}, {0x0FBF, 13}, {0x1FBF, 13}, +{0x007F, 14}, {0x207F, 14}, {0x107F, 14}, {0x307F, 14}, +{0x087F, 14}, {0x287F, 14}, {0x187F, 14}, {0x387F, 14}, +{0x047F, 14}, {0x247F, 14}, {0x147F, 14}, {0x0002, 3}, +{0x0011, 5}, {0x0005, 5}, {0x0015, 5}, {0x0003, 6}, +{0x003B, 6}, {0x0047, 8}, {0x00C7, 8}, {0x0017, 8}, +{0x00D7, 8}, {0x0077, 8}, {0x010F, 9}, {0x004F, 9}, +{0x01CF, 9}, {0x00AF, 9}, {0x016F, 9}, +#else {0x0000, 3}, {0x0001, 3}, {0x0003, 3}, {0x0010, 5}, {0x0012, 5}, {0x0013, 5}, {0x0016, 5}, {0x0017, 5}, {0x0031, 6}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6}, @@ -36,6 +74,7 @@ static const uint16_t ir2_codes[IR2_CODES][2] = { {0x0037, 6}, {0x00E2, 8}, {0x00E3, 8}, {0x00E8, 8}, {0x00EB, 8}, {0x00EE, 8}, {0x01E1, 9}, {0x01E4, 9}, {0x01E7, 9}, {0x01EA, 9}, {0x01ED, 9} +#endif }; static const uint8_t ir2_luma_table[256] = {