From c3665ee60f442069ba0322f53d947a1bf0be4007 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Sat, 27 Apr 2024 16:22:05 +0100 Subject: [PATCH] av1dec: Add force_integer_mv derived field for decoder use This is not the same as the syntax element value in the frame header because the specification parsing tables override the value on intra frames. (cherry picked from commit 6f56e0e7e516fef419c6b4361612c8a9bc178a2b) --- libavcodec/av1dec.c | 7 +++++++ libavcodec/av1dec.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 1d3c5dfc9d..11c852786f 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -730,6 +730,8 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s memcpy(dst->order_hints, src->order_hints, sizeof(dst->order_hints)); + dst->force_integer_mv = src->force_integer_mv; + return 0; fail: @@ -1288,6 +1290,11 @@ static int get_current_frame(AVCodecContext *avctx) order_hint_info(s); load_grain_params(s); + s->cur_frame.force_integer_mv = + s->raw_frame_header->force_integer_mv || + s->raw_frame_header->frame_type == AV1_FRAME_KEY || + s->raw_frame_header->frame_type == AV1_FRAME_INTRA_ONLY; + return ret; } diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h index 79a0be510b..b903b359c5 100644 --- a/libavcodec/av1dec.h +++ b/libavcodec/av1dec.h @@ -61,6 +61,12 @@ typedef struct AV1Frame { // OrderHints[] when this is the current frame, otherwise // SavedOrderHints[s][] when is the reference frame in slot s. uint8_t order_hints[AV1_TOTAL_REFS_PER_FRAME]; + + // force_integer_mv value at the end of the frame header parsing. + // This is not the same as the syntax element value in + // raw_frame_header because the specification parsing tables + // override the value on intra frames. + uint8_t force_integer_mv; } AV1Frame; typedef struct TileGroupInfo {