static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    bc->bits >>= n;
#else
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
}
['static inline int loco_get_rice(RICEContext *r)\n{\n    int v;\n    if (r->run > 0) {\n        r->run--;\n        loco_update_rice_param(r, 0);\n        return 0;\n    }\n    v = get_ur_golomb_jpegls(&r->bc, loco_get_rice_param(r), INT_MAX, 0);\n    loco_update_rice_param(r, (v + 1) >> 1);\n    if (!v) {\n        if (r->save >= 0) {\n            r->run = get_ur_golomb_jpegls(&r->bc, 2, INT_MAX, 0);\n            if (r->run > 1)\n                r->save += r->run + 1;\n            else\n                r->save -= 3;\n        } else\n            r->run2++;\n    } else {\n        v = ((v >> 1) + r->lossy) ^ -(v & 1);\n        if (r->run2 > 0) {\n            if (r->run2 > 2)\n                r->save += r->run2;\n            else\n                r->save -= 3;\n            r->run2 = 0;\n        }\n    }\n    return v;\n}', 'static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,\n                                       int esc_len)\n{\n    unsigned int buf;\n    int log;\n    buf = bitstream_peek(bc, 32);\n    log = av_log2(buf);\n    if (log - k >= 1 && 32 - log < limit) {\n        buf >>= log - k;\n        buf  += (30 - log) << k;\n        bitstream_skip(bc, 32 + k - log);\n        return buf;\n    } else {\n        int i;\n        for (i = 0;\n             i < limit && bitstream_read_bit(bc) == 0 && bitstream_bits_left(bc) > 0;\n             i++);\n        if (i < limit - 1) {\n            buf = bitstream_read(bc, k);\n            return buf + (i << k);\n        } else if (i == limit - 1) {\n            buf = bitstream_read(bc, esc_len);\n            return buf + 1;\n        } else\n            return -1;\n    }\n}', 'static inline unsigned bitstream_peek(BitstreamContext *bc, unsigned n)\n{\n    if (n > bc->bits_left)\n        refill_32(bc);\n    return show_val(bc, n);\n}', 'static inline void bitstream_skip(BitstreamContext *bc, unsigned n)\n{\n    if (n <= bc->bits_left)\n        skip_remaining(bc, n);\n    else {\n        n -= bc->bits_left;\n        skip_remaining(bc, bc->bits_left);\n        if (n >= 64) {\n            unsigned skip = n / 8;\n            n -= skip * 8;\n            bc->ptr += skip;\n        }\n        refill_64(bc);\n        if (n)\n            skip_remaining(bc, n);\n    }\n}', 'static inline void skip_remaining(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    bc->bits >>= n;\n#else\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n}']