Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jul 2012 22:32:31 +0000 (00:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jul 2012 22:32:31 +0000 (00:32 +0200)
* qatar/master:
  cosmetics: Consistently use C-style comments with multiple inclusion guards
  anm: fix a few Doxygen comments
  misc typo and wording fixes
  attributes: add av_noreturn
  attributes: drop pointless define guards
  configure: do not disable av_always_inline with --enable-small
  flvdec: initial stream switch support
  avplay: fix write on freed memory for rawvideo
  snow: remove a VLA used for edge emulation
  x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
  snow: remove the runs[] VLA.
  snow: Check mallocs at init
  flacdec: remove redundant setting of avctx->sample_fmt

Conflicts:
ffplay.c
libavcodec/h264.c
libavcodec/snow.c
libavcodec/snow.h
libavcodec/snowdec.c
libavcodec/snowenc.c
libavformat/flvdec.c
libavutil/attributes.h
tools/patcheck

Merged-by: Michael Niedermayer <michaelni@gmx.at>
24 files changed:
1  2 
cmdutils.h
configure
ffplay.c
libavcodec/anm.c
libavcodec/dsputil.h
libavcodec/flacdec.c
libavcodec/h264.c
libavcodec/snow.c
libavcodec/snow.h
libavcodec/snowdec.c
libavcodec/snowenc.c
libavcodec/version.h
libavcodec/xvmc.h
libavfilter/formats.h
libavfilter/version.h
libavfilter/x86/gradfun.c
libavfilter/x86/yadif.c
libavformat/flvdec.c
libavformat/rtp.h
libavformat/version.h
libavutil/arm/intmath.h
libavutil/attributes.h
libavutil/dict.h
tools/patcheck

diff --cc cmdutils.h
Simple merge
diff --cc configure
Simple merge
diff --cc ffplay.c
+++ b/ffplay.c
@@@ -1632,9 -1597,10 +1632,10 @@@ static int configure_video_filters(AVFi
  
  static int video_thread(void *arg)
  {
+     AVPacket pkt = { 0 };
      VideoState *is = arg;
      AVFrame *frame = avcodec_alloc_frame();
 -    int64_t pts_int;
 +    int64_t pts_int = AV_NOPTS_VALUE, pos = -1;
      double pts;
      int ret;
  
          while (is->paused && !is->videoq.abort_request)
              SDL_Delay(10);
  
 +        avcodec_get_frame_defaults(frame);
+         av_free_packet(&pkt);
          ret = get_video_frame(is, frame, &pts_int, &pkt);
          if (ret < 0)
              goto the_end;
Simple merge
Simple merge
Simple merge
@@@ -4441,13 -4372,12 +4441,13 @@@ again
                  break;
              case NAL_SPS:
                  init_get_bits(&s->gb, ptr, bit_length);
 -                if (ff_h264_decode_seq_parameter_set(h) < 0 &&
 -                    h->is_avc && (nalsize != consumed) && nalsize) {
 +                if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)) {
                      av_log(h->s.avctx, AV_LOG_DEBUG,
-                            "SPS decoding failure, trying alternative mode\n");
+                            "SPS decoding failure, trying again with the complete NAL\n");
 -                    init_get_bits(&s->gb, buf + buf_index + 1 - consumed,
 -                                  8 * (nalsize - 1));
 +                    if (h->is_avc)
 +                        av_assert0(next_avc - buf_index + consumed == nalsize);
 +                    init_get_bits(&s->gb, &buf[buf_index + 1 - consumed],
 +                                  8*(next_avc - buf_index + consumed - 1));
                      ff_h264_decode_seq_parameter_set(h);
                  }
  
@@@ -456,10 -458,17 +458,17 @@@ av_cold int ff_snow_common_init(AVCodec
          for(j=0; j<MAX_REF_FRAMES; j++)
              ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1);
  
-     s->avctx->get_buffer(s->avctx, &s->mconly_picture);
-     s->scratchbuf = av_mallocz(s->mconly_picture.linesize[0]*7*MB_SIZE);
+     if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) {
 -        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 -        return ret;
++//         av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
++//         return ret;
+     }
 -    FF_ALLOC_OR_GOTO(avctx, s->scratchbuf, s->mconly_picture.linesize[0]*7*MB_SIZE, fail);
 -    emu_buf_size = s->mconly_picture.linesize[0] * (2 * MB_SIZE + HTAPS_MAX - 1);
++    FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture.linesize[0], 2*width+256)*7*MB_SIZE, fail);
++    emu_buf_size = FFMAX(s->mconly_picture.linesize[0], 2*width+256) * (2 * MB_SIZE + HTAPS_MAX - 1);
+     FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail);
  
      return 0;
+ fail:
+     return AVERROR(ENOMEM);
  }
  
  int ff_snow_common_init_after_header(AVCodecContext *avctx) {
Simple merge
@@@ -365,7 -354,14 +365,12 @@@ static int decode_header(SnowContext *s
  
  static av_cold int decode_init(AVCodecContext *avctx)
  {
-     ff_snow_common_init(avctx);
+     int ret;
 -    avctx->pix_fmt= PIX_FMT_YUV420P;
 -
+     if ((ret = ff_snow_common_init(avctx)) < 0) {
+         ff_snow_common_end(avctx->priv_data);
+         return ret;
+     }
  
      return 0;
  }
Simple merge
Simple merge
Simple merge
Simple merge
  #define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
  
  /**
-  * Those FF_API_* defines are not part of public API.
+  * These FF_API_* defines are not part of the public API.
   * They may change, break or disappear at any time.
   */
 +#ifndef FF_API_OLD_ALL_FORMATS_API
 +#define FF_API_OLD_ALL_FORMATS_API (LIBAVFILTER_VERSION_MAJOR < 3)
 +#endif
  #ifndef FF_API_AVFILTERPAD_PUBLIC
  #define FF_API_AVFILTERPAD_PUBLIC           (LIBAVFILTER_VERSION_MAJOR < 4)
  #endif
  #ifndef FF_API_FOO_COUNT
  #define FF_API_FOO_COUNT                    (LIBAVFILTER_VERSION_MAJOR < 4)
  #endif
 +#ifndef FF_API_FILL_FRAME
 +#define FF_API_FILL_FRAME                   (LIBAVFILTER_VERSION_MAJOR < 4)
 +#endif
 +#ifndef FF_API_BUFFERSRC_BUFFER
 +#define FF_API_BUFFERSRC_BUFFER             (LIBAVFILTER_VERSION_MAJOR < 4)
 +#endif
  
- #endif // AVFILTER_VERSION_H
+ #endif /* AVFILTER_VERSION_H */
@@@ -26,9 -26,9 +26,9 @@@
  DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
  DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
  
 -static void gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
+ #if HAVE_MMX2
 +static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
  {
- #if HAVE_MMX2
      intptr_t x;
      if (width & 3) {
          x = width & ~3;
           "rm"(thresh), "m"(*dithers), "m"(*pw_7f)
          :"memory"
      );
- #endif
  }
+ #endif
  
 -static void gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
+ #if HAVE_SSSE3
 +static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
  {
- #if HAVE_SSSE3
      intptr_t x;
      if (width & 7) {
          // could be 10% faster if I somehow eliminated this
           "rm"(thresh), "m"(*dithers), "m"(*pw_7f)
          :"memory"
      );
- #endif // HAVE_SSSE3
  }
+ #endif // HAVE_SSSE3
  
 -static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width)
+ #if HAVE_SSE
 +static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width)
  {
- #if HAVE_SSE
  #define BLURV(load)\
      intptr_t x = -2*width;\
      __asm__ volatile(\
Simple merge
@@@ -616,17 -685,25 +696,27 @@@ static int flv_read_packet(AVFormatCont
      /* now find stream */
      for(i=0;i<s->nb_streams;i++) {
          st = s->streams[i];
-         if (st->id == stream_type)
 -        if (is_audio && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
++        if (stream_type == FLV_STREAM_TYPE_AUDIO && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+             if (flv_same_audio_codec(st->codec, flags)) {
+                 break;
+             }
+         } else
 -        if (!is_audio && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
++        if (stream_type == FLV_STREAM_TYPE_VIDEO && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+             if (flv_same_video_codec(st->codec, flags)) {
+                 break;
+             }
++        } else if (st->id == stream_type) {
 +            break;
+         }
      }
      if(i == s->nb_streams){
 -        st = create_stream(s, is_audio,
 -             is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO);
 -        s->ctx_flags &= ~AVFMTCTX_NOHEADER;
 +        av_log(s, AV_LOG_WARNING, "Stream discovered after head already parsed\n");
 +        st = create_stream(s, stream_type,
 +             (int[]){AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_DATA}[stream_type]);
      }
 -    av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard);
 -    if(  (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||         is_audio))
 -       ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
 +    av_dlog(s, "%d %X %d \n", stream_type, flags, st->discard);
 +    if(  (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || (stream_type == FLV_STREAM_TYPE_AUDIO)))
 +       ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && (stream_type == FLV_STREAM_TYPE_VIDEO)))
         || st->discard >= AVDISCARD_ALL
         ){
          avio_seek(s->pb, next, SEEK_SET);
Simple merge
  #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
  
  /**
-  * Those FF_API_* defines are not part of public API.
+  * These FF_API_* defines are not part of the public API.
   * They may change, break or disappear at any time.
   */
 +#ifndef FF_API_OLD_AVIO
 +#define FF_API_OLD_AVIO                (LIBAVFORMAT_VERSION_MAJOR < 55)
 +#endif
 +#ifndef FF_API_PKT_DUMP
 +#define FF_API_PKT_DUMP                (LIBAVFORMAT_VERSION_MAJOR < 54)
 +#endif
 +#ifndef FF_API_ALLOC_OUTPUT_CONTEXT
 +#define FF_API_ALLOC_OUTPUT_CONTEXT    (LIBAVFORMAT_VERSION_MAJOR < 55)
 +#endif
 +#ifndef FF_API_FORMAT_PARAMETERS
 +#define FF_API_FORMAT_PARAMETERS       (LIBAVFORMAT_VERSION_MAJOR < 55)
 +#endif
 +#ifndef FF_API_NEW_STREAM
 +#define FF_API_NEW_STREAM              (LIBAVFORMAT_VERSION_MAJOR < 55)
 +#endif
 +#ifndef FF_API_SET_PTS_INFO
 +#define FF_API_SET_PTS_INFO            (LIBAVFORMAT_VERSION_MAJOR < 55)
 +#endif
  #ifndef FF_API_CLOSE_INPUT_FILE
  #define FF_API_CLOSE_INPUT_FILE        (LIBAVFORMAT_VERSION_MAJOR < 55)
  #endif
Simple merge
  #else
  #    define av_always_inline inline
  #endif
 +#endif
 +
 +#ifndef av_extern_inline
 +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
 +#    define av_extern_inline extern inline
 +#else
 +#    define av_extern_inline inline
 +#endif
 +#endif
  
- #ifndef av_noreturn
- #if AV_GCC_VERSION_AT_LEAST(2,5)
- #    define av_noreturn __attribute__((noreturn))
- #else
- #    define av_noreturn
- #endif
- #endif
- #ifndef av_noinline
  #if AV_GCC_VERSION_AT_LEAST(3,1)
  #    define av_noinline __attribute__((noinline))
  #else
  #else
  #    define av_pure
  #endif
- #endif
  
- #ifndef av_const
 +#ifndef av_restrict
 +#define av_restrict restrict
 +#endif
 +
  #if AV_GCC_VERSION_AT_LEAST(2,6)
  #    define av_const __attribute__((const))
  #else
  #else
  #    define attribute_deprecated
  #endif
- #endif
  
- #ifndef av_unused
 +/**
 + * Disable warnings about deprecated features
 + * This is useful for sections of code kept for backward compatibility and
 + * scheduled for removal.
 + */
 +#ifndef AV_NOWARN_DEPRECATED
 +#if AV_GCC_VERSION_AT_LEAST(4,6)
 +#    define AV_NOWARN_DEPRECATED(code) \
 +        _Pragma("GCC diagnostic push") \
 +        _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
 +        code \
 +        _Pragma("GCC diagnostic pop")
 +#else
 +#    define AV_NOWARN_DEPRECATED(code) code
 +#endif
 +#endif
 +
 +
  #if defined(__GNUC__)
  #    define av_unused __attribute__((unused))
  #else
  #else
  #   define av_alias
  #endif
- #endif
  
- #ifndef av_uninit
 -#if defined(__GNUC__) && !defined(__ICC)
 +#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  #    define av_uninit(x) x=x
  #else
  #    define av_uninit(x) x
Simple merge
diff --cc tools/patcheck
@@@ -67,7 -67,8 +67,8 @@@ $EGREP $OPT '^\+ *(const *|)static' $*
  cat $TMP
  hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
  
- hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $*
 -hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive)\b' 'common typos' $*
++hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $*
  hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
  hiegrep '[^sn]printf' 'Please use av_log' $*
  hiegrep '\bmalloc' 'Please use av_malloc' $*