diff --git a/avconv.c b/avconv.c index acb497b759..302cc951f3 100644 --- a/avconv.c +++ b/avconv.c @@ -149,6 +149,8 @@ static int input_sync; static float dts_delta_threshold = 10; +static int print_stats = 1; + static uint8_t *audio_buf; static uint8_t *audio_out; static unsigned int allocated_audio_out_size, allocated_audio_buf_size; @@ -1374,6 +1376,9 @@ static void print_report(OutputFile *output_files, static int qp_histogram[52]; int hours, mins, secs, us; + if (!print_stats && !is_last_report) + return; + if (!is_last_report) { int64_t cur_time; /* display the report every 0.5 seconds */ @@ -1470,7 +1475,7 @@ static void print_report(OutputFile *output_files, snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); - av_log(NULL, is_last_report ? AV_LOG_WARNING : AV_LOG_INFO, "%s \r", buf); + av_log(NULL, AV_LOG_INFO, "%s \r", buf); fflush(stderr); @@ -1668,7 +1673,6 @@ static int output_packet(InputStream *ist, int ist_index, (ist->st->codec->sample_rate * ist->st->codec->channels); break;} case AVMEDIA_TYPE_VIDEO: - decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2; if (!(decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); avpkt.pts = pkt_pts; @@ -2135,6 +2139,8 @@ static int transcode_init(OutputFile *output_files, } else { if (!ost->enc) ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); + ist->decoding_needed = 1; + ost->encoding_needed = 1; switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ost->fifo= av_fifo_alloc(1024); @@ -2158,8 +2164,6 @@ static int transcode_init(OutputFile *output_files, codec->channel_layout = 0; ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1; icodec->request_channels = codec->channels; - ist->decoding_needed = 1; - ost->encoding_needed = 1; ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_rate = icodec->sample_rate; ost->resample_channels = icodec->channels; @@ -2189,8 +2193,6 @@ static int transcode_init(OutputFile *output_files, ost->resample_height = icodec->height; ost->resample_width = icodec->width; ost->resample_pix_fmt= icodec->pix_fmt; - ost->encoding_needed = 1; - ist->decoding_needed = 1; if (!ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; @@ -2213,15 +2215,13 @@ static int transcode_init(OutputFile *output_files, #endif break; case AVMEDIA_TYPE_SUBTITLE: - ost->encoding_needed = 1; - ist->decoding_needed = 1; break; default: abort(); break; } /* two pass mode */ - if (ost->encoding_needed && codec->codec_id != CODEC_ID_H264 && + if (codec->codec_id != CODEC_ID_H264 && (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { char logfilename[1024]; FILE *f; @@ -2665,12 +2665,6 @@ static int transcode(OutputFile *output_files, return ret; } -static int opt_verbose(const char *opt, const char *arg) -{ - av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -loglevel\n", opt); - return 0; -} - static double parse_frame_aspect_ratio(const char *arg) { int x = 0, y = 0; @@ -4087,7 +4081,6 @@ static const OptionDef options[] = { { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump}, "when dumping packets, also dump the payload" }, { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(rate_emu)}, "read input at native frame rate", "" }, - { "v", HAS_ARG, {(void*)opt_verbose}, "deprecated, use -loglevel instead", "number" }, { "target", HAS_ARG | OPT_FUNC2, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" }, @@ -4105,6 +4098,7 @@ static const OptionDef options[] = { #if CONFIG_AVFILTER { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" }, #endif + { "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", }, /* video options */ { "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" }, diff --git a/cmdutils.c b/cmdutils.c index d1607da3a8..c3fd8b87a3 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -336,6 +336,8 @@ static int locate_option(int argc, char **argv, const OptionDef *options, const void parse_loglevel(int argc, char **argv, const OptionDef *options) { int idx = locate_option(argc, argv, options, "loglevel"); + if (!idx) + idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) opt_loglevel("loglevel", argv[idx + 1]); } diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h index 3a731f2bf9..70b0d83fc5 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -12,3 +12,4 @@ { "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" }, { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, + { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, diff --git a/doc/avconv.texi b/doc/avconv.texi index c2040967a9..454d382eb1 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -154,10 +154,6 @@ To set the language of the second stream: avconv -i INPUT -metadata:s:1 language=eng OUTPUT @end example -@item -v @var{number} (@emph{global}) -This option is deprecated and has no effect, use -loglevel -to set verbosity level. - @item -target @var{type} (@emph{output}) Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, @code{dv50}). @var{type} may be prefixed with @code{pal-}, @code{ntsc-} or @@ -186,11 +182,14 @@ Stop writing to the stream after @var{framecount} frames. Use fixed quality scale (VBR). The meaning of @var{q} is codec-dependent. -@item -filter[:@var{stream_specifier}] @var{filter_graph} +@item -filter[:@var{stream_specifier}] @var{filter_graph} (@emph{output,per-stream}) @var{filter_graph} is a description of the filter graph to apply to the stream. Use @code{-filters} to show all the available filters (including also sources and sinks). +@item -stats (@emph{global}) +Print encoding progress/statistics. On by default. + @end table @section Video Options diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index e351cc6984..151c269955 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -101,7 +101,7 @@ Show available pixel formats. @item -sample_fmts Show available sample formats. -@item -loglevel @var{loglevel} +@item -loglevel @var{loglevel} | -v @var{loglevel} Set the logging level used by the library. @var{loglevel} is a number or a string containing one of the following values: @table @samp diff --git a/ffmpeg.c b/ffmpeg.c index 19dbd581cf..078ecd8576 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -156,6 +156,8 @@ static int input_sync; static float dts_delta_threshold = 10; +static int print_stats = 1; + static uint8_t *audio_buf; static uint8_t *audio_out; static unsigned int allocated_audio_out_size, allocated_audio_buf_size; @@ -1380,6 +1382,9 @@ static void print_report(OutputFile *output_files, static int qp_histogram[52]; int hours, mins, secs, us; + if (!print_stats && !is_last_report) + return; + if (!is_last_report) { if (last_time == -1) { last_time = cur_time; @@ -1473,7 +1478,7 @@ static void print_report(OutputFile *output_files, snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); - av_log(NULL, is_last_report ? AV_LOG_WARNING : AV_LOG_INFO, "%s \r", buf); + av_log(NULL, AV_LOG_INFO, "%s \r", buf); fflush(stderr); @@ -1671,7 +1676,6 @@ static int output_packet(InputStream *ist, int ist_index, (ist->st->codec->sample_rate * ist->st->codec->channels); break;} case AVMEDIA_TYPE_VIDEO: - decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2; if (!(decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); avpkt.pts = pkt_pts; @@ -2143,6 +2147,8 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, } else { if (!ost->enc) ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); + ist->decoding_needed = 1; + ost->encoding_needed = 1; switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ost->fifo= av_fifo_alloc(1024); @@ -2167,8 +2173,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt || codec->channel_layout != icodec->channel_layout; icodec->request_channels = codec->channels; - ist->decoding_needed = 1; - ost->encoding_needed = 1; ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_rate = icodec->sample_rate; ost->resample_channels = icodec->channels; @@ -2198,8 +2202,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, ost->resample_height = icodec->height; ost->resample_width = icodec->width; ost->resample_pix_fmt= icodec->pix_fmt; - ost->encoding_needed = 1; - ist->decoding_needed = 1; if (!ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; @@ -2226,15 +2228,13 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, #endif break; case AVMEDIA_TYPE_SUBTITLE: - ost->encoding_needed = 1; - ist->decoding_needed = 1; break; default: abort(); break; } /* two pass mode */ - if (ost->encoding_needed && codec->codec_id != CODEC_ID_H264 && + if (codec->codec_id != CODEC_ID_H264 && (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { char logfilename[1024]; FILE *f; @@ -2716,12 +2716,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, return ret; } -static int opt_verbose(const char *opt, const char *arg) -{ - av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -loglevel\n", opt); - return 0; -} - static int opt_frame_crop(const char *opt, const char *arg) { av_log(NULL, AV_LOG_FATAL, "Option '%s' has been removed, use the crop filter instead\n", opt); @@ -4265,7 +4259,6 @@ static const OptionDef options[] = { { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(rate_emu)}, "read input at native frame rate", "" }, { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "deprecated, use -loop" }, { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "deprecated, use -loop", "" }, - { "v", HAS_ARG, {(void*)opt_verbose}, "deprecated, use -loglevel instead", "number" }, { "target", HAS_ARG | OPT_FUNC2, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" }, @@ -4283,6 +4276,7 @@ static const OptionDef options[] = { #if CONFIG_AVFILTER { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" }, #endif + { "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", }, /* video options */ { "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" }, 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; + 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; + 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; + 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; diff --git a/libavutil/crc.c b/libavutil/crc.c index c3d74a2ce9..d0e736ed4d 100644 --- a/libavutil/crc.c +++ b/libavutil/crc.c @@ -57,7 +57,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257]; * @return <0 on failure */ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ - int i, j; + unsigned i, j; uint32_t c; if (bits < 8 || bits > 32 || poly >= (1LL<