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 int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data,\n                                      int *got_frame, AVPacket *avpkt)\n{\n    TrueMotion2RTContext *s = avctx->priv_data;\n    AVFrame * const p = data;\n    BitstreamContext *bc = &s->bc;\n    uint8_t *dst;\n    int x, y, delta_mode;\n    int ret;\n    ret = truemotion2rt_decode_header(avctx, avpkt);\n    if (ret < 0)\n        return ret;\n    ret = bitstream_init8(bc, avpkt->data + ret, avpkt->size - ret);\n    if (ret < 0)\n        return ret;\n    ret = ff_get_buffer(avctx, p, 0);\n    if (ret < 0)\n        return ret;\n    bitstream_skip(bc, 32);\n    delta_mode = s->delta_size - 2;\n    dst = p->data[0];\n    for (y = 0; y < avctx->height; y++) {\n        int diff = 0;\n        for (x = 0; x < avctx->width; x += s->hscale) {\n            diff  += delta_tabs[delta_mode][bitstream_read(bc, s->delta_size)];\n            dst[x] = av_clip_uint8((y ? dst[x - p->linesize[0]] : 0) + diff);\n        }\n        dst += p->linesize[0];\n    }\n    if (s->hscale > 1) {\n        dst = p->data[0];\n        for (y = 0; y < avctx->height; y++) {\n            for (x = 1; x < avctx->width; x += s->hscale)\n                dst[x] = dst[x - 1];\n            dst += p->linesize[0];\n        }\n    }\n    dst = p->data[0];\n    for (y = 0; y < avctx->height; y++) {\n        for (x = 0; x < avctx->width; x++)\n            dst[x] = av_clip_uint8(dst[x] + (dst[x] - 128) / 3);\n        dst += p->linesize[0];\n    }\n    dst = p->data[1];\n    for (y = 0; y < avctx->height >> 2; y++) {\n        int diff = 0;\n        for (x = 0; x < avctx->width >> 2; x += s->hscale) {\n            diff  += delta_tabs[delta_mode][bitstream_read(bc, s->delta_size)];\n            dst[x] = av_clip_uint8((y ? dst[x - p->linesize[1]] : 128) + diff);\n        }\n        dst += p->linesize[1];\n    }\n    if (s->hscale > 1) {\n        dst = p->data[1];\n        for (y = 0; y < avctx->height >> 2; y++) {\n            for (x = 1; x < avctx->width >> 2; x += s->hscale)\n                dst[x] = dst[x - 1];\n            dst += p->linesize[1];\n        }\n    }\n    dst = p->data[1];\n    for (y = 0; y < avctx->height >> 2; y++) {\n        for (x = 0; x < avctx->width >> 2; x++)\n            dst[x] += (dst[x] - 128) / 8;\n        dst += p->linesize[1];\n    }\n    dst = p->data[2];\n    for (y = 0; y < avctx->height >> 2; y++) {\n        int diff = 0;\n        for (x = 0; x < avctx->width >> 2; x += s->hscale) {\n            diff  += delta_tabs[delta_mode][bitstream_read(bc, s->delta_size)];\n            dst[x] = av_clip_uint8((y ? dst[x - p->linesize[2]] : 128) + diff);\n        }\n        dst += p->linesize[2];\n    }\n    if (s->hscale > 1) {\n        dst = p->data[2];\n        for (y = 0; y < avctx->height >> 2; y++) {\n            for (x = 1; x < avctx->width >> 2; x += s->hscale)\n                dst[x] = dst[x - 1];\n            dst += p->linesize[2];\n        }\n    }\n    dst = p->data[2];\n    for (y = 0; y < avctx->height >> 2; y++) {\n        for (x = 0; x < avctx->width >> 2; x++)\n            dst[x] += (dst[x] - 128) / 8;\n        dst += p->linesize[2];\n    }\n    p->pict_type = AV_PICTURE_TYPE_I;\n    p->key_frame = 1;\n    *got_frame = 1;\n    return avpkt->size;\n}', 'static inline int bitstream_init8(BitstreamContext *bc, const uint8_t *buffer,\n                                  unsigned byte_size)\n{\n    if (byte_size > INT_MAX / 8)\n        return AVERROR_INVALIDDATA;\n    return bitstream_init(bc, buffer, byte_size * 8);\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}']