summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-10-08 12:56:54 +0100
committerMans Rullgard <mans@mansr.com>2011-10-09 13:58:17 +0100
commit2f329db90e5d72ad383a0ba05fde3641a34ef73b (patch)
tree874046baa9e17574ef5faa2dc64606f5fabeb39a /libavcodec/mpeg12enc.c
parent60f10e0ad37418cc697765d85b0bc22db70f726a (diff)
downloadffmpeg-2f329db90e5d72ad383a0ba05fde3641a34ef73b.tar.gz
mpeg12enc: use sign_extend() function
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 79c46beef9..f4455be925 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"
@@ -690,8 +691,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--;