[x264-devel] -nan value for variable in x264?!

敏河 王 yboslcboy at yahoo.com.cn
Thu Mar 1 09:51:51 CET 2012


hi.

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?

What I have done is described as follow:

1. In function x264_macroblock_write_cavlc(...) , I change the code for I_4x4 pred from 
                          bs_write( s, 4, i_mode - (i_mode > i_pred) );
to
                          bs_write( s, 4, EncryptPred(i_mode - (i_mode > i_pred), 8, nFirst + i, nSec) );
2. The implement of function EncryptPred(...) is very simple:
                          static inline int EncryptPred(int nVal, int nMod, int nSeedFirst, int nSeedSec)
                          {return (nVal ^ GetKey(nMod, nSeedFirst, nSeedSec));}
3. Part of the function GetKey(...) is:
                          static int GetKey(int nMod, int nSeedFirst, int nSeedSec)
                          {
                                   const double LAMBDA = 3.987;
                                   const double SALT = 0.000321;
                                   const double FEEDBACK = g_fSeed;
                                   const int OFFSET = 100000000;

                                   /*double fPad = (double)nSeedFirst / ((double)nSeedSec + FEEDBACK);*/
                                   double fSeed = (double)nSeedFirst / ((double)nSeedSec + FEEDBACK);
                                   //...
                           }
4. Then comes the problem that I get a -nan value for fSeed when disable fPad, and get a right value when enable fPad. And it's a unsolvable problem for me. Wish your help.

Thank you so much.

Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20120301/e81929c9/attachment.html>


More information about the x264-devel mailing list