1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/mpegvideo: Move unrestricted_mv to MotionEstContext

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-19 15:35:20 +02:00
parent 05510dac6b
commit 273de7f60c
7 changed files with 15 additions and 15 deletions

View File

@ -551,7 +551,7 @@ static inline void get_limits(MPVEncContext *const s, int x, int y, int bframe)
if(c->avctx->me_range) c->range= c->avctx->me_range >> 1;
else c->range= 16;
*/
if (s->c.unrestricted_mv) {
if (c->unrestricted_mv) {
c->xmin = - x - 16;
c->ymin = - y - 16;
c->xmax = - x + s->c.width;
@ -600,7 +600,7 @@ static inline int h263_mv4_search(MPVEncContext *const s, int mx, int my, int sh
int same=1;
const int stride= c->stride;
const uint8_t *mv_penalty = c->current_mv_penalty;
int safety_clipping = s->c.unrestricted_mv && (s->c.width&15) && (s->c.height&15);
int safety_clipping = c->unrestricted_mv && (s->c.width&15) && (s->c.height&15);
init_mv4_ref(c);

View File

@ -69,6 +69,7 @@ typedef struct MotionEstContext {
int mb_flags;
int pre_pass; ///< = 1 for the pre pass
int dia_size;
int unrestricted_mv; ///< mv can point outside of the coded picture
int xmin;
int xmax;
int ymin;

View File

@ -164,7 +164,6 @@ typedef struct MpegEncContext {
int droppable;
/* motion compensation */
int unrestricted_mv; ///< mv can point outside of the coded picture
int h263_long_vectors; ///< use horrible H.263v1 long vector mode
BlockDSPContext bdsp;

View File

@ -926,7 +926,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->c.h263_aic = (avctx->flags & AV_CODEC_FLAG_AC_PRED) ? 1 : 0;
s->c.modified_quant = s->c.h263_aic;
s->c.loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
s->c.unrestricted_mv = s->c.obmc || s->c.loop_filter || s->c.umvplus;
s->me.unrestricted_mv = s->c.obmc || s->c.loop_filter || s->c.umvplus;
s->flipflop_rounding = 1;
/* /Fx */
@ -937,7 +937,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_FLV1:
s->c.out_format = FMT_H263;
s->c.h263_flv = 2; /* format = 1; 11-bit codes */
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->rtp_mode = 0; /* don't allow GOB */
avctx->delay = 0;
s->c.low_delay = 1;
@ -961,13 +961,13 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
// will be set later on a per-frame basis.
s->c.h263_aic = 1;
s->c.loop_filter = 1;
s->c.unrestricted_mv = 0;
s->me.unrestricted_mv = 0;
break;
#endif
case AV_CODEC_ID_MPEG4:
s->c.out_format = FMT_H263;
s->c.h263_pred = 1;
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->flipflop_rounding = 1;
s->c.low_delay = m->max_b_frames ? 0 : 1;
avctx->delay = s->c.low_delay ? 0 : (m->max_b_frames + 1);
@ -975,7 +975,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_MSMPEG4V2:
s->c.out_format = FMT_H263;
s->c.h263_pred = 1;
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->c.msmpeg4_version = MSMP4_V2;
avctx->delay = 0;
s->c.low_delay = 1;
@ -983,7 +983,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_MSMPEG4V3:
s->c.out_format = FMT_H263;
s->c.h263_pred = 1;
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->c.msmpeg4_version = MSMP4_V3;
s->flipflop_rounding = 1;
avctx->delay = 0;
@ -992,7 +992,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_WMV1:
s->c.out_format = FMT_H263;
s->c.h263_pred = 1;
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->c.msmpeg4_version = MSMP4_WMV1;
s->flipflop_rounding = 1;
avctx->delay = 0;
@ -1001,7 +1001,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_WMV2:
s->c.out_format = FMT_H263;
s->c.h263_pred = 1;
s->c.unrestricted_mv = 1;
s->me.unrestricted_mv = 1;
s->c.msmpeg4_version = MSMP4_WMV2;
s->flipflop_rounding = 1;
avctx->delay = 0;
@ -1867,7 +1867,7 @@ static void frame_end(MPVMainEncContext *const m)
{
MPVEncContext *const s = &m->s;
if (s->c.unrestricted_mv &&
if (s->me.unrestricted_mv &&
s->c.cur_pic.reference &&
!m->intra_only) {
int hshift = s->c.chroma_x_shift;

View File

@ -51,7 +51,7 @@ int ff_rv20_encode_picture_header(MPVMainEncContext *const m)
put_bits(&s->pb, 1, s->c.no_rounding);
av_assert1(s->f_code == 1);
av_assert1(!s->c.unrestricted_mv);
av_assert1(!s->me.unrestricted_mv);
av_assert1(!s->c.alt_inter_vlc);
av_assert1(!s->c.umvplus);
av_assert1(s->c.modified_quant == 1);

View File

@ -1869,7 +1869,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
mpv->me.dia_size = avctx->dia_size;
mpv->c.quarter_sample = (s->avctx->flags & AV_CODEC_FLAG_QPEL)!=0;
mpv->c.out_format = FMT_H263;
mpv->c.unrestricted_mv = 1;
mpv->me.unrestricted_mv = 1;
mpv->lambda = enc->lambda;
mpv->c.qscale = (mpv->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);

View File

@ -333,7 +333,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
s2->pict_type = s->pict_type;
s->m.me.scene_change_score = 0;
// s2->out_format = FMT_H263;
// s2->unrestricted_mv = 1;
// s->m.me.unrestricted_mv = 1;
s->m.lambda = s->quality;
s2->qscale = s->m.lambda * 139 +
FF_LAMBDA_SCALE * 64 >>