You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpegvideo: Move motion_est to MotionEstContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -919,7 +919,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
|
||||
s->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
|
||||
c->mb_var_sum_temp += (varc+128)>>8;
|
||||
|
||||
if (s->motion_est != FF_ME_ZERO) {
|
||||
if (c->motion_est != FF_ME_ZERO) {
|
||||
const int mot_stride = s->b8_stride;
|
||||
const int mot_xy = s->block_index[0];
|
||||
|
||||
@ -1127,7 +1127,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y, 1);
|
||||
|
||||
if (s->motion_est != FF_ME_ZERO) {
|
||||
if (c->motion_est != FF_ME_ZERO) {
|
||||
P_LEFT[0] = mv_table[mot_xy - 1][0];
|
||||
P_LEFT[1] = mv_table[mot_xy - 1][1];
|
||||
|
||||
@ -1599,8 +1599,9 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
|
||||
int ff_get_best_fcode(MPVMainEncContext *const m, const int16_t (*mv_table)[2], int type)
|
||||
{
|
||||
MpegEncContext *const s = &m->s;
|
||||
MotionEstContext *const c = &s->me;
|
||||
|
||||
if (s->motion_est != FF_ME_ZERO) {
|
||||
if (c->motion_est != FF_ME_ZERO) {
|
||||
int score[8];
|
||||
int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2);
|
||||
const uint8_t * fcode_tab = m->fcode_tab;
|
||||
|
@ -48,6 +48,7 @@ typedef struct MPVMainEncContext MPVMainEncContext;
|
||||
*/
|
||||
typedef struct MotionEstContext {
|
||||
AVCodecContext *avctx;
|
||||
int motion_est; ///< ME algorithm
|
||||
int skip; ///< set if ME is skipped for the current MB
|
||||
int co_located_mv[4][2]; ///< mv from last P-frame for direct mode ME
|
||||
int direct_basis_mv[4][2];
|
||||
|
@ -222,7 +222,6 @@ typedef struct MpegEncContext {
|
||||
uint8_t *mb_mean; ///< Table for MB luminance
|
||||
uint64_t encoding_error[MPV_MAX_PLANES];
|
||||
|
||||
int motion_est; ///< ME algorithm
|
||||
int mv_dir;
|
||||
#define MV_DIR_FORWARD 1
|
||||
#define MV_DIR_BACKWARD 2
|
||||
|
@ -217,7 +217,7 @@ FF_MPV_OPT_CMP_FUNC, \
|
||||
|
||||
#define FF_MPV_COMMON_MOTION_EST_OPTS \
|
||||
{ "mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_MV0 }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "mpv_flags" },\
|
||||
{"motion_est", "motion estimation algorithm", FF_MPV_OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
|
||||
{"motion_est", "motion estimation algorithm", FF_MPV_OFFSET(me.motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
|
||||
{ "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
|
||||
{ "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
|
||||
{ "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
|
||||
|
@ -1866,7 +1866,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
mpv->b8_stride = 2 * mpv->mb_width + 1;
|
||||
mpv->f_code = 1;
|
||||
mpv->pict_type = pic->pict_type;
|
||||
mpv->motion_est = enc->motion_est;
|
||||
mpv->me.motion_est = enc->motion_est;
|
||||
mpv->me.scene_change_score = 0;
|
||||
mpv->me.dia_size = avctx->dia_size;
|
||||
mpv->quarter_sample = (s->avctx->flags & AV_CODEC_FLAG_QPEL)!=0;
|
||||
|
@ -96,8 +96,6 @@ typedef struct SVQ1EncContext {
|
||||
|
||||
uint8_t *scratchbuf;
|
||||
|
||||
int motion_est;
|
||||
|
||||
SVQ1EncDSPContext svq1encdsp;
|
||||
} SVQ1EncContext;
|
||||
|
||||
@ -339,7 +337,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
|
||||
s->m.b8_stride = 2 * s->m.mb_width + 1;
|
||||
s->m.f_code = 1;
|
||||
s->m.pict_type = s->pict_type;
|
||||
s->m.motion_est = s->motion_est;
|
||||
s->m.me.scene_change_score = 0;
|
||||
// s->m.out_format = FMT_H263;
|
||||
// s->m.unrestricted_mv = 1;
|
||||
@ -719,7 +716,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
#define OFFSET(x) offsetof(struct SVQ1EncContext, x)
|
||||
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
|
||||
static const AVOption options[] = {
|
||||
{ "motion-est", "Motion estimation algorithm", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, VE, .unit = "motion-est"},
|
||||
{ "motion-est", "Motion estimation algorithm", OFFSET(m.me.motion_est), AV_OPT_TYPE_INT, { .i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, VE, .unit = "motion-est"},
|
||||
{ "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion-est" },
|
||||
{ "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion-est" },
|
||||
{ "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion-est" },
|
||||
|
Reference in New Issue
Block a user