[Ffmpeg-devel] [PATCH] Apple Video Encoder (rpza)
Mon Jun 6 19:20:34 CEST 2005
On Mon, Jun 06, 2005 at 11:04:27AM -0600, Mike Melanson wrote:
> Todd Kirby wrote:
> >Ok, most of this stuff is easy but, what is the alternative to random?
> >Is this a new requirement? I see lots of uses of random in the
> I believe one of the overriding goals here is repeatability. It
> helps for testing and validation. Using random numbers makes this
> difficult. Even when using the same random seeds, I am not sure if the ANSI
> C spec requires the actual random number generator to be implemented the
> same way on different platforms.
> I looked at the way random() is used in the video encoder:
> + r = (uint32_t)rgb24 + (uint32_t)(random() % 8);
> + g = (uint32_t)rgb24 + (uint32_t)(random() % 8);
> + b = (uint32_t)rgb24 + (uint32_t)(random() % 8);
> + int channel_value = color[channel] + ((random() % range) /
> 3.0) - (range / 6.0);
> To get around using random(), maybe you could just write a program to
> generate a static table of random values from 0..7. Copy the text of
> those tables into the source and just iterate through the values,
> wrapping when you hit the end. Encoding results should be repeatable.
This code should not even be in the encoder to begin with. If the user
wants this behavior they can use a noise-adding filter before
More information about the ffmpeg-devel