author | Hui Zhang <hui.zhang@amlogic.com> | 2020-04-01 05:45:03 (GMT) |
---|---|---|
committer | Hui Zhang <hui.zhang@amlogic.com> | 2020-04-02 05:53:40 (GMT) |
commit | 77ca17156ba6cb57ac3fa9bb785cf06397f6cf40 (patch) | |
tree | 81f1548378826c3547cf45569f4bb9a695c05b88 | |
parent | d7b9959ec36d2eafba6d3eabe16c7d2f4f58b8cc (diff) | |
download | media_modules-77ca17156ba6cb57ac3fa9bb785cf06397f6cf40.zip media_modules-77ca17156ba6cb57ac3fa9bb785cf06397f6cf40.tar.gz media_modules-77ca17156ba6cb57ac3fa9bb785cf06397f6cf40.tar.bz2 |
av1: fix av1 av out of sync issue in frame mode. [1/1]
PD#SWPL-18571
Problem:
av1 av out of sync in frame mode
Solution:
use duration to cal new pts for NON-KEYFRAME, because
multi-frames in one packet might cause frame vpts is missed
Verify:
ab311
Change-Id: Id77cabcbe7940afc2a9056251b37073272e9d11c
Signed-off-by: Hui Zhang <hui.zhang@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/vav1/vav1.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/frame_provider/decoder/vav1/vav1.c b/drivers/frame_provider/decoder/vav1/vav1.c index 6aaa86d..d98c5ec 100644 --- a/drivers/frame_provider/decoder/vav1/vav1.c +++ b/drivers/frame_provider/decoder/vav1/vav1.c @@ -292,6 +292,8 @@ static u32 double_write_mode; #define PTS_MODE_SWITCHING_RECOVERY_THREASHOLD 3 #define DUR2PTS(x) ((x)*90/96) +#define PTS2DUR(x) ((x)*96/90) + struct AV1HW_s; static int vav1_vf_states(struct vframe_states *states, void *); @@ -5489,6 +5491,18 @@ static int prepare_display_buf(struct AV1HW_s *hw, pts_valid = 1; pts_us64_valid = 1; } + if (vdec_frame_based(hw_to_vdec(hw)) && (!hw->get_frame_dur) && hw->last_lookup_pts_us64 && hw->last_pts + && ((vf->pts_us64 > hw->last_lookup_pts_us64) ||(vf->pts > hw->last_pts) )) { + if (vf->pts > hw->last_pts) + hw->frame_dur = PTS2DUR(vf->pts -hw->last_pts); + av1_print(hw, 0, + "AV1 frame mode dur=%d,pts(%d,%lld) last pts(%d,%lld)\n", + hw->frame_dur, vf->pts, + vf->pts_us64, hw->last_pts, hw->last_lookup_pts_us64); + hw->get_frame_dur = true; + hw->pts_mode = PTS_NONE_REF_USE_DURATION; + hw->duration_from_pts_done = 1; + } fill_frame_info(hw, pic_config, frame_size, vf->pts); @@ -5551,8 +5565,8 @@ static int prepare_display_buf(struct AV1HW_s *hw, hw->last_pts_us64 = vf->pts_us64; if ((debug & VP9_DEBUG_OUT_PTS) != 0) { pr_info - ("AV1 dec out pts: pts_mode=%d,dur=%d,pts(%d,%lld)(%d,%lld)\n", - hw->pts_mode, hw->frame_dur, vf->pts, + ("AV1 dec out slice_type %d pts: pts_mode=%d,dur=%d,pts(%d,%lld)(%d,%lld)\n", + slice_type, hw->pts_mode, hw->frame_dur, vf->pts, vf->pts_us64, pts_save, pts_us64_save); } @@ -6439,6 +6453,11 @@ int av1_continue_decoding(struct AV1HW_s *hw, int obu_type) pbi->bufmgr_proc_count); pbi->decode_idx++; hw->frame_count++; + cur_pic_config->slice_type = cm->cur_frame->frame_type; + if (hw->chunk) { + cur_pic_config->pts = hw->chunk->pts; + cur_pic_config->pts64 = hw->chunk->pts64; + } #ifdef DUAL_DECODE #else config_pic_size(hw, hw->aom_param.p.bit_depth); @@ -7998,13 +8017,6 @@ static int vav1_local_init(struct AV1HW_s *hw) ret = av1_local_init(hw); - - if (!hw->pts_unstable) { - hw->pts_unstable = - (hw->vav1_amstream_dec_info.rate == 0)?1:0; - pr_info("set pts unstable\n"); - } - return ret; } |