summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-10-01 18:10:36 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-10-14 23:23:25 +0200
commit963247b5f36a70f0ea083f5f43356d498fd85c47 (patch)
tree58e3843bbe4d40147289eed6d69cbda323c6b4ca
parentcd2f69cdd63d3ca5c2388d9ce6737b3e46bb19b2 (diff)
downloadffmpeg-963247b5f36a70f0ea083f5f43356d498fd85c47.tar.gz
avcodec/dvbsubdec: Split best score computation out of loop in compute_default_clut()
3% faster Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dvbsubdec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index ef581a9a3f..85a59f3ced 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -680,14 +680,17 @@ static void compute_default_clut(AVSubtitleRect *rect, int w, int h)
int l_r = x+1<w ? L( 1, 0) : 1;
int l_t = y ? L( 0,-1) : 1;
int l_b = y+1<h ? L( 0, 1) : 1;
- int score;
if (l_m)
continue;
scoretab[v] += l_l + l_r + l_t + l_b;
- score = 1024LL*scoretab[v] / counttab[v];
+ }
+ }
+ for (x = 0; x < 256; x++) {
+ if (scoretab[x]) {
+ int score = 1024LL*scoretab[x] / counttab[x];
if (score > bestscore) {
bestscore = score;
- bestv = v;
+ bestv = x;
}
}
}