Thanks Rob/Vicky for the info. I've read about the bi-phase signals, but I don't really see what IR does that's so special?
Take this example found in the FromRob.ir, rounded to 50:
Code: Select all
+2650 -900 +450 -450 +450 -450 +450 -900 +450 -900 +900 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +900 -450 +450 -900 +900 -109200
It's clearly bi-phase with (+450,-450) and (-450,+450) as the two logical pairs... But the Bi-Phase dropdown in IR doesn't seem to have any effect on it...if I set it to ODD, it shows:
Code: Select all
+2650; -900 +450; -450 +450; -450 +450; -900 +450; -900 +900; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +900; -900 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +900; -900 +450; -450 +450; -450 +450; -450 +900; -450 +450; -900 +900; -109200
With EVEN it shows:
Code: Select all
+2650 -900; +450 -450; +450 -450; +450 -900; +450 -900; +900 -450; +450 -450; +450 -450; +450 -450; +450 -450; +450 -450; +450 -450; +900 -900; +450 -450; +450 -450; +450 -450; +450 -450; +450 -450; +450 -450; +900 -900; +450 -450; +450 -450; +450 -450; +900 -450; +450 -900; +900 -109200;
So basically it's just inserting semicolons at either the odd or even positions...how does that really help? I'd much rather detect that it is bi-phase and show it like this:
Code: Select all
+2650 -900; +450 -450; +450 -450; +450 -450; -450 +450; -900 +900; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; +450 -450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; -450 +450; +450 -450; -450 +450; -450 +450; -450 +450; -450 +450; +450 -450; +450 -450; -450 +450; +450 -450; -108750
Basically I would parse it in one on/off at a time with some basic rules...Here are the rules:
Code: Select all
Definitions:
() represents the next logical pair being built.
+1 and -1 represent a single on or off burst of the bi-phase time.
+N and -N represent a burst that is N times the length of a +1 or -1.
+(N-1) and -(N-1) represent a burst that is (N-1) times the length of a +1 or -1.
Bi-Phase Rules:
() +1 ==> ( +1, ??? )
() -1 ==> ( -1, ??? )
( +1, ??? ) -1 ==> ( +1, -1 )
( -1, ??? ) +1 ==> ( -1, -1 )
( +1, ? ) -N ==> ( +1, -1 ) ( -(N-1), ??? )
( -1, ? ) +N ==> ( -1, +1 ) ( +(N-1), ??? )
( -N, ??? ) +N ==> ( -N, +N )
( +N, ??? ) -N ==> ( +N, -N )
() +N ==> ( +N, ??? )
() -N ==> ( -N, ??? )
Anything that doesn't match those rules fails the bi-phase parsing. So then we just need to account for the lead-in and lead-out, and I would do it by just trying all possibilities.
To look at this one as an example:
Code: Select all
Lead-in: +2650 -900
Remaining Input = +450 -450 +450 -450 +450 -900 +450 -900 +900 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +900 -450 +450 -900 +900 -109200
Parse Bi-Phase:
( +450, ??? ) ...consume +1 to start a pair.
( +450, -450 ) ...consume -1 to finish a pair.
( +450, -450 ) ( +450, ??? ) ...consume +1 to start a pair.
( +450, -450 ) ( +450, -450 ) ...consume -1 to finish a pair.
( +450, -450 ) ( +450, -450 ) ( +450, ??? ) ...consume +1 to start a pair
( +450, -450 ) ( +450, -450 ) ( +450, -450 ) ( -450, ??? ) ...we have ( +1, ??? ) -N so it yields ( +1, -1 ) ( -(N-1), ??? ).
( +450, -450 ) ( +450, -450 ) ( +450, -450 ) ( -450, +450 ) ...consume +1 to finish a pair.
( +450, -450 ) ( +450, -450 ) ( +450, -450 ) ( -450, +450 ) ( -900, ??? ) ...consume -2 to start a pair.
( +450, -450 ) ( +450, -450 ) ( +450, -450 ) ( -450, +450 ) ( -900, +900 ) ...consume +2 to finish a pair.
...
...skipping to the end...
...
( ...bunch of logical pairs... ) ( +450, ??? ) ...up next is lead-out off time.
( ...bunch of logical pairs... ) ( +450, -450 ) ...finish our logical pair by taking -1 from lead-out.
Lead-out = -109200 - (-450) =-108750
Now, the other possibility is that we should have split up the off time of the lead-in time instead of finishing our last pair by taking from the lead-out... However, that way would have ended with an error...let's check it out:
Code: Select all
Lead-in: +2650 -450 (took a -450 to start our first pair)
Remaining Input = -450 +450 -450 +450 -450 +450 -900 +450 -900 +900 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +450 -450 +900 -900 +450 -450 +450 -450 +450 -450 +900 -450 +450 -900 +900 -109200
Parse Bi-Phase:
( -450, ??? ) ...starting with the -1 from the lead-in.
( -450, +450 ) ...consume +1 to finish a pair.
( -450, +450 ) ( -450, ??? ) ...consume -1 to start a pair.
( +450, -450 ) ( +450, +450 ) ...consume +1 to finish a pair.
( +450, -450 ) ( +450, +450 ) ( -450, ??? ) ...consume -1 to start a pair.
( +450, -450 ) ( +450, +450 ) ( -450, +450 ) ...consume +1 to finish a pair.
( +450, -450 ) ( +450, +450 ) ( -450, +450 ) ( -900, ??? ) ...consume a -2 to start a pair.
( +450, -450 ) ( +450, +450 ) ( -450, +450 ) ( -900, ??? ) ...we have ( -2, ??? ) with +1 next which is not in our rules (needed to be +2 or higher).
ERROR
So the only way to parse it was the first way, leaving the lead-in as ( +2650, -900 ) and finishing our last logical pair using some of the off-time of the lead-out.
I'm pretty sure I could do all of this automated within RMIR...so you wouldn't even have to pick an even/odd...it would figure it out automatically. I'm also fairly certain it could figure out if it's bi-phase automatically and so automatically applying the above bi-phase parsing (still with the option to uncheck it though and see raw times). What do you think?