Skip to content

Decoder - "d->biphase_tics[d->biphase_tic]" assembled incorrectly #60

@mungewell

Description

@mungewell

The function 'biphase_decode2()' is called twice for each bit in the LTC frame.
https://github.com/x42/libltc/blob/master/src/decoder.c#L307

Since 'biphase_tic' is increased each time, it overflows (is limited by '% LTC_FRAME_BIT_COUNT') and the array is first filled with the early bits and then overwritten with later bits in the frame.
https://github.com/x42/libltc/blob/master/src/decoder.c#L264

	d->biphase_tics[d->biphase_tic] = d->snd_to_biphase_period;
	d->biphase_tic = (d->biphase_tic + 1) % LTC_FRAME_BIT_COUNT;

Either the array should only be filled on the 2nd calling/phase of the bitstream, or the array should be bigger to hold all 1/2 phases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions