~ft/hj264

ebae65d8a472ede5e1a6e299c2a7d54bf95c319f — Sigrid Solveig Haflínudóttir a month ago 17578ac
much betta
1 files changed, 8 insertions(+), 5 deletions(-)

M hj264.c
M hj264.c => hj264.c +8 -5
@@ 62,7 62,7 @@ struct Img {
	u8int bgrx[];
};

static uvlong nframes, tstart, debug;
static uvlong tstart, debug;
static int opt;

#pragma varargck type "ℏ" int


@@ 228,7 228,7 @@ done(void*, char*)
{
	Hj264 *h;

	h = *threaddata();
	h = *procdata();
	Bflush(&h->out);

	return 1;


@@ 246,9 246,9 @@ encthread(void *p)
	h = p;
	prev = nil;

	*procdata() = h;
	threadsetname("hj264/encthread");
	threadnotify(done, 1);
	*threaddata() = h;

	for(;;){
		if(recv(h->frame, &img) < 0)


@@ 332,8 332,8 @@ int
main(int argc, char **argv)
{
	int nthreads, fps, kbps, denoise, quality, qp, gop;
	uvlong fstart, fend, f₀, nframes;
	char *s, tmp[61], *f[5];
	uvlong fstart, fend, f₀;
	int ww, hh, in, fmt;
	u8int v[20];
	Img *img;


@@ 459,8 459,11 @@ main(int argc, char **argv)
			break;
		fend = npe_nanosec();

		if(debug && nframes > 0 && (nframes % fps) == 0)
		if(debug && nframes > 0 && (nframes % fps) == 0){
			fprint(2, "avg fps: %llud\n", nframes/((fend - f₀)/Nsec));
			f₀ = npe_nanosec();
			nframes = -1;
		}

		if(Nsec/fps > (fend - fstart))
			npe_nsleep(Nsec/fps - (fend - fstart));