- 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
This commit is contained in:
12
ffmpeg.c
12
ffmpeg.c
@@ -82,7 +82,7 @@ static int video_qmax = 15;
|
|||||||
static int video_qdiff = 3;
|
static int video_qdiff = 3;
|
||||||
static float video_qblur = 0.5;
|
static float video_qblur = 0.5;
|
||||||
static float video_qcomp = 0.5;
|
static float video_qcomp = 0.5;
|
||||||
static int motion_estimation_method = 0;
|
static int me_method = 0;
|
||||||
static int video_disable = 0;
|
static int video_disable = 0;
|
||||||
static int video_codec_id = CODEC_ID_NONE;
|
static int video_codec_id = CODEC_ID_NONE;
|
||||||
static int same_quality = 0;
|
static int same_quality = 0;
|
||||||
@@ -1388,7 +1388,7 @@ void opt_motion_estimation(const char *arg)
|
|||||||
break;
|
break;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
motion_estimation_method = (p - motion_str) - 4;
|
me_method = (p - motion_str) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void opt_video_codec(const char *arg)
|
void opt_video_codec(const char *arg)
|
||||||
@@ -1784,7 +1784,7 @@ void opt_output_file(const char *filename)
|
|||||||
else
|
else
|
||||||
video_enc->get_psnr = 0;
|
video_enc->get_psnr = 0;
|
||||||
|
|
||||||
video_enc->me_method = motion_estimation_method;
|
video_enc->me_method = me_method;
|
||||||
|
|
||||||
/* XXX: need to find a way to set codec parameters */
|
/* XXX: need to find a way to set codec parameters */
|
||||||
if (oc->format == &ppm_format ||
|
if (oc->format == &ppm_format ||
|
||||||
@@ -2038,11 +2038,11 @@ void show_formats(void)
|
|||||||
pp = motion_str;
|
pp = motion_str;
|
||||||
while (*pp) {
|
while (*pp) {
|
||||||
printf(" %s", *pp);
|
printf(" %s", *pp);
|
||||||
if ((pp - motion_str - 4) == ME_ZERO)
|
if ((pp - motion_str + 1) == ME_ZERO)
|
||||||
printf("(fastest)");
|
printf("(fastest)");
|
||||||
else if ((pp - motion_str - 4) == ME_FULL)
|
else if ((pp - motion_str + 1) == ME_FULL)
|
||||||
printf("(slowest)");
|
printf("(slowest)");
|
||||||
else if ((pp - motion_str - 4) == ME_EPZS)
|
else if ((pp - motion_str + 1) == ME_EPZS)
|
||||||
printf("(default)");
|
printf("(default)");
|
||||||
pp++;
|
pp++;
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ enum SampleFormat {
|
|||||||
|
|
||||||
/* motion estimation type, EPZS by default */
|
/* motion estimation type, EPZS by default */
|
||||||
enum Motion_Est_ID {
|
enum Motion_Est_ID {
|
||||||
ME_ZERO = -4,
|
ME_ZERO = 1,
|
||||||
ME_FULL,
|
ME_FULL,
|
||||||
ME_LOG,
|
ME_LOG,
|
||||||
ME_PHODS,
|
ME_PHODS,
|
||||||
@@ -66,6 +66,9 @@ enum Motion_Est_ID {
|
|||||||
ME_X1
|
ME_X1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* only for ME compatiblity with old apps */
|
||||||
|
extern int motion_estimation_method;
|
||||||
|
|
||||||
/* ME algos sorted by quality */
|
/* ME algos sorted by quality */
|
||||||
static const int Motion_Est_QTab[] = { -4, -1, -2, 1, 0, -3 };
|
static const int Motion_Est_QTab[] = { -4, -1, -2, 1, 0, -3 };
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w)= draw_edg
|
|||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
|
|
||||||
/* for jpeg fast DCT */
|
/* for jpeg fast DCT */
|
||||||
#define CONST_BITS 14
|
#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 UINT16 default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
|
||||||
static UINT8 default_fcode_tab[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];
|
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)
|
static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -315,7 +316,12 @@ int MPV_encode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ME algorithm */
|
/* 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 */
|
/* Fixed QSCALE */
|
||||||
s->fixed_qscale = (avctx->flags & CODEC_FLAG_QSCALE);
|
s->fixed_qscale = (avctx->flags & CODEC_FLAG_QSCALE);
|
||||||
|
|
||||||
@@ -415,7 +421,7 @@ int MPV_encode_init(AVCodecContext *avctx)
|
|||||||
mpeg1_encode_init(s);
|
mpeg1_encode_init(s);
|
||||||
|
|
||||||
/* dont use mv_penalty table for crap MV as it would be confused */
|
/* 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;
|
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 */
|
/* 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 mv_num[8];
|
||||||
int i;
|
int i;
|
||||||
int loose=0;
|
int loose=0;
|
||||||
|
Reference in New Issue
Block a user