aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJuanjo <pulento@users.sourceforge.net>2002-04-14 22:17:40 +0000
committerJuanjo <pulento@users.sourceforge.net>2002-04-14 22:17:40 +0000
commit101bea5f2272dfcca084aeeb78ccb1c2e925b12b (patch)
tree10a73258ed2e1105ff7b75fc8b356cd4eeb5907a /libavcodec
parente4986da9ce91c4a6f9e942c4225f0c3d90e5db95 (diff)
downloadffmpeg-101bea5f2272dfcca084aeeb78ccb1c2e925b12b.tar.gz
- ME method compatibility with legacy apps.
- Please use AVCodecContext's me_method now. Originally committed as revision 399 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h5
-rw-r--r--libavcodec/mpegvideo.c18
2 files changed, 16 insertions, 7 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a6b03e9dde..c5209bdac6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -58,7 +58,7 @@ enum SampleFormat {
/* motion estimation type, EPZS by default */
enum Motion_Est_ID {
- ME_ZERO = -4,
+ ME_ZERO = 1,
ME_FULL,
ME_LOG,
ME_PHODS,
@@ -66,6 +66,9 @@ enum Motion_Est_ID {
ME_X1
};
+/* only for ME compatiblity with old apps */
+extern int motion_estimation_method;
+
/* ME algos sorted by quality */
static const int Motion_Est_QTab[] = { -4, -1, -2, 1, 0, -3 };
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 7ae54ad93e..1f92ffe8d8 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -50,6 +50,7 @@ void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w)= draw_edg
//#define DEBUG
+
/* for jpeg fast DCT */
#define CONST_BITS 14
@@ -72,11 +73,11 @@ static UINT8 h263_chroma_roundtab[16] = {
static UINT16 default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
static UINT8 default_fcode_tab[MAX_MV*2+1];
-/* default motion estimation */
-int motion_estimation_method = ME_LOG;
-
extern UINT8 zigzag_end[64];
+/* default motion estimation */
+int motion_estimation_method = ME_EPZS;
+
static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale)
{
int i;
@@ -315,7 +316,12 @@ int MPV_encode_init(AVCodecContext *avctx)
}
/* ME algorithm */
- s->me_method = avctx->me_method;
+ if (avctx->me_method == 0)
+ /* For compatibility */
+ s->me_method = motion_estimation_method;
+ else
+ s->me_method = avctx->me_method;
+
/* Fixed QSCALE */
s->fixed_qscale = (avctx->flags & CODEC_FLAG_QSCALE);
@@ -415,7 +421,7 @@ int MPV_encode_init(AVCodecContext *avctx)
mpeg1_encode_init(s);
/* dont use mv_penalty table for crap MV as it would be confused */
- if (s->me_method < 0) s->mv_penalty = default_mv_penalty;
+ if (s->me_method < 5) s->mv_penalty = default_mv_penalty;
s->encoding = 1;
@@ -1346,7 +1352,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
}
/* find best f_code for ME which do unlimited searches */
- if(s->pict_type == P_TYPE && s->me_method >= 0){
+ if(s->pict_type == P_TYPE && s->me_method >= 5){
int mv_num[8];
int i;
int loose=0;