diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6dde8a64f4a21316caa0f9151173080900891ea4..655e828cbc6f9d28782ec4d03cc0d4053b8a640b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -50,7 +50,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 +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 diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index aca54974f75dcb8a398e45a45e6088571af5d3f9..523d1c078f7551300466e59847a4b935de68f30f 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" #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4fb594913109136b863431d7e6dacf7e4877c8ab..8f3544fa1aa005e8201d897fb11615492fe6c785 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" @@ -2035,12 +2034,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 5c537da38f9ba636d93cb87dc814d6ede39b4bae..80fa0fa1bd24e51bc983f25a5e7aa414c9967571 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -739,6 +739,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); @@ -777,10 +784,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 e84b0dae031db56df98e3c64b2e221c5e4381eac..d527ace6dda6921b3947cd294ecbf2979e4ac3a9 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" @@ -1850,14 +1849,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 similarity index 97% rename from libavcodec/mpegvideo_common.h rename to libavcodec/mpegvideo_motion.c index 224ec9887a4f6a89bd3ccfa7a8281d2128bc6017..ea0695323bbf191897e5b7018adae487d7288c51 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 * @@ -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 #include "avcodec.h" #include "dsputil.h" @@ -38,14 +29,6 @@ #include "msmpeg4.h" #include -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) @@ -874,12 +857,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) @@ -890,4 +873,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 */