I had a look at the magic numbers in SoftwareSerial today (only the 16Mhz part for now) because I wanted to check non-standard serial baudrates too.
static const DELAY_TABLE PROGMEM table[] =
{
// baud rxcenter rxintra rxstop tx
{ 115200, 1, 17, 17, 12, },
{ 57600, 10, 37, 37, 33, },
{ 38400, 25, 57, 57, 54, },
{ 31250, 31, 70, 70, 68, },
{ 28800, 34, 77, 77, 74, },
{ 19200, 54, 117, 117, 114, },
{ 14400, 74, 156, 156, 153, },
{ 9600, 114, 236, 236, 233, },
{ 4800, 233, 474, 474, 471, },
{ 2400, 471, 950, 950, 947, },
{ 1200, 947, 1902, 1902, 1899, },
{ 300, 3804, 7617, 7617, 7614, },
};
I came up with the following formulas
rxstop = 16000000L/(7 * baudrate) - 2;
rxintra = rxstop; // an easy one
tx = rxstop - 4; // slight error
rxcenter = rxstop/2 - 5; // slight error at higher baud rates.
this generates the following table
baud rxcenter rxintra rxstop tx
115200 3 17 17 14
57600 13 37 37 34
38400 23 57 57 54
31250 30 71 71 68
28800 33 77 77 74
19200 53 117 117 114
14400 73 156 156 153
9600 113 236 236 233
4800 232 474 474 471
2400 470 950 950 947
1200 946 1902 1902 1899
300 3803 7617 7617 7614
The difference 'matrix'
2 0 0 2
3 0 0 1
2 0 0 0
1 1 1 0
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
Not yet tested thoroughly but the error matrix indicates that the tables can be replaced by formulas, allowing non standard baud rates.
(to be continued)