Simplify render_point
The render_point function seems to fit a linear function through (x0,y0) and (x1,y1) and then finds y(x) on that line. It does some special case handling for y0>y1 vs y0<y1, which, as far as I can see, is unnecessary. I.e., the current code:
int dy=y1-y0;
int adx=x1-x0;
int ady=abs(dy);
int err=ady*(x-x0);
int off=err/adx;
if(dy<0)return(y0-off);
return(y0+off);
should be equivalent to this: return (x - x0) * (y1 - y0) / (x1 - x0) + y0;
The only difference would be in some integer overflow cases, which cannot happen in this place anyway. I've tried the replacement and found no difference when encoding a test file.