MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / mp_read_changes_map

Function mp_read_changes_map

libavcodec/motionpixels.c:67–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static void mp_read_changes_map(MotionPixelsContext *mp, GetBitContext *gb, int count, int bits_len, int read_color)
68{
69 uint16_t *pixels;
70 int offset, w, h, color = 0, x, y, i;
71
72 while (count--) {
73 offset = get_bits_long(gb, mp->offset_bits_len);
74 w = get_bits(gb, bits_len) + 1;
75 h = get_bits(gb, bits_len) + 1;
76 if (read_color)
77 color = get_bits(gb, 15);
78 x = offset % mp->avctx->width;
79 y = offset / mp->avctx->width;
80 if (y >= mp->avctx->height)
81 continue;
82 w = FFMIN(w, mp->avctx->width - x);
83 h = FFMIN(h, mp->avctx->height - y);
84 pixels = (uint16_t *)&mp->frame.data[0][y * mp->frame.linesize[0] + x * 2];
85 while (h--) {
86 mp->changes_map[offset] = w;
87 if (read_color)
88 for (i = 0; i < w; ++i)
89 pixels[i] = color;
90 offset += mp->avctx->width;
91 pixels += mp->frame.linesize[0] / 2;
92 }
93 }
94}
95
96static void mp_get_code(MotionPixelsContext *mp, GetBitContext *gb, int size, int code)
97{

Callers 1

mp_decode_frameFunction · 0.85

Calls 2

get_bits_longFunction · 0.85
get_bitsFunction · 0.85

Tested by

no test coverage detected