Functions for average and variance calulations
Hi, are there such functions in the FFmpeg library? I have an integer array with lets say 13 numbers (accumulated counts of X in the range of 0..12) like: a) 0 1 0 1 2 7 9 5 4 3 2 0 1 b) 7 1 9 8 1 6 2 0 0 1 9 1 0 In a) the average X would be ~6 and the variance would be small. In b) the average X would be ~3.5 and the variance would be bigger. I'm looking for functions that can calulate such values with a result in float resolution. -Ulf -- Von meinem Seibert gesendet
Am 09.07.19 um 00:25 schrieb Ulf Zibis:
Hi,
are there such functions in the FFmpeg library?
I have an integer array with lets say 13 numbers (accumulated counts of X in the range of 0..12) like: a) 0 1 0 1 2 7 9 5 4 3 2 0 1 b) 7 1 9 8 1 6 2 0 0 1 9 1 0
In a) the average X would be ~6 and the variance would be small. In b) the average X would be ~3.5 and the variance would be bigger.
I'm looking for functions that can calulate such values with a result in float resolution.
-Ulf For a qudratic average I could use something like: float sum = 0; for (int i = s->span_r - s->span_l; i >= 0; i--) sum += pow(counts[i], 2); float qaverage = sqrt(sum / (s->span_r - s->span_l + 1));
But for calculating the variance I'm lost. I assume, there are already solutions for both in the FFmpeg lib. -Ulf
On 7/9/19, Ulf Zibis <Ulf.Zibis@gmx.de> wrote:
Am 09.07.19 um 00:25 schrieb Ulf Zibis:
Hi,
are there such functions in the FFmpeg library?
I have an integer array with lets say 13 numbers (accumulated counts of X in the range of 0..12) like: a) 0 1 0 1 2 7 9 5 4 3 2 0 1 b) 7 1 9 8 1 6 2 0 0 1 9 1 0
In a) the average X would be ~6 and the variance would be small. In b) the average X would be ~3.5 and the variance would be bigger.
I'm looking for functions that can calulate such values with a result in float resolution.
-Ulf For a qudratic average I could use something like: float sum = 0; for (int i = s->span_r - s->span_l; i >= 0; i--) sum += pow(counts[i], 2); float qaverage = sqrt(sum / (s->span_r - s->span_l + 1));
But for calculating the variance I'm lost. I assume, there are already solutions for both in the FFmpeg lib.
No, they are not there. At least not freely available via API. If you have formula for variance then its easy to implement it.
-Ulf
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Am 09.07.19 um 10:06 schrieb Paul B Mahol:
On 7/9/19, Ulf Zibis <Ulf.Zibis@gmx.de> wrote:
Am 09.07.19 um 00:25 schrieb Ulf Zibis:
Hi,
are there such functions in the FFmpeg library?
I have an integer array with lets say 13 numbers (accumulated counts of X in the range of 0..12) like: a) 0 1 0 1 2 7 9 5 4 3 2 0 1 b) 7 1 9 8 1 6 2 0 0 1 9 1 0
In a) the average X would be ~6 and the variance would be small. In b) the average X would be ~3.5 and the variance would be bigger.
I'm looking for functions that can calulate such values with a result in float resolution.
-Ulf For a qudratic average I could use something like: float sum = 0; for (int i = s->span_r - s->span_l; i >= 0; i--) sum += pow(counts[i], 2); float qaverage = sqrt(sum / (s->span_r - s->span_l + 1));
But for calculating the variance I'm lost. I assume, there are already solutions for both in the FFmpeg lib. No, they are not there. At least not freely available via API. If you have formula for variance then its easy to implement it.
I now have developed these functions. Maybe one has interest, so I share them. -Ulf
participants (2)
-
Paul B Mahol -
Ulf Zibis