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

Raptor/RaptorQ FEC scheme #236

Open
gavv opened this issue Jul 5, 2019 · 16 comments
Open

Raptor/RaptorQ FEC scheme #236

gavv opened this issue Jul 5, 2019 · 16 comments
Labels
codecs Audio and FEC codecs enhancement help wanted An important and awaited task but we have no human resources for it yet

Comments

@gavv
Copy link
Member

gavv commented Jul 5, 2019

Intro

It would be interesting to try Raptor/RaptorQ FEC codes. It is claimed that they perform better than Reed-Solomon.

Our docs:

RFCs:

Known Raptor/RaptorQ implementations:

Implementation

We should try libRaptorQ.

The plan is:

  • Add target_libraptorq to roc_fec.

  • Add libRaptorQ dependency to build system (add --enable-libraptorq to SConstruct which enables libRaptorQ dependency and enables target_libraptorq; add libraptorq to 3rdparty.py; see libsndfile source and sink #246 for details on adding a new dependency).

  • Add fec::RaptorEncoder and fec::RaptorDecoder, implementing fec::IBlockEncoder and fec::IBlockDecoder using libRaptorQ (they should be placed into target_libraptorq).

  • Add raptor fec scheme to packet::FECScheme.

  • Register RaptorEncoder and RaptorDecoder in fec::CodecMap.

  • Currently both fec::Reader and fec::Writer expect that source and repair packets will have FECFRAME header (packet::FEC). This is true for Reed-Solomon and LDPC FEC-schemes, but not for Raptor scheme; Raptor uses bare RTP packets for both source and repair packets. We should improve fec::Reader and fec::Writer so that they will support two modes:

    • Source packets have RTP and FECFRAME headers. Repair packets have only FECFRAME header. Block number and number in block are deduced from FECFRAME headers. This is how it works currently.

    • Source and repair packets both have RTP header and don't have FECFRAME header. Block number and number in block are deduced from RTP headers. This is what we need for raptor.

    What mode to use should be defined by the FEC scheme. We should also add unit tests for the new mode.

  • Allow to enable Raptor via command-line tools and C API. It should be enabled by using corresponding FEC scheme. Since it does not introduce its own headers, no new protocols should be added. RTP should be used for both source and repair packets.

  • Enable Raptor scheme in roc_fec, roc_pipeline, and roc_lib tests (if it's enabled at compile-time).

Steps

This could be split into three pull requests:

  1. Add libRaptorQ dependency. Add raptor encoder and decoder. Enable them in codec-level roc_fec tests.

  2. Add support for bare-RTP source & repair packets in fec::Reader and fec::Writer (without FECFRAME header). Add corresponding unit tests.

  3. Register raptor FEC scheme. Add it to command-line tools and C API. Add it to reader-writer-level roc_fec tests and roc_pipeline & roc_lib tests.

@gavv gavv added enhancement help wanted An important and awaited task but we have no human resources for it yet labels Jul 5, 2019
@gavv gavv added this to Backlog in kanban board Jul 5, 2019
@gavv gavv moved this from Backlog to Help wanted in kanban board Sep 11, 2019
@drdpov
Copy link

drdpov commented Dec 16, 2019

Hi @gavv. Is this issue still open? Can I work with it? What should i start with?

@gavv
Copy link
Member Author

gavv commented Dec 16, 2019

Hi! Yes, this is still relevant and you're welcome.

I'd recommend to start from reading this page from our documentation and then RFC 6363, RFC 6681, and RFC 6682.

Then I suggest to look at OpenRQ and orq. IIRC, OpenRQ is quite complete, but it's written in Java. I don't know whether orq is complete. So you'll need to do some research. If we can just use orq, it would be great! If it's far from complete, we'll have either to send patches or to grow our own implementation, likely using OpenRQ and orq as a reference.

We already have generic FECFRAME code and tests. We support two FEC schemes (LDPC and Reed-Solomon). In command-line tools FEC scheme is auto-detected from port protocols (e.g. rs8m protocol corresponds to Reed-Solomon scheme). See manual pages for info on how to try different schemes. You can play with them and see how they behave on different block sizes and packet loss ratios. This post may be helpful.

In this task we should add raptor-specific payload format and encoder/decoder. For payload format, look at the roc_fec/headers.h, used in fec::Parser and fec::Composer. For codecs, look at fec::OFEncoder and fec::OFDecoder (LDPC and Reed-Solomon encoder & decoder implemented using OpenFEC). Then we should integrate the new scheme into pipeline and add corresponding FEC scheme. Finally, it would be interesting to compare Raptor with existing schemes in terms of latency and service quality.

@gavv
Copy link
Member Author

gavv commented Dec 30, 2019

@gavv
Copy link
Member Author

gavv commented Jan 7, 2020

I've took a look at those libraries and I think libRaptorQ looks very promising and we should try it first (its C++98 or C API).

I've also updated the issue and added a more detailed plan. And I've removed the part about fec::Parser/fec::Composer - we actually don't need a new parser & composer for Raptor because it doesn't introduce new headers, only a new RTP payload.

@ffisherr What do you think? Are you working on this / have plans to work on this?

@drdpov
Copy link

drdpov commented Jan 7, 2020

Hey @gavv, agree with you, example in libRaptorQ seems very easy, i believe, i can do the first pull request in couple days.

@gavv
Copy link
Member Author

gavv commented Jan 7, 2020

Great!

@drdpov
Copy link

drdpov commented Jan 10, 2020

Hey, i have some troubles while adding libRaptorQ to SConstruct file. Here it is:
/usr/local/include/RaptorQ/v1/caches.hpp:24:10: fatal error: vector: No such file or directory
#include
How can i solve that?
I saw in coding guidelines:
"We don’t use STL (the algorithms-and-containers part of the C++ standard library)."
Anyway, it is used in libraptoq.

@gavv
Copy link
Member Author

gavv commented Jan 10, 2020

We don't use STL, but we don't disable it in any way. So the error is unrelated. It's OK if libraptorq uses STL, we just wont be able to enable raptor on some restricted platforms.

@gavv
Copy link
Member Author

gavv commented Jan 11, 2020

You can push your changes to a branch on your fork and I'll take a look at it.

@drdpov
Copy link

drdpov commented Jan 11, 2020

Done.

@gavv
Copy link
Member Author

gavv commented Jan 11, 2020

Have you tried to remove extern "C" when including libraptorq headers?

@drdpov
Copy link

drdpov commented Jan 11, 2020

In "rq_encoder.h" #include <RaptorQ/RaptorQ_v1.hpp>? Yes, still doesn't work..

@gavv
Copy link
Member Author

gavv commented Jan 11, 2020

Well, I can't reproduce the error with <vector>, probably we have different compiler versions. But I got lots of other errors on your branch:

  • compiler is complaining on extern C; it should not be used for C++ headers;
  • roc is built with -std=c++98, and the included headers require at least C++11, which causes a lot of compilation errors.

One option would be to modify our build system to use c++11/c++17 for raptor codecs, but I'd like to avoid mixing different C++ standards for different translation units, it can lead to various linking problems.

Can we just use libraptorq pure C API instead?

BTW, for extensive discussions/debugging/etc I recommend to use our mailing list.

@gavv
Copy link
Member Author

gavv commented Apr 7, 2020

@ffisherr Do you still have plans on this?

@gavv
Copy link
Member Author

gavv commented Apr 29, 2020

Unassigning this so that someone else could pick it up. @ffisherr feel free to ping me if you decide to come back.

If somebody will pick this up, please take a look at these discussion at the mailing list:

https://www.freelists.org/post/roc/libRaptorQ
https://www.freelists.org/post/roc/roc-Re-libRaptorQ

@gavv gavv unassigned drdpov Apr 29, 2020
@gavv gavv added the codecs Audio and FEC codecs label May 25, 2020
@gavv gavv removed the hacktoberfest label Dec 4, 2020
@gavv
Copy link
Member Author

gavv commented Oct 2, 2023

The task is old but still relevant. We should check what is current status of libRaptorQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codecs Audio and FEC codecs enhancement help wanted An important and awaited task but we have no human resources for it yet
Projects
kanban board
Help wanted
Development

No branches or pull requests

2 participants