Giter Site home page Giter Site logo

Viterbi decoder msg size about libcorrect HOT 6 CLOSED

quiet avatar quiet commented on June 19, 2024
Viterbi decoder msg size

from libcorrect.

Comments (6)

brian-armstrong avatar brian-armstrong commented on June 19, 2024

@MageSlayer I think this is just poor variable naming and not an actual error. I've tested the conv code stuff with enough message lengths that I don't believe there's any actual error here, but of course it's still possible.

The first snippet you posted is from when the decoder is configuring its internal reader. The reader needs to trace out the number of raw bits passed to the decoder, and the snippet you posted is just deciding how many contiguous bytes that occupies in memory. This won't correspond directly to how many bits or bytes are recovered.

The second snippet is taking a given message length of msg_len bytes and deciding how many bits the actual encoded message will be. I think the corresponding part of the decoder is effectively sort of baked into the various loop indicies.

There is one small bug here. We configure the internal writer to set its ->len to this length here https://github.com/quiet/libcorrect/blob/master/src/convolutional/decode.c#L276 But as far as I can tell from inspecting the code, this len is never actually used in any way. It's a dead variable. I think I intended to use it for bounds checking so that the writer would provide an additional guard against overwrites in case the decoder had a bug, but haven't implemented it yet

If you can find a precise example that fails, I'd be happy to check it out

from libcorrect.

brian-armstrong avatar brian-armstrong commented on June 19, 2024

Also I think you can run the tests with make check

from libcorrect.

MageSlayer avatar MageSlayer commented on June 19, 2024

I am not sure I understand your point.

Isn't num_encoded_bytes is returned as correct_convolutional_decode result?
I mean _convolutional_decode returns it as decoded_len_bytes.
Are you trying to say that correct_convolutional_decode return value is unreliable?

from libcorrect.

brian-armstrong avatar brian-armstrong commented on June 19, 2024

Oof. Wow, I completely missed that. You're right, that return value must be completely wrong. Looking at the testbench now, I see that the return value is ignored (and in the libfec shim, nothing like the written length is returned, so it works there too)

I think this can be remedied fairly easily by having the bit_writer simply return how far into the buffer it's gone. One sec :)

from libcorrect.

MageSlayer avatar MageSlayer commented on June 19, 2024

BTW, could you make correct_convolutional_decode return value compatible with correct_reed_solomon_decode? I mean, is it possible to return -1 in case of error instead of 0?

from libcorrect.

brian-armstrong avatar brian-armstrong commented on June 19, 2024

This appears to be fixed by #7

from libcorrect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.