Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced hdc #245

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Enhanced hdc #245

wants to merge 4 commits into from

Conversation

awesie
Copy link
Contributor

@awesie awesie commented Aug 26, 2020

Do not merge.

This is a first draft of the enhanced stream support for AM. I would like more test data but I neither have a way to record AM nor am I in the right country currently.

My testing so far has been the AM sample that was provided a while ago. The converted form that works with nrsc5 can be found here: https://gofile.io/d/lQuUUN.

For testing, there is a CLI switch (--enhanced) that controls whether the core stream will be decoded (default) or core+enhanced. This would go away before this pull request is accepted.

Align the core and enhanced streams based on the PDU sequence number.
But, seq is limited to 6 bits so we need to manually adjust by 64
for some reason.
SBR needs to be fixed when it switches from mono to stereo, etc.
Easiest solution is to completely reset it, but this could be
improved.
Defaults to core-only. Use --enhanced to decode enhanced stream.
This is not for public consumption, only to ease testing.
@@ -542,7 +543,8 @@ void frame_process(frame_t *st, size_t length)
}
else
{
input_pdu_push(st->input, st->buffer + offset, cnt, prog, hdr.stream_id);
input_pdu_push(st->input, st->buffer + offset, cnt, prog, hdr.stream_id, seq);
seq = (seq + 1) & 0x3f;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sequence number also needs to be incremented in the case where the CRC is invalid. This line won't be reached due to the continue on line 523.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. Looking over this code, I feel like there are similar problems with st->pdu_idx[prog][hdr.stream_id] as well, so some refactoring might be warranted.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. We should reset st->pdu_idx[prog][hdr.stream_id] back to zero in the j == 0 && hdr.pfirst case, regardless of whether the CRC is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants