Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Nov 2013 02:13:39 +0000 (03:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Nov 2013 02:26:35 +0000 (03:26 +0100)
* qatar/master:
  Deprecate obsolete XvMC hardware decoding support

Conflicts:
libavcodec/mpeg12.c
libavcodec/mpeg12dec.c
libavcodec/mpegvideo.c
libavcodec/options_table.h
libavutil/pixdesc.c
libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
18 files changed:
1  2 
doc/general.texi
libavcodec/allcodecs.c
libavcodec/avcodec.h
libavcodec/codec_desc.c
libavcodec/error_resilience.c
libavcodec/mpeg12.c
libavcodec/mpeg12dec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_xvmc.c
libavcodec/options_table.h
libavcodec/version.h
libavcodec/x86/dsputil_init.c
libavcodec/xvmc.h
libavcodec/xvmc_internal.h
libavutil/old_pix_fmts.h
libavutil/pixdesc.c
libavutil/pixfmt.h
libavutil/version.h

Simple merge
Simple merge
Simple merge
@@@ -39,9 -36,10 +39,10 @@@ static const AVCodecDescriptor codec_de
          .id        = AV_CODEC_ID_MPEG2VIDEO,
          .type      = AVMEDIA_TYPE_VIDEO,
          .name      = "mpeg2video",
 -        .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
 +        .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
          .props     = AV_CODEC_PROP_LOSSY,
      },
+ #if FF_API_XVMC
      {
          .id        = AV_CODEC_ID_MPEG2VIDEO_XVMC,
          .type      = AVMEDIA_TYPE_VIDEO,
Simple merge
@@@ -39,8 -34,6 +39,7 @@@
  #include "mpeg12.h"
  #include "mpeg12data.h"
  #include "bytestream.h"
- #include "xvmc_internal.h"
 +#include "vdpau_internal.h"
  #include "thread.h"
  
  uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
  #include "mpeg12.h"
  #include "mpeg12data.h"
  #include "bytestream.h"
 +#include "vdpau_internal.h"
  #include "xvmc_internal.h"
  #include "thread.h"
+ #include "version.h"
  
  typedef struct Mpeg1Context {
      MpegEncContext mpeg_enc_ctx;
@@@ -1121,28 -1107,14 +1130,32 @@@ static void quant_matrix_rebuild(uint16
      }
  }
  
 -static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
 +static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
+ #if FF_API_XVMC
 +#if CONFIG_MPEG_XVMC_DECODER
      AV_PIX_FMT_XVMC_MPEG2_IDCT,
      AV_PIX_FMT_XVMC_MPEG2_MC,
 -    AV_PIX_FMT_NONE };
 +#endif
+ #endif /* FF_API_XVMC */
 +#if CONFIG_MPEG1_VDPAU_HWACCEL
 +    AV_PIX_FMT_VDPAU_MPEG1,
 +    AV_PIX_FMT_VDPAU,
 +#endif
 +    AV_PIX_FMT_YUV420P,
 +    AV_PIX_FMT_NONE
 +};
  
 -static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
 +static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
++#if FF_API_XVMC
 +#if CONFIG_MPEG_XVMC_DECODER
 +    AV_PIX_FMT_XVMC_MPEG2_IDCT,
 +    AV_PIX_FMT_XVMC_MPEG2_MC,
 +#endif
++#endif /* FF_API_XVMC */
 +#if CONFIG_MPEG2_VDPAU_HWACCEL
 +    AV_PIX_FMT_VDPAU_MPEG2,
 +    AV_PIX_FMT_VDPAU,
 +#endif
  #if CONFIG_MPEG2_DXVA2_HWACCEL
      AV_PIX_FMT_DXVA2_VLD,
  #endif
@@@ -1162,30 -1133,19 +1175,38 @@@ static enum AVPixelFormat mpeg_get_pixe
      Mpeg1Context *s1 = avctx->priv_data;
      MpegEncContext *s = &s1->mpeg_enc_ctx;
  
 -    if (avctx->xvmc_acceleration)
 -        return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
 +    if(s->chroma_format < 2) {
 +        return ff_thread_get_format(avctx,
 +                                avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?
 +                                mpeg1_hwaccel_pixfmt_list_420 :
 +                                mpeg2_hwaccel_pixfmt_list_420);
 +    } else if(s->chroma_format == 2)
 +        return AV_PIX_FMT_YUV422P;
 +    else
 +        return AV_PIX_FMT_YUV444P;
 +}
 +
 +static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
 +{
+ #if FF_API_XVMC
+ FF_DISABLE_DEPRECATION_WARNINGS
 -
 -    if (s->chroma_format <  2)
 -        return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
 -    else if (s->chroma_format == 2)
 -        return AV_PIX_FMT_YUV422P;
 -    else
 -        return AV_PIX_FMT_YUV444P;
 +    if (avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_IDCT && avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_MC) {
 +        avctx->xvmc_acceleration = 0;
 +    } else if (!avctx->xvmc_acceleration) {
 +        avctx->xvmc_acceleration = 2;
 +    }
+ FF_ENABLE_DEPRECATION_WARNINGS
+ #endif /* FF_API_XVMC */
 +    avctx->hwaccel = ff_find_hwaccel(avctx);
 +    // until then pix_fmt may be changed right after codec init
++#if FF_API_XVMC
 +    if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
++#else
++    if (
++#endif
 +        avctx->hwaccel || uses_vdpau(avctx))
 +        if (avctx->idct_algo == FF_IDCT_AUTO)
 +            avctx->idct_algo = FF_IDCT_SIMPLE;
  }
  
  /* Call this function when we know all parameters.
@@@ -1909,11 -1879,15 +1938,15 @@@ static int slice_end(AVCodecContext *av
              av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
      }
  
+ #if FF_API_XVMC
+ FF_DISABLE_DEPRECATION_WARNINGS
      if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
          ff_xvmc_field_end(s);
+ FF_ENABLE_DEPRECATION_WARNINGS
+ #endif /* FF_API_XVMC */
  
      /* end of slice reached */
 -    if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field) {
 +    if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s->first_slice) {
          /* end of image */
  
          ff_er_frame_end(&s->er);
@@@ -2583,21 -2469,7 +2616,22 @@@ AVCodec ff_mpeg2video_decoder = 
      .profiles       = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
  };
  
 +//legacy decoder
 +AVCodec ff_mpegvideo_decoder = {
 +    .name           = "mpegvideo",
 +    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
 +    .type           = AVMEDIA_TYPE_VIDEO,
 +    .id             = AV_CODEC_ID_MPEG2VIDEO,
 +    .priv_data_size = sizeof(Mpeg1Context),
 +    .init           = mpeg_decode_init,
 +    .close          = mpeg_decode_end,
 +    .decode         = mpeg_decode_frame,
 +    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
 +    .flush          = flush,
 +    .max_lowres     = 3,
 +};
 +
+ #if FF_API_XVMC
  #if CONFIG_MPEG_XVMC_DECODER
  static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
  {
@@@ -2631,35 -2503,4 +2665,36 @@@ AVCodec ff_mpeg_xvmc_decoder = 
  };
  
  #endif
+ #endif /* FF_API_XVMC */
 +
 +#if CONFIG_MPEG_VDPAU_DECODER
 +AVCodec ff_mpeg_vdpau_decoder = {
 +    .name           = "mpegvideo_vdpau",
 +    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-1/2 video (VDPAU acceleration)"),
 +    .type           = AVMEDIA_TYPE_VIDEO,
 +    .id             = AV_CODEC_ID_MPEG2VIDEO,
 +    .priv_data_size = sizeof(Mpeg1Context),
 +    .init           = mpeg_decode_init,
 +    .close          = mpeg_decode_end,
 +    .decode         = mpeg_decode_frame,
 +    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
 +                      CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
 +    .flush          = flush,
 +};
 +#endif
 +
 +#if CONFIG_MPEG1_VDPAU_DECODER
 +AVCodec ff_mpeg1_vdpau_decoder = {
 +    .name           = "mpeg1video_vdpau",
 +    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"),
 +    .type           = AVMEDIA_TYPE_VIDEO,
 +    .id             = AV_CODEC_ID_MPEG1VIDEO,
 +    .priv_data_size = sizeof(Mpeg1Context),
 +    .init           = mpeg_decode_init,
 +    .close          = mpeg_decode_end,
 +    .decode         = mpeg_decode_frame,
 +    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
 +                      CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
 +    .flush          = flush,
 +};
 +#endif
  #include "libavutil/attributes.h"
  #include "libavutil/avassert.h"
  #include "libavutil/imgutils.h"
+ #include "libavutil/internal.h"
  #include "avcodec.h"
  #include "dsputil.h"
 +#include "h264chroma.h"
  #include "internal.h"
  #include "mathops.h"
  #include "mpegvideo.h"
@@@ -1720,19 -1686,23 +1725,24 @@@ FF_ENABLE_DEPRECATION_WARNING
   * frame has been coded/decoded. */
  void ff_MPV_frame_end(MpegEncContext *s)
  {
 -    int i;
 -
+ #if FF_API_XVMC
+ FF_DISABLE_DEPRECATION_WARNINGS
      /* redraw edges for the frame if decoding didn't complete */
      // just to make sure that all data is rendered.
      if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
          ff_xvmc_field_end(s);
-    } else if ((s->er.error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
-               !s->avctx->hwaccel &&
-               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
-               s->unrestricted_mv &&
-               s->current_picture.reference &&
-               !s->intra_only &&
-               !(s->flags & CODEC_FLAG_EMU_EDGE) &&
-               !s->avctx->lowres
-             ) {
+     } else
+ FF_ENABLE_DEPRECATION_WARNINGS
+ #endif /* FF_API_XVMC */
 -    if ((s->er.error_count || s->encoding) &&
++    if ((s->er.error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
+         !s->avctx->hwaccel &&
++        !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
+         s->unrestricted_mv &&
+         s->current_picture.reference &&
+         !s->intra_only &&
 -        !(s->flags & CODEC_FLAG_EMU_EDGE)) {
++        !(s->flags & CODEC_FLAG_EMU_EDGE) &&
++        !s->avctx->lowres
++       ) {
          const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
          int hshift = desc->log2_chroma_w;
          int vshift = desc->log2_chroma_h;
@@@ -2664,9 -1967,12 +2674,12 @@@ void ff_clean_intra_table_entries(MpegE
   */
  static av_always_inline
  void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
 -                            int is_mpeg12)
 +                            int lowres_flag, int is_mpeg12)
  {
      const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
+ #if FF_API_XVMC
+ FF_DISABLE_DEPRECATION_WARNINGS
      if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
          ff_xvmc_decode_mb(s);//xvmc uses pblocks
          return;
Simple merge
@@@ -281,8 -273,10 +281,10 @@@ static const AVOption avcodec_options[
  {"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"},
  {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
  {"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+ #if FF_API_XVMC
  {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
 -{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "mbd"},
+ #endif /* FF_API_XVMC */
 +{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 2, V|E, "mbd"},
  {"simple", "use mbcmp (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"},
  {"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"},
  {"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"},
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -28,7 -27,7 +28,8 @@@
  #include "pixdesc.h"
  #include "internal.h"
  #include "intreadwrite.h"
 +#include "avstring.h"
+ #include "version.h"
  
  void av_read_image_line(uint16_t *dst,
                          const uint8_t *data[4], const int linesize[4],
Simple merge
  #ifndef FF_API_VDPAU
  #define FF_API_VDPAU                    (LIBAVUTIL_VERSION_MAJOR < 53)
  #endif
 +#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT
 +#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 53)
 +#endif
 +#ifndef FF_API_OLD_OPENCL
 +#define FF_API_OLD_OPENCL               (LIBAVUTIL_VERSION_MAJOR < 53)
 +#endif
+ #ifndef FF_API_XVMC
+ #define FF_API_XVMC                     (LIBAVUTIL_VERSION_MAJOR < 53)
+ #endif
  
  /**
   * @}