I've done most of the implementation for supporting QR codes, but I'm having a lot of trouble generating the error correction codes. There are four error correction levels (L, M, Q, and H). 100% of my tested QR codes have the correct error correction for Q and H. About 50% of M codes have the correct error correction codes, and none of the L codes have the correct error correction data. I can't figure out what's wrong with it. Does anyone have experience with generating QR codes?
I've looked at some other implementations (MIT license only -- I'd like to stay away from GPL code just in case), but their implementation is very confusing to me.