lavc/av1: Record reference ordering information for each frame
This is needed by Vulkan. Constructing this can't be delegated to CBS because packets might contain multiple frames (when non-shown frames are present) but we need separate snapshots immediately before each frame for the decoder. (cherry picked from commit 22ced1edc6fc4100072e122d549fe379aff76954)
This commit is contained in:
parent
d38bf5e08e
commit
0d851a82dd
@ -358,6 +358,25 @@ static void coded_lossless_param(AV1DecContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
static void order_hint_info(AV1DecContext *s)
|
||||
{
|
||||
const AV1RawFrameHeader *header = s->raw_frame_header;
|
||||
const AV1RawSequenceHeader *seq = s->raw_seq;
|
||||
AV1Frame *frame = &s->cur_frame;
|
||||
|
||||
frame->order_hint = header->order_hint;
|
||||
|
||||
for (int i = 0; i < AV1_REFS_PER_FRAME; i++) {
|
||||
int ref_name = i + AV1_REF_FRAME_LAST;
|
||||
int ref_slot = header->ref_frame_idx[i];
|
||||
int ref_order_hint = s->ref[ref_slot].order_hint;
|
||||
|
||||
frame->order_hints[ref_name] = ref_order_hint;
|
||||
frame->ref_frame_sign_bias[ref_name] =
|
||||
get_relative_dist(seq, ref_order_hint, frame->order_hint);
|
||||
}
|
||||
}
|
||||
|
||||
static void load_grain_params(AV1DecContext *s)
|
||||
{
|
||||
const AV1RawFrameHeader *header = s->raw_frame_header;
|
||||
@ -700,6 +719,12 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s
|
||||
sizeof(dst->film_grain));
|
||||
dst->coded_lossless = src->coded_lossless;
|
||||
|
||||
dst->order_hint = src->order_hint;
|
||||
memcpy(dst->ref_frame_sign_bias, src->ref_frame_sign_bias,
|
||||
sizeof(dst->ref_frame_sign_bias));
|
||||
memcpy(dst->order_hints, src->order_hints,
|
||||
sizeof(dst->order_hints));
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
@ -1255,6 +1280,7 @@ static int get_current_frame(AVCodecContext *avctx)
|
||||
global_motion_params(s);
|
||||
skip_mode_params(s);
|
||||
coded_lossless_param(s);
|
||||
order_hint_info(s);
|
||||
load_grain_params(s);
|
||||
|
||||
return ret;
|
||||
|
@ -53,6 +53,14 @@ typedef struct AV1Frame {
|
||||
AV1RawFilmGrainParams film_grain;
|
||||
|
||||
uint8_t coded_lossless;
|
||||
|
||||
// OrderHint for this frame.
|
||||
uint8_t order_hint;
|
||||
// RefFrameSignBias[] used when decoding this frame.
|
||||
uint8_t ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME];
|
||||
// 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];
|
||||
} AV1Frame;
|
||||
|
||||
typedef struct TileGroupInfo {
|
||||
|
Loading…
x
Reference in New Issue
Block a user