| 102 | } |
| 103 | |
| 104 | static void mp_read_changes_map(MotionPixelsContext *mp, GetBitContext *gb, int count, int bits_len, int read_color) |
| 105 | { |
| 106 | uint16_t *pixels; |
| 107 | int offset, w, h, color = 0, x, y, i; |
| 108 | |
| 109 | while (count--) { |
| 110 | offset = get_bits_long(gb, mp->offset_bits_len); |
| 111 | w = get_bits(gb, bits_len) + 1; |
| 112 | h = get_bits(gb, bits_len) + 1; |
| 113 | if (read_color) |
| 114 | color = get_bits(gb, 15); |
| 115 | x = offset % mp->avctx->width; |
| 116 | y = offset / mp->avctx->width; |
| 117 | if (y >= mp->avctx->height) |
| 118 | continue; |
| 119 | w = FFMIN(w, mp->avctx->width - x); |
| 120 | h = FFMIN(h, mp->avctx->height - y); |
| 121 | pixels = (uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2]; |
| 122 | while (h--) { |
| 123 | mp->changes_map[offset] = w; |
| 124 | if (read_color) |
| 125 | for (i = 0; i < w; ++i) |
| 126 | pixels[i] = color; |
| 127 | offset += mp->avctx->width; |
| 128 | pixels += mp->frame->linesize[0] / 2; |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | static int mp_get_code(MotionPixelsContext *mp, GetBitContext *gb, int size) |
| 134 | { |
no test coverage detected