Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-07 01:56:16 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-10 02:39:43 +0300
commitc2966ae14c1b7b2e9dbc6e24b47bc158c6fe006d (patch)
treeaa8cf1c830620d1808a18a4c727d105492845dba
parenta7a783a5c5115e338b0ad2f4321cef9ddffa825b (diff)
avcodec/clearvideo: Redo updating predicition
This is in preparation for further commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/clearvideo.c24
1 files 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);