Deprecate obsolete XvMC hardware decoding support

XvMC has long ago been superseded by newer acceleration APIs, such as
VDPAU, and few downstreams still support it. Furthermore XvMC is not
implemented within the hwaccel framework, but requires its own specific
code in the MPEG-1/2 decoder, which is a maintenance burden.
pull/48/head
Diego Biurrun 11 years ago
parent c7f7bfc9e3
commit 19e30a58fc
  1. 1
      doc/general.texi
  2. 5
      libavcodec/allcodecs.c
  3. 9
      libavcodec/avcodec.h
  4. 6
      libavcodec/codec_desc.c
  5. 10
      libavcodec/error_resilience.c
  6. 1
      libavcodec/mpeg12.c
  7. 65
      libavcodec/mpeg12dec.c
  8. 58
      libavcodec/mpegvideo.c
  9. 5
      libavcodec/mpegvideo_xvmc.c
  10. 2
      libavcodec/options_table.h
  11. 3
      libavcodec/version.h
  12. 8
      libavcodec/x86/dsputil_init.c
  13. 8
      libavcodec/xvmc.h
  14. 5
      libavcodec/xvmc_internal.h
  15. 2
      libavutil/old_pix_fmts.h
  16. 3
      libavutil/pixdesc.c
  17. 2
      libavutil/pixfmt.h
  18. 3
      libavutil/version.h

@ -577,7 +577,6 @@ following image formats are supported:
@item Mobotix MxPEG video @tab @tab X @item Mobotix MxPEG video @tab @tab X
@item Motion Pixels video @tab @tab X @item Motion Pixels video @tab @tab X
@item MPEG-1 video @tab X @tab X @item MPEG-1 video @tab X @tab X
@item MPEG-1/2 video XvMC (X-Video Motion Compensation) @tab @tab X
@item MPEG-2 video @tab X @tab X @item MPEG-2 video @tab X @tab X
@item MPEG-4 part 2 @tab X @tab X @item MPEG-4 part 2 @tab X @tab X
@tab libxvidcore can be used alternatively for encoding. @tab libxvidcore can be used alternatively for encoding.

@ -24,8 +24,9 @@
* Provide registration of all codecs, parsers and bitstream filters for libavcodec. * Provide registration of all codecs, parsers and bitstream filters for libavcodec.
*/ */
#include "avcodec.h"
#include "config.h" #include "config.h"
#include "avcodec.h"
#include "version.h"
#define REGISTER_HWACCEL(X, x) \ #define REGISTER_HWACCEL(X, x) \
{ \ { \
@ -178,7 +179,9 @@ void avcodec_register_all(void)
REGISTER_DECODER(MJPEGB, mjpegb); REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo); REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels); REGISTER_DECODER(MOTIONPIXELS, motionpixels);
#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc); REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
#endif /* FF_API_XVMC */
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4); REGISTER_ENCDEC (MPEG4, mpeg4);

@ -103,7 +103,9 @@ enum AVCodecID {
/* video codecs */ /* video codecs */
AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG1VIDEO,
AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
#if FF_API_XVMC
AV_CODEC_ID_MPEG2VIDEO_XVMC, AV_CODEC_ID_MPEG2VIDEO_XVMC,
#endif /* FF_API_XVMC */
AV_CODEC_ID_H261, AV_CODEC_ID_H261,
AV_CODEC_ID_H263, AV_CODEC_ID_H263,
AV_CODEC_ID_RV10, AV_CODEC_ID_RV10,
@ -691,8 +693,10 @@ typedef struct RcOverride{
*/ */
#define CODEC_CAP_DR1 0x0002 #define CODEC_CAP_DR1 0x0002
#define CODEC_CAP_TRUNCATED 0x0008 #define CODEC_CAP_TRUNCATED 0x0008
#if FF_API_XVMC
/* Codec can export data for HW decoding (XvMC). */ /* Codec can export data for HW decoding (XvMC). */
#define CODEC_CAP_HWACCEL 0x0010 #define CODEC_CAP_HWACCEL 0x0010
#endif /* FF_API_XVMC */
/** /**
* Encoder or decoder requires flushing with NULL input at the end in order to * Encoder or decoder requires flushing with NULL input at the end in order to
* give the complete and correct output. * give the complete and correct output.
@ -1526,12 +1530,15 @@ typedef struct AVCodecContext {
#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
#if FF_API_XVMC
/** /**
* XVideo Motion Acceleration * XVideo Motion Acceleration
* - encoding: forbidden * - encoding: forbidden
* - decoding: set by decoder * - decoding: set by decoder
* @deprecated XvMC support is slated for removal.
*/ */
int xvmc_acceleration; attribute_deprecated int xvmc_acceleration;
#endif /* FF_API_XVMC */
/** /**
* macroblock decision mode * macroblock decision mode

@ -18,10 +18,10 @@
#include <string.h> #include <string.h>
#include "avcodec.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "avcodec.h"
#include "version.h"
static const AVCodecDescriptor codec_descriptors[] = { static const AVCodecDescriptor codec_descriptors[] = {
/* video codecs */ /* video codecs */
@ -39,6 +39,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
.props = AV_CODEC_PROP_LOSSY, .props = AV_CODEC_PROP_LOSSY,
}, },
#if FF_API_XVMC
{ {
.id = AV_CODEC_ID_MPEG2VIDEO_XVMC, .id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
@ -46,6 +47,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
.props = AV_CODEC_PROP_LOSSY, .props = AV_CODEC_PROP_LOSSY,
}, },
#endif /* FF_API_XVMC */
{ {
.id = AV_CODEC_ID_H261, .id = AV_CODEC_ID_H261,
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,

@ -27,11 +27,13 @@
#include <limits.h> #include <limits.h>
#include "libavutil/internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "rectangle.h" #include "rectangle.h"
#include "thread.h" #include "thread.h"
#include "version.h"
/** /**
* @param stride the number of MVs to get to the next row * @param stride the number of MVs to get to the next row
@ -672,11 +674,15 @@ static int is_intra_more_likely(ERContext *s)
if (undamaged_count < 5) if (undamaged_count < 5)
return 0; // almost all MBs damaged -> use temporal prediction 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 // prevent dsp.sad() check, that requires access to the image
if (CONFIG_MPEG_XVMC_DECODER && if (CONFIG_MPEG_XVMC_DECODER &&
s->avctx->xvmc_acceleration && s->avctx->xvmc_acceleration &&
s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I) s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)
return 1; return 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs
is_intra_likely = 0; is_intra_likely = 0;
@ -1105,9 +1111,13 @@ void ff_er_frame_end(ERContext *s)
} else } else
guess_mv(s); guess_mv(s);
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
/* the filters below are not XvMC compatible, skip them */ /* the filters below are not XvMC compatible, skip them */
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
goto ec_clean; goto ec_clean;
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
/* fill DC for inter blocks */ /* fill DC for inter blocks */
for (mb_y = 0; mb_y < s->mb_height; mb_y++) { for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) { for (mb_x = 0; mb_x < s->mb_width; mb_x++) {

@ -34,7 +34,6 @@
#include "mpeg12.h" #include "mpeg12.h"
#include "mpeg12data.h" #include "mpeg12data.h"
#include "bytestream.h" #include "bytestream.h"
#include "xvmc_internal.h"
#include "thread.h" #include "thread.h"
uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];

@ -37,6 +37,7 @@
#include "bytestream.h" #include "bytestream.h"
#include "xvmc_internal.h" #include "xvmc_internal.h"
#include "thread.h" #include "thread.h"
#include "version.h"
typedef struct Mpeg1Context { typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx; MpegEncContext mpeg_enc_ctx;
@ -756,6 +757,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
} else } else
memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */ memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
s->mb_intra = 1; s->mb_intra = 1;
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
// if 1, we memcpy blocks in xvmcvideo // if 1, we memcpy blocks in xvmcvideo
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) { if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
@ -763,6 +766,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
exchange_uv(s); exchange_uv(s);
} }
} }
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) { if (s->flags2 & CODEC_FLAG2_FAST) {
@ -969,6 +974,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
return -1; return -1;
} }
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
//if 1, we memcpy blocks in xvmcvideo //if 1, we memcpy blocks in xvmcvideo
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) { if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, cbp); ff_xvmc_pack_pblocks(s, cbp);
@ -976,6 +983,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
exchange_uv(s); exchange_uv(s);
} }
} }
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) { if (s->flags2 & CODEC_FLAG2_FAST) {
@ -1098,10 +1107,12 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
} }
} }
#if FF_API_XVMC
static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = { static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
AV_PIX_FMT_XVMC_MPEG2_IDCT, AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC, AV_PIX_FMT_XVMC_MPEG2_MC,
AV_PIX_FMT_NONE }; AV_PIX_FMT_NONE };
#endif /* FF_API_XVMC */
static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = { static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
#if CONFIG_MPEG2_DXVA2_HWACCEL #if CONFIG_MPEG2_DXVA2_HWACCEL
@ -1122,16 +1133,19 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
Mpeg1Context *s1 = avctx->priv_data; Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx; MpegEncContext *s = &s1->mpeg_enc_ctx;
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->xvmc_acceleration) if (avctx->xvmc_acceleration)
return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420); return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
else { FF_ENABLE_DEPRECATION_WARNINGS
if (s->chroma_format < 2) #endif /* FF_API_XVMC */
return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
else if (s->chroma_format == 2) if (s->chroma_format < 2)
return AV_PIX_FMT_YUV422P; return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
else else if (s->chroma_format == 2)
return AV_PIX_FMT_YUV444P; return AV_PIX_FMT_YUV422P;
} else
return AV_PIX_FMT_YUV444P;
} }
/* Call this function when we know all parameters. /* Call this function when we know all parameters.
@ -1229,10 +1243,13 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx); avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx); avctx->hwaccel = ff_find_hwaccel(avctx);
// until then pix_fmt may be changed right after codec init // until then pix_fmt may be changed right after codec init
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || #if FF_API_XVMC
avctx->hwaccel) if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
if (avctx->idct_algo == FF_IDCT_AUTO) avctx->hwaccel) && avctx->idct_algo == FF_IDCT_AUTO)
avctx->idct_algo = FF_IDCT_SIMPLE; #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 /* Quantization matrices may need reordering
* if DCT permutation is changed. */ * if DCT permutation is changed. */
@ -1557,11 +1574,15 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
return -1; return -1;
} }
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
// MPV_frame_start will call this function too, // MPV_frame_start will call this function too,
// but we need to call it on every field // but we need to call it on every field
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
if (ff_xvmc_field_start(s, avctx) < 0) if (ff_xvmc_field_start(s, avctx) < 0)
return -1; return -1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
return 0; return 0;
} }
@ -1662,9 +1683,13 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
} }
for (;;) { for (;;) {
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
// If 1, we memcpy blocks in xvmcvideo. // If 1, we memcpy blocks in xvmcvideo.
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
ff_xvmc_init_block(s); // set s->block ff_xvmc_init_block(s); // set s->block
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if (mpeg_decode_mb(s, s->block) < 0) if (mpeg_decode_mb(s, s->block) < 0)
return -1; return -1;
@ -1854,8 +1879,12 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); 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) if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
ff_xvmc_field_end(s); ff_xvmc_field_end(s);
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
/* end of slice reached */ /* 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) {
@ -1990,9 +2019,13 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx); avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx); avctx->hwaccel = ff_find_hwaccel(avctx);
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) #if FF_API_XVMC
if (avctx->idct_algo == FF_IDCT_AUTO) if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) &&
avctx->idct_algo = FF_IDCT_SIMPLE; 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;
if (ff_MPV_common_init(s) < 0) if (ff_MPV_common_init(s) < 0)
return -1; return -1;
@ -2436,6 +2469,7 @@ AVCodec ff_mpeg2video_decoder = {
.profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles), .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
}; };
#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER #if CONFIG_MPEG_XVMC_DECODER
static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx) static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
{ {
@ -2469,3 +2503,4 @@ AVCodec ff_mpeg_xvmc_decoder = {
}; };
#endif #endif
#endif /* FF_API_XVMC */

@ -30,6 +30,7 @@
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "internal.h" #include "internal.h"
@ -1671,8 +1672,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
update_noise_reduction(s); update_noise_reduction(s);
} }
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
return ff_xvmc_field_start(s, avctx); return ff_xvmc_field_start(s, avctx);
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
return 0; return 0;
} }
@ -1682,31 +1687,37 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
void ff_MPV_frame_end(MpegEncContext *s) void ff_MPV_frame_end(MpegEncContext *s)
{ {
int i; int i;
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
/* redraw edges for the frame if decoding didn't complete */ /* redraw edges for the frame if decoding didn't complete */
// just to make sure that all data is rendered. // just to make sure that all data is rendered.
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
ff_xvmc_field_end(s); ff_xvmc_field_end(s);
} else if ((s->er.error_count || s->encoding) && } else
!s->avctx->hwaccel && FF_ENABLE_DEPRECATION_WARNINGS
s->unrestricted_mv && #endif /* FF_API_XVMC */
s->current_picture.reference && if ((s->er.error_count || s->encoding) &&
!s->intra_only && !s->avctx->hwaccel &&
!(s->flags & CODEC_FLAG_EMU_EDGE)) { s->unrestricted_mv &&
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); s->current_picture.reference &&
int hshift = desc->log2_chroma_w; !s->intra_only &&
int vshift = desc->log2_chroma_h; !(s->flags & CODEC_FLAG_EMU_EDGE)) {
s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
s->h_edge_pos, s->v_edge_pos, int hshift = desc->log2_chroma_w;
EDGE_WIDTH, EDGE_WIDTH, int vshift = desc->log2_chroma_h;
EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos, s->v_edge_pos,
s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH, EDGE_WIDTH,
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM);
EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM);
EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
} }
emms_c(); emms_c();
@ -1959,10 +1970,15 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
int is_mpeg12) int is_mpeg12)
{ {
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; 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){ if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
ff_xvmc_decode_mb(s);//xvmc uses pblocks ff_xvmc_decode_mb(s);//xvmc uses pblocks
return; return;
} }
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
/* print DCT coefficients */ /* print DCT coefficients */

@ -30,6 +30,9 @@
#include "xvmc.h" #include "xvmc.h"
#include "xvmc_internal.h" #include "xvmc_internal.h"
#include "version.h"
#if FF_API_XVMC
/** /**
* Initialize the block field of the MpegEncContext pointer passed as * Initialize the block field of the MpegEncContext pointer passed as
@ -329,3 +332,5 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
if (render->filled_mv_blocks_num == render->allocated_mv_blocks) if (render->filled_mv_blocks_num == render->allocated_mv_blocks)
ff_mpeg_draw_horiz_band(s, 0, 0); ff_mpeg_draw_horiz_band(s, 0, 0);
} }
#endif /* FF_API_XVMC */

@ -273,7 +273,9 @@ 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"}, {"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}, {"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}, {"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}, {"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"}, {"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"}, {"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"}, {"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"},

@ -97,5 +97,8 @@
#ifndef FF_API_ARCH_ALPHA #ifndef FF_API_ARCH_ALPHA
#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56) #define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56)
#endif #endif
#ifndef FF_API_XVMC
#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
#endif /* AVCODEC_VERSION_H */ #endif /* AVCODEC_VERSION_H */

@ -611,11 +611,15 @@ static av_cold void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx,
const int high_bit_depth = avctx->bits_per_raw_sample > 8; const int high_bit_depth = avctx->bits_per_raw_sample > 8;
if (!high_bit_depth) { if (!high_bit_depth) {
#if FF_API_XVMC
if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) { if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) {
/* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */ /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
c->clear_block = ff_clear_block_sse; #endif /* FF_API_XVMC */
c->clear_blocks = ff_clear_blocks_sse; c->clear_block = ff_clear_block_sse;
c->clear_blocks = ff_clear_blocks_sse;
#if FF_API_XVMC
} }
#endif /* FF_API_XVMC */
} }
c->vector_clipf = ff_vector_clipf_sse; c->vector_clipf = ff_vector_clipf_sse;

@ -29,8 +29,12 @@
#include <X11/extensions/XvMC.h> #include <X11/extensions/XvMC.h>
#include "libavutil/attributes.h"
#include "version.h"
#include "avcodec.h" #include "avcodec.h"
#if FF_API_XVMC
/** /**
* @defgroup lavc_codec_hwaccel_xvmc XvMC * @defgroup lavc_codec_hwaccel_xvmc XvMC
* @ingroup lavc_codec_hwaccel * @ingroup lavc_codec_hwaccel
@ -41,7 +45,7 @@
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct #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) */ the number is 1337 speak for the letters IDCT MCo (motion compensation) */
struct xvmc_pix_fmt { attribute_deprecated struct xvmc_pix_fmt {
/** The field contains the special constant value AV_XVMC_ID. /** The field contains the special constant value AV_XVMC_ID.
It is used as a test that the application correctly uses the API, It is used as a test that the application correctly uses the API,
and that there is no corruption caused by pixel routines. and that there is no corruption caused by pixel routines.
@ -165,4 +169,6 @@ struct xvmc_pix_fmt {
* @} * @}
*/ */
#endif /* FF_API_XVMC */
#endif /* AVCODEC_XVMC_H */ #endif /* AVCODEC_XVMC_H */

@ -23,6 +23,9 @@
#include "avcodec.h" #include "avcodec.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "version.h"
#if FF_API_XVMC
void ff_xvmc_init_block(MpegEncContext *s); void ff_xvmc_init_block(MpegEncContext *s);
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp); void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);
@ -30,4 +33,6 @@ int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx);
void ff_xvmc_field_end(MpegEncContext *s); void ff_xvmc_field_end(MpegEncContext *s);
void ff_xvmc_decode_mb(MpegEncContext *s); void ff_xvmc_decode_mb(MpegEncContext *s);
#endif /* FF_API_XVMC */
#endif /* AVCODEC_XVMC_INTERNAL_H */ #endif /* AVCODEC_XVMC_INTERNAL_H */

@ -42,8 +42,10 @@
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
#if FF_API_XVMC
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_XVMC_MPEG2_IDCT,
#endif /* FF_API_XVMC */
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)

@ -27,6 +27,7 @@
#include "pixdesc.h" #include "pixdesc.h"
#include "internal.h" #include "internal.h"
#include "intreadwrite.h" #include "intreadwrite.h"
#include "version.h"
void av_read_image_line(uint16_t *dst, void av_read_image_line(uint16_t *dst,
const uint8_t *data[4], const int linesize[4], const uint8_t *data[4], const int linesize[4],
@ -299,6 +300,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
}, },
.flags = AV_PIX_FMT_FLAG_PLANAR, .flags = AV_PIX_FMT_FLAG_PLANAR,
}, },
#if FF_API_XVMC
[AV_PIX_FMT_XVMC_MPEG2_MC] = { [AV_PIX_FMT_XVMC_MPEG2_MC] = {
.name = "xvmcmc", .name = "xvmcmc",
.flags = AV_PIX_FMT_FLAG_HWACCEL, .flags = AV_PIX_FMT_FLAG_HWACCEL,
@ -307,6 +309,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.name = "xvmcidct", .name = "xvmcidct",
.flags = AV_PIX_FMT_FLAG_HWACCEL, .flags = AV_PIX_FMT_FLAG_HWACCEL,
}, },
#endif /* FF_API_XVMC */
[AV_PIX_FMT_UYVY422] = { [AV_PIX_FMT_UYVY422] = {
.name = "uyvy422", .name = "uyvy422",
.nb_components = 3, .nb_components = 3,

@ -77,8 +77,10 @@ enum AVPixelFormat {
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of 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_MC,///< XVideo Motion Acceleration via common packet passing
AV_PIX_FMT_XVMC_MPEG2_IDCT, 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_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_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) AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)

@ -88,6 +88,9 @@
#ifndef FF_API_VDPAU #ifndef FF_API_VDPAU
#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 53) #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 53)
#endif #endif
#ifndef FF_API_XVMC
#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 53)
#endif
/** /**
* @} * @}

Loading…
Cancel
Save