summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4video.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-24 15:03:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-24 16:11:38 +0200
commit39de31ccb627bada6a42b7b58a1e069246e22238 (patch)
tree0cd35b4c224262daa987fceeea53fa54ce52d536 /libavcodec/mpeg4video.h
parentb71528d8967c1e10f499432fe26ff4713d1fd3b6 (diff)
avcodec/mpeg4video: Reorder operations to reduce accesses to err_recognition
About 9 cpu cycle faster mpeg4_decode_mb() Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg4video.h')
-rw-r--r--libavcodec/mpeg4video.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index b945f09a3e..49bc13f87a 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -230,21 +230,21 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int level,
} else {
level += pred;
ret = level;
- if (s->avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_AGGRESSIVE)) {
+ }
+ level *= scale;
+ if (level & (~2047)) {
+ if (!s->encoding && (s->avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_AGGRESSIVE))) {
if (level < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"dc<0 at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
- if (level * scale > 2048 + scale) {
+ if (level > 2048 + scale) {
av_log(s->avctx, AV_LOG_ERROR,
"dc overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
}
- }
- level *= scale;
- if (level & (~2047)) {
if (level < 0)
level = 0;
else if (!(s->workaround_bugs & FF_BUG_DC_CLIP))