[RESOLVED] 7 extra frames on 1 source

Support forum for DGDecNV
User avatar
Natasha
Posts: 22
Joined: Wed Nov 20, 2019 12:11 pm

Re: 7 extra frames on 1 source

Post by Natasha » Fri Feb 07, 2020 8:30 pm

Sherman, poor baby, come to me, I will help you.

User avatar
Bullwinkle
Posts: 72
Joined: Thu Sep 05, 2019 6:37 pm

Re: 7 extra frames on 1 source

Post by Bullwinkle » Sun Feb 09, 2020 6:38 pm

Sherman, you are a beloved child of the divine.

https://www.youtube.com/watch?v=2EaflX0MWRo (released version)
https://www.youtube.com/watch?v=Ma09CIqapwk (extended version)
https://www.youtube.com/watch?v=c56Sj7kMbLk (happy version)
https://www.youtube.com/watch?v=yqFz7T5v3iU (with lyrics)
https://www.youtube.com/watch?v=b-3eSxlgOhY (Motown remix)

Highest genius of the human spirit. RIP Levi Stubbs.

"When the world falls apart, some things stay in place
Levi Stubbs' tears run down his face."

-Billy Bragg

User avatar
Sherman
Posts: 14
Joined: Mon Jan 06, 2020 11:19 pm

Re: 7 extra frames on 1 source

Post by Sherman » Mon Feb 10, 2020 1:38 pm

Thank you, Bullwinkle. But are emotions irrational? Should we suppress them? Is it an evolutionary mistake? How do emotions know what is right?

User avatar
Bullwinkle
Posts: 72
Joined: Thu Sep 05, 2019 6:37 pm

Re: 7 extra frames on 1 source

Post by Bullwinkle » Mon Feb 10, 2020 1:41 pm

Sherman, emotions are beautiful manifestations of the divine spirit that set us apart from microbes. Embrace the divine, and sing your joy!

User avatar
Sherman
Posts: 14
Joined: Mon Jan 06, 2020 11:19 pm

Re: 7 extra frames on 1 source

Post by Sherman » Tue Feb 18, 2020 11:56 pm

Thanks, Bullwinkle! Think I got it:

https://www.youtube.com/watch?v=xhtzMwA5gJI

User avatar
Rocky
Posts: 408
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky » Mon Mar 23, 2020 1:55 pm

I've been working on the seeking issue. It's a doozy. Apparently, it's all caused by the RASL frames. My design assumes that the decoder always returns something for any coded frame. In fact I negotiated that with nVidia when I was working with them on the early CUVID rollout. But now, HEVC comes along with its Random Access Skipped Leading (RASL) frames. A Random Access Decodable Leading (RADL) frame is a frame that is decodable starting with the associated IDR/I, while a RASL is a frame that is not decodable and must be skipped by the decoder upon random access, meaning the decoder returns nothing for them. Oops, there goes my assumption and we need a hack or a re-design. So we have to cogitate on this and decide how to do things given the reality of RASL frames. All hands are on deck, even Natasha is looking into it.

User avatar
Rocky
Posts: 408
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky » Tue Mar 24, 2020 8:54 am

Hey that wasn't so bad. After discussing this with Curly :salute: I realized we could keep a count of leading RASLs per GOP and then just use that to adjust how many frames we need to decode starting at the IDR/I to get to the seeked-to frame. It seems to be working fine. I'll do some heavy regression testing and then give y'all a slipstream.

User avatar
Curly
Posts: 9
Joined: Sun Mar 15, 2020 11:05 am

Re: 7 extra frames on 1 source

Post by Curly » Tue Mar 24, 2020 10:11 am

Glad to be of assistance, Rock! Nyuk.

User avatar
Rocky
Posts: 408
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky » Tue Mar 24, 2020 12:24 pm

Glad I decided to test all my HEVC streams with this fix! I found one that starts like this:

SPS 390168
PPS 390234
PREFERRED TRANSFER CHARACTERISTICS 18
0:RASL 0 -23
1:RASL 0 -22
2:RASL 0 -21
3:RASL 0 -20
4:RASL 0 -19
5:RASL 0 -18
6:RASL 0 -17
7:CRA 390719 2 -16
8:TRAIL 0 -15
9:TRAIL 0 -14
10:TRAIL 0 -13
11:TRAIL 0 -12
12:TRAIL 0 -11
13:TRAIL 0 -10
14:TRAIL 0 -9

Yes, there are 7 leading frames that cannot be decoded. And we can't try to start decoding at the previous GOP because this is the first GOP. So I decided to treat this the same way as for AVC leading B frames: repeat the first decodable frame 7 times. The idea is to preserve audio sync.

Formally, an HEVC stream must start with an IDR, but people cut streams all the time and produce such technically illegal streams.

Still have a bunch more to test but things are looking good.

User avatar
MeteorRain
Posts: 121
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: 7 extra frames on 1 source

Post by MeteorRain » Tue Mar 24, 2020 1:49 pm

Yea it happened to TV caps a lot. They use CRAs instead of IDRs as many as possible, so the program can only be cut on CRAs. It's wise to make it work like AVC leading B frames and keep the rest of the video in sync and seek accurate.

Thanks for all the work guys!

Post Reply