From 6784a029345cba29d0e1e645c1f35e4403e4352f Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Tue, 29 Nov 2022 14:22:59 +0800 Subject: [PATCH] [av1d_parser]: fix dolby rpus and frame match err Signed-off-by: Yandong Lin Change-Id: I22ef06c28e696cb7b700a98bcb36bbdab3892a45 --- mpp/codec/dec/av1/av1d_parser.c | 18 +++++++++--------- mpp/codec/dec/av1/av1d_parser2_syntax.c | 7 +++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mpp/codec/dec/av1/av1d_parser.c b/mpp/codec/dec/av1/av1d_parser.c index 8820e3e7..14df15d9 100644 --- a/mpp/codec/dec/av1/av1d_parser.c +++ b/mpp/codec/dec/av1/av1d_parser.c @@ -24,6 +24,7 @@ #include "mpp_debug.h" #include "mpp_common.h" #include "mpp_compat_impl.h" +#include "rk_hdr_meta_com.h" #include "mpp_bitread.h" #include "mpp_packet_impl.h" @@ -482,6 +483,12 @@ static MPP_RET set_output_frame(Av1CodecContext *ctx) mpp_log2(s->operating_point_idc >> 8) > s->cur_frame.spatial_id) return 0; mpp_buf_slot_get_prop(s->slots, s->cur_frame.slot_index, SLOT_FRAME_PTR, &frame); + if (s->hdr_dynamic_meta && s->hdr_dynamic) { + mpp_frame_set_hdr_dynamic_meta(frame, s->hdr_dynamic_meta); + s->hdr_dynamic = 0; + if (s->raw_frame_header->show_existing_frame) + fill_hdr_meta_to_frame(frame, HDR_AV1); + } mpp_frame_set_pts(frame, s->pts); mpp_buf_slot_set_flag(s->slots, s->cur_frame.slot_index, SLOT_QUEUE_USE); mpp_buf_slot_enqueue(s->slots, s->cur_frame.slot_index, QUEUE_DISPLAY); @@ -593,10 +600,11 @@ static MPP_RET get_current_frame(Av1CodecContext *ctx) if (frame->ref) av1d_frame_unref(ctx, frame); + mpp_frame_set_meta(frame->f, NULL); mpp_frame_set_width(frame->f, ctx->width); mpp_frame_set_height(frame->f, ctx->height); - mpp_frame_set_hor_stride(frame->f, MPP_ALIGN(ctx->width, 16)); + mpp_frame_set_hor_stride(frame->f, MPP_ALIGN(ctx->width * s->bit_depth / 8, 8)); mpp_frame_set_ver_stride(frame->f, MPP_ALIGN(ctx->height, 8)); mpp_frame_set_errinfo(frame->f, 0); mpp_frame_set_discard(frame->f, 0); @@ -621,14 +629,6 @@ static MPP_RET get_current_frame(Av1CodecContext *ctx) } else mpp_frame_set_fmt(frame->f, ctx->pix_fmt); - if (ctx->pix_fmt == MPP_FMT_YUV420SP_10BIT) - mpp_frame_set_hor_stride(frame->f, MPP_ALIGN(ctx->width * s->bit_depth / 8, 8)); - - if (s->hdr_dynamic_meta && s->hdr_dynamic) { - mpp_frame_set_hdr_dynamic_meta(frame->f, s->hdr_dynamic_meta); - s->hdr_dynamic = 0; - } - value = 4; mpp_slots_set_prop(s->slots, SLOTS_NUMERATOR, &value); value = 1; diff --git a/mpp/codec/dec/av1/av1d_parser2_syntax.c b/mpp/codec/dec/av1/av1d_parser2_syntax.c index 82c7c53b..74280e93 100644 --- a/mpp/codec/dec/av1/av1d_parser2_syntax.c +++ b/mpp/codec/dec/av1/av1d_parser2_syntax.c @@ -120,8 +120,11 @@ static int av1d_fill_picparams(Av1CodecContext *ctx, DXVA_PicParams_AV1 *pp) int8_t ref_idx = frame_header->ref_frame_idx[i]; AV1Frame *ref_frame = &h->ref[ref_idx]; RefInfo *ref_i = ref_frame->ref; - pp->frame_refs[i].width = mpp_frame_get_width(ref_frame->f); - pp->frame_refs[i].height = mpp_frame_get_height(ref_frame->f);; + + if (ref_frame->f) { + pp->frame_refs[i].width = mpp_frame_get_width(ref_frame->f); + pp->frame_refs[i].height = mpp_frame_get_height(ref_frame->f);; + } pp->frame_refs[i].Index = ref_frame->slot_index; pp->frame_refs[i].order_hint = ref_frame->order_hint; if (ref_i) {