Calculating the approximate average compression ratio
3 comentarios
To calculate the average compression ratio:
1. Count the number of each frame type. 2. Multiple the compression ratio for each frame type by the number of each frame type. 3. Sum these numbers up and divide by the total number of frames:
For the sequence above:
Number of A frames = 2 Number of B frames = 8 Number of C frames = 3
Multiple the compression ratio for each frame type by the number of each frame type:
A frame = 2 * 0.3 = 0.6 B frame = 3 * 0.05 = 0.15 C frame = 8 * 0.7 = 5.6
Average compression = (0.6+ 0.15 + 5.6)/13 = 0.488462
However, if the number of frames is much longer than 13 frames, and you want to estimate the average compression ratio, you might just take the first 12 frames assuming there is a pattern to the frames:
*A BBC BBC BBC B* A
The pattern ends at frame 12, which is frame type B, because it is assumed that A is an I frame (since it is the first frame in the sequence). If the pattern was to end at A, then there will be two I frames next to each other - remember that I frames can be decoded independently, so it is unlikely that two I frames follow one another. So... if you have extremely long frames you might assume that the frames have this kind of pattern:
*A BBC BBC BBC BB* *A BBC BBC BBC BB* *A BBC BBC BBC BB*
In which case, you only need to calculate the average of the first 12 frames:
A frame = 1 * 0.3 = 0.3 B frame = 3 * 0.05 = 0.15 C frame = 8 * 0.7 = 5.6
So, the average is now 0.504167
Respuestas (0)
Ver también
Categorías
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!