shithub: treason

Download patch

ref: f64f8f7ffe3669b8313a796efa9a60946173ea42
parent: fcf4838dbaf44d5cb8b00e417172208dc3ee5382
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Nov 4 09:06:51 EST 2020

vpx decoding: convert cropped area only

--- a/decoder_vpx.c
+++ b/decoder_vpx.c
@@ -43,6 +43,12 @@
 		for(iter = nil;;){
 			if((im = vpx_codec_get_frame(&a->ctx, &iter)) == nil)
 				break;
+			if(im->fmt != VPX_IMG_FMT_I420){
+				vpx_img_free(im);
+				werrstr("images other than YUV420 aren't supported");
+				res = -1;
+				break;
+			}
 
 			if((f = malloc(sizeof(*f) + im->w*im->h*3)) != nil){
 				f->w = im->w;
@@ -51,7 +57,7 @@
 				f->crop.top = 0;
 				f->crop.right = im->d_w;
 				f->crop.bottom = im->d_h;
-				yuv420_rgb24(im->w, im->h, im->planes[0], im->planes[1], im->planes[2], im->stride[0], im->stride[1], f->rgb, f->w*3);
+				yuv420_rgb24(im->d_w, im->d_h, im->planes[0], im->planes[1], im->planes[2], im->stride[0], im->stride[1], f->rgb, f->w*3);
 				vpx_img_free(im);
 				f->dt = (sf.timestamp - lasttimestamp) * d->timebase * 1000000000ULL;
 				lasttimestamp = sf.timestamp;