diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-14 11:22:40 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-14 11:59:20 +0100 |
commit | e13d5e9a4b5b4de065b00b1caea850cd47fd4b18 (patch) | |
tree | 13bf2f01763823c4e4da6374acadc95b3f8bc121 /libavcodec | |
parent | 26afdbcfc0ecd646c6d829b781e0a53d6b289186 (diff) | |
parent | 5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2 (diff) | |
download | ffmpeg-e13d5e9a4b5b4de065b00b1caea850cd47fd4b18.tar.gz |
Merge commit '5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2'
* commit '5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2':
x86: h264_weight_10bit: port to cpuflags
libtheoraenc: add missing pixdesc.h header
avcodec: remove ff_is_hwaccel_pix_fmt
pixdesc: add av_pix_fmt_get_chroma_sub_sample
hlsenc: stand alone hls segmenter
Conflicts:
doc/muxers.texi
libavcodec/ffv1enc.c
libavcodec/imgconvert.c
libavcodec/mpegvideo_enc.c
libavcodec/tiffenc.c
libavformat/Makefile
libavformat/allformats.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 6 | ||||
-rw-r--r-- | libavcodec/imgconvert.c | 6 | ||||
-rw-r--r-- | libavcodec/internal.h | 5 | ||||
-rw-r--r-- | libavcodec/libtheoraenc.c | 1 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 9 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 7 | ||||
-rw-r--r-- | libavcodec/tiffenc.c | 3 | ||||
-rw-r--r-- | libavcodec/utils.c | 11 | ||||
-rw-r--r-- | libavcodec/x86/h264_weight_10bit.asm | 132 |
9 files changed, 92 insertions, 88 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4e662c2cd0..f6e0ee78c1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4579,7 +4579,11 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); /** * Return a value representing the fourCC code associated to the diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index de64b87743..43eeba7082 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -431,12 +431,6 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift = desc->log2_chroma_h; } -int ff_is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - return desc->flags & PIX_FMT_HWACCEL; -} - int avpicture_fill(AVPicture *picture, const uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height) { diff --git a/libavcodec/internal.h b/libavcodec/internal.h index a5e52b0c10..17ca8bb8c2 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -99,11 +99,6 @@ struct AVCodecDefault { }; /** - * Determine whether pix_fmt is a hardware accelerated format. - */ -int ff_is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt); - -/** * Return the hardware accelerated codec for codec codec_id and * pixel format pix_fmt. * diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 364581a4b2..5a866740c8 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -33,6 +33,7 @@ /* FFmpeg includes */ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" +#include "libavutil/pixdesc.h" #include "libavutil/log.h" #include "libavutil/base64.h" #include "avcodec.h" diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 1bf8c6e85e..f496e830a2 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -839,9 +839,8 @@ av_cold int ff_MPV_common_init(MpegEncContext *s) s->flags = s->avctx->flags; s->flags2 = s->avctx->flags2; - /* set chroma shifts */ - avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, - &s->chroma_y_shift); + /* set chroma shifts */ + avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); /* convert fourcc to upper case */ s->codec_tag = avpriv_toupper4(s->avctx->codec_tag); @@ -1762,8 +1761,8 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict) (s->codec_id == AV_CODEC_ID_H264 ? 0 : 1); s->low_delay = 0; // needed to see the vectors without trashing the buffers - avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, - &h_chroma_shift, &v_chroma_shift); + avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); + for (i = 0; i < 3; i++) { size_t size= (i == 0) ? pict->linesize[i] * FFALIGN(height, 16): pict->linesize[i] * FFALIGN(height, 16) >> v_chroma_shift; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 256b8d4e4d..3cf75113b8 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -29,6 +29,7 @@ #include "libavutil/intmath.h" #include "libavutil/mathematics.h" +#include "libavutil/pixdesc.h" #include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" @@ -687,8 +688,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_DEBUG, "intra_quant_bias = %d inter_quant_bias = %d\n",s->intra_quant_bias,s->inter_quant_bias); - avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, - &chroma_v_shift); + avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if (avctx->codec_id == AV_CODEC_ID_MPEG4 && s->avctx->time_base.den > (1 << 16) - 1) { @@ -1074,8 +1074,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) // empty } else { int h_chroma_shift, v_chroma_shift; - avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, - &v_chroma_shift); + avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < 3; i++) { int src_stride = pic_arg->linesize[i]; diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index d4402859f0..61294b9207 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -293,8 +293,7 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, case AV_PIX_FMT_YUV410P: case AV_PIX_FMT_YUV411P: s->photometric_interpretation = 6; - avcodec_get_chroma_sub_sample(avctx->pix_fmt, - &shift_h, &shift_v); + avcodec_get_chroma_sub_sample(avctx->pix_fmt, &shift_h, &shift_v); s->subsampling[0] = 1 << shift_h; s->subsampling[1] = 1 << shift_v; is_yuv = 1; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 0d3cb81bf1..364ce0f0ae 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -491,7 +491,8 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt); const int pixel_size = desc->comp[0].step_minus1 + 1; - avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); + av_pix_fmt_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, + &v_chroma_shift); avcodec_align_dimensions2(s, &w, &h, stride_align); @@ -689,9 +690,15 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, return 0; } +static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + return desc->flags & PIX_FMT_HWACCEL; +} + enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt) { - while (*fmt != AV_PIX_FMT_NONE && ff_is_hwaccel_pix_fmt(*fmt)) + while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt)) ++fmt; return fmt[0]; } diff --git a/libavcodec/x86/h264_weight_10bit.asm b/libavcodec/x86/h264_weight_10bit.asm index 20d26a49c3..3b09e420d2 100644 --- a/libavcodec/x86/h264_weight_10bit.asm +++ b/libavcodec/x86/h264_weight_10bit.asm @@ -48,7 +48,7 @@ SECTION .text movifnidn r5d, r5m %endmacro -%macro WEIGHT_SETUP 1 +%macro WEIGHT_SETUP 0 mova m0, [pw_1] movd m2, r3m pslld m0, m2 ; 1<<log2_denom @@ -59,19 +59,19 @@ SECTION .text pshufd m3, m3, 0 mova m4, [pw_pixel_max] paddw m2, [sq_1] ; log2_denom+1 -%ifnidn %1, sse4 +%if notcpuflag(sse4) pxor m7, m7 %endif %endmacro -%macro WEIGHT_OP 2-3 -%if %0==2 - mova m5, [r0+%2] +%macro WEIGHT_OP 1-2 +%if %0==1 + mova m5, [r0+%1] punpckhwd m6, m5, m0 punpcklwd m5, m0 %else - movq m5, [r0+%2] - movq m6, [r0+%3] + movq m5, [r0+%1] + movq m6, [r0+%2] punpcklwd m5, m0 punpcklwd m6, m0 %endif @@ -79,7 +79,7 @@ SECTION .text pmaddwd m6, m3 psrad m5, m2 psrad m6, m2 -%ifidn %1, sse4 +%if cpuflag(sse4) packusdw m5, m6 pminsw m5, m4 %else @@ -88,14 +88,14 @@ SECTION .text %endif %endmacro -%macro WEIGHT_FUNC_DBL 1 -cglobal h264_weight_16_10_%1 +%macro WEIGHT_FUNC_DBL 0 +cglobal h264_weight_16_10 WEIGHT_PROLOGUE - WEIGHT_SETUP %1 + WEIGHT_SETUP .nextrow: - WEIGHT_OP %1, 0 + WEIGHT_OP 0 mova [r0 ], m5 - WEIGHT_OP %1, 16 + WEIGHT_OP 16 mova [r0+16], m5 add r0, r1 dec r2d @@ -103,17 +103,18 @@ cglobal h264_weight_16_10_%1 REP_RET %endmacro -INIT_XMM -WEIGHT_FUNC_DBL sse2 -WEIGHT_FUNC_DBL sse4 +INIT_XMM sse2 +WEIGHT_FUNC_DBL +INIT_XMM sse4 +WEIGHT_FUNC_DBL -%macro WEIGHT_FUNC_MM 1 -cglobal h264_weight_8_10_%1 +%macro WEIGHT_FUNC_MM 0 +cglobal h264_weight_8_10 WEIGHT_PROLOGUE - WEIGHT_SETUP %1 + WEIGHT_SETUP .nextrow: - WEIGHT_OP %1, 0 + WEIGHT_OP 0 mova [r0], m5 add r0, r1 dec r2d @@ -121,19 +122,20 @@ cglobal h264_weight_8_10_%1 REP_RET %endmacro -INIT_XMM -WEIGHT_FUNC_MM sse2 -WEIGHT_FUNC_MM sse4 +INIT_XMM sse2 +WEIGHT_FUNC_MM +INIT_XMM sse4 +WEIGHT_FUNC_MM -%macro WEIGHT_FUNC_HALF_MM 1 -cglobal h264_weight_4_10_%1 +%macro WEIGHT_FUNC_HALF_MM 0 +cglobal h264_weight_4_10 WEIGHT_PROLOGUE sar r2d, 1 - WEIGHT_SETUP %1 + WEIGHT_SETUP lea r3, [r1*2] .nextrow: - WEIGHT_OP %1, 0, r1 + WEIGHT_OP 0, r1 movh [r0], m5 movhps [r0+r1], m5 add r0, r3 @@ -142,9 +144,10 @@ cglobal h264_weight_4_10_%1 REP_RET %endmacro -INIT_XMM -WEIGHT_FUNC_HALF_MM sse2 -WEIGHT_FUNC_HALF_MM sse4 +INIT_XMM sse2 +WEIGHT_FUNC_HALF_MM +INIT_XMM sse4 +WEIGHT_FUNC_HALF_MM ;----------------------------------------------------------------------------- @@ -168,7 +171,7 @@ DECLARE_REG_TMP 7 movifnidn t0d, r7m %endmacro -%macro BIWEIGHT_SETUP 1 +%macro BIWEIGHT_SETUP 0 lea t0, [t0*4+1] ; (offset<<2)+1 or t0, 1 shl r6, 16 @@ -182,23 +185,23 @@ DECLARE_REG_TMP 7 pshufd m5, m5, 0 mova m3, [pw_pixel_max] movifnidn r3d, r3m -%ifnidn %1, sse4 +%if notcpuflag(sse4) pxor m7, m7 %endif %endmacro -%macro BIWEIGHT 2-3 -%if %0==2 - mova m0, [r0+%2] - mova m1, [r1+%2] +%macro BIWEIGHT 1-2 +%if %0==1 + mova m0, [r0+%1] + mova m1, [r1+%1] punpckhwd m2, m0, m1 punpcklwd m0, m1 %else - movq m0, [r0+%2] - movq m1, [r1+%2] + movq m0, [r0+%1] + movq m1, [r1+%1] punpcklwd m0, m1 - movq m2, [r0+%3] - movq m1, [r1+%3] + movq m2, [r0+%2] + movq m1, [r1+%2] punpcklwd m2, m1 %endif pmaddwd m0, m4 @@ -207,7 +210,7 @@ DECLARE_REG_TMP 7 paddd m2, m5 psrad m0, m6 psrad m2, m6 -%ifidn %1, sse4 +%if cpuflag(sse4) packusdw m0, m2 pminsw m0, m3 %else @@ -216,14 +219,14 @@ DECLARE_REG_TMP 7 %endif %endmacro -%macro BIWEIGHT_FUNC_DBL 1 -cglobal h264_biweight_16_10_%1 +%macro BIWEIGHT_FUNC_DBL 0 +cglobal h264_biweight_16_10 BIWEIGHT_PROLOGUE - BIWEIGHT_SETUP %1 + BIWEIGHT_SETUP .nextrow: - BIWEIGHT %1, 0 + BIWEIGHT 0 mova [r0 ], m0 - BIWEIGHT %1, 16 + BIWEIGHT 16 mova [r0+16], m0 add r0, r2 add r1, r2 @@ -232,16 +235,17 @@ cglobal h264_biweight_16_10_%1 REP_RET %endmacro -INIT_XMM -BIWEIGHT_FUNC_DBL sse2 -BIWEIGHT_FUNC_DBL sse4 +INIT_XMM sse2 +BIWEIGHT_FUNC_DBL +INIT_XMM sse4 +BIWEIGHT_FUNC_DBL -%macro BIWEIGHT_FUNC 1 -cglobal h264_biweight_8_10_%1 +%macro BIWEIGHT_FUNC 0 +cglobal h264_biweight_8_10 BIWEIGHT_PROLOGUE - BIWEIGHT_SETUP %1 + BIWEIGHT_SETUP .nextrow: - BIWEIGHT %1, 0 + BIWEIGHT 0 mova [r0], m0 add r0, r2 add r1, r2 @@ -250,18 +254,19 @@ cglobal h264_biweight_8_10_%1 REP_RET %endmacro -INIT_XMM -BIWEIGHT_FUNC sse2 -BIWEIGHT_FUNC sse4 +INIT_XMM sse2 +BIWEIGHT_FUNC +INIT_XMM sse4 +BIWEIGHT_FUNC -%macro BIWEIGHT_FUNC_HALF 1 -cglobal h264_biweight_4_10_%1 +%macro BIWEIGHT_FUNC_HALF 0 +cglobal h264_biweight_4_10 BIWEIGHT_PROLOGUE - BIWEIGHT_SETUP %1 + BIWEIGHT_SETUP sar r3d, 1 lea r4, [r2*2] .nextrow: - BIWEIGHT %1, 0, r2 + BIWEIGHT 0, r2 movh [r0 ], m0 movhps [r0+r2], m0 add r0, r4 @@ -271,6 +276,7 @@ cglobal h264_biweight_4_10_%1 REP_RET %endmacro -INIT_XMM -BIWEIGHT_FUNC_HALF sse2 -BIWEIGHT_FUNC_HALF sse4 +INIT_XMM sse2 +BIWEIGHT_FUNC_HALF +INIT_XMM sse4 +BIWEIGHT_FUNC_HALF |