[MPlayer-dev-eng] [PATCH] new video filter : vf_deflicker
alexandre
alex14fr at gmail.com
Tue May 18 05:42:00 CEST 2010
On 16/05/2010 23:53, Reimar Döffinger wrote:
> bzero is deprecated and even removed from the newest POSIX versions.
Fixed.
> Divisions in an inner loop are bad, if you stick with floating point
> they should be multiplications by the inverse instead.
> However, you should not be using floating point after the alogrithmic
> change, you risk accumulating rounding errors.
> It makes more sense to make "means" an int array and do the division
> on use.
> This also allows optimizing special-cases (power of two frame count)
> by using shift if desired later on.
Sorry, means is already an int array. I guess it's OK to do an int
division in the loop, am I right ?
> Since you don't need h1 anymore there is no need for an extra F1,
> it only causes needeless cache pressure.
> In addition since you only compare the two histograms, the specific
> values are completely irrelevant, thus you should use ints and
> do a simple
> h1[mpi->planes[0][x + mpi->stride[0] * y]]++;
> in the innermost loop.
> I admit it will need changing the histogram matching code a bit.
Good point, I've changed this.
>> + // histogram matching
>> + for (n = 0; n< 256; n++) {
>> + for (k = (n == 0 ? 0 : F1[n - 1]);
>> + k< 256&& F1[n]> F2[k]; k++);
>> + L[n] = (k< 255 ? k : 255);
>> + }
>
> Simpler as
> k = 0;
> for (n = 0; n< 256; n++) {
> while (k< 255&& F1[n]> F2[k]) k++;
> L[n] = k;
> }
Fixed.
A
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vfdeflicker.txt
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100518/8a5938e3/attachment.txt>
More information about the MPlayer-dev-eng
mailing list