Skip to content

Commit

Permalink
linux-amlogic: Fix VC-1 micro stutter
Browse files Browse the repository at this point in the history
  • Loading branch information
Radostan Riedel committed Mar 31, 2017
1 parent c6067e9 commit ef55c8a
Showing 1 changed file with 63 additions and 0 deletions.
@@ -0,0 +1,63 @@
From 5f922844e81612991906bfba16c3fc503dca8211 Mon Sep 17 00:00:00 2001
From: Markus Pfau <pfau@peak3d.de>
Date: Thu, 30 Mar 2017 23:58:41 +0200
Subject: [PATCH 1/1] correct PTS on I-Frames

---
drivers/amlogic/amports/vvc1.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/amlogic/amports/vvc1.c b/drivers/amlogic/amports/vvc1.c
index 29bd4a3400d8..82e9696bc068 100644
--- a/drivers/amlogic/amports/vvc1.c
+++ b/drivers/amlogic/amports/vvc1.c
@@ -123,6 +123,7 @@ static u32 pts_by_offset = 1;
static u32 total_frame;
static u32 next_pts;
static u64 next_pts_us64;
+static unsigned int bframe_count;

#ifdef DEBUG_PTS
static u32 pts_hit, pts_missed, pts_i_hit, pts_i_missed;
@@ -259,7 +260,7 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
u32 picture_type;
u32 buffer_index;
unsigned int pts, pts_valid = 0, offset;
- u32 v_width, v_height;
+ u32 v_width, v_height, dur;
u64 pts_us64 = 0;

reg = READ_VREG(VC1_BUFFEROUT);
@@ -291,8 +292,21 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
if (pts_by_offset) {
offset = READ_VREG(VC1_OFFSET_REG);
if (keyframe_pts_only && (picture_type != I_PICTURE)) {
+ if (picture_type == B_PICTURE)
+ ++bframe_count;
+ else
+ bframe_count = 0;
pts_valid = 0;
} else if (pts_lookup_offset_us64(PTS_TYPE_VIDEO, offset, &pts, 0, &pts_us64) == 0) {
+ if (keyframe_pts_only)
+ {
+ dur = bframe_count * DUR2PTS(vvc1_amstream_dec_info.rate);
+ if (reg & INTERLACE_FLAG)
+ dur >>= 1;
+ pts += dur;
+ pts_us64 += (dur * 100) / 9;
+ bframe_count = 0;
+ }
pts_valid = 1;
#ifdef DEBUG_PTS
pts_hit++;
@@ -861,6 +875,7 @@ static void vvc1_local_init(void)

avi_flag = (unsigned long) vvc1_amstream_dec_info.param;
keyframe_pts_only = (u32)vvc1_amstream_dec_info.param & 0x100;
+ bframe_count = 0;

total_frame = 0;

--
2.11.0

0 comments on commit ef55c8a

Please sign in to comment.