<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><span>hi.<br><br>I am working on x264 (Copyright (c) 2003-2008 x264 project) for Encrypting videos, and get a mistake unsolvable. Would you please give me some tips?<br><br>What I have done is described as follow:<br><br>1. In function <em><strong>x264_macroblock_write_cavlc(...)</strong></em> , I change the code for I_4x4 pred from <br> </span><span><span style="background-color: #b9b9b9;"><span style="background-color: #000000;"><span style="background-color: #a2a2a2;"><span style="background-color: #ffffff;"><span style="background-color: #ff0000;"><span style="background-color: #ffffff;"><em>bs_write( s, 4, i_mode - (i_mode > i_pred) );</em></span></span></span></span></span></span></span><span><br> to<br>
</span><span><span style="background-color: #a2a2a2;"><span style="background-color: #ffffff;"><em>bs_write( s, 4, EncryptPred(i_mode - (i_mode > i_pred), 8, nFirst + i, nSec) );</em></span></span></span><span><br>2. The implement of function <em><strong>EncryptPred(...)</strong></em> is very simple:<br> </span><em><span style="background-color: #ffffff;"><span style="background-color: #ffffff;"><span style="background-color: #ffffff;"><span style="background-color: #ffffff;"><span style="background-color: #a2a2a2;"><span><span style="background-color: #ffffff;">static inline int EncryptPred(int nVal, int nMod, int nSeedFirst, int nSeedSec)</span><br></span></span><span style="background-color: #a2a2a2;"><span><span style="background-color: #ffffff;"> </span></span></span><span style="background-color: #a2a2a2;"><span><span
style="background-color: #ffffff;">{return (nVal ^ GetKey(nMod, nSeedFirst, nSeedSec));}</span></span></span></span></span></span></span></em><span><br>3. Part of the function <em><strong>GetKey(...)</strong></em> is:<br> </span><em><span>static int GetKey(int nMod, int nSeedFirst, int nSeedSec)<br> {<br> const double LAMBDA = 3.987;<br> const double SALT = 0.000321;<br> const double FEEDBACK = g_fSeed;<br> const int OFFSET = 100000000;<br><br> /*double fPad = (double)nSeedFirst /
((double)nSeedSec + FEEDBACK);*/<br> double fSeed = (double)nSeedFirst / ((double)nSeedSec + FEEDBACK);<br> //...<br> }</span></em><span><br>4. Then comes the problem that I get a <em><strong><font color="#ff0000">-nan</font></strong></em> value for <em>fSeed</em> when disable <em>fPad</em>, and get a right value when enable <em>fPad</em>. And it's a unsolvable problem for me. Wish your help.<br><br>Thank you so much.</span></div><div>Best regards.</div></div></body></html>