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

Function mp_decode_line

libavcodec/motionpixels.c:206–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y)
207{
208 YuvPixel p;
209 const int y0 = y * mp->avctx->width;
210 int w, i, x = 0;
211
212 p = mp->vpt[y];
213 if (mp->changes_map[y0 + x] == 0) {
214 memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
215 ++x;
216 }
217 while (x < mp->avctx->width) {
218 w = mp->changes_map[y0 + x];
219 if (w != 0) {
220 if ((y & 3) == 0) {
221 if (mp->changes_map[y0 + x + mp->avctx->width] < w ||
222 mp->changes_map[y0 + x + mp->avctx->width * 2] < w ||
223 mp->changes_map[y0 + x + mp->avctx->width * 3] < w) {
224 for (i = (x + 3) & ~3; i < x + w; i += 4) {
225 mp->hpt[((y / 4) * mp->avctx->width + i) / 4] = mp_get_yuv_from_rgb(mp, i, y);
226 }
227 }
228 }
229 x += w;
230 memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
231 p = mp_get_yuv_from_rgb(mp, x - 1, y);
232 } else {
233 p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
234 p.y = av_clip_uintp2(p.y, 5);
235 if ((x & 3) == 0) {
236 if ((y & 3) == 0) {
237 p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
238 p.v = av_clip_intp2(p.v, 5);
239 p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
240 p.u = av_clip_intp2(p.u, 5);
241 mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p;
242 } else {
243 p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v;
244 p.u = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].u;
245 }
246 }
247 mp_set_rgb_from_yuv(mp, x, y, &p);
248 ++x;
249 }
250 }
251}
252
253static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
254{

Callers 1

mp_decode_frame_helperFunction · 0.85

Calls 4

mp_get_yuv_from_rgbFunction · 0.85
mp_gradientFunction · 0.85
mp_get_vlcFunction · 0.85
mp_set_rgb_from_yuvFunction · 0.85

Tested by

no test coverage detected