From: Michael Niedermayer Date: Fri, 24 Feb 2012 01:57:18 +0000 (+0100) Subject: Merge remote-tracking branch 'qatar/master' X-Git-Tag: android-x86-4.4-r1~13288 X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=e2cc39b6096ed4353293252e3955417b7766f161;p=android-x86%2Fexternal-ffmpeg.git Merge remote-tracking branch 'qatar/master' * qatar/master: (40 commits) swf: check return values for av_get/new_packet(). wavpack: Don't shift minclip/maxclip rtpenc: Expose the max packet size via an avoption rtpenc: Move max_packet_size to a context variable rtpenc: Add an option for not sending RTCP packets lavc: drop encode() support for video. snowenc: switch to encode2(). snowenc: don't abuse input picture for storing information. a64multienc: switch to encode2(). a64multienc: don't write into output buffer when there's no output. libxvid: switch to encode2(). tiffenc: switch to encode2(). tiffenc: properly forward error codes in encode_frame(). lavc: drop libdirac encoder. gifenc: switch to encode2(). libvpxenc: switch to encode2(). flashsvenc: switch to encode2(). Remove libpostproc. lcl: don't overwrite input memory. swscale: take first/lastline over/underflows into account for MMX. ... Conflicts: .gitignore Makefile cmdutils.c configure doc/APIchanges libavcodec/Makefile libavcodec/allcodecs.c libavcodec/libdiracenc.c libavcodec/libxvidff.c libavcodec/qtrleenc.c libavcodec/tiffenc.c libavcodec/utils.c libavformat/mov.c libavformat/movenc.c libpostproc/Makefile libpostproc/postprocess.c libpostproc/postprocess.h libpostproc/postprocess_altivec_template.c libpostproc/postprocess_internal.h libpostproc/postprocess_template.c libswscale/swscale.c libswscale/utils.c Merged-by: Michael Niedermayer --- e2cc39b6096ed4353293252e3955417b7766f161 diff --cc configure index bf832c2b15,6278b9ab8e..7fdf0c0e5d --- a/configure +++ b/configure @@@ -1542,10 -1415,7 +1542,9 @@@ vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x h264_parser_select="golomb h264chroma h264dsp h264pred" # external libraries +libaacplus_encoder_deps="libaacplus" +libcelt_decoder_deps="libcelt" libdirac_decoder_deps="libdirac !libschroedinger" - libdirac_encoder_deps="libdirac" libfaac_encoder_deps="libfaac" libgsm_decoder_deps="libgsm" libgsm_encoder_deps="libgsm" @@@ -3139,14 -2935,9 +3138,14 @@@ check_mathfunc trunc enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32 enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init +enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus +enabled libass && require_pkg_config libass ass/ass.h ass_library_init +enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && + { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || + die "ERROR: libcelt version must be >= 0.11.0."; } enabled libdirac && require_pkg_config dirac \ - "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \ - "dirac_decoder_init dirac_encoder_init" + "libdirac_decoder/dirac_parser.h" \ + "dirac_decoder_init" enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm diff --cc libavcodec/Makefile index 0b144c8635,b177450563..f46708368f --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@@ -601,9 -554,9 +601,9 @@@ OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \ flacdec.o flacdata.o flac.o \ - mpegaudiodata.o + mpegaudiodata.o vorbis_data.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o - OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o timecode.o -OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o ++OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o timecode.o OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o @@@ -621,10 -572,7 +621,9 @@@ OBJS-$(CONFIG_WEBM_MUXER) OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o # external codec libraries +OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o +OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o - OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o diff --cc libavcodec/allcodecs.c index ef9a5ae52b,3d3289c4ee..18121ba808 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@@ -398,9 -371,7 +398,9 @@@ void avcodec_register_all(void REGISTER_ENCDEC (XSUB, xsub); /* external libraries */ + REGISTER_ENCODER (LIBAACPLUS, libaacplus); + REGISTER_DECODER (LIBCELT, libcelt); - REGISTER_ENCDEC (LIBDIRAC, libdirac); + REGISTER_DECODER (LIBDIRAC, libdirac); REGISTER_ENCODER (LIBFAAC, libfaac); REGISTER_ENCDEC (LIBGSM, libgsm); REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms); diff --cc libavcodec/ffv1.c index 1535c5e462,d2324fa41b..4c0ea4517e --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@@ -1843,10 -1754,10 +1855,10 @@@ AVCodec ff_ffv1_encoder = .id = CODEC_ID_FFV1, .priv_data_size = sizeof(FFV1Context), .init = encode_init, - .encode = encode_frame, + .encode2 = encode_frame, .close = common_end, .capabilities = CODEC_CAP_SLICE_THREADS, - .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE}, + .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUVA420P, PIX_FMT_YUV444P, PIX_FMT_YUVA444P, PIX_FMT_YUV440P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_0RGB32, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_YUV420P9, PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, PIX_FMT_GRAY16, PIX_FMT_GRAY8, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"), }; #endif diff --cc libavcodec/libxvidff.c index 1501b44135,44580d1364..a77fafc7ec --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@@ -33,6 -32,10 +33,7 @@@ #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libxvid_internal.h" + #include "mpegvideo.h" -#if !HAVE_MKSTEMP -#include -#endif /** * Buffer management macros. diff --cc libavcodec/qtrleenc.c index da520bc7eb,6936722df7..6ca4a3e818 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@@ -102,10 -97,10 +103,10 @@@ static av_cold int qtrle_encode_init(AV return -1; } - s->max_buf_size = s->logical_width*s->avctx->height*s->pixel_size /* image base material */ - s->max_buf_size = s->avctx->width*s->avctx->height*s->pixel_size*2 /* image base material */ - + 15 /* header + footer */ - + s->avctx->height*2 /* skip code+rle end */ - + s->avctx->width/MAX_RLE_BULK + 1 /* rle codes */; ++ s->max_buf_size = s->logical_width*s->avctx->height*s->pixel_size*2 /* image base material */ + + 15 /* header + footer */ + + s->avctx->height*2 /* skip code+rle end */ + + s->logical_width/MAX_RLE_BULK + 1 /* rle codes */; avctx->coded_frame = &s->frame; return 0; } @@@ -113,9 -108,9 +114,9 @@@ /** * Compute the best RLE sequence for a line */ - static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t **buf) + static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, uint8_t **buf) { - int width=s->avctx->width; + int width=s->logical_width; int i; signed char rlecode; @@@ -349,8 -333,8 +355,8 @@@ AVCodec ff_qtrle_encoder = .id = CODEC_ID_QTRLE, .priv_data_size = sizeof(QtrleEncContext), .init = qtrle_encode_init, - .encode = qtrle_encode_frame, + .encode2 = qtrle_encode_frame, .close = qtrle_encode_end, - .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB555BE, PIX_FMT_ARGB, PIX_FMT_NONE}, + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB555BE, PIX_FMT_ARGB, PIX_FMT_GRAY8, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"), }; diff --cc libavformat/mov.c index ff97a9b58f,b11e0bfef7..15df2bf198 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@@ -30,8 -31,7 +31,9 @@@ #include "libavutil/mathematics.h" #include "libavutil/avstring.h" #include "libavutil/dict.h" +#include "libavutil/opt.h" +#include "libavutil/timecode.h" + #include "libavcodec/ac3tab.h" #include "avformat.h" #include "internal.h" #include "avio_internal.h" diff --cc libavformat/movenc.c index 138c00fcb4,2c6a6e1864..472281957b --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@@ -52,8 -51,8 +52,8 @@@ static const AVOption options[] = { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), + FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags) - { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, + { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, { "frag_duration", "Maximum fragment duration", offsetof(MOVMuxContext, max_fragment_duration), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, diff --cc libavformat/rtpenc.c index 4b1ff1d889,e4ef0fc92b..32288684eb --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@@ -82,14 -83,16 +83,16 @@@ static int is_supported(enum CodecID id static int rtp_write_header(AVFormatContext *s1) { RTPMuxContext *s = s1->priv_data; - int max_packet_size, n; + int n; AVStream *st; - if (s1->nb_streams != 1) - return -1; + if (s1->nb_streams != 1) { + av_log(s1, AV_LOG_ERROR, "Only one stream supported in the RTP muxer\n"); + return AVERROR(EINVAL); + } st = s1->streams[0]; if (!is_supported(st->codec->codec_id)) { - av_log(s1, AV_LOG_ERROR, "Unsupported codec %x\n", st->codec->codec_id); + av_log(s1, AV_LOG_ERROR, "Unsupported codec %s\n", avcodec_get_name(st->codec->codec_id)); return -1; } diff --cc libswscale/swscale.c index 0578e2dacc,bd909bf163..6dc02b4422 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@@ -431,14 -406,15 +431,16 @@@ static int swScale(SwsContext *c, cons dst[2] + dstStride[2] * chrDstY, (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3] + dstStride[3] * dstY : NULL, }; + int use_mmx_vfilter= c->use_mmx_vfilter; - const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input - const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<chrDstVSubSample) - 1), dstH-1)]; - const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input - int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input - int lastLumSrcY2=firstLumSrcY2+ vLumFilterSize -1; // Last line needed as input - int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input + const int firstLumSrcY= FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]); //First line needed as input + const int firstLumSrcY2= FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1<chrDstVSubSample) - 1), dstH-1)]); + const int firstChrSrcY= FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]); //First line needed as input + + // Last line needed as input + int lastLumSrcY = FFMIN(c->srcH, firstLumSrcY + vLumFilterSize) - 1; + int lastLumSrcY2 = FFMIN(c->srcH, firstLumSrcY2 + vLumFilterSize) - 1; + int lastChrSrcY = FFMIN(c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1; int enough_lines; //handle holes (FAST_BILINEAR & weird filters) diff --cc libswscale/utils.c index 70b724e043,796adb60e1..129e6b7616 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@@ -936,9 -912,9 +937,9 @@@ int sws_init_context(SwsContext *c, Sws c->chrXInc+= 20; } //we don't use the x86 asm scaler if MMX is available - else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) { + else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->dstBpc <= 10) { - c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; - c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; + c->lumXInc = ((int64_t)(srcW-2)<<16)/(dstW-2) - 20; + c->chrXInc = ((int64_t)(c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } diff --cc libswscale/x86/swscale_mmx.c index 10a1542d34,64d5f0fc9d..28fc004573 --- a/libswscale/x86/swscale_mmx.c +++ b/libswscale/x86/swscale_mmx.c @@@ -114,10 -113,48 +114,48 @@@ void updateMMXDitherTables(SwsContext * c->greenDither= ff_dither4[dstY&1]; c->redDither= ff_dither8[(dstY+1)&1]; if (dstY < dstH - 2) { - const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; - const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; - const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; + const int16_t **lumSrcPtr= (const int16_t **)(void*) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; + const int16_t **chrUSrcPtr= (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; + const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; int i; + + if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) { + const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize; + int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize); + for (i = 0; i < neg; i++) + tmpY[i] = lumSrcPtr[neg]; + for ( ; i < end; i++) + tmpY[i] = lumSrcPtr[i]; + for ( ; i < vLumFilterSize; i++) + tmpY[i] = tmpY[i-1]; + lumSrcPtr = tmpY; + + if (alpSrcPtr) { + const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize; + for (i = 0; i < neg; i++) + tmpA[i] = alpSrcPtr[neg]; + for ( ; i < end; i++) + tmpA[i] = alpSrcPtr[i]; + for ( ; i < vLumFilterSize; i++) + tmpA[i] = tmpA[i - 1]; + alpSrcPtr = tmpA; + } + } + if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) { + const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize; + int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize); + for (i = 0; i < neg; i++) { + tmpU[i] = chrUSrcPtr[neg]; + } + for ( ; i < end; i++) { + tmpU[i] = chrUSrcPtr[i]; + } + for ( ; i < vChrFilterSize; i++) { + tmpU[i] = tmpU[i - 1]; + } + chrUSrcPtr = tmpU; + } + if (flags & SWS_ACCURATE_RND) { int s= APCK_SIZE / 8; for (i=0; i