From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/clearvideo: Redo updating predicition Date: Mon, 7 Nov 2022 02:49:20 +0100 Message-ID: <GV1P250MB0737C051A9234D810CC249C78F3C9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <GV1P250MB07375837F2A522ABDA22803E8F3C9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> This is in preparation for further commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/clearvideo.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 6ea3d7b6a2..11ae6ca9ad 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -296,7 +296,7 @@ static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, return 0; } -static MV mvi_predict(MVInfo *mvi, int mb_x, int mb_y, MV diff) +static MV *mvi_predict(MVInfo *mvi, int mb_x, int mb_y) { MV res, pred_mv; int left_mv, right_mv, top_mv, bot_mv; @@ -336,10 +336,16 @@ static MV mvi_predict(MVInfo *mvi, int mb_x, int mb_y, MV diff) res.y = bot_mv; } - mvi->mv[mvi->mb_stride + mb_x].x = res.x + diff.x; - mvi->mv[mvi->mb_stride + mb_x].y = res.y + diff.y; + mvi->mv[mvi->mb_stride + mb_x].x = res.x; + mvi->mv[mvi->mb_stride + mb_x].y = res.y; - return res; + return &mvi->mv[mvi->mb_stride + mb_x]; +} + +static void mvi_update_prediction(MV *mv, MV diff) +{ + mv->x += diff.x; + mv->y += diff.y; } static void mvi_reset(MVInfo *mvi, int mb_w, int mb_h, int mb_size) @@ -575,11 +581,13 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, for (j = 0; j < c->pmb_height; j++) { for (i = 0; i < c->pmb_width; i++) { + MV *mvp, mv; if (get_bits_left(&c->gb) <= 0) return AVERROR_INVALIDDATA; - if (get_bits1(&c->gb)) { - MV mv = mvi_predict(&c->mvi, i, j, zero_mv); + mvp = mvi_predict(&c->mvi, i, j); + mv = *mvp; + if (get_bits1(&c->gb)) { for (plane = 0; plane < 3; plane++) { int16_t x = plane == 0 ? i << c->tile_shift : i << (c->tile_shift - 1); int16_t y = plane == 0 ? j << c->tile_shift : j << (c->tile_shift - 1); @@ -596,15 +604,15 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int y = j << c->tile_shift; int size = 1 << c->tile_shift; TileInfo *tile; - MV mv, cmv; + MV cmv; tile = decode_tile_info(&c->gb, &lev[0]); // Y if (!tile) return AVERROR(ENOMEM); - mv = mvi_predict(&c->mvi, i, j, tile->mv); ret = restore_tree(avctx, c->pic, c->prev, 0, x, y, size, tile, mv); if (ret < 0) mb_ret = ret; + mvi_update_prediction(mvp, tile->mv); x = i << (c->tile_shift - 1); y = j << (c->tile_shift - 1); size = 1 << (c->tile_shift - 1); -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-11-07 1:49 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-07 1:48 [FFmpeg-devel] [PATCH 1/5] avcodec/clearvideo: Remove unnecessary level parameter Andreas Rheinhardt 2022-11-07 1:49 ` [FFmpeg-devel] [PATCH 2/5] avcodec/clearvideo: Move tile_do_block() upwards Andreas Rheinhardt 2022-11-07 1:49 ` Andreas Rheinhardt [this message] 2022-11-07 1:49 ` [FFmpeg-devel] [PATCH 4/5] avcodec/clearvideo: Use const where appropriate Andreas Rheinhardt 2022-11-07 1:49 ` [FFmpeg-devel] [PATCH 5/5] avcodec/clearvideo: Avoid allocations when decoding tiles Andreas Rheinhardt 2022-11-09 14:41 ` [FFmpeg-devel] [PATCH 1/5] avcodec/clearvideo: Remove unnecessary level parameter Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=GV1P250MB0737C051A9234D810CC249C78F3C9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git