diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-09 19:09:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-09 19:31:56 +0200 |
commit | 9f088a1ed4d34f0cf4244a4b80960af9e8f23dfc (patch) | |
tree | 049c8db5ee42c462bfe3d999146a224cff29bf03 /libavcodec | |
parent | e1a983e6010930ab742bede275de1ccf921485b7 (diff) | |
parent | f69f4036f8cc3b673864dce01d2714fd5e49e8da (diff) | |
download | ffmpeg-9f088a1ed4d34f0cf4244a4b80960af9e8f23dfc.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mpegvideo: reduce excessive inlining of mpeg_motion()
mpegvideo: convert mpegvideo_common.h to a .c file
build: factor out mpegvideo.o dependencies to CONFIG_MPEGVIDEO
Move MASK_ABS macro to libavcodec/mathops.h
x86: move MANGLE() and related macros to libavutil/x86/asm.h
x86: rename libavutil/x86_cpu.h to libavutil/x86/asm.h
aacdec: Don't fall back to the old output configuration when no old configuration is present.
rtmp: Add message tracking
rtsp: Support mpegts in raw udp packets
rtsp: Support receiving plain data over UDP without any RTP encapsulation
rtpdec: Remove an unused include
rtpenc: Remove an av_abort() that depends on user-supplied data
vsrc_movie: discourage its use with avconv.
avconv: allow no input files.
avconv: prevent invalid reads in transcode_init()
avconv: rename OutputStream.is_past_recording_time to finished.
Conflicts:
configure
doc/filters.texi
ffmpeg.c
ffmpeg.h
libavcodec/Makefile
libavcodec/aacdec.c
libavcodec/mpegvideo.c
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
34 files changed, 142 insertions, 125 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index c32afe0953..1f977bea45 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -54,6 +54,7 @@ OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_fixed.o \ mpegaudiodsp_float.o +OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) OBJS-$(CONFIG_SINEWIN) += sinewin.o @@ -126,7 +127,7 @@ OBJS-$(CONFIG_BMV_VIDEO_DECODER) += bmv.o OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmv.o OBJS-$(CONFIG_C93_DECODER) += c93.o OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ - mpeg12data.o mpegvideo.o + mpeg12data.o OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o @@ -145,8 +146,7 @@ OBJS-$(CONFIG_DFA_DECODER) += dfa.o OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \ mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ - mpegvideo.o + ratecontrol.o mpeg12data.o OBJS-$(CONFIG_DPX_DECODER) += dpx.o OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o @@ -164,13 +164,11 @@ OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \ ac3tab.o ac3.o kbdwin.o eac3_data.o OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \ - mpeg12data.o mpegvideo.o \ - error_resilience.o + mpeg12data.o error_resilience.o OBJS-$(CONFIG_EATGQ_DECODER) += eatgq.o eaidct.o OBJS-$(CONFIG_EATGV_DECODER) += eatgv.o OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \ - mpeg12data.o mpegvideo.o \ - error_resilience.o + mpeg12data.o error_resilience.o OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o @@ -200,27 +198,24 @@ OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o -OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o h261data.o \ - mpegvideo.o error_resilience.o +OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o h261data.o error_resilience.o OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o h261data.o \ mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ - mpegvideo.o + ratecontrol.o mpeg12data.o OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \ mpeg4video.o mpeg4videodec.o flvdec.o\ - intelh263dec.o mpegvideo.o \ - error_resilience.o + intelh263dec.o error_resilience.o OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \ mpeg4videoenc.o motion_est.o \ ratecontrol.o h263.o ituh263enc.o \ flvenc.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_H264_DECODER) += h264.o \ h264_loopfilter.o h264_direct.o \ cabac.o h264_sei.o h264_ps.o \ h264_refs.o h264_cavlc.o h264_cabac.o\ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o @@ -250,20 +245,18 @@ OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o \ mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ - mpegvideo.o + ratecontrol.o mpeg12data.o OBJS-$(CONFIG_LOCO_DECODER) += loco.o OBJS-$(CONFIG_MACE3_DECODER) += mace.o OBJS-$(CONFIG_MACE6_DECODER) += mace.o OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \ mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ - mpegvideo.o + ratecontrol.o mpeg12data.o OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o @@ -304,21 +297,21 @@ OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ timecode.o \ motion_est.o ratecontrol.o \ mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ timecode.o \ motion_est.o ratecontrol.o \ mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \ @@ -400,9 +393,9 @@ OBJS-$(CONFIG_RV10_ENCODER) += rv10enc.o OBJS-$(CONFIG_RV20_DECODER) += rv10.o OBJS-$(CONFIG_RV20_ENCODER) += rv20enc.o OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o rv34dsp.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv34dsp.o rv40dsp.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_SAMI_DECODER) += samidec.o ass.o OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_SANM_DECODER) += sanm.o @@ -419,7 +412,7 @@ OBJS-$(CONFIG_SMC_DECODER) += smc.o OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o rangecoder.o OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o rangecoder.o \ motion_est.o ratecontrol.o \ - h263.o mpegvideo.o \ + h263.o \ error_resilience.o ituh263enc.o \ mpegvideo_enc.o mpeg12data.o OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o @@ -433,17 +426,17 @@ OBJS-$(CONFIG_SUBVIEWER_DECODER) += subviewerdec.o ass.o OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \ motion_est.o h263.o \ - mpegvideo.o error_resilience.o \ + error_resilience.o \ ituh263enc.o mpegvideo_enc.o \ ratecontrol.o mpeg12data.o OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o \ h264_loopfilter.o h264_direct.o \ h264_sei.o h264_ps.o h264_refs.o \ h264_cavlc.o h264_cabac.o cabac.o \ - mpegvideo.o error_resilience.o \ + error_resilience.o \ svq1dec.o svq1.o h263.o OBJS-$(CONFIG_TARGA_DECODER) += targa.o OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o @@ -652,7 +645,7 @@ OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.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_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MXF_MUXER) += timecode.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o @@ -661,7 +654,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += xiph.o flac.o flacdata.o \ dirac.o vorbis_data.o OBJS-$(CONFIG_OGG_MUXER) += xiph.o flac.o flacdata.o \ vorbis_data.o -OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o +OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o xiph.o OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o OBJS-$(CONFIG_SPDIF_MUXER) += dca.o OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o mpegaudiodata.o \ @@ -737,12 +730,12 @@ OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \ h264_refs.o h264_sei.o h264_direct.o \ h264_loopfilter.o h264_cabac.o \ h264_cavlc.o h264_ps.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \ - mpegvideo.o error_resilience.o \ + error_resilience.o \ mpeg4videodec.o mpeg4video.o \ ituh263dec.o h263dec.o OBJS-$(CONFIG_PNG_PARSER) += png_parser.o @@ -750,13 +743,13 @@ OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \ mpegaudiodecheader.o mpegaudiodata.o OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \ mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o + error_resilience.o OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ msmpeg4.o msmpeg4data.o mpeg4video.o \ - h263.o mpegvideo.o error_resilience.o + h263.o error_resilience.o OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 909ecb173f..df2a494fba 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -369,12 +369,10 @@ static void push_output_configuration(AACContext *ac) { * configuration is unlocked. */ static void pop_output_configuration(AACContext *ac) { - if (ac->oc[1].status != OC_LOCKED) { - if (ac->oc[0].status == OC_LOCKED) { - ac->oc[1] = ac->oc[0]; - ac->avctx->channels = ac->oc[1].channels; - ac->avctx->channel_layout = ac->oc[1].channel_layout; - } + if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) { + ac->oc[1] = ac->oc[0]; + ac->avctx->channels = ac->oc[1].channels; + ac->avctx->channel_layout = ac->oc[1].channel_layout; } } diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index df5a32c0d4..04284e3e3a 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -31,7 +31,6 @@ #include "dsputil.h" #include "internal.h" #include "mpegvideo.h" -#include "mpegvideo_common.h" #include "dnxhdenc.h" #include "internal.h" diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index 3ef7f8b660..2840735c79 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -138,6 +138,13 @@ if ((y) < (x)) {\ } #endif +#ifndef MASK_ABS +#define MASK_ABS(mask, level) do { \ + mask = level >> 31; \ + level = (level ^ mask) - mask; \ + } while (0) +#endif + #ifndef NEG_SSR32 # define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) #endif diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 2766fbf59a..e488af071d 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -895,7 +895,7 @@ static void mpeg1_encode_block(MpegEncContext *s, run = i - last_non_zero - 1; alevel= level; - MASK_ABS(sign, alevel) + MASK_ABS(sign, alevel); sign&=1; if (alevel <= mpeg1_max_level[0][run]){ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 97bc46b052..924ddd6263 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -33,7 +33,6 @@ #include "dsputil.h" #include "internal.h" #include "mpegvideo.h" -#include "mpegvideo_common.h" #include "mjpegenc.h" #include "msmpeg4.h" #include "xvmc_internal.h" @@ -2388,12 +2387,12 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], op_pix = s->dsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { - MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); + ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { - MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); + ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); } } } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 38fce9f73c..3c6f13a2cd 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -748,6 +748,13 @@ static const AVClass name ## _class = {\ .version = LIBAVUTIL_VERSION_INT,\ }; +/** + * Set the given MpegEncContext to common defaults (same for encoding + * and decoding). The changed fields will not depend upon the prior + * state of the MpegEncContext. + */ +void ff_MPV_common_defaults(MpegEncContext *s); + void ff_MPV_decode_defaults(MpegEncContext *s); int ff_MPV_common_init(MpegEncContext *s); void ff_MPV_common_end(MpegEncContext *s); @@ -786,10 +793,18 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en int ff_dct_common_init(MpegEncContext *s); void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra); +int ff_dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); void ff_init_block_index(MpegEncContext *s); void ff_copy_picture(Picture *dst, Picture *src); +void ff_MPV_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, + uint8_t *dest_cr, int dir, + uint8_t **ref_picture, + op_pixels_func (*pix_op)[4], + qpel_mc_func (*qpix_op)[16]); + /** * Allocate a Picture. * The pixels are allocated/set by calling get_buffer() if shared = 0. diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index e34d56c288..5137dfa628 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -33,7 +33,6 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" -#include "mpegvideo_common.h" #include "h263.h" #include "mjpegenc.h" #include "msmpeg4.h" @@ -1897,14 +1896,16 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, } if (s->mv_dir & MV_DIR_FORWARD) { - MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, - op_pix, op_qpix); + ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, + s->last_picture.f.data, + op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { - MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, - op_pix, op_qpix); + ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, + s->next_picture.f.data, + op_pix, op_qpix); } if (s->flags & CODEC_FLAG_INTERLACED_DCT) { diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_motion.c index 67087c889a..354b60b386 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_motion.c @@ -1,5 +1,4 @@ /* - * The simplest mpeg encoder (well, it was the simplest!) * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * @@ -22,14 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * @file - * The simplest mpeg encoder (well, it was the simplest!). - */ - -#ifndef AVCODEC_MPEGVIDEO_COMMON_H -#define AVCODEC_MPEGVIDEO_COMMON_H - #include <string.h> #include "libavutil/avassert.h" #include "avcodec.h" @@ -39,14 +30,6 @@ #include "msmpeg4.h" #include <limits.h> -int ff_dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); - -/** - * Set the given MpegEncContext to common defaults (same for encoding and decoding). - * The changed fields will not depend upon the prior state of the MpegEncContext. - */ -void ff_MPV_common_defaults(MpegEncContext *s); - static inline void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture) @@ -357,21 +340,39 @@ if(s->quarter_sample) } } /* apply one mpeg motion vector to the three components */ -static av_always_inline -void mpeg_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - int field_based, int bottom_field, int field_select, - uint8_t **ref_picture, op_pixels_func (*pix_op)[4], - int motion_x, int motion_y, int h, int mb_y) +static void mpeg_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + int field_select, uint8_t **ref_picture, + op_pixels_func (*pix_op)[4], + int motion_x, int motion_y, int h, int mb_y) { #if !CONFIG_SMALL if(s->out_format == FMT_MPEG1) - mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based, + mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0, + field_select, ref_picture, pix_op, + motion_x, motion_y, h, 1, mb_y); + else +#endif + mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0, + field_select, ref_picture, pix_op, + motion_x, motion_y, h, 0, mb_y); +} + +static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, + uint8_t *dest_cb, uint8_t *dest_cr, + int bottom_field, int field_select, + uint8_t **ref_picture, + op_pixels_func (*pix_op)[4], + int motion_x, int motion_y, int h, int mb_y) +{ +#if !CONFIG_SMALL + if(s->out_format == FMT_MPEG1) + mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1, bottom_field, field_select, ref_picture, pix_op, motion_x, motion_y, h, 1, mb_y); else #endif - mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based, + mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1, bottom_field, field_select, ref_picture, pix_op, motion_x, motion_y, h, 0, mb_y); } @@ -726,8 +727,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { - mpeg_motion(s, dest_y, dest_cb, dest_cr, - 0, 0, 0, + mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y); } @@ -800,15 +800,15 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } }else{ /* top field */ - mpeg_motion(s, dest_y, dest_cb, dest_cr, - 1, 0, s->field_select[dir][0], - ref_picture, pix_op, - s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); + mpeg_motion_field(s, dest_y, dest_cb, dest_cr, + 0, s->field_select[dir][0], + ref_picture, pix_op, + s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); /* bottom field */ - mpeg_motion(s, dest_y, dest_cb, dest_cr, - 1, 1, s->field_select[dir][1], - ref_picture, pix_op, - s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); + mpeg_motion_field(s, dest_y, dest_cb, dest_cr, + 1, s->field_select[dir][1], + ref_picture, pix_op, + s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){ @@ -816,7 +816,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } mpeg_motion(s, dest_y, dest_cb, dest_cr, - 0, 0, s->field_select[dir][0], + s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1); } @@ -833,7 +833,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } mpeg_motion(s, dest_y, dest_cb, dest_cr, - 0, 0, s->field_select[dir][i], + s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1); @@ -847,17 +847,17 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ - mpeg_motion(s, dest_y, dest_cb, dest_cr, - 1, j, j^i, - ref_picture, pix_op, - s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y); + mpeg_motion_field(s, dest_y, dest_cb, dest_cr, + j, j^i, ref_picture, pix_op, + s->mv[dir][2*i + j][0], + s->mv[dir][2*i + j][1], 8, mb_y); } pix_op = s->dsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, - 0, 0, s->picture_structure != i+1, + s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1); @@ -875,12 +875,12 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } } -static inline void MPV_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, - uint8_t *dest_cr, int dir, - uint8_t **ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16]) +void ff_MPV_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, + uint8_t *dest_cr, int dir, + uint8_t **ref_picture, + op_pixels_func (*pix_op)[4], + qpel_mc_func (*qpix_op)[16]) { #if !CONFIG_SMALL if(s->out_format == FMT_MPEG1) @@ -891,4 +891,3 @@ static inline void MPV_motion(MpegEncContext *s, MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir, ref_picture, pix_op, qpix_op, 0); } -#endif /* AVCODEC_MPEGVIDEO_COMMON_H */ diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 71df53c823..b18e7deacd 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -31,7 +31,7 @@ #include "dsputil.h" #include "mpegvideo.h" #include "msmpeg4.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "h263.h" #include "mpeg4video.h" #include "msmpeg4data.h" diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c index 5549f3e550..cf1d7db8a4 100644 --- a/libavcodec/x86/ac3dsp_mmx.c +++ b/libavcodec/x86/ac3dsp_mmx.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "dsputil_mmx.h" #include "libavcodec/ac3dsp.h" diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h index 3fcd8abbc9..dc61a5bce2 100644 --- a/libavcodec/x86/cabac.h +++ b/libavcodec/x86/cabac.h @@ -23,7 +23,7 @@ #include "libavcodec/cabac.h" #include "libavutil/attributes.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavutil/internal.h" #include "config.h" diff --git a/libavcodec/x86/cavsdsp_mmx.c b/libavcodec/x86/cavsdsp_mmx.c index 05f192fc71..40875449fc 100644 --- a/libavcodec/x86/cavsdsp_mmx.c +++ b/libavcodec/x86/cavsdsp_mmx.c @@ -24,7 +24,7 @@ #include "libavutil/common.h" #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/cavsdsp.h" #include "dsputil_mmx.h" diff --git a/libavcodec/x86/dnxhd_mmx.c b/libavcodec/x86/dnxhd_mmx.c index 3c1e86955f..ccd1575545 100644 --- a/libavcodec/x86/dnxhd_mmx.c +++ b/libavcodec/x86/dnxhd_mmx.c @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dnxhdenc.h" #if HAVE_INLINE_ASM diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 6317f5dd7b..170cbbedf2 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -23,7 +23,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/h264dsp.h" #include "libavcodec/mpegvideo.h" diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h index d0b0344917..100381cb48 100644 --- a/libavcodec/x86/dsputil_mmx.h +++ b/libavcodec/x86/dsputil_mmx.h @@ -24,7 +24,7 @@ #include <stdint.h> #include "libavcodec/dsputil.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" typedef struct { uint64_t a, b; } xmm_reg; diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c index 77b7b7620e..65c38fa89d 100644 --- a/libavcodec/x86/dsputilenc_mmx.c +++ b/libavcodec/x86/dsputilenc_mmx.c @@ -23,7 +23,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" #include "libavcodec/mathops.h" diff --git a/libavcodec/x86/dwt.c b/libavcodec/x86/dwt.c index 7ef9e2414e..e718c80fef 100644 --- a/libavcodec/x86/dwt.c +++ b/libavcodec/x86/dwt.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "dsputil_mmx.h" #include "dwt.h" diff --git a/libavcodec/x86/fdct_mmx.c b/libavcodec/x86/fdct_mmx.c index f8fef4d8b2..566e0b66b3 100644 --- a/libavcodec/x86/fdct_mmx.c +++ b/libavcodec/x86/fdct_mmx.c @@ -31,7 +31,7 @@ */ #include "libavutil/common.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #if HAVE_INLINE_ASM diff --git a/libavcodec/x86/fmtconvert_mmx.c b/libavcodec/x86/fmtconvert_mmx.c index 814a17f631..361ac85faf 100644 --- a/libavcodec/x86/fmtconvert_mmx.c +++ b/libavcodec/x86/fmtconvert_mmx.c @@ -23,7 +23,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/fmtconvert.h" #include "libavcodec/dsputil.h" diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c index 87b9452501..ea71515079 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_mmx.c @@ -19,7 +19,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/h264dsp.h" #include "dsputil_mmx.h" diff --git a/libavcodec/x86/idct_mmx.c b/libavcodec/x86/idct_mmx.c index 2408ab26ad..4b92f5c2fa 100644 --- a/libavcodec/x86/idct_mmx.c +++ b/libavcodec/x86/idct_mmx.c @@ -22,7 +22,7 @@ #include "libavutil/common.h" #include "libavcodec/dsputil.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "dsputil_mmx.h" #if HAVE_INLINE_ASM diff --git a/libavcodec/x86/idct_sse2_xvid.c b/libavcodec/x86/idct_sse2_xvid.c index 3708f93df8..0f4f53c655 100644 --- a/libavcodec/x86/idct_sse2_xvid.c +++ b/libavcodec/x86/idct_sse2_xvid.c @@ -39,7 +39,7 @@ */ #include "libavcodec/dsputil.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "idct_xvid.h" #include "dsputil_mmx.h" diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c index 087a324a43..e0e6f8ba8a 100644 --- a/libavcodec/x86/lpc_mmx.c +++ b/libavcodec/x86/lpc_mmx.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavutil/cpu.h" #include "libavcodec/lpc.h" diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 78f37f24eb..79e29e6232 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -101,6 +101,12 @@ __asm__ volatile(\ ); #endif +#define MASK_ABS(mask, level) \ + __asm__ ("cltd \n\t" \ + "xorl %1, %0 \n\t" \ + "subl %1, %0 \n\t" \ + : "+a"(level), "=&d"(mask)) + // avoid +32 for shift optimization (gcc should do that ...) #define NEG_SSR32 NEG_SSR32 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c index 7ea77fc1b8..6b9f9efd83 100644 --- a/libavcodec/x86/mlpdsp.c +++ b/libavcodec/x86/mlpdsp.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/mlp.h" diff --git a/libavcodec/x86/motion_est_mmx.c b/libavcodec/x86/motion_est_mmx.c index e48a7fd398..06da8fa9db 100644 --- a/libavcodec/x86/motion_est_mmx.c +++ b/libavcodec/x86/motion_est_mmx.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" diff --git a/libavcodec/x86/mpegaudiodec_mmx.c b/libavcodec/x86/mpegaudiodec_mmx.c index 0d6cc08305..7bc0c30c4f 100644 --- a/libavcodec/x86/mpegaudiodec_mmx.c +++ b/libavcodec/x86/mpegaudiodec_mmx.c @@ -20,7 +20,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegaudiodsp.h" diff --git a/libavcodec/x86/mpegvideo_mmx.c b/libavcodec/x86/mpegvideo_mmx.c index 44d4cd3a8a..f3927f0eae 100644 --- a/libavcodec/x86/mpegvideo_mmx.c +++ b/libavcodec/x86/mpegvideo_mmx.c @@ -23,7 +23,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c index 7284a9beaf..b07ad89f0e 100644 --- a/libavcodec/x86/rv34dsp_init.c +++ b/libavcodec/x86/rv34dsp_init.c @@ -20,7 +20,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/rv34dsp.h" diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c index 5d47206e81..631291aafe 100644 --- a/libavcodec/x86/snowdsp_mmx.c +++ b/libavcodec/x86/snowdsp_mmx.c @@ -20,7 +20,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/avcodec.h" #include "libavcodec/snow.h" #include "libavcodec/dwt.h" diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c index 5922a6dbf7..8b490b6204 100644 --- a/libavcodec/x86/vc1dsp_mmx.c +++ b/libavcodec/x86/vc1dsp_mmx.c @@ -25,7 +25,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" #include "libavcodec/vc1dsp.h" diff --git a/libavcodec/x86/vp56dsp_init.c b/libavcodec/x86/vp56dsp_init.c index 83e29e15ee..bef1af6546 100644 --- a/libavcodec/x86/vp56dsp_init.c +++ b/libavcodec/x86/vp56dsp_init.c @@ -21,7 +21,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/dsputil.h" #include "libavcodec/vp56dsp.h" diff --git a/libavcodec/x86/vp8dsp-init.c b/libavcodec/x86/vp8dsp-init.c index 8c17fa0382..0dc6ba9f2c 100644 --- a/libavcodec/x86/vp8dsp-init.c +++ b/libavcodec/x86/vp8dsp-init.c @@ -21,7 +21,7 @@ */ #include "libavutil/cpu.h" -#include "libavutil/x86_cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/vp8dsp.h" #if HAVE_YASM |