Skip to content

Enhanced hdc#245

Open
awesie wants to merge 4 commits into
masterfrom
enhanced-hdc
Open

Enhanced hdc#245
awesie wants to merge 4 commits into
masterfrom
enhanced-hdc

Conversation

@awesie
Copy link
Copy Markdown
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.

awesie added 4 commits August 26, 2020 21:45
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.
Comment thread src/frame.c
{
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants