1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge remote-tracking branch 'qatar/master'

* 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>
This commit is contained in:
Michael Niedermayer 2013-11-14 03:13:39 +01:00
commit 5231eecdaf
18 changed files with 123 additions and 18 deletions

View File

@ -663,7 +663,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.

View File

@ -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) \
{ \ { \
@ -189,7 +190,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);

View File

@ -105,7 +105,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,
@ -754,8 +756,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.
@ -1665,12 +1669,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

View File

@ -21,10 +21,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 */
@ -42,6 +42,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 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,
@ -49,6 +50,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,

View File

@ -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
@ -697,11 +699,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;
@ -1173,9 +1179,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++) {

View File

@ -40,7 +40,6 @@
#include "mpeg12data.h" #include "mpeg12data.h"
#include "bytestream.h" #include "bytestream.h"
#include "vdpau_internal.h" #include "vdpau_internal.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];

View File

@ -38,6 +38,7 @@
#include "vdpau_internal.h" #include "vdpau_internal.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;
@ -773,6 +774,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
@ -780,6 +783,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) {
@ -992,6 +997,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);
@ -999,6 +1006,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) {
@ -1122,10 +1131,12 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
} }
static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = { static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER #if CONFIG_MPEG_XVMC_DECODER
AV_PIX_FMT_XVMC_MPEG2_IDCT, AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC, AV_PIX_FMT_XVMC_MPEG2_MC,
#endif #endif
#endif /* FF_API_XVMC */
#if CONFIG_MPEG1_VDPAU_HWACCEL #if CONFIG_MPEG1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG1, AV_PIX_FMT_VDPAU_MPEG1,
AV_PIX_FMT_VDPAU, AV_PIX_FMT_VDPAU,
@ -1135,10 +1146,12 @@ static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
}; };
static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = { static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER #if CONFIG_MPEG_XVMC_DECODER
AV_PIX_FMT_XVMC_MPEG2_IDCT, AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC, AV_PIX_FMT_XVMC_MPEG2_MC,
#endif #endif
#endif /* FF_API_XVMC */
#if CONFIG_MPEG2_VDPAU_HWACCEL #if CONFIG_MPEG2_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG2, AV_PIX_FMT_VDPAU_MPEG2,
AV_PIX_FMT_VDPAU, AV_PIX_FMT_VDPAU,
@ -1175,14 +1188,22 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx) static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
{ {
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_IDCT && avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_MC) { if (avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_IDCT && avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_MC) {
avctx->xvmc_acceleration = 0; avctx->xvmc_acceleration = 0;
} else if (!avctx->xvmc_acceleration) { } else if (!avctx->xvmc_acceleration) {
avctx->xvmc_acceleration = 2; avctx->xvmc_acceleration = 2;
} }
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
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 FF_API_XVMC
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
#else
if (
#endif
avctx->hwaccel || uses_vdpau(avctx)) avctx->hwaccel || uses_vdpau(avctx))
if (avctx->idct_algo == FF_IDCT_AUTO) if (avctx->idct_algo == FF_IDCT_AUTO)
avctx->idct_algo = FF_IDCT_SIMPLE; avctx->idct_algo = FF_IDCT_SIMPLE;
@ -1598,11 +1619,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;
} }
@ -1705,9 +1730,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;
@ -1909,8 +1938,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 && !s->first_slice) { if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s->first_slice) {
@ -2598,6 +2631,7 @@ AVCodec ff_mpegvideo_decoder = {
.max_lowres = 3, .max_lowres = 3,
}; };
#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)
{ {
@ -2631,6 +2665,7 @@ AVCodec ff_mpeg_xvmc_decoder = {
}; };
#endif #endif
#endif /* FF_API_XVMC */
#if CONFIG_MPEG_VDPAU_DECODER #if CONFIG_MPEG_VDPAU_DECODER
AVCodec ff_mpeg_vdpau_decoder = { AVCodec ff_mpeg_vdpau_decoder = {

View File

@ -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 "h264chroma.h" #include "h264chroma.h"
@ -1710,8 +1711,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;
} }
@ -1720,19 +1725,24 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
* frame has been coded/decoded. */ * frame has been coded/decoded. */
void ff_MPV_frame_end(MpegEncContext *s) 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 */ /* 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 || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) && } else
!s->avctx->hwaccel && FF_ENABLE_DEPRECATION_WARNINGS
!(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && #endif /* FF_API_XVMC */
s->unrestricted_mv && if ((s->er.error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
s->current_picture.reference && !s->avctx->hwaccel &&
!s->intra_only && !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
!(s->flags & CODEC_FLAG_EMU_EDGE) && s->unrestricted_mv &&
!s->avctx->lowres s->current_picture.reference &&
) { !s->intra_only &&
!(s->flags & CODEC_FLAG_EMU_EDGE) &&
!s->avctx->lowres
) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w; int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h; int vshift = desc->log2_chroma_h;
@ -2667,10 +2677,15 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
int lowres_flag, int is_mpeg12) int lowres_flag, 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 */

View File

@ -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 */

View File

@ -281,7 +281,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 }, 0, 2, V|E, "mbd"}, {"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"}, {"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"},

View File

@ -117,5 +117,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 */

View File

@ -601,11 +601,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;

View File

@ -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 */

View File

@ -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 */

View File

@ -44,8 +44,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)

View File

@ -29,6 +29,7 @@
#include "internal.h" #include "internal.h"
#include "intreadwrite.h" #include "intreadwrite.h"
#include "avstring.h" #include "avstring.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],
@ -313,6 +314,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,
@ -321,6 +323,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,

View File

@ -80,8 +80,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)

View File

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