aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-09 16:09:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-09 16:09:26 +0100
commite624df5dc33fb1ded7b8b23a72565f882dbb0387 (patch)
tree4758dd971adb803257ed176e213cbf11b4a50df6 /libavformat
parent9825b99eca0fb7ff4e5939f03c154f27eef04ebb (diff)
downloadffmpeg-e624df5dc33fb1ded7b8b23a72565f882dbb0387.tar.gz
mpegts: only calculate stat index when its needed during probe
40% faster probe Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index bded171f0b..e73209cdb3 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -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;