shithub: hantro9

Download patch

ref: a15e8798f07b778144f60562643e8c826a7e77b3
parent: 73ef8b16fe03183346cd1272d0ed4d15028cb104
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue May 2 22:49:27 EDT 2023

more garbage

--- a/ivfh264.c
+++ b/ivfh264.c
@@ -702,7 +702,7 @@
 main(int argc, char **argv)
 {
 	u64int timestamp, framenum;
-	int fd, shgo;
+	int fd, shgo, vpu;
 	u32int tbnum, tbdenum;
 	u16int w, h, hlen;
 	Biobuf in, settings;
@@ -717,6 +717,7 @@
 		usage();
 	}ARGEND
 
+	vpu = open("/dev/vpu", ORDWR);
 	fd = 0;
 	if(argc == 1){
 		if((fd = open(*argv, OREAD)) < 0)
@@ -753,6 +754,7 @@
 
 		if(v.nal_unit_type == 8){ /* have sps+pps */
 			s = smprint(
+				"decode h264\n"
 				"sps pic_height_in_map_units_minus1 %d\n"
 				"sps pic_width_in_mbs_minus1 %d\n"
 				"sps chroma_format_idc %d\n"
@@ -804,7 +806,8 @@
 				v.pps.weighted_pred_flag,
 				v.pps.pic_parameter_set_id
 			);
-			pwrite(1, s, strlen(s), 0);
+			if(pwrite(vpu, s, strlen(s), 0) < 0)
+				sysfatal("%r");
 			free(s);
 			shgo = 1;
 		}else if(shgo){
@@ -832,10 +835,12 @@
 				v.sh.field_pic_flag,
 				v.sh.bottom_field_flag
 			);
-			pwrite(1, s, strlen(s), 0);
+			if(pwrite(vpu, s, strlen(s), 0) < 0)
+				sysfatal("%r");
 			Bseek(&in, off, 0);
 			Bread(&in, buf, sz);
-			pwrite(1, buf, sz, -1);
+			pwrite(vpu, buf, sz, -1);
+			pread(vpu, buf, 0, 0);
 		}
 
 		Bseek(&in, off+sz, 0);