[FFmpeg-cvslog] mpeg12enc: use sign_extend() function
Mans Rullgard
git at videolan.org
Mon Mar 19 05:30:32 CET 2012
ffmpeg | branch: release/0.8 | Mans Rullgard <mans at mansr.com> | Sat Oct 8 12:56:54 2011 +0100| [48f9a800722736c9fd1ed37562a8760417f8f221] | committer: Reinhard Tartler
mpeg12enc: use sign_extend() function
Signed-off-by: Mans Rullgard <mans at mansr.com>
(cherry picked from commit 2f329db90e5d72ad383a0ba05fde3641a34ef73b)
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48f9a800722736c9fd1ed37562a8760417f8f221
---
libavcodec/mpeg12enc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index eb07ecf..f77677a 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "dsputil.h"
+#include "mathops.h"
#include "mpegvideo.h"
#include "mpeg12.h"
@@ -681,8 +682,7 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
int bit_size = f_or_b_code - 1;
int range = 1 << bit_size;
/* modulo encoding */
- int l= INT_BIT - 5 - bit_size;
- val= (val<<l)>>l;
+ val = sign_extend(val, 5 + bit_size);
if (val >= 0) {
val--;
More information about the ffmpeg-cvslog
mailing list