Merge remote-tracking branch 'qatar/master'
* qatar/master: mpeg4dec: use unsigned type for startcode in ff_mpeg4_decode_picture_header mpeg124: use sign_extend() function ac3dec: use get_sbits() instead of manually sign-extending 4xm: fix signed overflow wmavoice: fix a signed overflow mpegvideo_enc: fix a signed overflow crc: fix signed overflow fate: run avconv with -nostats flag avtools: add -v as alias for -loglevel avconv: always print stats with AV_LOG_INFO doc/avconv: add forgotten output/per-stream info to -filter avconv: add -stats option to enable/disable printing encoding progress avconv: in output_packet() don't set decoded_data_size for video. avconv: remove pointless always true condition avconv: factorize common code in transcode_init() zmbv: remove memcpy() of decoded frame mpeg12enc: use sign_extend() function h264pred: use unsigned types for pixel values, fix signed overflows h264: fix signed overflows in x*0x01010101 expressions h264pred: remove unused variables Conflicts: avconv.c tests/fate-run.sh Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
0a23067ab4
23 changed files with 69 additions and 85 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)){
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue