First working solution

JPEG encoder fifo still overflows on some inputs needs some debuging
because the usb fifo is also overflowing.