Commit 0a23067a authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 028a79c1 581810f5
...@@ -149,6 +149,8 @@ static int input_sync; ...@@ -149,6 +149,8 @@ static int input_sync;
static float dts_delta_threshold = 10; static float dts_delta_threshold = 10;
static int print_stats = 1;
static uint8_t *audio_buf; static uint8_t *audio_buf;
static uint8_t *audio_out; static uint8_t *audio_out;
static unsigned int allocated_audio_out_size, allocated_audio_buf_size; static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
...@@ -1374,6 +1376,9 @@ static void print_report(OutputFile *output_files, ...@@ -1374,6 +1376,9 @@ static void print_report(OutputFile *output_files,
static int qp_histogram[52]; static int qp_histogram[52];
int hours, mins, secs, us; int hours, mins, secs, us;
if (!print_stats && !is_last_report)
return;
if (!is_last_report) { if (!is_last_report) {
int64_t cur_time; int64_t cur_time;
/* display the report every 0.5 seconds */ /* display the report every 0.5 seconds */
...@@ -1470,7 +1475,7 @@ static void print_report(OutputFile *output_files, ...@@ -1470,7 +1475,7 @@ static void print_report(OutputFile *output_files,
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
nb_frames_dup, nb_frames_drop); 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); fflush(stderr);
...@@ -1668,7 +1673,6 @@ static int output_packet(InputStream *ist, int ist_index, ...@@ -1668,7 +1673,6 @@ static int output_packet(InputStream *ist, int ist_index,
(ist->st->codec->sample_rate * ist->st->codec->channels); (ist->st->codec->sample_rate * ist->st->codec->channels);
break;} break;}
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
if (!(decoded_frame = avcodec_alloc_frame())) if (!(decoded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avpkt.pts = pkt_pts; avpkt.pts = pkt_pts;
...@@ -2135,6 +2139,8 @@ static int transcode_init(OutputFile *output_files, ...@@ -2135,6 +2139,8 @@ static int transcode_init(OutputFile *output_files,
} else { } else {
if (!ost->enc) if (!ost->enc)
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
ist->decoding_needed = 1;
ost->encoding_needed = 1;
switch(codec->codec_type) { switch(codec->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ost->fifo= av_fifo_alloc(1024); ost->fifo= av_fifo_alloc(1024);
...@@ -2158,8 +2164,6 @@ static int transcode_init(OutputFile *output_files, ...@@ -2158,8 +2164,6 @@ static int transcode_init(OutputFile *output_files,
codec->channel_layout = 0; codec->channel_layout = 0;
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1; ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
icodec->request_channels = codec->channels; icodec->request_channels = codec->channels;
ist->decoding_needed = 1;
ost->encoding_needed = 1;
ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_fmt = icodec->sample_fmt;
ost->resample_sample_rate = icodec->sample_rate; ost->resample_sample_rate = icodec->sample_rate;
ost->resample_channels = icodec->channels; ost->resample_channels = icodec->channels;
...@@ -2189,8 +2193,6 @@ static int transcode_init(OutputFile *output_files, ...@@ -2189,8 +2193,6 @@ static int transcode_init(OutputFile *output_files,
ost->resample_height = icodec->height; ost->resample_height = icodec->height;
ost->resample_width = icodec->width; ost->resample_width = icodec->width;
ost->resample_pix_fmt= icodec->pix_fmt; ost->resample_pix_fmt= icodec->pix_fmt;
ost->encoding_needed = 1;
ist->decoding_needed = 1;
if (!ost->frame_rate.num) if (!ost->frame_rate.num)
ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; 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, ...@@ -2213,15 +2215,13 @@ static int transcode_init(OutputFile *output_files,
#endif #endif
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break; break;
default: default:
abort(); abort();
break; break;
} }
/* two pass mode */ /* 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))) { (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
char logfilename[1024]; char logfilename[1024];
FILE *f; FILE *f;
...@@ -2665,12 +2665,6 @@ static int transcode(OutputFile *output_files, ...@@ -2665,12 +2665,6 @@ static int transcode(OutputFile *output_files,
return ret; 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) static double parse_frame_aspect_ratio(const char *arg)
{ {
int x = 0, y = 0; int x = 0, y = 0;
...@@ -4087,7 +4081,6 @@ static const OptionDef options[] = { ...@@ -4087,7 +4081,6 @@ static const OptionDef options[] = {
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump}, { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
"when dumping packets, also dump the payload" }, "when dumping packets, also dump the payload" },
{ "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(rate_emu)}, "read input at native frame rate", "" }, { "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" }, { "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", "" }, { "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", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
...@@ -4105,6 +4098,7 @@ static const OptionDef options[] = { ...@@ -4105,6 +4098,7 @@ static const OptionDef options[] = {
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" }, { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" },
#endif #endif
{ "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", },
/* video options */ /* video options */
{ "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" }, { "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" },
......
...@@ -336,6 +336,8 @@ static int locate_option(int argc, char **argv, const OptionDef *options, const ...@@ -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) void parse_loglevel(int argc, char **argv, const OptionDef *options)
{ {
int idx = locate_option(argc, argv, options, "loglevel"); int idx = locate_option(argc, argv, options, "loglevel");
if (!idx)
idx = locate_option(argc, argv, options, "v");
if (idx && argv[idx + 1]) if (idx && argv[idx + 1])
opt_loglevel("loglevel", argv[idx + 1]); opt_loglevel("loglevel", argv[idx + 1]);
} }
......
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
{ "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" }, { "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" }, { "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" }, { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
{ "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
...@@ -154,10 +154,6 @@ To set the language of the second stream: ...@@ -154,10 +154,6 @@ To set the language of the second stream:
avconv -i INPUT -metadata:s:1 language=eng OUTPUT avconv -i INPUT -metadata:s:1 language=eng OUTPUT
@end example @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}) @item -target @var{type} (@emph{output})
Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, 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 @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. ...@@ -186,11 +182,14 @@ Stop writing to the stream after @var{framecount} frames.
Use fixed quality scale (VBR). The meaning of @var{q} is Use fixed quality scale (VBR). The meaning of @var{q} is
codec-dependent. 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 @var{filter_graph} is a description of the filter graph to apply to
the stream. Use @code{-filters} to show all the available filters the stream. Use @code{-filters} to show all the available filters
(including also sources and sinks). (including also sources and sinks).
@item -stats (@emph{global})
Print encoding progress/statistics. On by default.
@end table @end table
@section Video Options @section Video Options
......
...@@ -101,7 +101,7 @@ Show available pixel formats. ...@@ -101,7 +101,7 @@ Show available pixel formats.
@item -sample_fmts @item -sample_fmts
Show available sample formats. Show available sample formats.
@item -loglevel @var{loglevel} @item -loglevel @var{loglevel} | -v @var{loglevel}
Set the logging level used by the library. Set the logging level used by the library.
@var{loglevel} is a number or a string containing one of the following values: @var{loglevel} is a number or a string containing one of the following values:
@table @samp @table @samp
......
...@@ -156,6 +156,8 @@ static int input_sync; ...@@ -156,6 +156,8 @@ static int input_sync;
static float dts_delta_threshold = 10; static float dts_delta_threshold = 10;
static int print_stats = 1;
static uint8_t *audio_buf; static uint8_t *audio_buf;
static uint8_t *audio_out; static uint8_t *audio_out;
static unsigned int allocated_audio_out_size, allocated_audio_buf_size; static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
...@@ -1380,6 +1382,9 @@ static void print_report(OutputFile *output_files, ...@@ -1380,6 +1382,9 @@ static void print_report(OutputFile *output_files,
static int qp_histogram[52]; static int qp_histogram[52];
int hours, mins, secs, us; int hours, mins, secs, us;
if (!print_stats && !is_last_report)
return;
if (!is_last_report) { if (!is_last_report) {
if (last_time == -1) { if (last_time == -1) {
last_time = cur_time; last_time = cur_time;
...@@ -1473,7 +1478,7 @@ static void print_report(OutputFile *output_files, ...@@ -1473,7 +1478,7 @@ static void print_report(OutputFile *output_files,
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
nb_frames_dup, nb_frames_drop); 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); fflush(stderr);
...@@ -1671,7 +1676,6 @@ static int output_packet(InputStream *ist, int ist_index, ...@@ -1671,7 +1676,6 @@ static int output_packet(InputStream *ist, int ist_index,
(ist->st->codec->sample_rate * ist->st->codec->channels); (ist->st->codec->sample_rate * ist->st->codec->channels);
break;} break;}
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
if (!(decoded_frame = avcodec_alloc_frame())) if (!(decoded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avpkt.pts = pkt_pts; avpkt.pts = pkt_pts;
...@@ -2143,6 +2147,8 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, ...@@ -2143,6 +2147,8 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
} else { } else {
if (!ost->enc) if (!ost->enc)
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
ist->decoding_needed = 1;
ost->encoding_needed = 1;
switch(codec->codec_type) { switch(codec->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ost->fifo= av_fifo_alloc(1024); ost->fifo= av_fifo_alloc(1024);
...@@ -2167,8 +2173,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, ...@@ -2167,8 +2173,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt
|| codec->channel_layout != icodec->channel_layout; || codec->channel_layout != icodec->channel_layout;
icodec->request_channels = codec->channels; icodec->request_channels = codec->channels;
ist->decoding_needed = 1;
ost->encoding_needed = 1;
ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_fmt = icodec->sample_fmt;
ost->resample_sample_rate = icodec->sample_rate; ost->resample_sample_rate = icodec->sample_rate;
ost->resample_channels = icodec->channels; ost->resample_channels = icodec->channels;
...@@ -2198,8 +2202,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, ...@@ -2198,8 +2202,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
ost->resample_height = icodec->height; ost->resample_height = icodec->height;
ost->resample_width = icodec->width; ost->resample_width = icodec->width;
ost->resample_pix_fmt= icodec->pix_fmt; ost->resample_pix_fmt= icodec->pix_fmt;
ost->encoding_needed = 1;
ist->decoding_needed = 1;
if (!ost->frame_rate.num) if (!ost->frame_rate.num)
ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; 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, ...@@ -2226,15 +2228,13 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
#endif #endif
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break; break;
default: default:
abort(); abort();
break; break;
} }
/* two pass mode */ /* 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))) { (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
char logfilename[1024]; char logfilename[1024];
FILE *f; FILE *f;
...@@ -2716,12 +2716,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, ...@@ -2716,12 +2716,6 @@ static int transcode(OutputFile *output_files, int nb_output_files,
return ret; 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) 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); 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[] = { ...@@ -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", "" }, { "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_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", "" }, { "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" }, { "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", "" }, { "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", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
...@@ -4283,6 +4276,7 @@ static const OptionDef options[] = { ...@@ -4283,6 +4276,7 @@ static const OptionDef options[] = {
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" }, { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" },
#endif #endif
{ "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", },
/* video options */ /* video options */
{ "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" }, { "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" },
......
...@@ -279,7 +279,7 @@ static void init_mv(FourXContext *f){ ...@@ -279,7 +279,7 @@ static void init_mv(FourXContext *f){
} }
#endif #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; int i;
dc*= 0x10001; dc*= 0x10001;
......
...@@ -505,9 +505,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma ...@@ -505,9 +505,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
mantissa = b5_mantissas[get_bits(gbc, 4)]; mantissa = b5_mantissas[get_bits(gbc, 4)];
break; break;
default: /* 6 to 15 */ default: /* 6 to 15 */
mantissa = get_bits(gbc, quantization_tab[bap]);
/* Shift mantissa and sign-extend it. */ /* 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; break;
} }
coeffs[freq] = mantissa >> exps[freq]; coeffs[freq] = mantissa >> exps[freq];
......
...@@ -1722,7 +1722,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_ty ...@@ -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; tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL;
topright= (uint8_t*) &tr_high; topright= (uint8_t*) &tr_high;
} else { } else {
tr= ptr[3 - linesize]*0x01010101; tr= ptr[3 - linesize]*0x01010101u;
topright= (uint8_t*) &tr; topright= (uint8_t*) &tr;
} }
}else }else
......
...@@ -593,7 +593,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){ ...@@ -593,7 +593,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){
ref_cache[3 - 1*8]= ref[4*top_xy + 3]; ref_cache[3 - 1*8]= ref[4*top_xy + 3];
}else{ }else{
AV_ZERO128(mv_cache[0 - 1*8]); 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)){ if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#undef BIT_DEPTH #undef BIT_DEPTH
static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ 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_EDGE
LOAD_TOP_RIGHT_EDGE LOAD_TOP_RIGHT_EDGE
uint32_t v = PACK_4U8((lt + 2*t0 + t1 + 2) >> 2, 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 ...@@ -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){ 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 LOAD_LEFT_EDGE
AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101); 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 ...@@ -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){ static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int stride){
LOAD_TOP_EDGE LOAD_TOP_EDGE
LOAD_LEFT_EDGE LOAD_LEFT_EDGE
const av_unused int unu0= t0;
const av_unused int unu1= l0;
src[0+0*stride]=(l1 + t1)>>1; src[0+0*stride]=(l1 + t1)>>1;
src[1+0*stride]= src[1+0*stride]=
...@@ -292,7 +290,7 @@ static void pred16x16_tm_vp8_c(uint8_t *src, int 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){ static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
int i; int i;
int dc0; unsigned dc0;
dc0=0; dc0=0;
for(i=0;i<8; i++) for(i=0;i<8; i++)
...@@ -307,7 +305,7 @@ static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){ ...@@ -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){ static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
int i; int i;
int dc0; unsigned dc0;
dc0=0; dc0=0;
for(i=0;i<8; i++) for(i=0;i<8; i++)
...@@ -322,7 +320,7 @@ static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){ ...@@ -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){ static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
int i; int i;
int dc0=0; unsigned dc0 = 0;
for(i=0;i<4; i++){ for(i=0;i<4; i++){
dc0+= src[-1+i*stride] + src[i-stride]; 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 ...@@ -121,28 +121,28 @@ static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _s
#define LOAD_TOP_RIGHT_EDGE\ #define LOAD_TOP_RIGHT_EDGE\
const int av_unused t4= topright[0];\ const unsigned av_unused t4 = topright[0];\
const int av_unused t5= topright[1];\ const unsigned av_unused t5 = topright[1];\
const int av_unused t6= topright[2];\ const unsigned av_unused t6 = topright[2];\
const int av_unused t7= topright[3];\ const unsigned av_unused t7 = topright[3];\
#define LOAD_DOWN_LEFT_EDGE\ #define LOAD_DOWN_LEFT_EDGE\
const int av_unused l4= src[-1+4*stride];\ const unsigned av_unused l4 = src[-1+4*stride];\
const int av_unused l5= src[-1+5*stride];\ const unsigned av_unused l5 = src[-1+5*stride];\
const int av_unused l6= src[-1+6*stride];\ const unsigned av_unused l6 = src[-1+6*stride];\
const int av_unused l7= src[-1+7*stride];\ const unsigned av_unused l7 = src[-1+7*stride];\
#define LOAD_LEFT_EDGE\ #define LOAD_LEFT_EDGE\
const int av_unused l0= src[-1+0*stride];\ const unsigned av_unused l0 = src[-1+0*stride];\
const int av_unused l1= src[-1+1*stride];\ const unsigned av_unused l1 = src[-1+1*stride];\
const int av_unused l2= src[-1+2*stride];\ const unsigned av_unused l2 = src[-1+2*stride];\
const int av_unused l3= src[-1+3*stride];\ const unsigned av_unused l3 = src[-1+3*stride];\
#define LOAD_TOP_EDGE\ #define LOAD_TOP_EDGE\
const int av_unused t0= src[ 0-1*stride];\ const unsigned av_unused t0 = src[ 0-1*stride];\
const int av_unused t1= src[ 1-1*stride];\ const unsigned av_unused t1 = src[ 1-1*stride];\
const int av_unused t2= src[ 2-1*stride];\ const unsigned av_unused t2 = src[ 2-1*stride];\
const int av_unused t3= src[ 3-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){ static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src; pixel *src = (pixel*)_src;
......
...@@ -271,7 +271,7 @@ int ff_h263_resync(MpegEncContext *s){ ...@@ -271,7 +271,7 @@ int ff_h263_resync(MpegEncContext *s){
int h263_decode_motion(MpegEncContext * s, int pred, int f_code) 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); code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
if (code == 0) if (code == 0)
...@@ -293,8 +293,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code) ...@@ -293,8 +293,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
/* modulo decoding */ /* modulo decoding */
if (!s->h263_long_vectors) { if (!s->h263_long_vectors) {
l = INT_BIT - 5 - f_code; val = sign_extend(val, 5 + f_code);
val = (val<<l)>>l;
} else { } else {
/* horrible h263 long vector mode */ /* horrible h263 long vector mode */
if (pred < -31 && val < -63) if (pred < -31 && val < -63)
......
...@@ -657,7 +657,7 @@ void h263_encode_mb(MpegEncContext * s, ...@@ -657,7 +657,7 @@ void h263_encode_mb(MpegEncContext * s,
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code) 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) { if (val == 0) {
/* zero vector */ /* zero vector */
...@@ -667,8 +667,7 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code) ...@@ -667,8 +667,7 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
bit_size = f_code - 1; bit_size = f_code - 1;
range = 1 << bit_size; range = 1 << bit_size;
/* modulo encoding */ /* modulo encoding */
l= INT_BIT - 6 - bit_size; val = sign_extend(val, 6 + bit_size);
val = (val<<l)>>l;
sign = val>>31; sign = val>>31;
val= (val^sign)-sign; val= (val^sign)-sign;
sign&=1; sign&=1;
......
...@@ -55,7 +55,7 @@ static VLC mv_vlc; ...@@ -55,7 +55,7 @@ static VLC mv_vlc;
/* as H.263, but only 17 codes */ /* as H.263, but only 17 codes */
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred) 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); code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
if (code == 0) { if (code == 0) {
...@@ -78,9 +78,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred) ...@@ -78,9 +78,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
val += pred; val += pred;
/* modulo decoding */ /* modulo decoding */
l = INT_BIT - 5 - shift; return sign_extend(val, 5 + shift);
val = (val << l) >> l;
return val;
} }
static inline int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mathops.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpeg12.h" #include "mpeg12.h"
...@@ -694,8 +695,7 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) ...@@ -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 bit_size = f_or_b_code - 1;
int range = 1 << bit_size; int range = 1 << bit_size;
/* modulo encoding */ /* modulo encoding */
int l= INT_BIT - 5 - bit_size; val = sign_extend(val, 5 + bit_size);
val= (val<<l)>>l;
if (val >= 0) { if (val >= 0) {
val--; val--;
......
...@@ -2124,7 +2124,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ ...@@ -2124,7 +2124,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
*/ */
int ff_mpeg4_decode_picture_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 */ /* search next start code */
align_get_bits(gb); align_get_bits(gb);
......
...@@ -2030,7 +2030,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){ ...@@ -2030,7 +2030,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
int varc; int varc;
int sum = s->dsp.pix_sum(pix, s->linesize); 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_var [s->mb_stride * mb_y + mb_x] = varc;
s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8; 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, ...@@ -1085,7 +1085,7 @@ static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
int excl_range = s->aw_pulse_range; // always 16 or 24 int excl_range = s->aw_pulse_range; // always 16 or 24
uint16_t *use_mask_ptr = &use_mask[idx >> 4]; uint16_t *use_mask_ptr = &use_mask[idx >> 4];
int first_sh = 16 - (idx & 15); int first_sh = 16 - (idx & 15);
*use_mask_ptr++ &= 0xFFFF << first_sh; *use_mask_ptr++ &= 0xFFFFu << first_sh;
excl_range -= first_sh; excl_range -= first_sh;
if (excl_range >= 16) { if (excl_range >= 16) {
*use_mask_ptr++ = 0; *use_mask_ptr++ = 0;
......
...@@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac ...@@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
default: default:
av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt); 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); *data_size = sizeof(AVFrame);
*(AVFrame*)data = c->pic; *(AVFrame*)data = c->pic;
......
...@@ -57,7 +57,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257]; ...@@ -57,7 +57,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
* @return <0 on failure * @return <0 on failure
*/ */
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ 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; uint32_t c;
if (bits < 8 || bits > 32 || poly >= (1LL<<bits)) if (bits < 8 || bits > 32 || poly >= (1LL<<bits))
......
...@@ -51,7 +51,7 @@ run(){ ...@@ -51,7 +51,7 @@ run(){
} }
avconv(){ avconv(){
run $tool -v 0 -threads $threads -thread_type $thread_type "$@" run $tool -nostats -threads $threads -thread_type $thread_type "$@"
} }
framecrc(){ framecrc(){
......
...@@ -44,7 +44,7 @@ echov(){ ...@@ -44,7 +44,7 @@ echov(){
. $(dirname $0)/md5.sh . $(dirname $0)/md5.sh
AVCONV_OPTS="-v 0 -y" AVCONV_OPTS="-nostats -y"
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact" COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact"
DEC_OPTS="$COMMON_OPTS -threads $threads" DEC_OPTS="$COMMON_OPTS -threads $threads"
ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint" ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment