compute output buffer size