Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Mar 2012 00:36:49 +0000 (01:36 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Mar 2012 00:36:49 +0000 (01:36 +0100)
* qatar/master:
  dxa: remove useless code
  lavf: don't select an attached picture as default stream for seeking.
  avconv: remove pointless checks.
  avconv: check for get_filtered_frame() failure.
  avconv: remove a pointless check.
  swscale: convert hscale() to use named arguments.
  x86inc: add *mp named argument support to DEFINE_ARGS.
  swscale: convert hscale to cpuflags().

Conflicts:
ffmpeg.c
libswscale/x86/scale.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
ffmpeg.c
libavcodec/dxa.c
libavformat/utils.c
libavutil/x86/x86inc.asm
libswscale/x86/scale.asm

diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -2168,30 -1973,76 +2168,30 @@@ static int transcode_video(InputStream 
              continue;
  
  #if CONFIG_AVFILTER
 -        resample_changed = ost->resample_width   != decoded_frame->width  ||
 -                           ost->resample_height  != decoded_frame->height ||
 -                           ost->resample_pix_fmt != decoded_frame->format;
 -        if (resample_changed) {
 -            av_log(NULL, AV_LOG_INFO,
 -                    "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
 -                    ist->file_index, ist->st->index,
 -                    ost->resample_width,  ost->resample_height,  av_get_pix_fmt_name(ost->resample_pix_fmt),
 -                    decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format));
 -
 -            avfilter_graph_free(&ost->graph);
 -            if (configure_video_filters(ist, ost)) {
 -                av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
 -                exit_program(1);
 -            }
 -
 -            ost->resample_width   = decoded_frame->width;
 -            ost->resample_height  = decoded_frame->height;
 -            ost->resample_pix_fmt = decoded_frame->format;
 -        }
 +        while (av_buffersink_poll_frame(ost->output_video_filter)) {
 +            AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base;
 +            AVFrame *filtered_frame;
  
 -        if (ist->st->sample_aspect_ratio.num)
 -            decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
 -        if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) {
 -            FrameBuffer      *buf = decoded_frame->opaque;
 -            AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(
 -                                        decoded_frame->data, decoded_frame->linesize,
 -                                        AV_PERM_READ | AV_PERM_PRESERVE,
 -                                        ist->st->codec->width, ist->st->codec->height,
 -                                        ist->st->codec->pix_fmt);
 -
 -            avfilter_copy_frame_props(fb, decoded_frame);
 -            fb->buf->priv           = buf;
 -            fb->buf->free           = filter_release_buffer;
 -
 -            buf->refcount++;
 -            av_buffersrc_buffer(ost->input_video_filter, fb);
 -        } else
 -            av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame,
 -                                     decoded_frame->pts, decoded_frame->sample_aspect_ratio);
 -
 -        if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) {
 -            ret = AVERROR(ENOMEM);
 -            goto fail;
 -        } else
 -            avcodec_get_frame_defaults(ist->filtered_frame);
 -        filtered_frame = ist->filtered_frame;
 -
 -        frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]);
 -        while (frame_available) {
 -            AVRational ist_pts_tb;
 -            if ((ret = get_filtered_video_frame(ost->output_video_filter,
 -                                                filtered_frame, &ost->picref,
 -                                                &ist_pts_tb)) < 0)
 +            if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){
 +                av_log(NULL, AV_LOG_WARNING, "AV Filter told us it has a frame available but failed to output one\n");
 +                goto cont;
 +            }
 +            if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) {
 +                ret = AVERROR(ENOMEM);
-                 goto end;
+                 goto fail;
 +            }
 +            filtered_frame = ist->filtered_frame;
 +            *filtered_frame= *decoded_frame; //for me_threshold
 +            avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref);
              filtered_frame->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
-             if (ost->picref->video && !ost->frame_aspect_ratio)
+             if (!ost->frame_aspect_ratio)
 -                ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
 -#else
 -            filtered_frame = decoded_frame;
 -#endif
 -
 -            do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size,
 -                         same_quant ? quality : ost->st->codec->global_quality);
 -            if (vstats_filename && frame_size)
 -                do_video_stats(output_files[ost->file_index].ctx, ost, frame_size);
 -#if CONFIG_AVFILTER
 -            frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
 +                ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
 +            do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame);
 +            cont:
              avfilter_unref_buffer(ost->picref);
          }
 +#else
 +        do_video_out(output_files[ost->file_index].ctx, ost, ist, decoded_frame);
  #endif
      }
  
@@@ -292,12 -291,8 +291,11 @@@ static av_cold int decode_init(AVCodecC
  {
      DxaDecContext * const c = avctx->priv_data;
  
-     c->avctx = avctx;
      avctx->pix_fmt = PIX_FMT_PAL8;
  
 +    avcodec_get_frame_defaults(&c->pic);
 +    avcodec_get_frame_defaults(&c->prev);
 +
      c->dsize = avctx->width * avctx->height * 2;
      if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
          av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
Simple merge
Simple merge
@@@ -408,20 -412,18 +412,20 @@@ SCALE_FUNC %1, %2, X, X8, 7, %
  %endif
  %endmacro
  
- ; SCALE_FUNCS2 opt, 8_xmm_args, 9to10_xmm_args, 16_xmm_args
- %macro SCALE_FUNCS2 4
- %ifnidn %1, sse4
- SCALE_FUNCS  8, 15, %1, %2
- SCALE_FUNCS  9, 15, %1, %3
- SCALE_FUNCS 10, 15, %1, %3
- SCALE_FUNCS 14, 15, %1, %3
- SCALE_FUNCS 16, 15, %1, %4
+ ; SCALE_FUNCS2 8_xmm_args, 9to10_xmm_args, 16_xmm_args
+ %macro SCALE_FUNCS2 3
+ %if notcpuflag(sse4)
+ SCALE_FUNCS  8, 15, %1
+ SCALE_FUNCS  9, 15, %2
+ SCALE_FUNCS 10, 15, %2
++SCALE_FUNCS 14, 15, %2
+ SCALE_FUNCS 16, 15, %3
  %endif ; !sse4
- SCALE_FUNCS  8, 19, %1, %2
- SCALE_FUNCS  9, 19, %1, %3
- SCALE_FUNCS 10, 19, %1, %3
- SCALE_FUNCS 14, 19, %1, %3
- SCALE_FUNCS 16, 19, %1, %4
+ SCALE_FUNCS  8, 19, %1
+ SCALE_FUNCS  9, 19, %2
+ SCALE_FUNCS 10, 19, %2
++SCALE_FUNCS 14, 19, %2
+ SCALE_FUNCS 16, 19, %3
  %endmacro
  
  %if ARCH_X86_32