Commit e624df5d authored by Michael Niedermayer's avatar Michael Niedermayer

mpegts: only calculate stat index when its needed during probe

40% faster probe
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 9825b99e
......@@ -452,22 +452,19 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
static int analyze(const uint8_t *buf, int size, int packet_size, int *index){
int stat[TS_MAX_PACKET_SIZE];
int i;
int x=0;
int best_score=0;
memset(stat, 0, packet_size*sizeof(*stat));
for(x=i=0; i<size-3; i++){
for(i=0; i<size-3; i++){
if(buf[i] == 0x47 && !(buf[i+1] & 0x80) && buf[i+3] != 0x47){
int x = i % packet_size;
stat[x]++;
if(stat[x] > best_score){
best_score= stat[x];
if(index) *index= x;
}
}
x++;
if(x == packet_size) x= 0;
}
return best_score;
......
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