pass the correct output buffer size to lzo1x_compress rather than the input buffer size
check the result of lzo1x_optimize