[Ffmpeg-devel] [RFC] av_random...

Ryan Martell rdm4
Mon Jan 8 18:56:24 CET 2007


On Jan 8, 2007, at 10:00 AM, Michael Niedermayer wrote:
> Hi
>
> On Sun, Jan 07, 2007 at 08:08:01PM -0600, Ryan Martell wrote:
> [...]
> i dont like these magic_cookies, if someone calls the code without  
> init then
> thats pretty much his problem IMHO

I kinda like the net, but okay.

>>     unsigned long mt[AV_RANDOM_N];	///< the array for the state  
>> vector
>
> unsigned int or uint_fast32_t if you want to be pedantic but long is
> 64-bit on some architectures and that is not really wanted here i  
> think

Fixed.

>>     int mti; ///< current untempered value we use as the base.
>> } AVRandomState;
>>
>>
>> void av_init_random(unsigned long seed, AVRandomState *state); /// 
>> < to be inlined, the struct must be visible, so it doesn't make  
>> sense to try and keep it opaque with malloc/free like calls
>> void av_random_generate_untempered_numbers(AVRandomState  
>> *state); ///< Regenerate the untempered numbers (must be done  
>> every 624 iterations, or it will loop)
>>
>> /* generates a random number on [0,0xffffffff]-interval */
>> static inline unsigned int av_random(AVRandomState *state)
>
> that should be /** ... */ for doxygen compatibility

Fixed.

>> {
>>     unsigned int y= 0;
>
> y is not read before its written so the =0 is redundant

Fixed.

How's this?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: random.c
Type: application/octet-stream
Size: 3561 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070108/7031231a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random.h
Type: application/octet-stream
Size: 2321 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070108/7031231a/attachment-0001.obj>
-------------- next part --------------

(Patch for makefile would have to be submitted as well, if the code  
looks okay)




More information about the ffmpeg-devel mailing list