shithub: treason

Download patch

ref: 82829c55c5faa242557a6effe7b0d4be7194bbac
parent: 5cc548d0c12503bd870091e0feac712457f8621e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Dec 31 21:27:09 EST 1969

av1: do not apply grain, update decoding time

--- a/decoder_av1.c
+++ b/decoder_av1.c
@@ -62,7 +62,6 @@
 
 		start = nanosec();
 		res = dav1d_get_picture(a->c, &pic);
-		d->decodetime = nanosec() - start;
 		if(res < 0){
 			if(res != DAV1D_ERR(EAGAIN)){
 				werrstr("dav1d_get_picture: %d", res);
@@ -80,15 +79,18 @@
 			werrstr("unsupported bits per component: %d", pic.p.bpc);
 			res = -1;
 			break;
-		}else if((f = newframe(pic.p.w, pic.p.h, pic.data, pic.stride[0], pic.stride[1])) != nil){
-			memset(&f->crop, 0, sizeof(f->crop));
-			f->dt = (pic.m.timestamp - lasttimestamp) * d->timebase * 1000000000ULL;
-			lasttimestamp = pic.m.timestamp;
-			dav1d_picture_unref(&pic);
+		}else{
+			if((f = newframe(pic.p.w, pic.p.h, pic.data, pic.stride[0], pic.stride[1])) != nil){
+				memset(&f->crop, 0, sizeof(f->crop));
+				f->dt = (pic.m.timestamp - lasttimestamp) * d->timebase * 1000000000ULL;
+				lasttimestamp = pic.m.timestamp;
 
-			if(sendp(d->frames, f) < 0){
-				free(f);
-				break;
+				if(sendp(d->frames, f) < 0){
+					dav1d_picture_unref(&pic);
+					free(f);
+					break;
+				}
+				dav1d_picture_unref(&pic);
 			}
 		}
 
@@ -98,6 +100,8 @@
 				werrstr("dav1d_send_data: %d", res);
 				break;
 			}
+		}else{
+			d->decodetime = nanosec() - start;
 		}
 	}
 	if(res != 0)
@@ -131,6 +135,7 @@
 	dav1d_default_settings(&av1s);
 	av1s.n_frame_threads = nproc;
 	av1s.n_tile_threads = nproc;
+	av1s.apply_grain = 0;
 
 	if((res = dav1d_open(&a->c, &av1s)) != 0){
 		werrstr("dav1d_open: %d", res);