mathdon wrote:I can't win, can I?

This attempt of mine is TOO general! Is there any harm in leaving it, or do I reject the case where the last 2 bits are equal?
It's all a question of instinct. I'm not saying that it will never happen, I'm just saying that I don't expect it to ever happen. I've been decoding these protocols for years, whereas you've just started, so it will take a while for you to develop an instinct for what's likely to occur and what isn't.
mathdon wrote:I'm still on a steep learning curve with all this, but I was assuming that the ON pulse after the long OFF leadout was the first half of a biphase "burst", so it had to be an ON/OFF burst, i.e. a 1. If it could be the second half, that would make it be a 0 with the first OFF half being concatenated with the preceding leadout. But if it were allowed to be either the first or second half, how would we ever know which it was? An initial long ON could only be the second half of a 0 concatenated with the first half of the following 1, but an initial short ON could be EITHER first half of a 1 OR second half of a 0 without any way to distinguish between them.
Here's a look at the data for the 1 and 2 buttons:
1:
(raw times)
+315 -630 +630 -630 +630 -630 +630 -315 +315 -630 +630 -630 +315 -315 +315 -315 +315 -315 +315 -315 +315 -315 +630 -630 +315 -89145
(split into EVEN bi-phase pairs)
+315 -315; -315 +315; +315 -315; -315 +315; +315 -315; -315 +315; +315 -315; +315 -315; -315 +315; +315 -315; -315 +315; -315 +315; -315 +315; -315 +315; -315 +315; -315 +315; +315 -315; -315 +315; -89145
(binary)
101010110100000010 -89145
2:
(raw times)
+315 -630 +630 -630 +630 -630 +630 -315 +315 -630 +630 -630 +315 -315 +315 -315 +315 -315 +315 -315 +630 -630 +630 -89460
(split into EVEN bi-phase pairs)
+315 -315; -315 +315; +315 -315; -315 +315; +315 -315; -315 +315; +315 -315; +315 -315; -315 +315; +315 -315; -315 +315; -315 +315; -315 +315; -315 +315; -315 +315; +315 -315; -315 +315; +315 -89460;
(binary)
101010110100000101 -89145
(Note: you'll notice that the 2 string ends with +315 -89460, which is really +315 -315; -89145 but the last OFF time gets merged with the leadout time).
Now, let's create a fictional signal that starts with a zero. (This is really the 2 string with the first binary digit changed).
(binary)
001010110100000101 -89145
(split into ODD bi-phase pairs)
+315; -315 +315; +315 -315; -315 +315; +315 -315; -315 +315; +315 -315; +315 -315; -315 +315; +315 -315; -315 +315; -315 +315; -315 +315; -315 +315; -315 +315; +315 -315; -315 +315; +315 -89460;
(raw times)
+315 -315 +630 -630 +630 -630 +630 -315 +315 -630 +630 -630 +315 -315 +315 -315 +315 -315 +315 -315 +630 -630 +630 -89775
(note, I added the leading -315 to the leadout to come up with -89775)
The reason why there's an ODD selection in IR.exe for bi-phase is exactly for situations like this. When I'm decoding a new signal, I select EVEN first and then look at the data. If I see pairs like "+315 +315" or "-315 -315", I change the selection to ODD to see if that fixes it. Of course, as with every rule, there will always be exceptions, and one such exception is the ReplayTV signal, where there are a couple of "double wide" pairs in the beginning of the string. To see an example of this, look at the FromRob.ir file that's in the IR zip and select the P&P:REW button. Select Bi-Phase: ODD and enter 440 as the rounding, which gives:
+2640; -440 -440; +440 -440; +440 -440; +440 -440; -440 +440; -440 -440; +440 +440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; +440 -440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; -440 +440; +440 -440; -440 +440; -440 +440; -440 +440; -440 +440; +440 -440; +440 -440; -440 +440; +440 -109120;
In binary that's:
+2640 -440; -440 1110 -880 +880; 00000001 00000001 00001101 -108680;