History

Convert XvMC to hwaccel v3

Ivan Kalvachev committed 12 years ago

Commit 1c63aed1 parent c19f19314 files · +122 −139Browse files

Unified · Split

14 files
  1. configure +9 −1
  2. libavcodec/Makefile +3 −2
  3. libavcodec/allcodecs.c +2 −0
  4. libavcodec/avcodec.h +22 −2
  5. libavcodec/error_resilience.c +6 −14
  6. libavcodec/mpeg12dec.c +19 −72
  7. libavcodec/mpegvideo.c +3 −23
  8. libavcodec/mpegvideo.h +1 −0
  9. libavcodec/mpegvideo_xvmc.c +46 −7
  10. libavcodec/x86/dsputil_init.c +1 −7
  11. libavcodec/xvmc.h +0 −4
  12. libavcodec/xvmc_internal.h +0 −7
  13. libavutil/pixdesc.c +6 −0
  14. libavutil/pixfmt.h +4 −0
configure+9−1
@@ -1318,6 +1318,7 @@ HWACCEL_LIST=" · 1317 unmodified lines
1318 vaapi1318 vaapi
1319 vda1319 vda
1320 vdpau1320 vdpau
1321 xvmc
1321"1322"
1322 1323
1323LIBRARY_LIST="1324LIBRARY_LIST="
@@ -2039,6 +2040,7 @@ vaapi_deps="va_va_h" · 715 unmodified lines
2039vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"2040vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
2040vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"2041vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
2041vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"2042vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2043xvmc_deps="X11_extensions_XvMClib_h"
2042 2044
2043h263_vaapi_hwaccel_deps="vaapi"2045h263_vaapi_hwaccel_deps="vaapi"
2044h263_vaapi_hwaccel_select="h263_decoder"2046h263_vaapi_hwaccel_select="h263_decoder"
@@ -2059,10 +2061,14 @@ h264_vdpau_hwaccel_deps="vdpau" · 14 unmodified lines
2059h264_vdpau_hwaccel_select="h264_decoder"2061h264_vdpau_hwaccel_select="h264_decoder"
2060mpeg_vdpau_decoder_deps="vdpau"2062mpeg_vdpau_decoder_deps="vdpau"
2061mpeg_vdpau_decoder_select="mpeg2video_decoder"2063mpeg_vdpau_decoder_select="mpeg2video_decoder"
2064mpeg_xvmc_hwaccel_deps="xvmc"
2065mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2062mpeg1_vdpau_decoder_deps="vdpau"2066mpeg1_vdpau_decoder_deps="vdpau"
2063mpeg1_vdpau_decoder_select="mpeg1video_decoder"2067mpeg1_vdpau_decoder_select="mpeg1video_decoder"
2064mpeg1_vdpau_hwaccel_deps="vdpau"2068mpeg1_vdpau_hwaccel_deps="vdpau"
2065mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"2069mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2070mpeg1_xvmc_hwaccel_deps="xvmc"
2071mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2066mpeg2_crystalhd_decoder_select="crystalhd"2072mpeg2_crystalhd_decoder_select="crystalhd"
2067mpeg2_dxva2_hwaccel_deps="dxva2"2073mpeg2_dxva2_hwaccel_deps="dxva2"
2068mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"2074mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
@@ -2070,6 +2076,8 @@ mpeg2_vaapi_hwaccel_deps="vaapi" · 1 unmodified line
2070mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"2076mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2071mpeg2_vdpau_hwaccel_deps="vdpau"2077mpeg2_vdpau_hwaccel_deps="vdpau"
2072mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"2078mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2079mpeg2_xvmc_hwaccel_deps="xvmc"
2080mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2073mpeg4_crystalhd_decoder_select="crystalhd"2081mpeg4_crystalhd_decoder_select="crystalhd"
2074mpeg4_vaapi_hwaccel_deps="vaapi"2082mpeg4_vaapi_hwaccel_deps="vaapi"
2075mpeg4_vaapi_hwaccel_select="mpeg4_decoder"2083mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
@@ -2454,7 +2462,7 @@ enable static · 378 unmodified lines
2454enable swscale_alpha2462enable swscale_alpha
2455 2463
2456# Enable hwaccels by default.2464# Enable hwaccels by default.
2457enable dxva2 vaapi vdpau2465enable dxva2 vaapi vdpau xvmc
2458 2466
2459# build settings2467# build settings
2460SHFLAGS='-shared -Wl,-soname,$$(@F)'2468SHFLAGS='-shared -Wl,-soname,$$(@F)'
libavcodec/Makefile+3−2
@@ -297,7 +297,6 @@ OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o · 296 unmodified lines
297OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o297OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
298OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o \298OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o \
299 mpegvideo.o error_resilience.o299 mpegvideo.o error_resilience.o
300OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o
301OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o300OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
302OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o301OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
303OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o302OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
@@ -635,9 +634,11 @@ OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o · 331 unmodified lines
635OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o634OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o
636OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o635OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
637OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o636OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
637OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
638OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o638OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
639OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o vaapi_mpeg.o639OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o vaapi_mpeg.o
640OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o640OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o
641OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) += mpegvideo_xvmc.o
641OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o vaapi_mpeg.o642OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o vaapi_mpeg.o
642OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o643OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o
643OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o644OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o
@@ -827,7 +828,7 @@ SKIPHEADERS += %_tablegen.h \ · 183 unmodified lines
827SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h828SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
828SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h829SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
829SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h830SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h
830SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h831SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
831SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h832SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
832SKIPHEADERS-$(CONFIG_VDA) += vda.h833SKIPHEADERS-$(CONFIG_VDA) += vda.h
833SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h834SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
libavcodec/allcodecs.c+2−0
@@ -80,7 +80,9 @@ void avcodec_register_all(void) · 79 unmodified lines
80 REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);80 REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
81 REGISTER_HWACCEL(H264_VDA, h264_vda);81 REGISTER_HWACCEL(H264_VDA, h264_vda);
82 REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);82 REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
83 REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
83 REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);84 REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
85 REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
84 REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);86 REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
85 REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);87 REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
86 REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);88 REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
libavcodec/avcodec.h+22−2
@@ -767,7 +767,13 @@ typedef struct RcOverride{ · 766 unmodified lines
767#define CODEC_CAP_DR1 0x0002767#define CODEC_CAP_DR1 0x0002
768#define CODEC_CAP_TRUNCATED 0x0008768#define CODEC_CAP_TRUNCATED 0x0008
769#if FF_API_XVMC769#if FF_API_XVMC
770/* Codec can export data for HW decoding (XvMC). */770/* Codec can export data for HW decoding. This flag indicates that
771 * the codec would call get_format() with list that might contain HW accelerated
772 * pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them
773 * including raw image format.
774 * The application can use the passed context to determine bitstream version,
775 * chroma format, resolution etc.
776 */
771#define CODEC_CAP_HWACCEL 0x0010777#define CODEC_CAP_HWACCEL 0x0010
772#endif /* FF_API_XVMC */778#endif /* FF_API_XVMC */
773/**779/**
@@ -1695,7 +1701,7 @@ typedef struct AVCodecContext { · 921 unmodified lines
1695 * XVideo Motion Acceleration1701 * XVideo Motion Acceleration
1696 * - encoding: forbidden1702 * - encoding: forbidden
1697 * - decoding: set by decoder1703 * - decoding: set by decoder
1698 * @deprecated XvMC support is slated for removal.1704 * @deprecated XvMC doesn't need it anymore.
1699 */1705 */
1700 attribute_deprecated int xvmc_acceleration;1706 attribute_deprecated int xvmc_acceleration;
1701#endif /* FF_API_XVMC */1707#endif /* FF_API_XVMC */
@@ -3100,6 +3106,8 @@ typedef struct AVCodec { · 1398 unmodified lines
3100 3106
3101int av_codec_get_max_lowres(const AVCodec *codec);3107int av_codec_get_max_lowres(const AVCodec *codec);
3102 3108
3109struct MpegEncContext;
3110
3103/**3111/**
3104 * AVHWAccel.3112 * AVHWAccel.
3105 */3113 */
@@ -3161,6 +3169,7 @@ typedef struct AVHWAccel { · 55 unmodified lines
3161 *3169 *
3162 * Meaningful slice information (codec specific) is guaranteed to3170 * Meaningful slice information (codec specific) is guaranteed to
3163 * be parsed at this point. This function is mandatory.3171 * be parsed at this point. This function is mandatory.
3172 * The only exception is XvMC, that works on MB level.
3164 *3173 *
3165 * @param avctx the codec context3174 * @param avctx the codec context
3166 * @param buf the slice data buffer base3175 * @param buf the slice data buffer base
@@ -3188,6 +3197,17 @@ typedef struct AVHWAccel { · 21 unmodified lines
3188 * AVCodecContext.release_buffer().3197 * AVCodecContext.release_buffer().
3189 */3198 */
3190 int priv_data_size;3199 int priv_data_size;
3200
3201 /**
3202 * Called for every Macroblock in a slice.
3203 *
3204 * XvMC uses it to replace the ff_MPV_decode_mb().
3205 * Instead of decoding to raw picture, MB parameters are
3206 * stored in an array provided by the video driver.
3207 *
3208 * @param s the mpeg context
3209 */
3210 void (*decode_mb)(struct MpegEncContext *s);
3191} AVHWAccel;3211} AVHWAccel;
3192 3212
3193/**3213/**
libavcodec/error_resilience.c+6−14
@@ -699,15 +699,11 @@ static int is_intra_more_likely(ERContext *s) · 698 unmodified lines
699 if (undamaged_count < 5)699 if (undamaged_count < 5)
700 return 0; // almost all MBs damaged -> use temporal prediction700 return 0; // almost all MBs damaged -> use temporal prediction
701 701
702#if FF_API_XVMC
703FF_DISABLE_DEPRECATION_WARNINGS
704 // prevent dsp.sad() check, that requires access to the image702 // prevent dsp.sad() check, that requires access to the image
705 if (CONFIG_MPEG_XVMC_DECODER &&703 if (CONFIG_XVMC &&
706 s->avctx->xvmc_acceleration &&704 s->avctx->hwaccel && s->avctx->hwaccel->decode_mb &&
707 s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)705 s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)
708 return 1;706 return 1;
709FF_ENABLE_DEPRECATION_WARNINGS
710#endif /* FF_API_XVMC */
711 707
712 skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs708 skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs
713 is_intra_likely = 0;709 is_intra_likely = 0;
@@ -770,7 +766,7 @@ void ff_er_frame_start(ERContext *s) · 56 unmodified lines
770 766
771static int er_supported(ERContext *s)767static int er_supported(ERContext *s)
772{768{
773 if(s->avctx->hwaccel ||769 if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice ||
774 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||770 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
775 !s->cur_pic ||771 !s->cur_pic ||
776 s->cur_pic->field_picture772 s->cur_pic->field_picture
@@ -795,7 +791,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty, · 18 unmodified lines
795 const int end_xy = s->mb_index2xy[end_i];791 const int end_xy = s->mb_index2xy[end_i];
796 int mask = -1;792 int mask = -1;
797 793
798 if (s->avctx->hwaccel)794 if (s->avctx->hwaccel && s->avctx->hwaccel->decode_slice)
799 return;795 return;
800 796
801 if (start_i > end_i || start_xy > end_xy) {797 if (start_i > end_i || start_xy > end_xy) {
@@ -1188,13 +1184,9 @@ void ff_er_frame_end(ERContext *s) · 386 unmodified lines
1188 } else1184 } else
1189 guess_mv(s);1185 guess_mv(s);
1190 1186
1191#if FF_API_XVMC1187 /* the filters below manipulate raw image, skip them */
1192FF_DISABLE_DEPRECATION_WARNINGS1188 if (CONFIG_XVMC && s->avctx->hwaccel && s->avctx->hwaccel->decode_mb)
1193 /* the filters below are not XvMC compatible, skip them */
1194 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
1195 goto ec_clean;1189 goto ec_clean;
1196FF_ENABLE_DEPRECATION_WARNINGS
1197#endif /* FF_API_XVMC */
1198 /* fill DC for inter blocks */1190 /* fill DC for inter blocks */
1199 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {1191 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
1200 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {1192 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
libavcodec/mpeg12dec.c+19−72
@@ -666,14 +666,6 @@ static inline int get_qscale(MpegEncContext *s) · 665 unmodified lines
666 }666 }
667}667}
668 668
669static void exchange_uv(MpegEncContext *s)
670{
671 int16_t (*tmp)[64];
672
673 tmp = s->pblocks[4];
674 s->pblocks[4] = s->pblocks[5];
675 s->pblocks[5] = tmp;
676}
677 669
678/* motion type (for MPEG-2) */670/* motion type (for MPEG-2) */
679#define MT_FIELD 1671#define MT_FIELD 1
@@ -777,17 +769,10 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 97 unmodified lines
777 } else769 } else
778 memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */770 memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
779 s->mb_intra = 1;771 s->mb_intra = 1;
780#if FF_API_XVMC
781FF_DISABLE_DEPRECATION_WARNINGS
782 // if 1, we memcpy blocks in xvmcvideo772 // if 1, we memcpy blocks in xvmcvideo
783 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {773 if (CONFIG_XVMC && s->pack_pblocks) {
784 ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks774 ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
785 if (s->swap_uv) {
786 exchange_uv(s);
787 }
788 }775 }
789FF_ENABLE_DEPRECATION_WARNINGS
790#endif /* FF_API_XVMC */
791 776
792 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {777 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
793 if (s->flags2 & CODEC_FLAG2_FAST) {778 if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -1000,17 +985,10 @@ FF_ENABLE_DEPRECATION_WARNINGS · 206 unmodified lines
1000 return -1;985 return -1;
1001 }986 }
1002 987
1003#if FF_API_XVMC
1004FF_DISABLE_DEPRECATION_WARNINGS
1005 //if 1, we memcpy blocks in xvmcvideo988 //if 1, we memcpy blocks in xvmcvideo
1006 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {989 if (CONFIG_XVMC && s->pack_pblocks) {
1007 ff_xvmc_pack_pblocks(s, cbp);990 ff_xvmc_pack_pblocks(s, cbp);
1008 if (s->swap_uv) {
1009 exchange_uv(s);
1010 }
1011 }991 }
1012FF_ENABLE_DEPRECATION_WARNINGS
1013#endif /* FF_API_XVMC */
1014 992
1015 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {993 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
1016 if (s->flags2 & CODEC_FLAG2_FAST) {994 if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -1134,12 +1112,9 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, · 117 unmodified lines
1134}1112}
1135 1113
1136static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {1114static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
1137#if FF_API_XVMC1115#if CONFIG_MPEG1_XVMC_HWACCEL
1138#if CONFIG_MPEG_XVMC_DECODER1116 AV_PIX_FMT_XVMC,
1139 AV_PIX_FMT_XVMC_MPEG2_IDCT,
1140 AV_PIX_FMT_XVMC_MPEG2_MC,
1141#endif1117#endif
1142#endif /* FF_API_XVMC */
1143#if CONFIG_MPEG1_VDPAU_HWACCEL1118#if CONFIG_MPEG1_VDPAU_HWACCEL
1144 AV_PIX_FMT_VDPAU_MPEG1,1119 AV_PIX_FMT_VDPAU_MPEG1,
1145 AV_PIX_FMT_VDPAU,1120 AV_PIX_FMT_VDPAU,
@@ -1149,12 +1124,9 @@ static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = { · 3 unmodified lines
1149};1124};
1150 1125
1151static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {1126static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
1152#if FF_API_XVMC1127#if CONFIG_MPEG2_XVMC_HWACCEL
1153#if CONFIG_MPEG_XVMC_DECODER1128 AV_PIX_FMT_XVMC,
1154 AV_PIX_FMT_XVMC_MPEG2_IDCT,
1155 AV_PIX_FMT_XVMC_MPEG2_MC,
1156#endif1129#endif
1157#endif /* FF_API_XVMC */
1158#if CONFIG_MPEG2_VDPAU_HWACCEL1130#if CONFIG_MPEG2_VDPAU_HWACCEL
1159 AV_PIX_FMT_VDPAU_MPEG2,1131 AV_PIX_FMT_VDPAU_MPEG2,
1160 AV_PIX_FMT_VDPAU,1132 AV_PIX_FMT_VDPAU,
@@ -1191,25 +1163,21 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) · 30 unmodified lines
1191 1163
1192static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)1164static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
1193{1165{
1194#if FF_API_XVMC
1195FF_DISABLE_DEPRECATION_WARNINGS
1196 if (avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_IDCT && avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_MC) {
1197 avctx->xvmc_acceleration = 0;
1198 } else if (!avctx->xvmc_acceleration) {
1199 avctx->xvmc_acceleration = 2;
1200 }
1201FF_ENABLE_DEPRECATION_WARNINGS
1202#endif /* FF_API_XVMC */
1203 avctx->hwaccel = ff_find_hwaccel(avctx);1166 avctx->hwaccel = ff_find_hwaccel(avctx);
1204 // until then pix_fmt may be changed right after codec init1167 // until then pix_fmt may be changed right after codec init
1205#if FF_API_XVMC1168 if (avctx->hwaccel || uses_vdpau(avctx))
1206 if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
1207#else
1208 if (
1209#endif
1210 avctx->hwaccel || uses_vdpau(avctx))
1211 if (avctx->idct_algo == FF_IDCT_AUTO)1169 if (avctx->idct_algo == FF_IDCT_AUTO)
1212 avctx->idct_algo = FF_IDCT_SIMPLE;1170 avctx->idct_algo = FF_IDCT_SIMPLE;
1171
1172 if (avctx->hwaccel && avctx->pix_fmt == AV_PIX_FMT_XVMC) {
1173 Mpeg1Context *s1 = avctx->priv_data;
1174 MpegEncContext *s = &s1->mpeg_enc_ctx;
1175
1176 s->pack_pblocks = 1;
1177#if FF_API_XVMC
1178 avctx->xvmc_acceleration = 2;
1179#endif /* FF_API_XVMC */
1180 }
1213}1181}
1214 1182
1215/* Call this function when we know all parameters.1183/* Call this function when we know all parameters.
@@ -1630,16 +1598,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 414 unmodified lines
1630 return -1;1598 return -1;
1631 }1599 }
1632 1600
1633#if FF_API_XVMC
1634FF_DISABLE_DEPRECATION_WARNINGS
1635// MPV_frame_start will call this function too,
1636// but we need to call it on every field
1637 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
1638 if (ff_xvmc_field_start(s, avctx) < 0)
1639 return -1;
1640FF_ENABLE_DEPRECATION_WARNINGS
1641#endif /* FF_API_XVMC */
1642
1643 return 0;1601 return 0;
1644}1602}
1645 1603
@@ -1711,7 +1669,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 65 unmodified lines
1711 return -1;1669 return -1;
1712 }1670 }
1713 1671
1714 if (avctx->hwaccel) {1672 if (avctx->hwaccel && avctx->hwaccel->decode_slice) {
1715 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */1673 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
1716 int start_code = -1;1674 int start_code = -1;
1717 buf_end = avpriv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);1675 buf_end = avpriv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
@@ -1741,13 +1699,9 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 23 unmodified lines
1741 }1699 }
1742 1700
1743 for (;;) {1701 for (;;) {
1744#if FF_API_XVMC
1745FF_DISABLE_DEPRECATION_WARNINGS
1746 // If 1, we memcpy blocks in xvmcvideo.1702 // If 1, we memcpy blocks in xvmcvideo.
1747 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)1703 if (CONFIG_XVMC && s->pack_pblocks)
1748 ff_xvmc_init_block(s); // set s->block1704 ff_xvmc_init_block(s); // set s->block
1749FF_ENABLE_DEPRECATION_WARNINGS
1750#endif /* FF_API_XVMC */
1751 1705
1752 if (mpeg_decode_mb(s, s->block) < 0)1706 if (mpeg_decode_mb(s, s->block) < 0)
1753 return -1;1707 return -1;
@@ -1949,13 +1903,6 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) · 195 unmodified lines
1949 av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");1903 av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
1950 }1904 }
1951 1905
1952#if FF_API_XVMC
1953FF_DISABLE_DEPRECATION_WARNINGS
1954 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
1955 ff_xvmc_field_end(s);
1956FF_ENABLE_DEPRECATION_WARNINGS
1957#endif /* FF_API_XVMC */
1958
1959 /* end of slice reached */1906 /* end of slice reached */
1960 if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s1->first_slice) {1907 if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s1->first_slice) {
1961 /* end of image */1908 /* end of image */
libavcodec/mpegvideo.c+3−23
@@ -39,7 +39,6 @@ · 38 unmodified lines
39#include "mpegvideo.h"39#include "mpegvideo.h"
40#include "mjpegenc.h"40#include "mjpegenc.h"
41#include "msmpeg4.h"41#include "msmpeg4.h"
42#include "xvmc_internal.h"
43#include "thread.h"42#include "thread.h"
44#include <limits.h>43#include <limits.h>
45 44
@@ -1673,28 +1672,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) · 1627 unmodified lines
1673 update_noise_reduction(s);1672 update_noise_reduction(s);
1674 }1673 }
1675 1674
1676#if FF_API_XVMC
1677FF_DISABLE_DEPRECATION_WARNINGS
1678 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
1679 return ff_xvmc_field_start(s, avctx);
1680FF_ENABLE_DEPRECATION_WARNINGS
1681#endif /* FF_API_XVMC */
1682
1683 return 0;1675 return 0;
1684}1676}
1685 1677
1686/* called after a frame has been decoded. */1678/* called after a frame has been decoded. */
1687void ff_MPV_frame_end(MpegEncContext *s)1679void ff_MPV_frame_end(MpegEncContext *s)
1688{1680{
1689#if FF_API_XVMC
1690FF_DISABLE_DEPRECATION_WARNINGS
1691 /* redraw edges for the frame if decoding didn't complete */
1692 // just to make sure that all data is rendered.
1693 if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
1694 ff_xvmc_field_end(s);
1695 } else
1696FF_ENABLE_DEPRECATION_WARNINGS
1697#endif /* FF_API_XVMC */
1698 if ((s->er.error_count || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&1681 if ((s->er.error_count || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
1699 !s->avctx->hwaccel &&1682 !s->avctx->hwaccel &&
1700 !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&1683 !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
@@ -2618,14 +2601,11 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], · 917 unmodified lines
2618{2601{
2619 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;2602 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
2620 2603
2621#if FF_API_XVMC2604 if (CONFIG_XVMC &&
2622FF_DISABLE_DEPRECATION_WARNINGS2605 s->avctx->hwaccel && s->avctx->hwaccel->decode_mb) {
2623 if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){2606 s->avctx->hwaccel->decode_mb(s);//xvmc uses pblocks
2624 ff_xvmc_decode_mb(s);//xvmc uses pblocks
2625 return;2607 return;
2626 }2608 }
2627FF_ENABLE_DEPRECATION_WARNINGS
2628#endif /* FF_API_XVMC */
2629 2609
2630 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {2610 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
2631 /* print DCT coefficients */2611 /* print DCT coefficients */
libavcodec/mpegvideo.h+1−0
@@ -693,6 +693,7 @@ typedef struct MpegEncContext { · 692 unmodified lines
693 693
694 uint8_t *ptr_lastgob;694 uint8_t *ptr_lastgob;
695 int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped695 int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped
696 int pack_pblocks; //xvmc needs to keep blocks without gaps.
696 int16_t (*pblocks[12])[64];697 int16_t (*pblocks[12])[64];
697 698
698 int16_t (*block)[64]; ///< points to one of the following blocks699 int16_t (*block)[64]; ///< points to one of the following blocks
libavcodec/mpegvideo_xvmc.c+46−7
@@ -32,8 +32,6 @@ · 31 unmodified lines
32#include "xvmc_internal.h"32#include "xvmc_internal.h"
33#include "version.h"33#include "version.h"
34 34
35#if FF_API_XVMC
36
37/**35/**
38 * Initialize the block field of the MpegEncContext pointer passed as36 * Initialize the block field of the MpegEncContext pointer passed as
39 * parameter after making sure that the data is not corrupted.37 * parameter after making sure that the data is not corrupted.
@@ -49,6 +47,15 @@ void ff_xvmc_init_block(MpegEncContext *s) · 9 unmodified lines
49 s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);47 s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
50}48}
51 49
50static void exchange_uv(MpegEncContext *s)
51{
52 int16_t (*tmp)[64];
53
54 tmp = s->pblocks[4];
55 s->pblocks[4] = s->pblocks[5];
56 s->pblocks[5] = tmp;
57}
58
52/**59/**
53 * Fill individual block pointers, so there are no gaps in the data_block array60 * Fill individual block pointers, so there are no gaps in the data_block array
54 * in case not all blocks in the macroblock are coded.61 * in case not all blocks in the macroblock are coded.
@@ -66,6 +73,9 @@ void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp) · 11 unmodified lines
66 s->pblocks[i] = NULL;73 s->pblocks[i] = NULL;
67 cbp += cbp;74 cbp += cbp;
68 }75 }
76 if (s->swap_uv) {
77 exchange_uv(s);
78 }
69}79}
70 80
71/**81/**
@@ -73,8 +83,9 @@ void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp) · 1 unmodified line
73 * This function should be called for every new field and/or frame.83 * This function should be called for every new field and/or frame.
74 * It should be safe to call the function a few times for the same field.84 * It should be safe to call the function a few times for the same field.
75 */85 */
76int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)86static int ff_xvmc_field_start(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
77{87{
88 struct MpegEncContext *s = avctx->priv_data;
78 struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];89 struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
79 const int mb_block_count = 4 + (1 << s->chroma_format);90 const int mb_block_count = 4 + (1 << s->chroma_format);
80 91
@@ -141,20 +152,22 @@ return -1; · 60 unmodified lines
141 * some leftover blocks, for example from error_resilience(), may remain.152 * some leftover blocks, for example from error_resilience(), may remain.
142 * It should be safe to call the function a few times for the same field.153 * It should be safe to call the function a few times for the same field.
143 */154 */
144void ff_xvmc_field_end(MpegEncContext *s)155static int ff_xvmc_field_end(AVCodecContext *avctx)
145{156{
157 struct MpegEncContext *s = avctx->priv_data;
146 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];158 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
147 assert(render);159 assert(render);
148 160
149 if (render->filled_mv_blocks_num > 0)161 if (render->filled_mv_blocks_num > 0)
150 ff_mpeg_draw_horiz_band(s, 0, 0);162 ff_mpeg_draw_horiz_band(s, 0, 0);
163 return 0;
151}164}
152 165
153/**166/**
154 * Synthesize the data needed by XvMC to render one macroblock of data.167 * Synthesize the data needed by XvMC to render one macroblock of data.
155 * Fill all relevant fields, if necessary do IDCT.168 * Fill all relevant fields, if necessary do IDCT.
156 */169 */
157void ff_xvmc_decode_mb(MpegEncContext *s)170static void ff_xvmc_decode_mb(struct MpegEncContext *s)
158{171{
159 XvMCMacroBlock *mv_block;172 XvMCMacroBlock *mv_block;
160 struct xvmc_pix_fmt *render;173 struct xvmc_pix_fmt *render;
@@ -313,7 +326,7 @@ void ff_xvmc_decode_mb(MpegEncContext *s) · 152 unmodified lines
313 * slowdown. */326 * slowdown. */
314 }327 }
315 // copy blocks only if the codec doesn't support pblocks reordering328 // copy blocks only if the codec doesn't support pblocks reordering
316 if (s->avctx->xvmc_acceleration == 1) {329 if (!s->pack_pblocks) {
317 memcpy(&render->data_blocks[render->next_free_data_block_num*64],330 memcpy(&render->data_blocks[render->next_free_data_block_num*64],
318 s->pblocks[i], sizeof(*s->pblocks[i]));331 s->pblocks[i], sizeof(*s->pblocks[i]));
319 }332 }
@@ -333,4 +346,30 @@ void ff_xvmc_decode_mb(MpegEncContext *s) · 13 unmodified lines
333 ff_mpeg_draw_horiz_band(s, 0, 0);346 ff_mpeg_draw_horiz_band(s, 0, 0);
334}347}
335 348
336#endif /* FF_API_XVMC */349#if CONFIG_MPEG1_XVMC_HWACCEL
350AVHWAccel ff_mpeg1_xvmc_hwaccel = {
351 .name = "mpeg1_xvmc",
352 .type = AVMEDIA_TYPE_VIDEO,
353 .id = AV_CODEC_ID_MPEG1VIDEO,
354 .pix_fmt = AV_PIX_FMT_XVMC,
355 .start_frame = ff_xvmc_field_start,
356 .end_frame = ff_xvmc_field_end,
357 .decode_slice = NULL,
358 .decode_mb = ff_xvmc_decode_mb,
359 .priv_data_size = 0,
360};
361#endif
362
363#if CONFIG_MPEG2_XVMC_HWACCEL
364AVHWAccel ff_mpeg2_xvmc_hwaccel = {
365 .name = "mpeg2_xvmc",
366 .type = AVMEDIA_TYPE_VIDEO,
367 .id = AV_CODEC_ID_MPEG2VIDEO,
368 .pix_fmt = AV_PIX_FMT_XVMC,
369 .start_frame = ff_xvmc_field_start,
370 .end_frame = ff_xvmc_field_end,
371 .decode_slice = NULL,
372 .decode_mb = ff_xvmc_decode_mb,
373 .priv_data_size = 0,
374};
375#endif
libavcodec/x86/dsputil_init.c+1−7
@@ -583,17 +583,11 @@ static av_cold void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, · 582 unmodified lines
583 const int high_bit_depth = avctx->bits_per_raw_sample > 8;583 const int high_bit_depth = avctx->bits_per_raw_sample > 8;
584 584
585 if (!high_bit_depth) {585 if (!high_bit_depth) {
586#if FF_API_XVMC586 if (!(CONFIG_XVMC && avctx->hwaccel && avctx->hwaccel->decode_mb)) {
587FF_DISABLE_DEPRECATION_WARNINGS
588 if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) {
589 /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */587 /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
590FF_ENABLE_DEPRECATION_WARNINGS
591#endif /* FF_API_XVMC */
592 c->clear_block = ff_clear_block_sse;588 c->clear_block = ff_clear_block_sse;
593 c->clear_blocks = ff_clear_blocks_sse;589 c->clear_blocks = ff_clear_blocks_sse;
594#if FF_API_XVMC
595 }590 }
596#endif /* FF_API_XVMC */
597 }591 }
598 592
599 c->vector_clipf = ff_vector_clipf_sse;593 c->vector_clipf = ff_vector_clipf_sse;
libavcodec/xvmc.h+0−4
@@ -33,8 +33,6 @@ · 32 unmodified lines
33#include "version.h"33#include "version.h"
34#include "avcodec.h"34#include "avcodec.h"
35 35
36#if FF_API_XVMC
37
38/**36/**
39 * @defgroup lavc_codec_hwaccel_xvmc XvMC37 * @defgroup lavc_codec_hwaccel_xvmc XvMC
40 * @ingroup lavc_codec_hwaccel38 * @ingroup lavc_codec_hwaccel
@@ -169,6 +167,4 @@ attribute_deprecated struct xvmc_pix_fmt { · 128 unmodified lines
169 * @}167 * @}
170 */168 */
171 169
172#endif /* FF_API_XVMC */
173
174#endif /* AVCODEC_XVMC_H */170#endif /* AVCODEC_XVMC_H */
libavcodec/xvmc_internal.h+0−7
@@ -25,14 +25,7 @@ · 24 unmodified lines
25#include "mpegvideo.h"25#include "mpegvideo.h"
26#include "version.h"26#include "version.h"
27 27
28#if FF_API_XVMC
29
30void ff_xvmc_init_block(MpegEncContext *s);28void ff_xvmc_init_block(MpegEncContext *s);
31void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);29void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);
32int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx);
33void ff_xvmc_field_end(MpegEncContext *s);
34void ff_xvmc_decode_mb(MpegEncContext *s);
35
36#endif /* FF_API_XVMC */
37 30
38#endif /* AVCODEC_XVMC_INTERNAL_H */31#endif /* AVCODEC_XVMC_INTERNAL_H */
libavutil/pixdesc.c+6−0
@@ -324,6 +324,12 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 323 unmodified lines
324 .flags = AV_PIX_FMT_FLAG_HWACCEL,324 .flags = AV_PIX_FMT_FLAG_HWACCEL,
325 },325 },
326#endif /* FF_API_XVMC */326#endif /* FF_API_XVMC */
327#if !FF_API_XVMC
328 [AV_PIX_FMT_XVMC] = {
329 .name = "xvmc",
330 .flags = AV_PIX_FMT_FLAG_HWACCEL,
331 },
332#endif /* !FF_API_XVMC */
327 [AV_PIX_FMT_UYVY422] = {333 [AV_PIX_FMT_UYVY422] = {
328 .name = "uyvy422",334 .name = "uyvy422",
329 .nb_components = 3,335 .nb_components = 3,
libavutil/pixfmt.h+4−0
@@ -83,6 +83,7 @@ enum AVPixelFormat { · 82 unmodified lines
83#if FF_API_XVMC83#if FF_API_XVMC
84 AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing84 AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
85 AV_PIX_FMT_XVMC_MPEG2_IDCT,85 AV_PIX_FMT_XVMC_MPEG2_IDCT,
86#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT
86#endif /* FF_API_XVMC */87#endif /* FF_API_XVMC */
87 AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y188 AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
88 AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y389 AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
@@ -262,6 +263,9 @@ enum AVPixelFormat { · 173 unmodified lines
262 AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */263 AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
263 AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */264 AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
264 AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */265 AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
266#if !FF_API_XVMC
267 AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
268#endif /* !FF_API_XVMC */
265 269
266 AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions270 AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
267 271

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t