Hi Mike!
Using a very simple system, I have encoded "Hi Mike!". It is not perfect by far and is crude. Let me backtrack and explain why it was so crude.
My initial encoding method was trying to set MV table values per macroblock, which wasn't working. Although I modified the motion vector, the changes I made were not being truly reflected in the motion vector during decoding.
I have now worked out how to modify the overall motion vector, and I am modifying the X dimension only.
During this experimentation, I have also observed that if the motion vectors are modified for an entire frame are too great, this will cause the residual frame to be very large and results in the encoder converting the P-frame to an I-frame. (A P-frame is a predicted frame containing motion vectors that are used as deltas to modify preceding frame representations, an I-frame is a reference frame that essentially contains the picture).
In switching from MV tables to MV, I also changed to a fundamental encoding scheme which works as follows. I set the X-direction of a MV as follows:
- 1 = encode bit value of 1
- 2 = encode bit value of 0
- 3 = nothing to encode
During the encoding process I was trying to encode the length of the message as a four byte integer representation followed by "Hi Mike!" -- as you can see the integer representation didn't work, but, we have "Hi Mike!" (LSB -> MSB) at encode-time.
- 0 >> 00000000
- 1 >> 00000000
- 2 >> 00000000
- 3 >> 00000000
- 4 >> 00010010
- 5 >> 10010110
- 6 >> 00000100
- 7 >> 10110010
- 8 >> 10010110
- 9 >> 11010110
- 10 >> 10100110
- 11 >> 10000100
Using my analysis tool I have been able to output the follow (note, I stopped selecting bits/mv values as seen as I hit a MV with the x-dimension value of 3.
- 0 >> 22222222
- 1 >> 22222222
- 2 >> 22222222
- 3 >> 22222222
- 4 >> 22212212
- 5 >> 12212212
- 6 >> 22222112
- 7 >> 02112212
- 8 >> 22212212
- 9 >> 11212222
- 10 >> 12222112
- 11 >> 12222122
For some reason there is a "0" value in there - this shouldn't be the case. I'm not sure why there is that discrepency, I might have to look into using ECCs (Error Correcting Codes). Replace the 2's with 0's and we have our encoded message!