summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/4xm.c2
-rw-r--r--libavcodec/ac3dec.c4
-rw-r--r--libavcodec/h264.c2
-rw-r--r--libavcodec/h264_mvpred.h2
-rw-r--r--libavcodec/h264pred.c12
-rw-r--r--libavcodec/h264pred_template.c32
-rw-r--r--libavcodec/ituh263dec.c5
-rw-r--r--libavcodec/ituh263enc.c5
-rw-r--r--libavcodec/mpeg12.c6
-rw-r--r--libavcodec/mpeg12enc.c4
-rw-r--r--libavcodec/mpeg4videodec.c2
-rw-r--r--libavcodec/mpegvideo_enc.c2
-rw-r--r--libavcodec/wmavoice.c2
-rw-r--r--libavcodec/zmbv.c2
14 files changed, 38 insertions, 44 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index f2a82573b4..e6638c7b4b 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -279,7 +279,7 @@ static void init_mv(FourXContext *f){
}
#endif
-static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, int dc){
+static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc){
int i;
dc*= 0x10001;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 6bc50192ee..4b277296d1 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -505,9 +505,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
mantissa = b5_mantissas[get_bits(gbc, 4)];
break;
default: /* 6 to 15 */
- mantissa = get_bits(gbc, quantization_tab[bap]);
/* Shift mantissa and sign-extend it. */
- mantissa = (mantissa << (32-quantization_tab[bap]))>>8;
+ mantissa = get_sbits(gbc, quantization_tab[bap]);
+ mantissa <<= 24 - quantization_tab[bap];
break;
}
coeffs[freq] = mantissa >> exps[freq];
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 05797f9455..071a6ad1d2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1722,7 +1722,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_ty
tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL;
topright= (uint8_t*) &tr_high;
} else {
- tr= ptr[3 - linesize]*0x01010101;
+ tr= ptr[3 - linesize]*0x01010101u;
topright= (uint8_t*) &tr;
}
}else
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index b46d0985a8..4cf79ea161 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -593,7 +593,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){
ref_cache[3 - 1*8]= ref[4*top_xy + 3];
}else{
AV_ZERO128(mv_cache[0 - 1*8]);
- AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
+ AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101u);
}
if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index eb4166f1e3..dce29f9f0b 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -40,7 +40,7 @@
#undef BIT_DEPTH
static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
- const int lt= src[-1-1*stride];
+ const unsigned lt = src[-1-1*stride];
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
uint32_t v = PACK_4U8((lt + 2*t0 + t1 + 2) >> 2,
@@ -55,7 +55,7 @@ static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int st
}
static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
- const int lt= src[-1-1*stride];
+ const unsigned lt = src[-1-1*stride];
LOAD_LEFT_EDGE
AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101);
@@ -67,8 +67,6 @@ static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int
static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
- const av_unused int unu0= t0;
- const av_unused int unu1= l0;
src[0+0*stride]=(l1 + t1)>>1;
src[1+0*stride]=
@@ -292,7 +290,7 @@ static void pred16x16_tm_vp8_c(uint8_t *src, int stride){
static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
int i;
- int dc0;
+ unsigned dc0;
dc0=0;
for(i=0;i<8; i++)
@@ -307,7 +305,7 @@ static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
int i;
- int dc0;
+ unsigned dc0;
dc0=0;
for(i=0;i<8; i++)
@@ -322,7 +320,7 @@ static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
int i;
- int dc0=0;
+ unsigned dc0 = 0;
for(i=0;i<4; i++){
dc0+= src[-1+i*stride] + src[i-stride];
diff --git a/libavcodec/h264pred_template.c b/libavcodec/h264pred_template.c
index eb5250501a..8021895378 100644
--- a/libavcodec/h264pred_template.c
+++ b/libavcodec/h264pred_template.c
@@ -121,28 +121,28 @@ static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _s
#define LOAD_TOP_RIGHT_EDGE\
- const int av_unused t4= topright[0];\
- const int av_unused t5= topright[1];\
- const int av_unused t6= topright[2];\
- const int av_unused t7= topright[3];\
+ const unsigned av_unused t4 = topright[0];\
+ const unsigned av_unused t5 = topright[1];\
+ const unsigned av_unused t6 = topright[2];\
+ const unsigned av_unused t7 = topright[3];\
#define LOAD_DOWN_LEFT_EDGE\
- const int av_unused l4= src[-1+4*stride];\
- const int av_unused l5= src[-1+5*stride];\
- const int av_unused l6= src[-1+6*stride];\
- const int av_unused l7= src[-1+7*stride];\
+ const unsigned av_unused l4 = src[-1+4*stride];\
+ const unsigned av_unused l5 = src[-1+5*stride];\
+ const unsigned av_unused l6 = src[-1+6*stride];\
+ const unsigned av_unused l7 = src[-1+7*stride];\
#define LOAD_LEFT_EDGE\
- const int av_unused l0= src[-1+0*stride];\
- const int av_unused l1= src[-1+1*stride];\
- const int av_unused l2= src[-1+2*stride];\
- const int av_unused l3= src[-1+3*stride];\
+ const unsigned av_unused l0 = src[-1+0*stride];\
+ const unsigned av_unused l1 = src[-1+1*stride];\
+ const unsigned av_unused l2 = src[-1+2*stride];\
+ const unsigned av_unused l3 = src[-1+3*stride];\
#define LOAD_TOP_EDGE\
- const int av_unused t0= src[ 0-1*stride];\
- const int av_unused t1= src[ 1-1*stride];\
- const int av_unused t2= src[ 2-1*stride];\
- const int av_unused t3= src[ 3-1*stride];\
+ const unsigned av_unused t0 = src[ 0-1*stride];\
+ const unsigned av_unused t1 = src[ 1-1*stride];\
+ const unsigned av_unused t2 = src[ 2-1*stride];\
+ const unsigned av_unused t3 = src[ 3-1*stride];\
static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index b0976801ed..69e7ab9c99 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -271,7 +271,7 @@ int ff_h263_resync(MpegEncContext *s){
int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
{
- int code, val, sign, shift, l;
+ int code, val, sign, shift;
code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
if (code == 0)
@@ -293,8 +293,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
/* modulo decoding */
if (!s->h263_long_vectors) {
- l = INT_BIT - 5 - f_code;
- val = (val<<l)>>l;
+ val = sign_extend(val, 5 + f_code);
} else {
/* horrible h263 long vector mode */
if (pred < -31 && val < -63)
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 557ed48a56..3f4485f376 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -657,7 +657,7 @@ void h263_encode_mb(MpegEncContext * s,
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
{
- int range, l, bit_size, sign, code, bits;
+ int range, bit_size, sign, code, bits;
if (val == 0) {
/* zero vector */
@@ -667,8 +667,7 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
bit_size = f_code - 1;
range = 1 << bit_size;
/* modulo encoding */
- l= INT_BIT - 6 - bit_size;
- val = (val<<l)>>l;
+ val = sign_extend(val, 6 + bit_size);
sign = val>>31;
val= (val^sign)-sign;
sign&=1;
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 341cad7a4b..0575a976f0 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -55,7 +55,7 @@ static VLC mv_vlc;
/* as H.263, but only 17 codes */
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
{
- int code, sign, val, l, shift;
+ int code, sign, val, shift;
code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
if (code == 0) {
@@ -78,9 +78,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
val += pred;
/* modulo decoding */
- l = INT_BIT - 5 - shift;
- val = (val << l) >> l;
- return val;
+ return sign_extend(val, 5 + shift);
}
static inline int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 441e9bbd78..fd50e73211 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"
@@ -694,8 +695,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--;
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 9d8e193262..538706460e 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2124,7 +2124,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
*/
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
{
- int startcode, v;
+ unsigned startcode, v;
/* search next start code */
align_get_bits(gb);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 5943ce71e0..6439dbf262 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -2030,7 +2030,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
int varc;
int sum = s->dsp.pix_sum(pix, s->linesize);
- varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
+ varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)sum*sum)>>8) + 500 + 128)>>8;
s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc;
s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index db8f51674a..2e3a0f9ba6 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1085,7 +1085,7 @@ static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
int excl_range = s->aw_pulse_range; // always 16 or 24
uint16_t *use_mask_ptr = &use_mask[idx >> 4];
int first_sh = 16 - (idx & 15);
- *use_mask_ptr++ &= 0xFFFF << first_sh;
+ *use_mask_ptr++ &= 0xFFFFu << first_sh;
excl_range -= first_sh;
if (excl_range >= 16) {
*use_mask_ptr++ = 0;
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 054c84231f..42da1fb600 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
default:
av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);
}
- memcpy(c->prev, c->cur, c->width * c->height * (c->bpp / 8));
+ FFSWAP(uint8_t *, c->cur, c->prev);
}
*data_size = sizeof(AVFrame);
*(AVFrame*)data = c->pic;