From d66b9dec116847400323ca15ee709529b237cdf1 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 8 Oct 2011 20:32:09 +0100 Subject: h264pred: remove unused variables Signed-off-by: Mans Rullgard --- libavcodec/h264pred.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c index b3701ef3b8..5bef78071f 100644 --- a/libavcodec/h264pred.c +++ b/libavcodec/h264pred.c @@ -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]= -- cgit v1.2.1 From 4d1418cd4f620b382106542d0f33d96e33a0fdae Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 8 Oct 2011 21:19:51 +0100 Subject: h264: fix signed overflows in x*0x01010101 expressions Signed-off-by: Mans Rullgard --- libavcodec/h264.c | 2 +- libavcodec/h264_mvpred.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 83c26eff29..aac1a15a92 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1668,7 +1668,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 4751928211..7c7086d440 100644 --- a/libavcodec/h264_mvpred.h +++ b/libavcodec/h264_mvpred.h @@ -588,7 +588,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)){ -- cgit v1.2.1 From 60f10e0ad37418cc697765d85b0bc22db70f726a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 8 Oct 2011 21:22:06 +0100 Subject: h264pred: use unsigned types for pixel values, fix signed overflows Signed-off-by: Mans Rullgard --- libavcodec/h264pred.c | 10 +++++----- libavcodec/h264pred_template.c | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c index 5bef78071f..e73d82c547 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); @@ -290,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++) @@ -305,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++) @@ -320,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 e5d91555b8..750e82c12a 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; -- cgit v1.2.1 From 2f329db90e5d72ad383a0ba05fde3641a34ef73b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 8 Oct 2011 12:56:54 +0100 Subject: mpeg12enc: use sign_extend() function Signed-off-by: Mans Rullgard --- libavcodec/mpeg12enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 79c46beef9..f4455be925 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" @@ -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; + val = sign_extend(val, 5 + bit_size); if (val >= 0) { val--; -- cgit v1.2.1 From 282847ba801e65718a84dc38d46be5077beef040 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 13:21:10 +0100 Subject: zmbv: remove memcpy() of decoded frame Signed-off-by: Mans Rullgard --- libavcodec/zmbv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 10fd903b98..a9c127ee4f 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; -- cgit v1.2.1 From 11fdb7e197f0cb8016df9668fc2050bee25e4955 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 27 Sep 2011 08:16:26 +0200 Subject: avconv: factorize common code in transcode_init() --- avconv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/avconv.c b/avconv.c index c418b7cfc1..058c0ee3b5 100644 --- a/avconv.c +++ b/avconv.c @@ -2059,6 +2059,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); @@ -2083,8 +2085,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; @@ -2134,8 +2134,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}; @@ -2153,8 +2151,6 @@ static int transcode_init(OutputFile *output_files, #endif break; case AVMEDIA_TYPE_SUBTITLE: - ost->encoding_needed = 1; - ist->decoding_needed = 1; break; default: abort(); -- cgit v1.2.1 From 515901fad2ee0f2429d6b457bb4e4f6a5fd98028 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 27 Sep 2011 08:21:48 +0200 Subject: avconv: remove pointless always true condition --- avconv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/avconv.c b/avconv.c index 058c0ee3b5..d2cb69f0bb 100644 --- a/avconv.c +++ b/avconv.c @@ -2157,8 +2157,7 @@ static int transcode_init(OutputFile *output_files, break; } /* two pass mode */ - if (ost->encoding_needed && - (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { + if ((codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { char logfilename[1024]; FILE *f; -- cgit v1.2.1 From c6007065edd79b6cd8423a27b63e726eee2d868c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 27 Sep 2011 20:00:28 +0200 Subject: avconv: in output_packet() don't set decoded_data_size for video. It's only used for audio. --- avconv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/avconv.c b/avconv.c index d2cb69f0bb..a5548ec1bf 100644 --- a/avconv.c +++ b/avconv.c @@ -1600,7 +1600,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; -- cgit v1.2.1 From 3460dd8acf457218980487cb99c47107af8531fb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 9 Oct 2011 15:57:30 +0200 Subject: avconv: add -stats option to enable/disable printing encoding progress --- avconv.c | 6 ++++++ doc/avconv.texi | 3 +++ 2 files changed, 9 insertions(+) diff --git a/avconv.c b/avconv.c index a5548ec1bf..f1d23edecd 100644 --- a/avconv.c +++ b/avconv.c @@ -132,6 +132,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; @@ -1313,6 +1315,9 @@ static void print_report(OutputFile *output_files, static int64_t last_time = -1; static int qp_histogram[52]; + if (!print_stats && !is_last_report) + return; + if (!is_last_report) { int64_t cur_time; /* display the report every 0.5 seconds */ @@ -3980,6 +3985,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/doc/avconv.texi b/doc/avconv.texi index d585db8105..74e9e77acd 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -191,6 +191,9 @@ codec-dependent. 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 -- cgit v1.2.1 From 667d98182d9ced97fc7d494c668a8e5806cfa883 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 9 Oct 2011 15:57:54 +0200 Subject: doc/avconv: add forgotten output/per-stream info to -filter --- doc/avconv.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/avconv.texi b/doc/avconv.texi index 74e9e77acd..0abcc9d400 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -186,7 +186,7 @@ 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). -- cgit v1.2.1 From f5646a325b94a077bf9849d5f6a4b3d4e69ed37b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 9 Oct 2011 16:32:54 +0200 Subject: avconv: always print stats with AV_LOG_INFO It's now possible to disable printing stats during encoding with -nostats, so there's no reason to print them differently depending on whether it's last report or not. --- avconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv.c b/avconv.c index f1d23edecd..9b69e1dad7 100644 --- a/avconv.c +++ b/avconv.c @@ -1407,7 +1407,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); -- cgit v1.2.1 From 8124d8ad6654d9b26725e86f6fffbb00527975d4 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 7 Oct 2011 13:29:03 +0100 Subject: avtools: add -v as alias for -loglevel This saves a bit of typing. Signed-off-by: Mans Rullgard --- avconv.c | 7 ------- cmdutils.c | 2 ++ cmdutils_common_opts.h | 1 + doc/avconv.texi | 4 ---- doc/avtools-common-opts.texi | 2 +- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/avconv.c b/avconv.c index 9b69e1dad7..03c419dcb2 100644 --- a/avconv.c +++ b/avconv.c @@ -2548,12 +2548,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; @@ -3967,7 +3961,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", "" }, diff --git a/cmdutils.c b/cmdutils.c index 2c37880d74..77bad25e33 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -335,6 +335,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 36b2e322e5..1158afab99 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -12,3 +12,4 @@ { "pix_fmts" , OPT_EXIT, {(void*)show_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 0abcc9d400..9faaee630d 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 diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index 634b152ccc..1824813a1e 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 -- cgit v1.2.1 From 0836d48a16419faf742e999f565dc50d863d0f55 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 7 Oct 2011 14:13:02 +0100 Subject: fate: run avconv with -nostats flag Signed-off-by: Mans Rullgard --- tests/fate-run.sh | 2 +- tests/regression-funcs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 1babcc867e..07cfe74ba7 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -50,7 +50,7 @@ run(){ } avconv(){ - run avconv -v 0 -threads $threads -thread_type $thread_type "$@" + run avconv -nostats -threads $threads -thread_type $thread_type "$@" } framecrc(){ diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh index bba189092b..6d23fa387e 100755 --- a/tests/regression-funcs.sh +++ b/tests/regression-funcs.sh @@ -43,7 +43,7 @@ echov(){ . $(dirname $0)/md5.sh -AVCONV_OPTS="-v 0 -y" +AVCONV_OPTS="-nostats -y" COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact" DEC_OPTS="$COMMON_OPTS -threads $threads" ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint" -- cgit v1.2.1 From 8b19ae07616bbd18969b94cbf5d74308a8f2bbdf Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 8 Oct 2011 01:59:51 +0100 Subject: crc: fix signed overflow This fixes a signed overflow from i << 24 when i == 255 by making i unsigned. The result of the shift is already assigned to an variable of unsigned type. Signed-off-by: Mans Rullgard --- libavutil/crc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/crc.c b/libavutil/crc.c index 6c9f92809f..44719ffaee 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< Date: Sun, 9 Oct 2011 20:32:58 +0100 Subject: mpegvideo_enc: fix a signed overflow Signed-off-by: Mans Rullgard --- libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index cad267b663..706a93b734 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2023,7 +2023,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; -- cgit v1.2.1 From ba3f07d0611d9a6c10eaa90b3c058ecdffe76676 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 20:46:22 +0100 Subject: wmavoice: fix a signed overflow Signed-off-by: Mans Rullgard --- libavcodec/wmavoice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index cff3f5fc7e..3b805ac04b 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; -- cgit v1.2.1 From 84dda407628e298f33d610e9e04a8b2945d24665 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 20:38:01 +0100 Subject: 4xm: fix signed overflow Signed-off-by: Mans Rullgard --- libavcodec/4xm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 92157893dd..847ebce2b6 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -277,7 +277,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; -- cgit v1.2.1 From 633ddb85192f1cc39d61fae98455eb6ae5638df0 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 23:15:17 +0100 Subject: ac3dec: use get_sbits() instead of manually sign-extending Signed-off-by: Mans Rullgard --- libavcodec/ac3dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 5046a5c644..956a7ac3ad 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]; -- cgit v1.2.1 From aa498fef0dbd6eebd1b4dd90c36d3117cd9a17b2 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 23:16:07 +0100 Subject: mpeg124: use sign_extend() function Signed-off-by: Mans Rullgard --- libavcodec/ituh263dec.c | 5 ++--- libavcodec/ituh263enc.c | 5 ++--- libavcodec/mpeg12.c | 6 ++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index a54d7c1728..a234c2ac7a 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 383a81b0e1..783a04f64d 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 6a12344139..5734ab8674 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -54,7 +54,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) { @@ -77,9 +77,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) -- cgit v1.2.1 From 581810f5024dbb9df8e794dc0f5beac30d3a5fd4 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Oct 2011 23:21:01 +0100 Subject: mpeg4dec: use unsigned type for startcode in ff_mpeg4_decode_picture_header Signed-off-by: Mans Rullgard --- libavcodec/mpeg4videodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 0d061acfb9..cd7de73c98 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2101,7 +2101,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); -- cgit v1.2.1