Commit 56d85041 authored by Koen Vos's avatar Koen Vos Committed by Jean-Marc Valin

Fixes bitrate statistics for decode-only operation and inband FEC

Signed-off-by: Jean-Marc Valin's avatarJean-Marc Valin <jmvalin@jmvalin.ca>
parent 3499e78b
......@@ -834,28 +834,32 @@ int main(int argc, char *argv[])
}
lost_prev = lost;
/* count bits */
bits += len[toggle]*8;
bits_max = ( len[toggle]*8 > bits_max ) ? len[toggle]*8 : bits_max;
if( count >= use_inbandfec ) {
nrg = 0.0;
/* count bits */
bits += len[toggle]*8;
bits_max = ( len[toggle]*8 > bits_max ) ? len[toggle]*8 : bits_max;
bits2 += len[toggle]*len[toggle]*64;
if (!decode_only)
{
nrg = 0.0;
for ( k = 0; k < frame_size * channels; k++ ) {
nrg += in[ k ] * (double)in[ k ];
}
nrg /= frame_size * channels;
if( nrg > 1e5 ) {
bits_act += len[toggle]*8;
count_act++;
}
}
if ( ( nrg / ( frame_size * channels ) ) > 1e5 ) {
bits_act += len[toggle]*8;
count_act++;
}
/* Variance */
bits2 += len[toggle]*len[toggle]*64;
}
count++;
toggle = (toggle + use_inbandfec) & 1;
}
/* Print out bitrate statistics */
if(decode_only)
frame_size = (int)(tot_samples / count);
count -= use_inbandfec;
fprintf (stderr, "average bitrate: %7.3f kb/s\n",
1e-3*bits*sampling_rate/tot_samples);
fprintf (stderr, "maximum bitrate: %7.3f kb/s\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment