[FFmpeg-cvslog] mpeg12enc: factor out check in encode_dc

Vittorio Giovara git at videolan.org
Thu Nov 6 17:33:37 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Nov  4 09:36:57 2014 -0500| [37b3361e755361d4ff14a2973df001c0140d98d6] | committer: Vittorio Giovara

mpeg12enc: factor out check in encode_dc

Makes coverity less confused and the code more readable.

CC: libav-stable at libav.org
Bug-Id: CID 751744

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37b3361e755361d4ff14a2973df001c0140d98d6
---

 libavcodec/mpeg12enc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 3376f10..96130ea 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -546,7 +546,8 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
 
 static inline void encode_dc(MpegEncContext *s, int diff, int component)
 {
-    if (((unsigned) (diff + 255)) >= 511) {
+    unsigned int diff_u = diff + 255;
+    if (diff_u >= 511) {
         int index;
 
         if (diff < 0) {



More information about the ffmpeg-cvslog mailing list