ref: 85a8a51370eb0b8a4061fc601c705d43cc73b119
parent: a67d9836f66b1018dc4ae30bf67c4b7caeb413c1
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Sep 15 14:16:01 EDT 2020
h264: use real height to get rid of garbage pixels at the bottom
--- a/decoder_h264.c
+++ b/decoder_h264.c
@@ -25,7 +25,7 @@
Aux *a;
int res, off;
u32int used, nerr, isidr, picid;
- u32int w, h, crop, left, top;
+ u32int realh, w, h, crop, left, top;
u8int *pic;
d = x;
@@ -32,6 +32,7 @@
a = d->aux;
lasttimestamp = 0;
memset(&pic, 0, sizeof(pic));
+ realh = 0;
for(res = 0; res >= 0 && (res = Sread(d->s, &sf)) == 0 && sf.sz > 0;){
off = 0;
next:
@@ -47,7 +48,7 @@
res = -1;
}else if((f = malloc(sizeof(*f) + w*h*3)) != nil){
f->w = w;
- f->h = h;
+ f->h = realh;
yuv420_rgb24(w, h, pic, pic+w*h, pic+w*h*5/4, w, w/2, f->rgb, w*3);
f->dt = (sf.timestamp - lasttimestamp) * d->timebase * 1000000000ULL;
lasttimestamp = sf.timestamp;
@@ -65,6 +66,7 @@
w = h264bsdPicWidth(&a->c) * 16;
h = h264bsdPicHeight(&a->c) * 16;
}
+ realh = h;
if(w & 15)
w += 16 - (w & 15);
if(h & 15)