[FFmpeg-cvslog] lavc: Remove deprecated XvMC support hacks

Diego Biurrun git at videolan.org
Mon Oct 23 21:39:29 EEST 2017


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Dec  7 08:18:41 2016 +0100| [dcc39ee10e82833ce24aa57926c00ffeb1948198] | committer: Vittorio Giovara

lavc: Remove deprecated XvMC support hacks

Deprecated in 11/2013.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dcc39ee10e82833ce24aa57926c00ffeb1948198
---

 configure                     |   3 -
 libavcodec/4xm.c              |   2 +-
 libavcodec/Makefile           |   3 -
 libavcodec/allcodecs.c        |   3 -
 libavcodec/asvdec.c           |   2 +-
 libavcodec/avcodec.h          |  17 ---
 libavcodec/bink.c             |   2 +-
 libavcodec/blockdsp.c         |  10 +-
 libavcodec/blockdsp.h         |  10 +-
 libavcodec/cavs.c             |   2 +-
 libavcodec/codec_desc.c       |  11 +-
 libavcodec/dnxhddec.c         |   2 +-
 libavcodec/dnxhdenc.c         |   2 +-
 libavcodec/eamad.c            |   2 +-
 libavcodec/eatqi.c            |   2 +-
 libavcodec/error_resilience.c |  21 ---
 libavcodec/g2meet.c           |   2 +-
 libavcodec/intrax8.c          |   2 +-
 libavcodec/jvdec.c            |   2 +-
 libavcodec/mdec.c             |   2 +-
 libavcodec/mimic.c            |   2 +-
 libavcodec/mjpegdec.c         |   2 +-
 libavcodec/mpeg12dec.c        | 103 -------------
 libavcodec/mpegvideo.c        |  29 +---
 libavcodec/mpegvideo_xvmc.c   | 337 ------------------------------------------
 libavcodec/options_table.h    |   3 -
 libavcodec/vc1dec.c           |   2 +-
 libavcodec/version.h          |   3 -
 libavcodec/wmv2.c             |   2 +-
 libavcodec/x86/blockdsp.c     |  16 +-
 libavcodec/xvmc.h             | 174 ----------------------
 libavcodec/xvmc_internal.h    |  38 -----
 libavutil/pixdesc.c           |  10 --
 libavutil/pixfmt.h            |   4 -
 libavutil/version.h           |   3 -
 tests/checkasm/blockdsp.c     |   4 +-
 36 files changed, 25 insertions(+), 809 deletions(-)

diff --git a/configure b/configure
index 1c7887209e..366520cf96 100755
--- a/configure
+++ b/configure
@@ -2073,8 +2073,6 @@ mp3on4_decoder_select="mpegaudio"
 mp3on4float_decoder_select="mpegaudio"
 mpc7_decoder_select="bswapdsp mpegaudiodsp"
 mpc8_decoder_select="mpegaudiodsp"
-mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
-mpeg_xvmc_decoder_select="mpeg2video_decoder"
 mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
 mpeg1video_encoder_select="aandcttables mpegvideoenc"
 mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
@@ -4645,7 +4643,6 @@ check_header unistd.h
 check_header valgrind/valgrind.h
 check_header VideoDecodeAcceleration/VDADecoder.h
 check_header windows.h
-check_header X11/extensions/XvMClib.h
 
 # it seems there are versions of clang in some distros that try to use the
 # gcc headers, which explodes for stdatomic
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 28f839165e..b419bfa268 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -960,7 +960,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     }
 
     f->version = AV_RL32(avctx->extradata) >> 16;
-    ff_blockdsp_init(&f->bdsp, avctx);
+    ff_blockdsp_init(&f->bdsp);
     ff_bswapdsp_init(&f->bbdsp);
     f->avctx = avctx;
     init_vlcs(f);
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2b1e221248..3a55a28e27 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -13,7 +13,6 @@ HEADERS = avcodec.h                                                     \
           vdpau.h                                                       \
           version.h                                                     \
           vorbis_parser.h                                               \
-          xvmc.h                                                        \
 
 OBJS = allcodecs.o                                                      \
        avpacket.o                                                       \
@@ -330,7 +329,6 @@ OBJS-$(CONFIG_MP3ON4_DECODER)          += mpegaudiodec_fixed.o mpeg4audio.o
 OBJS-$(CONFIG_MP3ON4FLOAT_DECODER)     += mpegaudiodec_float.o mpeg4audio.o
 OBJS-$(CONFIG_MPC7_DECODER)            += mpc7.o mpc.o
 OBJS-$(CONFIG_MPC8_DECODER)            += mpc8.o mpc.o
-OBJS-$(CONFIG_MPEG_XVMC_DECODER)       += mpegvideo_xvmc.o
 OBJS-$(CONFIG_MPEG1VIDEO_DECODER)      += mpeg12dec.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_MPEG1VIDEO_ENCODER)      += mpeg12enc.o mpeg12.o
 OBJS-$(CONFIG_MPEG2_QSV_DECODER)       += qsvdec_other.o
@@ -791,7 +789,6 @@ SKIPHEADERS-$(CONFIG_D3D11VA)          += d3d11va.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_DXVA2)            += dxva2.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
 SKIPHEADERS-$(CONFIG_LIBVPX)           += libvpx.h
-SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
 SKIPHEADERS-$(CONFIG_NVENC)            += nvenc.h
 SKIPHEADERS-$(CONFIG_QSV)              += qsv.h qsv_internal.h
 SKIPHEADERS-$(CONFIG_QSVDEC)           += qsvdec.h
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b9936c57f7..556bdb43f3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -203,9 +203,6 @@ void avcodec_register_all(void)
     REGISTER_DECODER(MJPEGB,            mjpegb);
     REGISTER_DECODER(MMVIDEO,           mmvideo);
     REGISTER_DECODER(MOTIONPIXELS,      motionpixels);
-#if FF_API_XVMC
-    REGISTER_DECODER(MPEG_XVMC,         mpeg_xvmc);
-#endif /* FF_API_XVMC */
     REGISTER_ENCDEC (MPEG1VIDEO,        mpeg1video);
     REGISTER_ENCDEC (MPEG2VIDEO,        mpeg2video);
     REGISTER_DECODER(MPEG2_MMAL,        mpeg2_mmal);
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index bd87512d13..7aa16f02db 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -282,7 +282,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     }
 
     ff_asv_common_init(avctx);
-    ff_blockdsp_init(&a->bdsp, avctx);
+    ff_blockdsp_init(&a->bdsp);
     ff_idctdsp_init(&a->idsp, avctx);
     init_vlcs(a);
     ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1eb3ac6f4a..8567c8b28f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -218,9 +218,6 @@ enum AVCodecID {
     /* video codecs */
     AV_CODEC_ID_MPEG1VIDEO,
     AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
-#if FF_API_XVMC
-    AV_CODEC_ID_MPEG2VIDEO_XVMC,
-#endif /* FF_API_XVMC */
     AV_CODEC_ID_H261,
     AV_CODEC_ID_H263,
     AV_CODEC_ID_RV10,
@@ -1010,10 +1007,6 @@ typedef struct RcOverride{
  */
 #define CODEC_CAP_DR1             0x0002
 #define CODEC_CAP_TRUNCATED       0x0008
-#if FF_API_XVMC
-/* Codec can export data for HW decoding (XvMC). */
-#define CODEC_CAP_HWACCEL         0x0010
-#endif /* FF_API_XVMC */
 /**
  * Encoder or decoder requires flushing with NULL input at the end in order to
  * give the complete and correct output.
@@ -1957,16 +1950,6 @@ typedef struct AVCodecContext {
 #define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
 #define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
 
-#if FF_API_XVMC
-    /**
-     * XVideo Motion Acceleration
-     * - encoding: forbidden
-     * - decoding: set by decoder
-     * @deprecated XvMC support is slated for removal.
-     */
-    attribute_deprecated int xvmc_acceleration;
-#endif /* FF_API_XVMC */
-
     /**
      * macroblock decision mode
      * - encoding: Set by user.
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 74db80a2be..84388b86aa 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1309,7 +1309,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
 
-    ff_blockdsp_init(&c->bdsp, avctx);
+    ff_blockdsp_init(&c->bdsp);
     ff_hpeldsp_init(&c->hdsp, avctx->flags);
     ff_binkdsp_init(&c->binkdsp);
 
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index 2c396f1f61..a2c0e579cf 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -20,10 +20,10 @@
 #include <string.h>
 
 #include "config.h"
+
 #include "libavutil/attributes.h"
-#include "avcodec.h"
+
 #include "blockdsp.h"
-#include "version.h"
 
 static void clear_block_8_c(int16_t *block)
 {
@@ -57,7 +57,7 @@ static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
     }
 }
 
-av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
+av_cold void ff_blockdsp_init(BlockDSPContext *c)
 {
     c->clear_block  = clear_block_8_c;
     c->clear_blocks = clear_blocks_8_c;
@@ -70,9 +70,5 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
     if (ARCH_PPC)
         ff_blockdsp_init_ppc(c);
     if (ARCH_X86)
-#if FF_API_XVMC
-        ff_blockdsp_init_x86(c, avctx);
-#else
         ff_blockdsp_init_x86(c);
-#endif /* FF_API_XVMC */
 }
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index e555d29b60..ecce2c3076 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -22,9 +22,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "avcodec.h"
-#include "version.h"
-
 /* add and put pixel (decoding)
  * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16.
  * h for op_pixels_func is limited to { width / 2, width },
@@ -39,15 +36,10 @@ typedef struct BlockDSPContext {
     op_fill_func fill_block_tab[2];
 } BlockDSPContext;
 
-void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx);
+void ff_blockdsp_init(BlockDSPContext *c);
 
 void ff_blockdsp_init_arm(BlockDSPContext *c);
 void ff_blockdsp_init_ppc(BlockDSPContext *c);
-#if FF_API_XVMC
-void ff_blockdsp_init_x86(BlockDSPContext *c,
-                          AVCodecContext *avctx);
-#else
 void ff_blockdsp_init_x86(BlockDSPContext *c);
-#endif /* FF_API_XVMC */
 
 #endif /* AVCODEC_BLOCKDSP_H */
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 6959f54404..323091324a 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -760,7 +760,7 @@ av_cold int ff_cavs_init(AVCodecContext *avctx)
 {
     AVSContext *h = avctx->priv_data;
 
-    ff_blockdsp_init(&h->bdsp, avctx);
+    ff_blockdsp_init(&h->bdsp);
     ff_h264chroma_init(&h->h264chroma, 8);
     ff_idctdsp_init(&h->idsp, avctx);
     ff_videodsp_init(&h->vdsp, 8);
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 8b9ec40e59..7103b5890a 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -20,9 +20,9 @@
 
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
+
 #include "avcodec.h"
 #include "profiles.h"
-#include "version.h"
 
 static const AVCodecDescriptor codec_descriptors[] = {
     /* video codecs */
@@ -41,15 +41,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .props     = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
         .profiles  = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
     },
-#if FF_API_XVMC
-    {
-        .id        = AV_CODEC_ID_MPEG2VIDEO_XVMC,
-        .type      = AVMEDIA_TYPE_VIDEO,
-        .name      = "mpegvideo_xvmc",
-        .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
-        .props     = AV_CODEC_PROP_LOSSY,
-    },
-#endif /* FF_API_XVMC */
     {
         .id        = AV_CODEC_ID_H261,
         .type      = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 75247eaff4..fd58795de3 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -162,7 +162,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
         return AVERROR_INVALIDDATA;
     }
     if (ctx->bit_depth != old_bit_depth) {
-        ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
+        ff_blockdsp_init(&ctx->bdsp);
         ff_idctdsp_init(&ctx->idsp, ctx->avctx);
     }
 
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 0c6c59cec8..f5fd9e9a38 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -313,7 +313,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 
     avctx->bits_per_raw_sample = ctx->cid_table->bit_depth;
 
-    ff_blockdsp_init(&ctx->bdsp, avctx);
+    ff_blockdsp_init(&ctx->bdsp);
     ff_fdctdsp_init(&ctx->m.fdsp, avctx);
     ff_mpv_idct_init(&ctx->m);
     ff_mpegvideoencdsp_init(&ctx->m.mpvencdsp, avctx);
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 7509c2ddd4..0f8a4d0e23 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -67,7 +67,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     MadContext *s = avctx->priv_data;
     s->avctx = avctx;
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_bswapdsp_init(&s->bbdsp);
     ff_idctdsp_init(&s->idsp, avctx);
     ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE);
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index cb70cda7fe..1ae4d3fb70 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -57,7 +57,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
 {
     TqiContext *t = avctx->priv_data;
 
-    ff_blockdsp_init(&t->bdsp, avctx);
+    ff_blockdsp_init(&t->bdsp);
     ff_bswapdsp_init(&t->bsdsp);
     ff_idctdsp_init(&t->idsp, avctx);
     ff_init_scantable_permutation(t->idsp.idct_permutation, FF_IDCT_PERM_NONE);
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index bf3a6882c7..54b7b3cc0f 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -35,7 +35,6 @@
 #include "mpegvideo.h"
 #include "rectangle.h"
 #include "thread.h"
-#include "version.h"
 
 /**
  * @param stride the number of MVs to get to the next row
@@ -677,16 +676,6 @@ static int is_intra_more_likely(ERContext *s)
     if (undamaged_count < 5)
         return 0; // almost all MBs damaged -> use temporal prediction
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-    // prevent dsp.sad() check, that requires access to the image
-    if (CONFIG_MPEG_XVMC_DECODER    &&
-        s->avctx->xvmc_acceleration &&
-        s->cur_pic.f->pict_type == AV_PICTURE_TYPE_I)
-        return 1;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     skip_amount     = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs
     is_intra_likely = 0;
 
@@ -1102,13 +1091,6 @@ void ff_er_frame_end(ERContext *s)
     } else
         guess_mv(s);
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-    /* the filters below are not XvMC compatible, skip them */
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        goto ec_clean;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
     /* fill DC for inter blocks */
     for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
         for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
@@ -1202,9 +1184,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
                        s->mb_height, linesize[2], 0);
     }
 
-#if FF_API_XVMC
-ec_clean:
-#endif
     /* clean a few tables */
     for (i = 0; i < s->mb_num; i++) {
         const int mb_xy = s->mb_index2xy[i];
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 511ea534b8..d7dc976153 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -199,7 +199,7 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
     if (ret)
         return ret;
 
-    ff_blockdsp_init(&c->bdsp, avctx);
+    ff_blockdsp_init(&c->bdsp);
     ff_idctdsp_init(&c->idsp, avctx);
     ff_init_scantable(c->idsp.idct_permutation, &c->scantable,
                       ff_zigzag_direct);
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 2a73a072db..d32bb059e1 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -759,7 +759,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
                       ff_wmv1_scantable[3]);
 
     ff_intrax8dsp_init(&w->dsp);
-    ff_blockdsp_init(&w->bdsp, avctx);
+    ff_blockdsp_init(&w->bdsp);
 
     return 0;
 }
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 5f5a825cd7..3a92b584c3 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -55,7 +55,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     return 0;
 }
 
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 4b6056e15c..c0db368ca6 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -220,7 +220,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     a->avctx           = avctx;
 
-    ff_blockdsp_init(&a->bdsp, avctx);
+    ff_blockdsp_init(&a->bdsp);
     ff_idctdsp_init(&a->idsp, avctx);
     ff_mpeg12_init_vlcs();
     ff_init_scantable(a->idsp.idct_permutation, &a->scantable,
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 1ec27b2926..31d07ecd50 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -148,7 +148,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
         return ret;
     }
-    ff_blockdsp_init(&ctx->bdsp, avctx);
+    ff_blockdsp_init(&ctx->bdsp);
     ff_bswapdsp_init(&ctx->bbdsp);
     ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
     ff_idctdsp_init(&ctx->idsp, avctx);
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index f6e9038539..13d3e8cb02 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -113,7 +113,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
     }
 
     s->avctx = avctx;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_hpeldsp_init(&s->hdsp, avctx->flags);
     ff_idctdsp_init(&s->idsp, avctx);
     ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index afdd652b6a..528a4ed16d 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -45,7 +45,6 @@
 #include "profiles.h"
 #include "thread.h"
 #include "version.h"
-#include "xvmc_internal.h"
 
 typedef struct Mpeg1Context {
     MpegEncContext mpeg_enc_ctx;
@@ -763,13 +762,6 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
             memset(s->last_mv, 0, sizeof(s->last_mv));
         }
         s->mb_intra = 1;
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-        // if 1, we memcpy blocks in xvmcvideo
-        if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
-            ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
 
         if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
             if (s->avctx->flags2 & AV_CODEC_FLAG2_FAST) {
@@ -992,14 +984,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 return AVERROR_INVALIDDATA;
             }
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-            // if 1, we memcpy blocks in xvmcvideo
-            if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
-                ff_xvmc_pack_pblocks(s, cbp);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
             if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
                 if (s->avctx->flags2 & AV_CODEC_FLAG2_FAST) {
                     for (i = 0; i < 6; i++) {
@@ -1121,14 +1105,6 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
         matrix[new_perm[i]] = temp_matrix[old_perm[i]];
 }
 
-#if FF_API_XVMC
-static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
-    AV_PIX_FMT_XVMC_MPEG2_IDCT,
-    AV_PIX_FMT_XVMC_MPEG2_MC,
-    AV_PIX_FMT_NONE
-};
-#endif /* FF_API_XVMC */
-
 static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
 #if CONFIG_MPEG2_DXVA2_HWACCEL
     AV_PIX_FMT_DXVA2_VLD,
@@ -1162,13 +1138,6 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
     MpegEncContext *s = &s1->mpeg_enc_ctx;
     const enum AVPixelFormat *pix_fmts;
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (avctx->xvmc_acceleration)
-        return ff_get_format(avctx, pixfmt_xvmc_mpg2_420);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     if (s->chroma_format < 2)
         pix_fmts = mpeg12_hwaccel_pixfmt_list_420;
     else if (s->chroma_format == 2)
@@ -1273,12 +1242,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 
         avctx->pix_fmt = mpeg_get_pixelformat(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 ||
-             avctx->hwaccel) && avctx->idct_algo == FF_IDCT_AUTO)
-#else
         if (avctx->hwaccel && avctx->idct_algo == FF_IDCT_AUTO)
-#endif /* FF_API_XVMC */
             avctx->idct_algo = FF_IDCT_SIMPLE;
 
         /* Quantization matrices may need reordering
@@ -1661,16 +1625,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
             return ret;
     }
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-// ff_mpv_frame_start will call this function too,
-// but we need to call it on every field
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        if (ff_xvmc_field_start(s, avctx) < 0)
-            return -1;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     return 0;
 }
 
@@ -1779,14 +1733,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
     }
 
     for (;;) {
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-        // If 1, we memcpy blocks in xvmcvideo.
-        if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
-            ff_xvmc_init_block(s); // set s->block
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
         if ((ret = mpeg_decode_mb(s, s->block)) < 0)
             return ret;
 
@@ -1991,13 +1937,6 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
                    "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) {
         /* end of image */
@@ -2135,12 +2074,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
 
     avctx->pix_fmt = mpeg_get_pixelformat(avctx);
 
-#if FF_API_XVMC
-    if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) &&
-        avctx->idct_algo == FF_IDCT_AUTO)
-#else
     if (avctx->hwaccel && avctx->idct_algo == FF_IDCT_AUTO)
-#endif /* FF_API_XVMC */
         avctx->idct_algo = FF_IDCT_SIMPLE;
 
     ff_mpv_idct_init(s);
@@ -2682,40 +2616,3 @@ AVCodec ff_mpeg2video_decoder = {
     .flush          = flush,
     .profiles       = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
 };
-
-#if FF_API_XVMC
-#if CONFIG_MPEG_XVMC_DECODER
-static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
-{
-    if (avctx->active_thread_type & FF_THREAD_SLICE)
-        return -1;
-    if (!(avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
-        return -1;
-    if (!(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
-        ff_dlog(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
-    }
-    mpeg_decode_init(avctx);
-
-    avctx->pix_fmt           = AV_PIX_FMT_XVMC_MPEG2_IDCT;
-    avctx->xvmc_acceleration = 2; // 2 - the blocks are packed!
-
-    return 0;
-}
-
-AVCodec ff_mpeg_xvmc_decoder = {
-    .name           = "mpegvideo_xvmc",
-    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = AV_CODEC_ID_MPEG2VIDEO_XVMC,
-    .priv_data_size = sizeof(Mpeg1Context),
-    .init           = mpeg_mc_decode_init,
-    .close          = mpeg_decode_end,
-    .decode         = mpeg_decode_frame,
-    .capabilities   = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-                      AV_CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL |
-                      AV_CODEC_CAP_DELAY,
-    .flush          = flush,
-};
-
-#endif
-#endif /* FF_API_XVMC */
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 379b690b4d..ca3cd2e799 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -44,7 +44,6 @@
 #include "mjpegenc.h"
 #include "msmpeg4.h"
 #include "qpeldsp.h"
-#include "xvmc_internal.h"
 #include "thread.h"
 #include "wmv2.h"
 #include <limits.h>
@@ -270,7 +269,7 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
 /* init common dct for both encoder and decoder */
 static av_cold int dct_init(MpegEncContext *s)
 {
-    ff_blockdsp_init(&s->bdsp, s->avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
     ff_mpegvideodsp_init(&s->mdsp);
     ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
@@ -1249,29 +1248,12 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
         s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
     }
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        return ff_xvmc_field_start(s, avctx);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     return 0;
 }
 
 /* called after a frame has been decoded. */
 void ff_mpv_frame_end(MpegEncContext *s)
 {
-#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
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     emms_c();
 
     if (s->current_picture.reference)
@@ -1492,15 +1474,6 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
 {
     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;
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
        /* print DCT coefficients */
        int i,j;
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
deleted file mode 100644
index b7de79c583..0000000000
--- a/libavcodec/mpegvideo_xvmc.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * XVideo Motion Compensation
- * Copyright (c) 2003 Ivan Kalvachev
- *
- * This file is part of Libav.
- *
- * Libav 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.
- *
- * Libav is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <limits.h>
-#include <X11/extensions/XvMC.h>
-
-#include "avcodec.h"
-#include "mpegutils.h"
-#include "mpegvideo.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#include "xvmc.h"
-#include "xvmc_internal.h"
-#include "version.h"
-
-#if FF_API_XVMC
-
-/**
- * Initialize the block field of the MpegEncContext pointer passed as
- * parameter after making sure that the data is not corrupted.
- * In order to implement something like direct rendering instead of decoding
- * coefficients in s->blocks and then copying them, copy them directly
- * into the data_blocks array provided by xvmc.
- */
-void ff_xvmc_init_block(MpegEncContext *s)
-{
-    struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
-    assert(render && render->xvmc_id == AV_XVMC_ID);
-
-    s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
-}
-
-/**
- * Fill individual block pointers, so there are no gaps in the data_block array
- * in case not all blocks in the macroblock are coded.
- */
-void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
-{
-    int i, j = 0;
-    const int mb_block_count = 4 + (1 << s->chroma_format);
-
-    cbp <<= 12-mb_block_count;
-    for (i = 0; i < mb_block_count; i++) {
-        if (cbp & (1 << 11))
-            s->pblocks[i] = &s->block[j++];
-        else
-            s->pblocks[i] = NULL;
-        cbp += cbp;
-    }
-}
-
-/**
- * Find and store the surfaces that are used as reference frames.
- * This function should be called for every new field and/or frame.
- * It should be safe to call the function a few times for the same field.
- */
-int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
-{
-    struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
-    const int mb_block_count = 4 + (1 << s->chroma_format);
-
-    assert(avctx);
-    if (!render || render->xvmc_id != AV_XVMC_ID ||
-        !render->data_blocks || !render->mv_blocks ||
-        (unsigned int)render->allocated_mv_blocks   > INT_MAX/(64*6) ||
-        (unsigned int)render->allocated_data_blocks > INT_MAX/64     ||
-        !render->p_surface) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Render token doesn't look as expected.\n");
-        return -1; // make sure that this is a render packet
-    }
-
-    if (render->filled_mv_blocks_num) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Rendering surface contains %i unprocessed blocks.\n",
-               render->filled_mv_blocks_num);
-        return -1;
-    }
-    if (render->allocated_mv_blocks   < 1 ||
-        render->allocated_data_blocks <  render->allocated_mv_blocks*mb_block_count ||
-        render->start_mv_blocks_num   >= render->allocated_mv_blocks                ||
-        render->next_free_data_block_num >
-                        render->allocated_data_blocks -
-                        mb_block_count*(render->allocated_mv_blocks-render->start_mv_blocks_num)) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Rendering surface doesn't provide enough block structures to work with.\n");
-        return -1;
-    }
-
-    render->picture_structure = s->picture_structure;
-    render->flags             = s->first_field ? 0 : XVMC_SECOND_FIELD;
-    render->p_future_surface  = NULL;
-    render->p_past_surface    = NULL;
-
-    switch(s->pict_type) {
-        case  AV_PICTURE_TYPE_I:
-            return 0; // no prediction from other frames
-        case  AV_PICTURE_TYPE_B:
-            next = (struct xvmc_pix_fmt*)s->next_picture.f->data[2];
-            if (!next)
-                return -1;
-            if (next->xvmc_id != AV_XVMC_ID)
-                return -1;
-            render->p_future_surface = next->p_surface;
-            // no return here, going to set forward prediction
-        case  AV_PICTURE_TYPE_P:
-            last = (struct xvmc_pix_fmt*)s->last_picture.f->data[2];
-            if (!last)
-                last = render; // predict second field from the first
-            if (last->xvmc_id != AV_XVMC_ID)
-                return -1;
-            render->p_past_surface = last->p_surface;
-            return 0;
-    }
-
-return -1;
-}
-
-/**
- * Complete frame/field rendering by passing any remaining blocks.
- * Normally ff_draw_horiz_band() is called for each slice, however,
- * some leftover blocks, for example from error_resilience(), may remain.
- * It should be safe to call the function a few times for the same field.
- */
-void ff_xvmc_field_end(MpegEncContext *s)
-{
-    struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
-    assert(render);
-
-    if (render->filled_mv_blocks_num > 0)
-        ff_mpeg_draw_horiz_band(s, 0, 0);
-}
-
-/**
- * Synthesize the data needed by XvMC to render one macroblock of data.
- * Fill all relevant fields, if necessary do IDCT.
- */
-void ff_xvmc_decode_mb(MpegEncContext *s)
-{
-    XvMCMacroBlock *mv_block;
-    struct xvmc_pix_fmt *render;
-    int i, cbp, blocks_per_mb;
-
-    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-
-
-    if (s->encoding) {
-        av_log(s->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n");
-        return;
-    }
-
-    // from ff_mpv_decode_mb(), update DC predictors for P macroblocks
-    if (!s->mb_intra) {
-        s->last_dc[0] =
-        s->last_dc[1] =
-        s->last_dc[2] =  128 << s->intra_dc_precision;
-    }
-
-    // MC doesn't skip blocks
-    s->mb_skipped = 0;
-
-
-    // Do I need to export quant when I could not perform postprocessing?
-    // Anyway, it doesn't hurt.
-    s->current_picture.qscale_table[mb_xy] = s->qscale;
-
-    // start of XVMC-specific code
-    render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
-    assert(render);
-    assert(render->xvmc_id == AV_XVMC_ID);
-    assert(render->mv_blocks);
-
-    // take the next free macroblock
-    mv_block = &render->mv_blocks[render->start_mv_blocks_num +
-                                  render->filled_mv_blocks_num];
-
-    mv_block->x        = s->mb_x;
-    mv_block->y        = s->mb_y;
-    mv_block->dct_type = s->interlaced_dct; // XVMC_DCT_TYPE_FRAME/FIELD;
-    if (s->mb_intra) {
-        mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; // no MC, all done
-    } else {
-        mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
-
-        if (s->mv_dir & MV_DIR_FORWARD) {
-            mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
-            // PMV[n][dir][xy] = mv[dir][n][xy]
-            mv_block->PMV[0][0][0] = s->mv[0][0][0];
-            mv_block->PMV[0][0][1] = s->mv[0][0][1];
-            mv_block->PMV[1][0][0] = s->mv[0][1][0];
-            mv_block->PMV[1][0][1] = s->mv[0][1][1];
-        }
-        if (s->mv_dir & MV_DIR_BACKWARD) {
-            mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
-            mv_block->PMV[0][1][0] = s->mv[1][0][0];
-            mv_block->PMV[0][1][1] = s->mv[1][0][1];
-            mv_block->PMV[1][1][0] = s->mv[1][1][0];
-            mv_block->PMV[1][1][1] = s->mv[1][1][1];
-        }
-
-        switch(s->mv_type) {
-            case  MV_TYPE_16X16:
-                mv_block->motion_type = XVMC_PREDICTION_FRAME;
-                break;
-            case  MV_TYPE_16X8:
-                mv_block->motion_type = XVMC_PREDICTION_16x8;
-                break;
-            case  MV_TYPE_FIELD:
-                mv_block->motion_type = XVMC_PREDICTION_FIELD;
-                if (s->picture_structure == PICT_FRAME) {
-                    mv_block->PMV[0][0][1] <<= 1;
-                    mv_block->PMV[1][0][1] <<= 1;
-                    mv_block->PMV[0][1][1] <<= 1;
-                    mv_block->PMV[1][1][1] <<= 1;
-                }
-                break;
-            case  MV_TYPE_DMV:
-                mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
-                if (s->picture_structure == PICT_FRAME) {
-
-                    mv_block->PMV[0][0][0] = s->mv[0][0][0];      // top from top
-                    mv_block->PMV[0][0][1] = s->mv[0][0][1] << 1;
-
-                    mv_block->PMV[0][1][0] = s->mv[0][0][0];      // bottom from bottom
-                    mv_block->PMV[0][1][1] = s->mv[0][0][1] << 1;
-
-                    mv_block->PMV[1][0][0] = s->mv[0][2][0];      // dmv00, top from bottom
-                    mv_block->PMV[1][0][1] = s->mv[0][2][1] << 1; // dmv01
-
-                    mv_block->PMV[1][1][0] = s->mv[0][3][0];      // dmv10, bottom from top
-                    mv_block->PMV[1][1][1] = s->mv[0][3][1] << 1; // dmv11
-
-                } else {
-                    mv_block->PMV[0][1][0] = s->mv[0][2][0];      // dmv00
-                    mv_block->PMV[0][1][1] = s->mv[0][2][1];      // dmv01
-                }
-                break;
-            default:
-                assert(0);
-        }
-
-        mv_block->motion_vertical_field_select = 0;
-
-        // set correct field references
-        if (s->mv_type == MV_TYPE_FIELD || s->mv_type == MV_TYPE_16X8) {
-            mv_block->motion_vertical_field_select |= s->field_select[0][0];
-            mv_block->motion_vertical_field_select |= s->field_select[1][0] << 1;
-            mv_block->motion_vertical_field_select |= s->field_select[0][1] << 2;
-            mv_block->motion_vertical_field_select |= s->field_select[1][1] << 3;
-        }
-    } // !intra
-    // time to handle data blocks
-    mv_block->index = render->next_free_data_block_num;
-
-    blocks_per_mb = 6;
-    if (s->chroma_format >= 2) {
-        blocks_per_mb = 4 + (1 << s->chroma_format);
-    }
-
-    // calculate cbp
-    cbp = 0;
-    for (i = 0; i < blocks_per_mb; i++) {
-        cbp += cbp;
-        if (s->block_last_index[i] >= 0)
-            cbp++;
-    }
-
-    if (s->avctx->flags & AV_CODEC_FLAG_GRAY) {
-        if (s->mb_intra) {                                   // intra frames are always full chroma blocks
-            for (i = 4; i < blocks_per_mb; i++) {
-                memset(s->pblocks[i], 0, sizeof(*s->pblocks[i]));  // so we need to clear them
-                if (!render->unsigned_intra)
-                    *s->pblocks[i][0] = 1 << 10;
-            }
-        } else {
-            cbp &= 0xf << (blocks_per_mb - 4);
-            blocks_per_mb = 4;                               // luminance blocks only
-        }
-    }
-    mv_block->coded_block_pattern = cbp;
-    if (cbp == 0)
-        mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
-
-    for (i = 0; i < blocks_per_mb; i++) {
-        if (s->block_last_index[i] >= 0) {
-            // I do not have unsigned_intra MOCO to test, hope it is OK.
-            if (s->mb_intra && (render->idct || !render->unsigned_intra))
-                *s->pblocks[i][0] -= 1 << 10;
-            if (!render->idct) {
-                s->idsp.idct(*s->pblocks[i]);
-                /* It is unclear if MC hardware requires pixel diff values to be
-                 * in the range [-255;255]. TODO: Clipping if such hardware is
-                 * ever found. As of now it would only be an unnecessary
-                 * slowdown. */
-            }
-            // copy blocks only if the codec doesn't support pblocks reordering
-            if (s->avctx->xvmc_acceleration == 1) {
-                memcpy(&render->data_blocks[render->next_free_data_block_num*64],
-                       s->pblocks[i], sizeof(*s->pblocks[i]));
-            }
-            render->next_free_data_block_num++;
-        }
-    }
-    render->filled_mv_blocks_num++;
-
-    assert(render->filled_mv_blocks_num     <= render->allocated_mv_blocks);
-    assert(render->next_free_data_block_num <= render->allocated_data_blocks);
-    /* The above conditions should not be able to fail as long as this function
-     * is used and the following 'if ()' automatically calls a callback to free
-     * blocks. */
-
-
-    if (render->filled_mv_blocks_num == render->allocated_mv_blocks)
-        ff_mpeg_draw_horiz_band(s, 0, 0);
-}
-
-#endif /* FF_API_XVMC */
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 7257791292..5e3540d2dd 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -294,9 +294,6 @@ static const AVOption avcodec_options[] = {
 {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 #endif
 {"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},
-#endif /* FF_API_XVMC */
 {"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, 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"},
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index b26fbf2eff..89b4f4bdce 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -431,7 +431,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
 
     if (ff_vc1_init_common(v) < 0)
         return -1;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_h264chroma_init(&v->h264chroma, 8);
     ff_qpeldsp_init(&s->qdsp);
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6f69f2d59c..986e697bc9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -47,9 +47,6 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#ifndef FF_API_XVMC
-#define FF_API_XVMC              (LIBAVCODEC_VERSION_MAJOR < 58)
-#endif
 #ifndef FF_API_ERROR_RATE
 #define FF_API_ERROR_RATE        (LIBAVCODEC_VERSION_MAJOR < 58)
 #endif
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index 6542d31e9d..93bb642760 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -32,7 +32,7 @@ av_cold void ff_wmv2_common_init(Wmv2Context *w)
 {
     MpegEncContext *const s = &w->s;
 
-    ff_blockdsp_init(&s->bdsp, s->avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_wmv2dsp_init(&w->wdsp);
     s->idsp.perm_type = w->wdsp.idct_perm;
     ff_init_scantable_permutation(s->idsp.idct_permutation,
diff --git a/libavcodec/x86/blockdsp.c b/libavcodec/x86/blockdsp.c
index 9bb5185b89..b047e19ab5 100644
--- a/libavcodec/x86/blockdsp.c
+++ b/libavcodec/x86/blockdsp.c
@@ -19,13 +19,14 @@
 #include <stdint.h>
 
 #include "config.h"
+
 #include "libavutil/attributes.h"
 #include "libavutil/internal.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
+
 #include "libavcodec/blockdsp.h"
-#include "libavcodec/version.h"
 
 #if HAVE_INLINE_ASM
 
@@ -87,12 +88,7 @@ static void clear_blocks_sse(int16_t *blocks)
 
 #endif /* HAVE_INLINE_ASM */
 
-#if FF_API_XVMC
-av_cold void ff_blockdsp_init_x86(BlockDSPContext *c,
-                                  AVCodecContext *avctx)
-#else
 av_cold void ff_blockdsp_init_x86(BlockDSPContext *c)
-#endif /* FF_API_XVMC */
 {
 #if HAVE_INLINE_ASM
     int cpu_flags = av_get_cpu_flags();
@@ -102,14 +98,6 @@ av_cold void ff_blockdsp_init_x86(BlockDSPContext *c)
         c->clear_blocks = clear_blocks_mmx;
     }
 
-#if FF_API_XVMC
-FF_DISABLE_DEPRECATION_WARNINGS
-    /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
-    if (CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)
-        return;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_XVMC */
-
     if (INLINE_SSE(cpu_flags)) {
         c->clear_block  = clear_block_sse;
         c->clear_blocks = clear_blocks_sse;
diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h
deleted file mode 100644
index 91027b9c2f..0000000000
--- a/libavcodec/xvmc.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2003 Ivan Kalvachev
- *
- * This file is part of Libav.
- *
- * Libav 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.
- *
- * Libav is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XVMC_H
-#define AVCODEC_XVMC_H
-
-/**
- * @file
- * @ingroup lavc_codec_hwaccel_xvmc
- * Public libavcodec XvMC header.
- */
-
-#include <X11/extensions/XvMC.h>
-
-#include "libavutil/attributes.h"
-#include "version.h"
-#include "avcodec.h"
-
-#if FF_API_XVMC
-
-/**
- * @defgroup lavc_codec_hwaccel_xvmc XvMC
- * @ingroup lavc_codec_hwaccel
- *
- * @{
- */
-
-#define AV_XVMC_ID                    0x1DC711C0  /**< special value to ensure that regular pixel routines haven't corrupted the struct
-                                                       the number is 1337 speak for the letters IDCT MCo (motion compensation) */
-
-struct attribute_deprecated xvmc_pix_fmt {
-    /** The field contains the special constant value AV_XVMC_ID.
-        It is used as a test that the application correctly uses the API,
-        and that there is no corruption caused by pixel routines.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             xvmc_id;
-
-    /** Pointer to the block array allocated by XvMCCreateBlocks().
-        The array has to be freed by XvMCDestroyBlocks().
-        Each group of 64 values represents one data block of differential
-        pixel information (in MoCo mode) or coefficients for IDCT.
-        - application - set the pointer during initialization
-        - libavcodec  - fills coefficients/pixel data into the array
-    */
-    short*          data_blocks;
-
-    /** Pointer to the macroblock description array allocated by
-        XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
-        - application - set the pointer during initialization
-        - libavcodec  - fills description data into the array
-    */
-    XvMCMacroBlock* mv_blocks;
-
-    /** Number of macroblock descriptions that can be stored in the mv_blocks
-        array.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             allocated_mv_blocks;
-
-    /** Number of blocks that can be stored at once in the data_blocks array.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             allocated_data_blocks;
-
-    /** Indicate that the hardware would interpret data_blocks as IDCT
-        coefficients and perform IDCT on them.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             idct;
-
-    /** In MoCo mode it indicates that intra macroblocks are assumed to be in
-        unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             unsigned_intra;
-
-    /** Pointer to the surface allocated by XvMCCreateSurface().
-        It has to be freed by XvMCDestroySurface() on application exit.
-        It identifies the frame and its state on the video hardware.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    XvMCSurface*    p_surface;
-
-/** Set by the decoder before calling ff_draw_horiz_band(),
-    needed by the XvMCRenderSurface function. */
-//@{
-    /** Pointer to the surface used as past reference
-        - application - unchanged
-        - libavcodec  - set
-    */
-    XvMCSurface*    p_past_surface;
-
-    /** Pointer to the surface used as future reference
-        - application - unchanged
-        - libavcodec  - set
-    */
-    XvMCSurface*    p_future_surface;
-
-    /** top/bottom field or frame
-        - application - unchanged
-        - libavcodec  - set
-    */
-    unsigned int    picture_structure;
-
-    /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
-        - application - unchanged
-        - libavcodec  - set
-    */
-    unsigned int    flags;
-//}@
-
-    /** Number of macroblock descriptions in the mv_blocks array
-        that have already been passed to the hardware.
-        - application - zeroes it on get_buffer().
-                        A successful ff_draw_horiz_band() may increment it
-                        with filled_mb_block_num or zero both.
-        - libavcodec  - unchanged
-    */
-    int             start_mv_blocks_num;
-
-    /** Number of new macroblock descriptions in the mv_blocks array (after
-        start_mv_blocks_num) that are filled by libavcodec and have to be
-        passed to the hardware.
-        - application - zeroes it on get_buffer() or after successful
-                        ff_draw_horiz_band().
-        - libavcodec  - increment with one of each stored MB
-    */
-    int             filled_mv_blocks_num;
-
-    /** Number of the next free data block; one data block consists of
-        64 short values in the data_blocks array.
-        All blocks before this one have already been claimed by placing their
-        position into the corresponding block description structure field,
-        that are part of the mv_blocks array.
-        - application - zeroes it on get_buffer().
-                        A successful ff_draw_horiz_band() may zero it together
-                        with start_mb_blocks_num.
-        - libavcodec  - each decoded macroblock increases it by the number
-                        of coded blocks it contains.
-    */
-    int             next_free_data_block_num;
-};
-
-/**
- * @}
- */
-
-#endif /* FF_API_XVMC */
-
-#endif /* AVCODEC_XVMC_H */
diff --git a/libavcodec/xvmc_internal.h b/libavcodec/xvmc_internal.h
deleted file mode 100644
index 9018e4a40a..0000000000
--- a/libavcodec/xvmc_internal.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * XVideo Motion Compensation internal functions
- *
- * This file is part of Libav.
- *
- * Libav 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.
- *
- * Libav is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XVMC_INTERNAL_H
-#define AVCODEC_XVMC_INTERNAL_H
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "version.h"
-
-#if FF_API_XVMC
-
-void ff_xvmc_init_block(MpegEncContext *s);
-void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);
-int  ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx);
-void ff_xvmc_field_end(MpegEncContext *s);
-void ff_xvmc_decode_mb(MpegEncContext *s);
-
-#endif /* FF_API_XVMC */
-
-#endif /* AVCODEC_XVMC_INTERNAL_H */
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index d69eeea9de..e4e5674a66 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -313,16 +313,6 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_PLANAR,
     },
-#if FF_API_XVMC
-    [AV_PIX_FMT_XVMC_MPEG2_MC] = {
-        .name = "xvmcmc",
-        .flags = AV_PIX_FMT_FLAG_HWACCEL,
-    },
-    [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
-        .name = "xvmcidct",
-        .flags = AV_PIX_FMT_FLAG_HWACCEL,
-    },
-#endif /* FF_API_XVMC */
     [AV_PIX_FMT_UYVY422] = {
         .name = "uyvy422",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 41498ccef7..0b7582576b 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -71,10 +71,6 @@ enum AVPixelFormat {
     AV_PIX_FMT_YUVJ420P,  ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
     AV_PIX_FMT_YUVJ422P,  ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
     AV_PIX_FMT_YUVJ444P,  ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
-#if FF_API_XVMC
-    AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
-    AV_PIX_FMT_XVMC_MPEG2_IDCT,
-#endif /* FF_API_XVMC */
     AV_PIX_FMT_UYVY422,   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
     AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
     AV_PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
diff --git a/libavutil/version.h b/libavutil/version.h
index 93f471f99b..904d387411 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -81,9 +81,6 @@
 #ifndef FF_API_VDPAU
 #define FF_API_VDPAU                    (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
-#ifndef FF_API_XVMC
-#define FF_API_XVMC                     (LIBAVUTIL_VERSION_MAJOR < 56)
-#endif
 #ifndef FF_API_OPT_TYPE_METADATA
 #define FF_API_OPT_TYPE_METADATA        (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index 6b4bc804fc..f10e2ff578 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -55,11 +55,9 @@ void checkasm_check_blockdsp(void)
 {
     LOCAL_ALIGNED_16(uint16_t, buf0, [6 * 8 * 8]);
     LOCAL_ALIGNED_16(uint16_t, buf1, [6 * 8 * 8]);
-
-    AVCodecContext avctx = { 0 };
     BlockDSPContext h;
 
-    ff_blockdsp_init(&h, &avctx);
+    ff_blockdsp_init(&h);
 
     check_clear(clear_block,  8 * 8);
     check_clear(clear_blocks, 8 * 8 * 6);



More information about the ffmpeg-cvslog mailing list