aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-10-08 12:56:54 +0100
committerReinhard Tartler <siretart@tauware.de>2012-03-18 17:50:35 +0100
commit48f9a800722736c9fd1ed37562a8760417f8f221 (patch)
treeb68faf5dff18f084ea83ac7b059230a755ebe150 /libavcodec
parent2c99aa48d7073a6ccdecc7ff1f88a781a5a62a86 (diff)
downloadffmpeg-48f9a800722736c9fd1ed37562a8760417f8f221.tar.gz
mpeg12enc: use sign_extend() function
Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 2f329db90e5d72ad383a0ba05fde3641a34ef73b) Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg12enc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index eb07ecfc5e..f77677a239 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--;