最近在研究SSA字体文件的嵌入编码,算法的主体部分已经完成,但是卡在最后几个字节的编码问题上了Orz
Sub Station Alpha v4.00+ Script Format中的原文是这么写的:
引用
If the length of the file being encoded is not an exact multiple of 3, then for odd-number filelengths , the last byte is multiplied by hexadecimal 100, and the most significant 12 bits are converted to two characters as above. For even-number filelengths , the last two bytes are multiplied by hexadecimal 10000, and the most significant 18 bits are converted to three characters as above.
上面的
filelengths 是指文件的总长度么?
如果是的话总长度的奇偶貌似和被3除的余数无关的说:
filelengthmod3mod6
even 0 0
odd 1 1
even 2 2
odd 0 3
even 1 4
odd 2 5
如上,无论是odd还是even被3除都有余数为0、1、2三种情况,那么对于odd余数为2时何来the last byte以及对于even余数为1时何来the last two bytes啊啊混乱ing……不知哪位高人可指点一下迷津?