mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mpeg12enc: use sign_extend() function
Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
60f10e0ad3
commit
2f329db90e
@ -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--;
|
||||
|
Loading…
Reference in New Issue
Block a user