This avoids high scores in random data that has a high 0x47 frequency
Fixes Ticket3844
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
int stat[TS_MAX_PACKET_SIZE];
int i;
int best_score = 0;
+ int best_score2 = 0;
memset(stat, 0, packet_size * sizeof(*stat));
best_score = stat[x];
if (index)
*index = x;
+ } else if (stat[x] > best_score2) {
+ best_score2 = stat[x];
}
}
}
- return best_score;
+ return best_score - best_score2;
}
/* autodetect fec presence. Must have at least 1024 bytes */