Commit 2f329db9 authored by Mans Rullgard's avatar Mans Rullgard

mpeg12enc: use sign_extend() function

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 60f10e0a
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mathops.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpeg12.h" #include "mpeg12.h"
...@@ -690,8 +691,7 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) ...@@ -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 bit_size = f_or_b_code - 1;
int range = 1 << bit_size; int range = 1 << bit_size;
/* modulo encoding */ /* modulo encoding */
int l= INT_BIT - 5 - bit_size; val = sign_extend(val, 5 + bit_size);
val= (val<<l)>>l;
if (val >= 0) { if (val >= 0) {
val--; val--;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment