ref: 709cb723bba3aa43ba40a5c70dba0b337bae54e2
parent: 14a76c31ba5ca60d00a898f70d13c9db14d4e5d4
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Dec 14 13:59:24 EST 2020
wat. fix weird crash after libs were updated
--- a/frame.c
+++ b/frame.c
@@ -7,19 +7,23 @@
{
Frame *f;
+ assert(w > 2 && h > 2);
+ assert(ystride > 2 && uvstride > 2);
+ assert(yuv[0] != nil && yuv[1] != nil && yuv[2] != nil);
+
if((f = malloc(sizeof(*f) + (ystride+uvstride)*h)) == nil)
return nil;
f->w = w;
f->h = h;
+ f->ystride = ystride;
+ f->uvstride = uvstride;
f->yuv[0] = f->data;
+ f->yuv[1] = f->yuv[0] + ystride*h;
+ f->yuv[2] = f->yuv[1] + uvstride*h/2;
memmove(f->yuv[0], yuv[0], ystride*h);
- f->yuv[1] = f->data + ystride*h;
memmove(f->yuv[1], yuv[1], uvstride*h/2);
- f->yuv[2] = f->data + ystride*h + uvstride*h/2;
memmove(f->yuv[2], yuv[2], uvstride*h/2);
- f->ystride = ystride;
- f->uvstride = uvstride;
return f;
}