Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Jun 2011 03:19:30 +0000 (05:19 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Jun 2011 03:19:30 +0000 (05:19 +0200)
* qatar/master: (25 commits)
  Replace custom DEBUG preprocessor trickery by the standard one.
  vorbis: Remove non-compiling debug statement.
  vorbis: Remove pointless DEBUG #ifdef around debug output macros.
  cook: Remove non-compiling debug output.
  Remove pointless #ifdefs around function declarations in a header.
  Replace #ifdef + av_log() combinations by av_dlog().
  Replace custom debug output functions by av_dlog().
  cook: Remove unused debug functions.
  Remove stray extra arguments from av_dlog() invocations.
  targa: fix big-endian build
  v4l2: remove one forgotten use of AVFormatParameters.pix_fmt.
  vfwcap: add a framerate private option.
  v4l2: add a framerate private option.
  libdc1394: add a framerate private option.
  fbdev: add a framerate private option.
  bktr: add a framerate private option.
  oma: check avio_read() return value
  nutdec: remove unused variable
  Remove unused variables
  swscale: allocate larger buffer to handle altivec overreads.
  ...

Conflicts:
ffmpeg.c
libavcodec/dca.c
libavcodec/dirac.c
libavcodec/error_resilience.c
libavcodec/h264.c
libavcodec/mpeg12.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_enc.c
libavcodec/pthread.c
libavcodec/rv10.c
libavcodec/s302m.c
libavcodec/shorten.c
libavcodec/truemotion2.c
libavcodec/utils.c
libavdevice/dv1394.c
libavdevice/fbdev.c
libavdevice/libdc1394.c
libavdevice/v4l2.c
libavformat/4xm.c
libavformat/apetag.c
libavformat/asfdec.c
libavformat/avidec.c
libavformat/mmf.c
libavformat/mpeg.c
libavformat/mpegenc.c
libavformat/mpegts.c
libavformat/oggdec.c
libavformat/oggparseogm.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rpl.c
libavformat/rtpdec_latm.c
libavformat/sauce.c
libavformat/sol.c
libswscale/utils.c
tests/ref/vsynth1/error
tests/ref/vsynth2/error

Merged-by: Michael Niedermayer <michaelni@gmx.at>
66 files changed:
1  2 
configure
ffmpeg.c
ffserver.c
libavcodec/aaccoder.c
libavcodec/aacenc.c
libavcodec/aacenc.h
libavcodec/cook.c
libavcodec/dca.c
libavcodec/dirac.c
libavcodec/error_resilience.c
libavcodec/h263dec.c
libavcodec/h264.c
libavcodec/indeo5.c
libavcodec/interplayvideo.c
libavcodec/ituh263dec.c
libavcodec/ivi_common.c
libavcodec/ivi_common.h
libavcodec/mpeg12.c
libavcodec/mpeg12enc.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c
libavcodec/mpegvideo_parser.c
libavcodec/msmpeg4.c
libavcodec/pngdec.c
libavcodec/pthread.c
libavcodec/rv10.c
libavcodec/s302m.c
libavcodec/shorten.c
libavcodec/svq1dec.c
libavcodec/targa.c
libavcodec/truemotion2.c
libavcodec/tscc.c
libavcodec/utils.c
libavcodec/vorbis.c
libavcodec/vorbisdec.c
libavcodec/vqavideo.c
libavcodec/x86/h264_intrapred.asm
libavcodec/x86/h264_intrapred_init.c
libavdevice/bktr.c
libavdevice/dv1394.c
libavdevice/fbdev.c
libavdevice/libdc1394.c
libavdevice/v4l2.c
libavdevice/vfwcap.c
libavformat/4xm.c
libavformat/ape.c
libavformat/apetag.c
libavformat/asfdec.c
libavformat/gif.c
libavformat/ipmovie.c
libavformat/mmf.c
libavformat/mpeg.c
libavformat/mpegenc.c
libavformat/mpegts.c
libavformat/nutdec.c
libavformat/oggdec.c
libavformat/oma.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rpl.c
libavformat/rtpdec_latm.c
libavformat/rtsp.c
libavformat/sauce.c
libavformat/sol.c

diff --cc configure
+++ b/configure
@@@ -1075,8 -1071,9 +1075,10 @@@ HAVE_LIST=
      inet_aton
      inline_asm
      isatty
 +    kbhit
      ldbrx
+     libdc1394_1
+     libdc1394_2
      llrint
      llrintf
      local_aligned_16
@@@ -2912,9 -2876,7 +2914,8 @@@ check_mathfunc trunc
  
  # these are off by default, so fail if requested and not available
  enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
 +enabled libcelt    && require libcelt celt/celt.h celt_decode -lcelt0
  enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
- enabled libdc1394  && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
  enabled libdirac   && require_pkg_config dirac                          \
      "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h"  \
      "dirac_decoder_init dirac_encoder_init"
@@@ -2946,7 -2908,15 +2947,16 @@@ enabled libxavs    && require  libxavs 
  enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
  enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  
+ # libdc1394 check
+ if enabled libdc1394; then
+     { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
+         enable libdc1394_2; } ||
+     { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
+         enable libdc1394_1; } ||
+     die "ERROR: No version of libdc1394 found "
+ fi
 +SDL_CONFIG="${cross_prefix}sdl-config"
  if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
      check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
      enable sdl &&
diff --cc ffmpeg.c
Simple merge
diff --cc ffserver.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -535,11 -527,26 +535,27 @@@ skip_mean_and_median
                      /* zero MV */
                      pred_count++;
  
 -                    if (!fixed[mb_xy]) {
++                    if (!fixed[mb_xy] && 0) {
+                         if (s->avctx->codec_id == CODEC_ID_H264) {
+                             // FIXME
+                         } else {
+                             ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+                                                      mb_y, 0);
+                         }
+                         prev_x = s->last_picture.motion_val[0][mot_index][0];
+                         prev_y = s->last_picture.motion_val[0][mot_index][1];
+                         prev_ref = s->last_picture.ref_index[0][4*mb_xy];
+                     } else {
+                         prev_x = s->current_picture.motion_val[0][mot_index][0];
+                         prev_y = s->current_picture.motion_val[0][mot_index][1];
+                         prev_ref = s->current_picture.ref_index[0][4*mb_xy];
+                     }
                      /* last MV */
-                     mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0];
-                     mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1];
-                     ref         [pred_count]   = s->current_picture.ref_index[0][4*mb_xy];
+                     mv_predictor[pred_count][0]= prev_x;
+                     mv_predictor[pred_count][1]= prev_y;
+                     ref         [pred_count]   = prev_ref;
 +                    pred_count++;
  
                      s->mv_dir = MV_DIR_FORWARD;
                      s->mb_intra=0;
@@@ -670,8 -677,13 +686,14 @@@ static int is_intra_more_likely(MpegEnc
                  uint8_t *mb_ptr     = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
                  uint8_t *last_mb_ptr= s->last_picture.data   [0] + mb_x*16 + mb_y*16*s->linesize;
  
+                 if (s->avctx->codec_id == CODEC_ID_H264) {
+                     // FIXME
+                 } else {
+                     ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+                                              mb_y, 0);
+                 }
                  is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr                    , s->linesize, 16);
 +                // FIXME need await_progress() here
                  is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16);
              }else{
                  if(IS_INTRA(s->current_picture.mb_type[mb_xy]))
Simple merge
@@@ -611,6 -1060,6 +747,7 @@@ av_cold int ff_h264_decode_init(AVCodec
      return 0;
  }
  
++
  #define IN_RANGE(a, b, size) (((a) >= (b)) && ((a) < ((b)+(size))))
  static void copy_picture_range(Picture **to, Picture **from, int count, MpegEncContext *new_base, MpegEncContext *old_base)
  {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -2340,9 -2288,8 +2339,9 @@@ static int decode_chunks(AVCodecContex
          buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
          if (start_code > 0x1ff){
              if(s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT){
-                 if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
+                 if(HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)){
                      int i;
 +                    assert(avctx->thread_count > 1);
  
                      avctx->execute(avctx, slice_decode_thread,  &s2->thread_context[0], NULL, s->slice_count, sizeof(void*));
                      for(i=0; i<s->slice_count; i++)
                      break;
                  }
  
-                 if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
+                 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;
 +                    assert(avctx->thread_count > 1);
                      if(threshold <= mb_y){
                          MpegEncContext *thread_context= s2->thread_context[s->slice_count];
  
Simple merge
Simple merge
@@@ -586,7 -586,7 +586,8 @@@ av_cold int MPV_common_init(MpegEncCont
          return -1;
      }
  
-     if(s->avctx->active_thread_type&FF_THREAD_SLICE &&
++
+     if((s->avctx->active_thread_type & FF_THREAD_SLICE) &&
         (s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){
          av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
          return -1;
          if(init_duplicate_context(s, s) < 0) goto fail;
          s->start_mb_y = 0;
          s->end_mb_y   = s->mb_height;
 -    }
++
      }
  
      return 0;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -238,9 -237,9 +237,9 @@@ static int svq1_decode_block_intra (Get
      }
  
      if ((stages > 0) && (level >= 4)) {
- #ifdef DEBUG_SVQ1
-     av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
- #endif
 -      av_dlog(s->avctx,
++      av_dlog(NULL,
+               "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
+               stages, level);
        return -1;        /* invalid vector */
      }
  
@@@ -288,9 -287,9 +287,9 @@@ static int svq1_decode_block_non_intra 
      if (stages == -1) continue; /* skip vector */
  
      if ((stages > 0) && (level >= 4)) {
- #ifdef DEBUG_SVQ1
-     av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",stages,level);
- #endif
 -      av_dlog(s->avctx,
++      av_dlog(NULL,
+               "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
+               stages, level);
        return -1;        /* invalid vector */
      }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1178,17 -1165,17 +1165,17 @@@ static int vorbis_floor1_decode(vorbis_
          csub = (1 << cbits) - 1;
          cval = 0;
  
-         AV_DEBUG("Cbits %u\n", cbits);
+         av_dlog(NULL, "Cbits %u\n", cbits);
  
          if (cbits) // this reads all subclasses for this partition's class
 -            cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[class]].vlc.table,
 -                            vc->codebooks[vf->class_masterbook[class]].nb_bits, 3);
 +            cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[partition_class]].vlc.table,
 +                            vc->codebooks[vf->class_masterbook[partition_class]].nb_bits, 3);
  
          for (j = 0; j < cdim; ++j) {
 -            book = vf->subclass_books[class][cval & csub];
 +            book = vf->subclass_books[partition_class][cval & csub];
  
-             AV_DEBUG("book %d Cbits %u cval %u  bits:%d\n",
-                      book, cbits, cval, get_bits_count(gb));
+             av_dlog(NULL, "book %d Cbits %u cval %u  bits:%d\n",
+                     book, cbits, cval, get_bits_count(gb));
  
              cval = cval >> cbits;
              if (book > -1) {
Simple merge
Simple merge
Simple merge
Simple merge
  
  #include "libavutil/log.h"
  #include "libavutil/opt.h"
 -#include "libavformat/avformat.h"
 +#include "avdevice.h"
- #undef DV1394_DEBUG
  #include "libavformat/dv.h"
  #include "dv1394.h"
  
  #include <time.h>
  #include <linux/fb.h>
  
+ #include "libavutil/log.h"
  #include "libavutil/mem.h"
+ #include "libavutil/opt.h"
+ #include "libavutil/parseutils.h"
  #include "libavutil/pixdesc.h"
 -#include "libavformat/avformat.h"
 +#include "avdevice.h"
  
  struct rgb_pixfmt_map_entry {
      int bits_per_pixel;
@@@ -189,16 -198,12 +198,16 @@@ static int fbdev_read_packet(AVFormatCo
          fbdev->time_frame = av_gettime();
  
      /* wait based on the frame rate */
 -    curtime = av_gettime();
 -    delay = fbdev->time_frame - curtime;
 -    av_dlog(avctx,
 -            "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
 -            fbdev->time_frame, curtime, delay);
 -    if (delay > 0) {
 +    while (1) {
 +        curtime = av_gettime();
 +        delay = fbdev->time_frame - curtime;
 +        av_dlog(avctx,
 +                "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
 +                fbdev->time_frame, curtime, delay);
 +        if (delay <= 0) {
-             fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
++            fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->fps);
 +            break;
 +        }
          if (avctx->flags & AVFMT_FLAG_NONBLOCK)
              return AVERROR(EAGAIN);
          ts.tv_sec  =  delay / 1000000;
@@@ -2,11 -2,10 +2,10 @@@
   * IIDC1394 grab interface (uses libdc1394 and libraw1394)
   * Copyright (c) 2004 Roman Shaposhnik
   * Copyright (c) 2008 Alessandro Sappia
-  * Copyright (c) 2011 Martin Lambers
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
@@@ -433,11 -450,12 +434,12 @@@ static void mmap_close(struct video_dat
  static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
  {
      struct video_data *s = s1->priv_data;
 -    struct v4l2_input input;
 -    struct v4l2_standard standard;
 -    struct v4l2_streamparm streamparm = { 0 };
 +    struct v4l2_input input = {0};
 +    struct v4l2_standard standard = {0};
 +    struct v4l2_streamparm streamparm = {0};
      struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe;
      int i, ret;
+     AVRational fps;
  
      streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  
@@@ -705,12 -733,12 +712,13 @@@ static int v4l2_read_close(AVFormatCont
  
  #define OFFSET(x) offsetof(struct video_data, x)
  #define DEC AV_OPT_FLAG_DECODING_PARAM
 +
  static const AVOption options[] = {
 -    { "standard", "", offsetof(struct video_data, standard), FF_OPT_TYPE_STRING, {.str = "NTSC" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
 -    { "channel",  "", offsetof(struct video_data, channel),  FF_OPT_TYPE_INT,    {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 +    { "standard", "", OFFSET(standard), FF_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
 +    { "channel",  "", OFFSET(channel),  FF_OPT_TYPE_INT,    {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
      { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
      { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+     { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
      { NULL },
  };
  
  #include "libavutil/parseutils.h"
  #include <windows.h>
  #include <vfw.h>
 +#include "avdevice.h"
  
- //#define DEBUG_VFW
  /* Defines for VFW missing from MinGW.
   * Remove this when MinGW incorporates them. */
  #define HWND_MESSAGE                ((HWND)-3)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -364,8 -355,8 +361,6 @@@ static int ogg_packet(AVFormatContext *
          }
      }while (!complete);
  
--    av_dlog(s, "ogg_packet: idx %i, frame size %i, start %i\n",
-            idx, os->psize, os->pstart);
 -            idx, os->psize, os->pstart);
  
      if (os->granule == -1)
          av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge