]> git.sesse.net Git - ffmpeg/commitdiff
Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jan 2012 01:25:56 +0000 (02:25 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jan 2012 02:06:45 +0000 (03:06 +0100)
* qatar/master:
  mpegenc: use avctx->slices as number of slices
  v410enc: fix undefined signed left shift caused by integer promotion
  Release notes: mention cleaned up header includes
  fix Changelog file
  Fix a bunch of typos.
  Drop some pointless void* return value casts from av_malloc() invocations.
  wavpack: fix typos in previous cosmetic clean-up commit
  wavpack: cosmetics: K&R pretty-printing
  avconv: remove the 'codec framerate is different from stream' warning
  wavpack: determine sample_fmt before requesting a buffer
  bmv audio: implement new audio decoding API
  mpegaudiodec: skip all channels when skipping granules
  mpegenc: simplify muxrate calculation

Conflicts:
Changelog
avconv.c
doc/RELEASE_NOTES
libavcodec/h264.c
libavcodec/mpeg12.c
libavcodec/mpegaudiodec.c
libavcodec/mpegvideo.c
libavformat/mpegenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
23 files changed:
1  2 
Changelog
avconv.c
ffmpeg.c
libavcodec/bmv.c
libavcodec/error_resilience.c
libavcodec/h264.c
libavcodec/imgconvert.c
libavcodec/mpeg12.c
libavcodec/mpegaudiodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c
libavcodec/options.c
libavcodec/snow.c
libavcodec/v410enc.c
libavcodec/wavpack.c
libavformat/mmst.c
libavformat/mpegenc.c
libavformat/rmenc.c
libpostproc/postprocess_template.c
libswscale/colorspace-test.c
tests/codec-regression.sh
tools/patcheck

diff --cc Changelog
index 7b5d27778e264c80e83424dbd743284106c0d195,37302082debb3c68e43794678657ad8763863c76..09e44d4935d7623ef4d3fb37bd21cb9e7888a3ab
+++ b/Changelog
@@@ -2,31 -2,17 +2,29 @@@ Entries are sorted chronologically fro
  releases are sorted from youngest to oldest.
  
  
 -version <next>:
 -
 +version next:
 +- v410 Quicktime Uncompressed 4:4:4 10-bit encoder and decoder
 +- SBaGen (SBG) binaural beats script demuxer
 +- OpenMG Audio muxer
 +- dv: add timecode to metadata
 +- thumbnail video filter
 +- XML output in ffprobe
 +- asplit audio filter
 +- tinterlace video filter
 +- astreamsync audio filter
 +- amerge audio filter
- - Indeo 4 decoder
- - SMJPEG demuxer
  - Automatic thread count based on detection number of (available) CPU cores
 +- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
  
  
 -version 0.8_beta1:
 +version 0.9:
  
 +- openal input device added
 +- boxblur filter added
  - BWF muxer
  - Flash Screen Video 2 decoder
 -- ffplay/ffprobe/ffserver renamed to avplay/avprobe/avserver
 -- ffmpeg deprecated, added avconv, which is almost the same for now, except
 +- lavfi input device added
 +- added avconv, which is almost the same for now, except
  for a few incompatible changes in the options, which will hopefully make them
  easier to use. The changes are:
      * The options placement is now strictly enforced! While in theory the
  - Discworld II BMV decoding support
  - VBLE Decoder
  - OS X Video Decoder Acceleration (VDA) support
 +- compact and csv output in ffprobe
 +- pan audio filter
 +- IFF Amiga Continuous Bitmap (ACBM) decoder
 +- ass filter
  - CRI ADX audio format demuxer
  - Playstation Portable PMP format demuxer
 +- Microsoft Windows ICO demuxer
 +- life source
  - PCM format support in OMA demuxer
  - CLJR encoder
 +- new option: -report
  - Dxtory capture format decoder
 -- v410 QuickTime uncompressed 4:4:4 10-bit encoder and decoder
 -- OpenMG Audio muxer
 +- cellauto source
  - Simple segmenting muxer
+ - Indeo 4 decoder
+ - SMJPEG demuxer
  
  
 -version 0.7:
 -
 -- E-AC-3 audio encoder
 -- ac3enc: add channel coupling support
 -- floating-point sample format support for (E-)AC-3, DCA, AAC, Vorbis decoders
 -- H.264/MPEG frame-level multithreading
 -- av_metadata_* functions renamed to av_dict_* and moved to libavutil
 -- 4:4:4 H.264 decoding support
 -- 10-bit H.264 optimizations for x86
 -- bump libswscale for recently reported ABI break
 -
 -
 -version 0.7_beta2:
 -
 -- VP8 frame-level multithreading
 -- NEON optimizations for VP8
 -- removed a lot of deprecated API cruft
 -- FFT and IMDCT optimizations for AVX (Sandy Bridge) processors
 -- DPX image encoder
 -- SMPTE 302M AES3 audio decoder
 -- ffmpeg no longer quits after the 'q' key is pressed; use 'ctrl+c' instead
 -- 9bit and 10bit per sample support in the H.264 decoder
 -
 -
 -version 0.7_beta1:
 +version 0.8:
  
 +- many many things we forgot because we rather write code than changelogs
  - WebM support in Matroska de/muxer
  - low overhead Ogg muxing
  - MMS-TCP support
diff --cc avconv.c
index d4ffcb07654efe3f8bc2d61118809f28311965e0,096623e7dc0fa142e8e06c8e8a3feeed82e930d2..a8f3d7033954fedb8ba16966f2751805fd81d87b
+++ b/avconv.c
@@@ -3223,21 -3107,12 +3223,12 @@@ static void add_input_streams(OptionsCo
                  st->discard = AVDISCARD_ALL;
              break;
          case AVMEDIA_TYPE_VIDEO:
-             rfps      = ic->streams[i]->r_frame_rate.num;
-             rfps_base = ic->streams[i]->r_frame_rate.den;
 +            if(!ist->dec)
 +                ist->dec = avcodec_find_decoder(dec->codec_id);
              if (dec->lowres) {
                  dec->flags |= CODEC_FLAG_EMU_EDGE;
 -                dec->height >>= dec->lowres;
 -                dec->width  >>= dec->lowres;
              }
  
-             if (dec->time_base.den != rfps * dec->ticks_per_frame || dec->time_base.num != rfps_base) {
-                 av_log(NULL, AV_LOG_INFO,"\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
-                        i, (float)dec->time_base.den / dec->time_base.num, dec->time_base.den, dec->time_base.num,
-                        (float)rfps / rfps_base, rfps, rfps_base);
-             }
              if (o->video_disable)
                  st->discard = AVDISCARD_ALL;
              else if (video_discard)
diff --cc ffmpeg.c
index fe15eea3f7e0a461a407a309198f973ac6b33277,0ec3b241caffd2652b110992a3f834f3a47fed52..2323552fdfa9a982e4db10a49eec9a2cbd8a2def
+++ b/ffmpeg.c
@@@ -3412,190 -3041,98 +3412,181 @@@ static int copy_metadata(char *outspec
      return 0;
  }
  
 -static int opt_map_meta_data(const char *opt, const char *arg)
 +static int opt_recording_timestamp(OptionsContext *o, const char *opt, const char *arg)
  {
 -    fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. "
 -                    "Use -map_metadata instead.\n");
 -    return opt_map_metadata(opt, arg);
 +    char buf[128];
 +    int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
 +    struct tm time = *gmtime((time_t*)&recording_timestamp);
 +    strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
 +    parse_option(o, "metadata", buf, options);
 +
 +    av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
 +                                 "tag instead.\n", opt);
 +    return 0;
  }
  
 -static int opt_map_chapters(const char *opt, const char *arg)
 +static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
  {
 -    ChapterMap *c;
 -    char *p;
 -
 -    chapter_maps = grow_array(chapter_maps, sizeof(*chapter_maps), &nb_chapter_maps,
 -                              nb_chapter_maps + 1);
 -    c = &chapter_maps[nb_chapter_maps - 1];
 -    c->out_file = strtol(arg, &p, 0);
 -    if (*p)
 -        p++;
 +    const char *codec_string = encoder ? "encoder" : "decoder";
 +    AVCodec *codec;
  
 -    c->in_file = strtol(p, &p, 0);
 -    return 0;
 +    codec = encoder ?
 +        avcodec_find_encoder_by_name(name) :
 +        avcodec_find_decoder_by_name(name);
 +    if (!codec) {
 +        av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
 +        exit_program(1);
 +    }
 +    if (codec->type != type) {
 +        av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
 +        exit_program(1);
 +    }
 +    return codec;
  }
  
 -static int opt_input_ts_scale(const char *opt, const char *arg)
 +static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)
  {
 -    unsigned int stream;
 -    double scale;
 -    char *p;
 +    char *codec_name = NULL;
  
 -    stream = strtol(arg, &p, 0);
 -    if (*p)
 -        p++;
 -    scale= strtod(p, &p);
 -
 -    ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
 -    ts_scale[stream] = scale;
 -    return 0;
 +    MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
 +    if (codec_name) {
 +        AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type, 0);
 +        st->codec->codec_id = codec->id;
 +        return codec;
 +    } else
 +        return avcodec_find_decoder(st->codec->codec_id);
  }
  
 -static int opt_recording_time(const char *opt, const char *arg)
 +/**
 + * Add all the streams from the given input file to the global
 + * list of input streams.
 + */
 +static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
  {
-     int i, rfps, rfps_base;
 -    recording_time = parse_time_or_die(opt, arg, 1);
 -    return 0;
 -}
++    int i;
 +    char *next, *codec_tag = NULL;
  
 -static int opt_start_time(const char *opt, const char *arg)
 -{
 -    start_time = parse_time_or_die(opt, arg, 1);
 -    return 0;
 -}
 +    for (i = 0; i < ic->nb_streams; i++) {
 +        AVStream *st = ic->streams[i];
 +        AVCodecContext *dec = st->codec;
 +        InputStream *ist;
  
 -static int opt_recording_timestamp(const char *opt, const char *arg)
 -{
 -    char buf[128];
 -    int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
 -    struct tm time = *gmtime((time_t*)&recording_timestamp);
 -    strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
 -    opt_metadata("metadata", buf);
 +        input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1);
 +        ist = &input_streams[nb_input_streams - 1];
 +        ist->st = st;
 +        ist->file_index = nb_input_files;
 +        ist->discard = 1;
 +        ist->opts = filter_codec_opts(codec_opts, choose_decoder(o, ic, st), ic, st);
  
 -    av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
 -                                 "tag instead.\n", opt);
 -    return 0;
 +        ist->ts_scale = 1.0;
 +        MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
 +
 +        MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
 +        if (codec_tag) {
 +            uint32_t tag = strtol(codec_tag, &next, 0);
 +            if (*next)
 +                tag = AV_RL32(codec_tag);
 +            st->codec->codec_tag = tag;
 +        }
 +
 +        ist->dec = choose_decoder(o, ic, st);
 +
 +        switch (dec->codec_type) {
 +        case AVMEDIA_TYPE_AUDIO:
 +            if (!ist->dec)
 +                ist->dec = avcodec_find_decoder(dec->codec_id);
 +            if (o->audio_disable)
 +                st->discard = AVDISCARD_ALL;
 +            break;
 +        case AVMEDIA_TYPE_VIDEO:
 +            if(!ist->dec)
 +                ist->dec = avcodec_find_decoder(dec->codec_id);
-             rfps      = ic->streams[i]->r_frame_rate.num;
-             rfps_base = ic->streams[i]->r_frame_rate.den;
 +            if (dec->lowres) {
 +                dec->flags |= CODEC_FLAG_EMU_EDGE;
 +            }
 +
-             if (dec->time_base.den != rfps * dec->ticks_per_frame || dec->time_base.num != rfps_base) {
-                 av_log(NULL, AV_LOG_INFO,"\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
-                        i, (float)dec->time_base.den / dec->time_base.num, dec->time_base.den, dec->time_base.num,
-                        (float)rfps / rfps_base, rfps, rfps_base);
-             }
 +            if (o->video_disable)
 +                st->discard = AVDISCARD_ALL;
 +            else if (video_discard)
 +                st->discard = video_discard;
 +            break;
 +        case AVMEDIA_TYPE_DATA:
 +            if (o->data_disable)
 +                st->discard= AVDISCARD_ALL;
 +            break;
 +        case AVMEDIA_TYPE_SUBTITLE:
 +            if(!ist->dec)
 +                ist->dec = avcodec_find_decoder(dec->codec_id);
 +            if(o->subtitle_disable)
 +                st->discard = AVDISCARD_ALL;
 +            break;
 +        case AVMEDIA_TYPE_ATTACHMENT:
 +        case AVMEDIA_TYPE_UNKNOWN:
 +            break;
 +        default:
 +            abort();
 +        }
 +    }
  }
  
 -static int opt_input_ts_offset(const char *opt, const char *arg)
 +static void assert_file_overwrite(const char *filename)
  {
 -    input_ts_offset = parse_time_or_die(opt, arg, 1);
 -    return 0;
 +    if ((!file_overwrite || no_file_overwrite) &&
 +        (strchr(filename, ':') == NULL || filename[1] == ':' ||
 +         av_strstart(filename, "file:", NULL))) {
 +        if (avio_check(filename, 0) == 0) {
 +            if (!using_stdin && (!no_file_overwrite || file_overwrite)) {
 +                fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
 +                fflush(stderr);
 +                term_exit();
 +                signal(SIGINT, SIG_DFL);
 +                if (!read_yesno()) {
 +                    av_log(0, AV_LOG_FATAL, "Not overwriting - exiting\n");
 +                    exit_program(1);
 +                }
 +                term_init();
 +            }
 +            else {
 +                av_log(0, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
 +                exit_program(1);
 +            }
 +        }
 +    }
  }
  
 -static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
 +static void dump_attachment(AVStream *st, const char *filename)
  {
 -    const char *codec_string = encoder ? "encoder" : "decoder";
 -    AVCodec *codec;
 +    int ret;
 +    AVIOContext *out = NULL;
 +    AVDictionaryEntry *e;
  
 -    if(!name)
 -        return CODEC_ID_NONE;
 -    codec = encoder ?
 -        avcodec_find_encoder_by_name(name) :
 -        avcodec_find_decoder_by_name(name);
 -    if(!codec) {
 -        fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
 +    if (!st->codec->extradata_size) {
 +        av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
 +               nb_input_files - 1, st->index);
 +        return;
 +    }
 +    if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
 +        filename = e->value;
 +    if (!*filename) {
 +        av_log(NULL, AV_LOG_FATAL, "No filename specified and no 'filename' tag"
 +               "in stream #%d:%d.\n", nb_input_files - 1, st->index);
          exit_program(1);
      }
 -    if(codec->type != type) {
 -        fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
 +
 +    assert_file_overwrite(filename);
 +
 +    if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
 +        av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
 +               filename);
          exit_program(1);
      }
 -    return codec->id;
 +
 +    avio_write(out, st->codec->extradata, st->codec->extradata_size);
 +    avio_flush(out);
 +    avio_close(out);
  }
  
 -static int opt_input_file(const char *opt, const char *filename)
 +static int opt_input_file(OptionsContext *o, const char *opt, const char *filename)
  {
      AVFormatContext *ic;
      AVInputFormat *file_iformat = NULL;
Simple merge
Simple merge
index a9f15f44d9ded9dd19cd746c8227b2a0b6b6bd46,316a57d75e5ff7d0c545bda94eb1904c715c6a4a..8a79311f7c309ae542880e8e6b43395595e471d0
@@@ -3780,9 -3741,7 +3779,12 @@@ static int decode_nal_units(H264Contex
      int nals_needed=0; ///< number of NALs that need decoding before the next frame thread starts
      int nal_index;
  
-     h->max_contexts = (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_SLICE)) ? avctx->thread_count : 1;
 +    h->nal_unit_type= 0;
 +
++    if(!s->slice_context_count)
++         s->slice_context_count= 1;
+     h->max_contexts = s->slice_context_count;
++
      if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){
          h->current_slice = 0;
          if (!s->first_field)
Simple merge
index 990b6d67cdd1a33235d14a75a3fe632b6f3ff40f,20195128391f3470f777d51266eeefe9b68b5200..fcbea5429d83e98f283fe20a7323ecdee4ca688f
@@@ -2485,8 -2428,9 +2485,10 @@@ static int decode_chunks(AVCodecContex
                  }
  
                  if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
-                     int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count;
+                     int threshold = (s2->mb_height * s->slice_count +
+                                      s2->slice_context_count / 2) /
+                                     s2->slice_context_count;
 +                    av_assert0(avctx->thread_count > 1);
                      if (threshold <= mb_y) {
                          MpegEncContext *thread_context = s2->thread_context[s->slice_count];
  
Simple merge
index 5c04e9d0789f4917e547e3f26c0834fdfb69f6d8,a2aa257f89369592779968af337e7dca528ffef0..90eb737ec7ac6d93f7dc8dc737e88d548f6380b6
@@@ -827,12 -875,23 +832,13 @@@ av_cold int MPV_common_init(MpegEncCont
          // Note the + 1 is for  a quicker mpeg4 slice_end detection
  
          s->parse_context.state = -1;
 -        if ((s->avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
 -            s->avctx->debug_mv) {
 -            s->visualization_buffer[0] = av_malloc((s->mb_width * 16 +
 -                        2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
 -            s->visualization_buffer[1] = av_malloc((s->mb_width * 16 +
 -                        2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
 -            s->visualization_buffer[2] = av_malloc((s->mb_width * 16 +
 -                        2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
 -        }
 -    }
  
 -    s->context_initialized = 1;
 -    s->thread_context[0]   = s;
 +        s->context_initialized = 1;
 +        s->thread_context[0]   = s;
  
-         if (s->encoding || (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE)) {
-             for (i = 1; i < threads; i++) {
 -    if (s->width && s->height) {
++//     if (s->width && s->height) {
+         if (nb_slices > 1) {
+             for (i = 1; i < nb_slices; i++) {
                  s->thread_context[i] = av_malloc(sizeof(MpegEncContext));
                  memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
              }
              s->start_mb_y = 0;
              s->end_mb_y   = s->mb_height;
          }
 -    }
+         s->slice_context_count = nb_slices;
++//     }
  
      return 0;
   fail:
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 1ac0ecd3c7693d45567a0f4bf41064943dc232a3,6896877fca1bddaa525da4e3e9447b9d0f06b392..7d358238b252c3216e01b678ab7361151dd96fce
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
 - * License along with Libav; if not, write to the Free Software
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  #define BITSTREAM_READER_LE
+ #include "libavutil/audioconvert.h"
  #include "avcodec.h"
  #include "get_bits.h"
  #include "unary.h"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 491e032bf74774f518eb03de5f6f48692170b85e,220593b17f39fb8c9d821a7cc393166363a74120..f3ead202981d572ccc3f094399199df467f05f03
@@@ -68,13 -68,8 +68,13 @@@ f
  
  if [ -n "$do_mpeg2thread_ilace" ]; then
  # mpeg2 encoding interlaced using intra vlc
- do_video_encoding mpeg2threadivlc.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
+ do_video_encoding mpeg2threadivlc.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2 -slices 2"
  do_video_decoding
 +
 +# mpeg2 encoding interlaced
 +file=${outfile}mpeg2reuse.mpg
 +do_avconv $file $DEC_OPTS -me_threshold 256 -i ${target_path}/${outfile}mpeg2thread.mpg $ENC_OPTS -same_quant -me_threshold 256 -mb_threshold 1024 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
 +do_video_decoding
  fi
  
  if [ -n "$do_msmpeg4v2" ] ; then
diff --cc tools/patcheck
Simple merge