Move the FEC private tables into .cc files.
Change the arrays to be continuous uint8_t arrays instead being of arrays of arrays (of arrays). Code size difference is 17K for arm, ~42K for arm64. New lookup algorithm, tailored for these two tables + tests. Instead of returning a raw pointer into the table, the algorithm returns an ArrayView, which includes size information for how much memory can be read. Change-Id: I000b094520bac944e518eb8b51d8dbef4670f5d7 Bug: webrtc:9102 Reviewed-on: https://webrtc-review.googlesource.com/65920 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22736}
This commit is contained in:
@ -111,7 +111,9 @@ rtc_static_library("rtp_rtcp") {
|
||||
"include/ulpfec_receiver.h",
|
||||
"source/dtmf_queue.cc",
|
||||
"source/dtmf_queue.h",
|
||||
"source/fec_private_tables_bursty.cc",
|
||||
"source/fec_private_tables_bursty.h",
|
||||
"source/fec_private_tables_random.cc",
|
||||
"source/fec_private_tables_random.h",
|
||||
"source/flexfec_header_reader_writer.cc",
|
||||
"source/flexfec_header_reader_writer.h",
|
||||
@ -331,6 +333,7 @@ if (rtc_include_tests) {
|
||||
|
||||
sources = [
|
||||
"source/byte_io_unittest.cc",
|
||||
"source/fec_private_tables_bursty_unittest.cc",
|
||||
"source/flexfec_header_reader_writer_unittest.cc",
|
||||
"source/flexfec_receiver_unittest.cc",
|
||||
"source/flexfec_sender_unittest.cc",
|
||||
|
661
modules/rtp_rtcp/source/fec_private_tables_bursty.cc
Normal file
661
modules/rtp_rtcp/source/fec_private_tables_bursty.cc
Normal file
@ -0,0 +1,661 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/rtp_rtcp/source/fec_private_tables_bursty.h"
|
||||
|
||||
|
||||
namespace {
|
||||
// clang-format off
|
||||
#define kMaskBursty1_1 \
|
||||
0x80, 0x00
|
||||
|
||||
#define kMaskBursty2_1 \
|
||||
0xc0, 0x00
|
||||
|
||||
#define kMaskBursty2_2 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00
|
||||
|
||||
#define kMaskBursty3_1 \
|
||||
0xe0, 0x00
|
||||
|
||||
#define kMaskBursty3_2 \
|
||||
0xc0, 0x00, \
|
||||
0xa0, 0x00
|
||||
|
||||
#define kMaskBursty3_3 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00
|
||||
|
||||
#define kMaskBursty4_1 \
|
||||
0xf0, 0x00
|
||||
|
||||
#define kMaskBursty4_2 \
|
||||
0xa0, 0x00, \
|
||||
0xd0, 0x00
|
||||
|
||||
#define kMaskBursty4_3 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x90, 0x00
|
||||
|
||||
#define kMaskBursty4_4 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00
|
||||
|
||||
#define kMaskBursty5_1 \
|
||||
0xf8, 0x00
|
||||
|
||||
#define kMaskBursty5_2 \
|
||||
0xd0, 0x00, \
|
||||
0xa8, 0x00
|
||||
|
||||
#define kMaskBursty5_3 \
|
||||
0x70, 0x00, \
|
||||
0x90, 0x00, \
|
||||
0xc8, 0x00
|
||||
|
||||
#define kMaskBursty5_4 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x88, 0x00
|
||||
|
||||
#define kMaskBursty5_5 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00
|
||||
|
||||
#define kMaskBursty6_1 \
|
||||
0xfc, 0x00
|
||||
|
||||
#define kMaskBursty6_2 \
|
||||
0xa8, 0x00, \
|
||||
0xd4, 0x00
|
||||
|
||||
#define kMaskBursty6_3 \
|
||||
0x94, 0x00, \
|
||||
0xc8, 0x00, \
|
||||
0x64, 0x00
|
||||
|
||||
#define kMaskBursty6_4 \
|
||||
0x60, 0x00, \
|
||||
0x38, 0x00, \
|
||||
0x88, 0x00, \
|
||||
0xc4, 0x00
|
||||
|
||||
#define kMaskBursty6_5 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x84, 0x00
|
||||
|
||||
#define kMaskBursty6_6 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00
|
||||
|
||||
#define kMaskBursty7_1 \
|
||||
0xfe, 0x00
|
||||
|
||||
#define kMaskBursty7_2 \
|
||||
0xd4, 0x00, \
|
||||
0xaa, 0x00
|
||||
|
||||
#define kMaskBursty7_3 \
|
||||
0xc8, 0x00, \
|
||||
0x74, 0x00, \
|
||||
0x92, 0x00
|
||||
|
||||
#define kMaskBursty7_4 \
|
||||
0x38, 0x00, \
|
||||
0x8a, 0x00, \
|
||||
0xc4, 0x00, \
|
||||
0x62, 0x00
|
||||
|
||||
#define kMaskBursty7_5 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x1c, 0x00, \
|
||||
0x84, 0x00, \
|
||||
0xc2, 0x00
|
||||
|
||||
#define kMaskBursty7_6 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x82, 0x00
|
||||
|
||||
#define kMaskBursty7_7 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00
|
||||
|
||||
#define kMaskBursty8_1 \
|
||||
0xff, 0x00
|
||||
|
||||
#define kMaskBursty8_2 \
|
||||
0xaa, 0x00, \
|
||||
0xd5, 0x00
|
||||
|
||||
#define kMaskBursty8_3 \
|
||||
0x74, 0x00, \
|
||||
0x92, 0x00, \
|
||||
0xc9, 0x00
|
||||
|
||||
#define kMaskBursty8_4 \
|
||||
0x8a, 0x00, \
|
||||
0xc5, 0x00, \
|
||||
0x62, 0x00, \
|
||||
0x31, 0x00
|
||||
|
||||
#define kMaskBursty8_5 \
|
||||
0x30, 0x00, \
|
||||
0x1c, 0x00, \
|
||||
0x85, 0x00, \
|
||||
0xc2, 0x00, \
|
||||
0x61, 0x00
|
||||
|
||||
#define kMaskBursty8_6 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0e, 0x00, \
|
||||
0x82, 0x00, \
|
||||
0xc1, 0x00
|
||||
|
||||
#define kMaskBursty8_7 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x81, 0x00
|
||||
|
||||
#define kMaskBursty8_8 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00
|
||||
|
||||
#define kMaskBursty9_1 \
|
||||
0xff, 0x80
|
||||
|
||||
#define kMaskBursty9_2 \
|
||||
0xd5, 0x00, \
|
||||
0xaa, 0x80
|
||||
|
||||
#define kMaskBursty9_3 \
|
||||
0x92, 0x00, \
|
||||
0xc9, 0x00, \
|
||||
0x74, 0x80
|
||||
|
||||
#define kMaskBursty9_4 \
|
||||
0xc5, 0x00, \
|
||||
0x62, 0x00, \
|
||||
0x39, 0x00, \
|
||||
0x8a, 0x80
|
||||
|
||||
#define kMaskBursty9_5 \
|
||||
0x1c, 0x00, \
|
||||
0x85, 0x00, \
|
||||
0xc2, 0x80, \
|
||||
0x61, 0x00, \
|
||||
0x30, 0x80
|
||||
|
||||
#define kMaskBursty9_6 \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0e, 0x00, \
|
||||
0x82, 0x80, \
|
||||
0xc1, 0x00, \
|
||||
0x60, 0x80
|
||||
|
||||
#define kMaskBursty9_7 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x07, 0x00, \
|
||||
0x81, 0x00, \
|
||||
0xc0, 0x80
|
||||
|
||||
#define kMaskBursty9_8 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x80, 0x80
|
||||
|
||||
#define kMaskBursty9_9 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80
|
||||
|
||||
#define kMaskBursty10_1 \
|
||||
0xff, 0xc0
|
||||
|
||||
#define kMaskBursty10_2 \
|
||||
0xaa, 0x80, \
|
||||
0xd5, 0x40
|
||||
|
||||
#define kMaskBursty10_3 \
|
||||
0xc9, 0x00, \
|
||||
0x74, 0x80, \
|
||||
0x92, 0x40
|
||||
|
||||
#define kMaskBursty10_4 \
|
||||
0x62, 0x00, \
|
||||
0x39, 0x00, \
|
||||
0x8a, 0x80, \
|
||||
0xc5, 0x40
|
||||
|
||||
#define kMaskBursty10_5 \
|
||||
0x85, 0x00, \
|
||||
0xc2, 0x80, \
|
||||
0x61, 0x40, \
|
||||
0x30, 0x80, \
|
||||
0x18, 0x40
|
||||
|
||||
#define kMaskBursty10_6 \
|
||||
0x18, 0x00, \
|
||||
0x0e, 0x00, \
|
||||
0x82, 0x80, \
|
||||
0xc1, 0x40, \
|
||||
0x60, 0x80, \
|
||||
0x30, 0x40
|
||||
|
||||
#define kMaskBursty10_7 \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x07, 0x00, \
|
||||
0x81, 0x40, \
|
||||
0xc0, 0x80, \
|
||||
0x60, 0x40
|
||||
|
||||
#define kMaskBursty10_8 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x80, 0x80, \
|
||||
0xc0, 0x40
|
||||
|
||||
#define kMaskBursty10_9 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x80, 0x40
|
||||
|
||||
#define kMaskBursty10_10 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0
|
||||
|
||||
#define kMaskBursty11_1 \
|
||||
0xff, 0xe0
|
||||
|
||||
#define kMaskBursty11_2 \
|
||||
0xd5, 0x40, \
|
||||
0xaa, 0xa0
|
||||
|
||||
#define kMaskBursty11_3 \
|
||||
0x74, 0x80, \
|
||||
0x92, 0x40, \
|
||||
0xc9, 0x20
|
||||
|
||||
#define kMaskBursty11_4 \
|
||||
0x39, 0x00, \
|
||||
0x8a, 0x80, \
|
||||
0xc5, 0x40, \
|
||||
0x62, 0x20
|
||||
|
||||
#define kMaskBursty11_5 \
|
||||
0xc2, 0xc0, \
|
||||
0x61, 0x00, \
|
||||
0x30, 0xa0, \
|
||||
0x1c, 0x40, \
|
||||
0x85, 0x20
|
||||
|
||||
#define kMaskBursty11_6 \
|
||||
0x0e, 0x00, \
|
||||
0x82, 0x80, \
|
||||
0xc1, 0x40, \
|
||||
0x60, 0xa0, \
|
||||
0x30, 0x40, \
|
||||
0x18, 0x20
|
||||
|
||||
#define kMaskBursty11_7 \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x07, 0x00, \
|
||||
0x81, 0x40, \
|
||||
0xc0, 0xa0, \
|
||||
0x60, 0x40, \
|
||||
0x30, 0x20
|
||||
|
||||
#define kMaskBursty11_8 \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x40, \
|
||||
0x80, 0xa0, \
|
||||
0xc0, 0x40, \
|
||||
0x60, 0x20
|
||||
|
||||
#define kMaskBursty11_9 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x80, 0x40, \
|
||||
0xc0, 0x20
|
||||
|
||||
#define kMaskBursty11_10 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0, \
|
||||
0x80, 0x20
|
||||
|
||||
#define kMaskBursty11_11 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0, \
|
||||
0x00, 0x60
|
||||
|
||||
#define kMaskBursty12_1 \
|
||||
0xff, 0xf0
|
||||
|
||||
#define kMaskBursty12_2 \
|
||||
0xaa, 0xa0, \
|
||||
0xd5, 0x50
|
||||
|
||||
#define kMaskBursty12_3 \
|
||||
0x92, 0x40, \
|
||||
0xc9, 0x20, \
|
||||
0x74, 0x90
|
||||
|
||||
#define kMaskBursty12_4 \
|
||||
0x8a, 0x80, \
|
||||
0xc5, 0x40, \
|
||||
0x62, 0x20, \
|
||||
0x39, 0x10
|
||||
|
||||
#define kMaskBursty12_5 \
|
||||
0x61, 0x00, \
|
||||
0x30, 0xa0, \
|
||||
0x1c, 0x50, \
|
||||
0x85, 0x20, \
|
||||
0xc2, 0x90
|
||||
|
||||
#define kMaskBursty12_6 \
|
||||
0x82, 0x90, \
|
||||
0xc1, 0x40, \
|
||||
0x60, 0xa0, \
|
||||
0x30, 0x50, \
|
||||
0x18, 0x20, \
|
||||
0x0c, 0x10
|
||||
|
||||
#define kMaskBursty12_7 \
|
||||
0x0c, 0x00, \
|
||||
0x07, 0x00, \
|
||||
0x81, 0x40, \
|
||||
0xc0, 0xa0, \
|
||||
0x60, 0x50, \
|
||||
0x30, 0x20, \
|
||||
0x18, 0x10
|
||||
|
||||
#define kMaskBursty12_8 \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x80, 0xa0, \
|
||||
0xc0, 0x50, \
|
||||
0x60, 0x20, \
|
||||
0x30, 0x10
|
||||
|
||||
#define kMaskBursty12_9 \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x80, 0x50, \
|
||||
0xc0, 0x20, \
|
||||
0x60, 0x10
|
||||
|
||||
#define kMaskBursty12_10 \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0, \
|
||||
0x80, 0x20, \
|
||||
0xc0, 0x10
|
||||
|
||||
#define kMaskBursty12_11 \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0, \
|
||||
0x00, 0x60, \
|
||||
0x80, 0x10
|
||||
|
||||
#define kMaskBursty12_12 \
|
||||
0x80, 0x00, \
|
||||
0xc0, 0x00, \
|
||||
0x60, 0x00, \
|
||||
0x30, 0x00, \
|
||||
0x18, 0x00, \
|
||||
0x0c, 0x00, \
|
||||
0x06, 0x00, \
|
||||
0x03, 0x00, \
|
||||
0x01, 0x80, \
|
||||
0x00, 0xc0, \
|
||||
0x00, 0x60, \
|
||||
0x00, 0x30
|
||||
|
||||
#define kPacketMaskBursty1 1, \
|
||||
kMaskBursty1_1
|
||||
|
||||
#define kPacketMaskBursty2 2, \
|
||||
kMaskBursty2_1, \
|
||||
kMaskBursty2_2
|
||||
|
||||
#define kPacketMaskBursty3 3, \
|
||||
kMaskBursty3_1, \
|
||||
kMaskBursty3_2, \
|
||||
kMaskBursty3_3
|
||||
|
||||
#define kPacketMaskBursty4 4, \
|
||||
kMaskBursty4_1, \
|
||||
kMaskBursty4_2, \
|
||||
kMaskBursty4_3, \
|
||||
kMaskBursty4_4
|
||||
|
||||
#define kPacketMaskBursty5 5, \
|
||||
kMaskBursty5_1, \
|
||||
kMaskBursty5_2, \
|
||||
kMaskBursty5_3, \
|
||||
kMaskBursty5_4, \
|
||||
kMaskBursty5_5
|
||||
|
||||
#define kPacketMaskBursty6 6, \
|
||||
kMaskBursty6_1, \
|
||||
kMaskBursty6_2, \
|
||||
kMaskBursty6_3, \
|
||||
kMaskBursty6_4, \
|
||||
kMaskBursty6_5, \
|
||||
kMaskBursty6_6
|
||||
|
||||
#define kPacketMaskBursty7 7, \
|
||||
kMaskBursty7_1, \
|
||||
kMaskBursty7_2, \
|
||||
kMaskBursty7_3, \
|
||||
kMaskBursty7_4, \
|
||||
kMaskBursty7_5, \
|
||||
kMaskBursty7_6, \
|
||||
kMaskBursty7_7
|
||||
|
||||
#define kPacketMaskBursty8 8, \
|
||||
kMaskBursty8_1, \
|
||||
kMaskBursty8_2, \
|
||||
kMaskBursty8_3, \
|
||||
kMaskBursty8_4, \
|
||||
kMaskBursty8_5, \
|
||||
kMaskBursty8_6, \
|
||||
kMaskBursty8_7, \
|
||||
kMaskBursty8_8
|
||||
|
||||
#define kPacketMaskBursty9 9, \
|
||||
kMaskBursty9_1, \
|
||||
kMaskBursty9_2, \
|
||||
kMaskBursty9_3, \
|
||||
kMaskBursty9_4, \
|
||||
kMaskBursty9_5, \
|
||||
kMaskBursty9_6, \
|
||||
kMaskBursty9_7, \
|
||||
kMaskBursty9_8, \
|
||||
kMaskBursty9_9
|
||||
|
||||
#define kPacketMaskBursty10 10, \
|
||||
kMaskBursty10_1, \
|
||||
kMaskBursty10_2, \
|
||||
kMaskBursty10_3, \
|
||||
kMaskBursty10_4, \
|
||||
kMaskBursty10_5, \
|
||||
kMaskBursty10_6, \
|
||||
kMaskBursty10_7, \
|
||||
kMaskBursty10_8, \
|
||||
kMaskBursty10_9, \
|
||||
kMaskBursty10_10
|
||||
|
||||
#define kPacketMaskBursty11 11, \
|
||||
kMaskBursty11_1, \
|
||||
kMaskBursty11_2, \
|
||||
kMaskBursty11_3, \
|
||||
kMaskBursty11_4, \
|
||||
kMaskBursty11_5, \
|
||||
kMaskBursty11_6, \
|
||||
kMaskBursty11_7, \
|
||||
kMaskBursty11_8, \
|
||||
kMaskBursty11_9, \
|
||||
kMaskBursty11_10, \
|
||||
kMaskBursty11_11
|
||||
|
||||
#define kPacketMaskBursty12 12, \
|
||||
kMaskBursty12_1, \
|
||||
kMaskBursty12_2, \
|
||||
kMaskBursty12_3, \
|
||||
kMaskBursty12_4, \
|
||||
kMaskBursty12_5, \
|
||||
kMaskBursty12_6, \
|
||||
kMaskBursty12_7, \
|
||||
kMaskBursty12_8, \
|
||||
kMaskBursty12_9, \
|
||||
kMaskBursty12_10, \
|
||||
kMaskBursty12_11, \
|
||||
kMaskBursty12_12
|
||||
|
||||
// clang-format on
|
||||
} // namespace
|
||||
|
||||
namespace webrtc {
|
||||
namespace fec_private_tables {
|
||||
|
||||
const uint8_t kPacketMaskBurstyTbl[] = {
|
||||
12,
|
||||
kPacketMaskBursty1,
|
||||
kPacketMaskBursty2,
|
||||
kPacketMaskBursty3,
|
||||
kPacketMaskBursty4,
|
||||
kPacketMaskBursty5,
|
||||
kPacketMaskBursty6,
|
||||
kPacketMaskBursty7,
|
||||
kPacketMaskBursty8,
|
||||
kPacketMaskBursty9,
|
||||
kPacketMaskBursty10,
|
||||
kPacketMaskBursty11,
|
||||
kPacketMaskBursty12,
|
||||
};
|
||||
|
||||
} // namespace fec_private_tables
|
||||
} // namespace webrtc
|
@ -25,737 +25,14 @@
|
||||
// (i.e., more packets/symbols in the code, so larger (k,m), i.e., k > 4,
|
||||
// m > 3).
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
namespace webrtc {
|
||||
namespace fec_private_tables {
|
||||
|
||||
const uint8_t kMaskBursty1_1[2] = {
|
||||
0x80, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty2_1[2] = {
|
||||
0xc0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty2_2[4] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty3_1[2] = {
|
||||
0xe0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty3_2[4] = {
|
||||
0xc0, 0x00,
|
||||
0xa0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty3_3[6] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty4_1[2] = {
|
||||
0xf0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty4_2[4] = {
|
||||
0xa0, 0x00,
|
||||
0xd0, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty4_3[6] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x90, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty4_4[8] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty5_1[2] = {
|
||||
0xf8, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty5_2[4] = {
|
||||
0xd0, 0x00,
|
||||
0xa8, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty5_3[6] = {
|
||||
0x70, 0x00,
|
||||
0x90, 0x00,
|
||||
0xc8, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty5_4[8] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x88, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty5_5[10] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_1[2] = {
|
||||
0xfc, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_2[4] = {
|
||||
0xa8, 0x00,
|
||||
0xd4, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_3[6] = {
|
||||
0x94, 0x00,
|
||||
0xc8, 0x00,
|
||||
0x64, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_4[8] = {
|
||||
0x60, 0x00,
|
||||
0x38, 0x00,
|
||||
0x88, 0x00,
|
||||
0xc4, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_5[10] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x84, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty6_6[12] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_1[2] = {
|
||||
0xfe, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_2[4] = {
|
||||
0xd4, 0x00,
|
||||
0xaa, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_3[6] = {
|
||||
0xc8, 0x00,
|
||||
0x74, 0x00,
|
||||
0x92, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_4[8] = {
|
||||
0x38, 0x00,
|
||||
0x8a, 0x00,
|
||||
0xc4, 0x00,
|
||||
0x62, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_5[10] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x1c, 0x00,
|
||||
0x84, 0x00,
|
||||
0xc2, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_6[12] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x82, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty7_7[14] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_1[2] = {
|
||||
0xff, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_2[4] = {
|
||||
0xaa, 0x00,
|
||||
0xd5, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_3[6] = {
|
||||
0x74, 0x00,
|
||||
0x92, 0x00,
|
||||
0xc9, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_4[8] = {
|
||||
0x8a, 0x00,
|
||||
0xc5, 0x00,
|
||||
0x62, 0x00,
|
||||
0x31, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_5[10] = {
|
||||
0x30, 0x00,
|
||||
0x1c, 0x00,
|
||||
0x85, 0x00,
|
||||
0xc2, 0x00,
|
||||
0x61, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_6[12] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0e, 0x00,
|
||||
0x82, 0x00,
|
||||
0xc1, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_7[14] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x81, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty8_8[16] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_1[2] = {
|
||||
0xff, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_2[4] = {
|
||||
0xd5, 0x00,
|
||||
0xaa, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_3[6] = {
|
||||
0x92, 0x00,
|
||||
0xc9, 0x00,
|
||||
0x74, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_4[8] = {
|
||||
0xc5, 0x00,
|
||||
0x62, 0x00,
|
||||
0x39, 0x00,
|
||||
0x8a, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_5[10] = {
|
||||
0x1c, 0x00,
|
||||
0x85, 0x00,
|
||||
0xc2, 0x80,
|
||||
0x61, 0x00,
|
||||
0x30, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_6[12] = {
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0e, 0x00,
|
||||
0x82, 0x80,
|
||||
0xc1, 0x00,
|
||||
0x60, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_7[14] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x07, 0x00,
|
||||
0x81, 0x00,
|
||||
0xc0, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_8[16] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x80, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty9_9[18] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_1[2] = {
|
||||
0xff, 0xc0
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_2[4] = {
|
||||
0xaa, 0x80,
|
||||
0xd5, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_3[6] = {
|
||||
0xc9, 0x00,
|
||||
0x74, 0x80,
|
||||
0x92, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_4[8] = {
|
||||
0x62, 0x00,
|
||||
0x39, 0x00,
|
||||
0x8a, 0x80,
|
||||
0xc5, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_5[10] = {
|
||||
0x85, 0x00,
|
||||
0xc2, 0x80,
|
||||
0x61, 0x40,
|
||||
0x30, 0x80,
|
||||
0x18, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_6[12] = {
|
||||
0x18, 0x00,
|
||||
0x0e, 0x00,
|
||||
0x82, 0x80,
|
||||
0xc1, 0x40,
|
||||
0x60, 0x80,
|
||||
0x30, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_7[14] = {
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x07, 0x00,
|
||||
0x81, 0x40,
|
||||
0xc0, 0x80,
|
||||
0x60, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_8[16] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x80, 0x80,
|
||||
0xc0, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_9[18] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x80, 0x40
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty10_10[20] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_1[2] = {
|
||||
0xff, 0xe0
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_2[4] = {
|
||||
0xd5, 0x40,
|
||||
0xaa, 0xa0
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_3[6] = {
|
||||
0x74, 0x80,
|
||||
0x92, 0x40,
|
||||
0xc9, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_4[8] = {
|
||||
0x39, 0x00,
|
||||
0x8a, 0x80,
|
||||
0xc5, 0x40,
|
||||
0x62, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_5[10] = {
|
||||
0xc2, 0xc0,
|
||||
0x61, 0x00,
|
||||
0x30, 0xa0,
|
||||
0x1c, 0x40,
|
||||
0x85, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_6[12] = {
|
||||
0x0e, 0x00,
|
||||
0x82, 0x80,
|
||||
0xc1, 0x40,
|
||||
0x60, 0xa0,
|
||||
0x30, 0x40,
|
||||
0x18, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_7[14] = {
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x07, 0x00,
|
||||
0x81, 0x40,
|
||||
0xc0, 0xa0,
|
||||
0x60, 0x40,
|
||||
0x30, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_8[16] = {
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x40,
|
||||
0x80, 0xa0,
|
||||
0xc0, 0x40,
|
||||
0x60, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_9[18] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x80, 0x40,
|
||||
0xc0, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_10[20] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0,
|
||||
0x80, 0x20
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty11_11[22] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0,
|
||||
0x00, 0x60
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_1[2] = {
|
||||
0xff, 0xf0
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_2[4] = {
|
||||
0xaa, 0xa0,
|
||||
0xd5, 0x50
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_3[6] = {
|
||||
0x92, 0x40,
|
||||
0xc9, 0x20,
|
||||
0x74, 0x90
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_4[8] = {
|
||||
0x8a, 0x80,
|
||||
0xc5, 0x40,
|
||||
0x62, 0x20,
|
||||
0x39, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_5[10] = {
|
||||
0x61, 0x00,
|
||||
0x30, 0xa0,
|
||||
0x1c, 0x50,
|
||||
0x85, 0x20,
|
||||
0xc2, 0x90
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_6[12] = {
|
||||
0x82, 0x90,
|
||||
0xc1, 0x40,
|
||||
0x60, 0xa0,
|
||||
0x30, 0x50,
|
||||
0x18, 0x20,
|
||||
0x0c, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_7[14] = {
|
||||
0x0c, 0x00,
|
||||
0x07, 0x00,
|
||||
0x81, 0x40,
|
||||
0xc0, 0xa0,
|
||||
0x60, 0x50,
|
||||
0x30, 0x20,
|
||||
0x18, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_8[16] = {
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x80, 0xa0,
|
||||
0xc0, 0x50,
|
||||
0x60, 0x20,
|
||||
0x30, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_9[18] = {
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x80, 0x50,
|
||||
0xc0, 0x20,
|
||||
0x60, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_10[20] = {
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0,
|
||||
0x80, 0x20,
|
||||
0xc0, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_11[22] = {
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0,
|
||||
0x00, 0x60,
|
||||
0x80, 0x10
|
||||
};
|
||||
|
||||
const uint8_t kMaskBursty12_12[24] = {
|
||||
0x80, 0x00,
|
||||
0xc0, 0x00,
|
||||
0x60, 0x00,
|
||||
0x30, 0x00,
|
||||
0x18, 0x00,
|
||||
0x0c, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x01, 0x80,
|
||||
0x00, 0xc0,
|
||||
0x00, 0x60,
|
||||
0x00, 0x30
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty1[1] = {
|
||||
kMaskBursty1_1
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty2[2] = {
|
||||
kMaskBursty2_1,
|
||||
kMaskBursty2_2
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty3[3] = {
|
||||
kMaskBursty3_1,
|
||||
kMaskBursty3_2,
|
||||
kMaskBursty3_3
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty4[4] = {
|
||||
kMaskBursty4_1,
|
||||
kMaskBursty4_2,
|
||||
kMaskBursty4_3,
|
||||
kMaskBursty4_4
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty5[5] = {
|
||||
kMaskBursty5_1,
|
||||
kMaskBursty5_2,
|
||||
kMaskBursty5_3,
|
||||
kMaskBursty5_4,
|
||||
kMaskBursty5_5
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty6[6] = {
|
||||
kMaskBursty6_1,
|
||||
kMaskBursty6_2,
|
||||
kMaskBursty6_3,
|
||||
kMaskBursty6_4,
|
||||
kMaskBursty6_5,
|
||||
kMaskBursty6_6
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty7[7] = {
|
||||
kMaskBursty7_1,
|
||||
kMaskBursty7_2,
|
||||
kMaskBursty7_3,
|
||||
kMaskBursty7_4,
|
||||
kMaskBursty7_5,
|
||||
kMaskBursty7_6,
|
||||
kMaskBursty7_7
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty8[8] = {
|
||||
kMaskBursty8_1,
|
||||
kMaskBursty8_2,
|
||||
kMaskBursty8_3,
|
||||
kMaskBursty8_4,
|
||||
kMaskBursty8_5,
|
||||
kMaskBursty8_6,
|
||||
kMaskBursty8_7,
|
||||
kMaskBursty8_8
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty9[9] = {
|
||||
kMaskBursty9_1,
|
||||
kMaskBursty9_2,
|
||||
kMaskBursty9_3,
|
||||
kMaskBursty9_4,
|
||||
kMaskBursty9_5,
|
||||
kMaskBursty9_6,
|
||||
kMaskBursty9_7,
|
||||
kMaskBursty9_8,
|
||||
kMaskBursty9_9
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty10[10] = {
|
||||
kMaskBursty10_1,
|
||||
kMaskBursty10_2,
|
||||
kMaskBursty10_3,
|
||||
kMaskBursty10_4,
|
||||
kMaskBursty10_5,
|
||||
kMaskBursty10_6,
|
||||
kMaskBursty10_7,
|
||||
kMaskBursty10_8,
|
||||
kMaskBursty10_9,
|
||||
kMaskBursty10_10
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty11[11] = {
|
||||
kMaskBursty11_1,
|
||||
kMaskBursty11_2,
|
||||
kMaskBursty11_3,
|
||||
kMaskBursty11_4,
|
||||
kMaskBursty11_5,
|
||||
kMaskBursty11_6,
|
||||
kMaskBursty11_7,
|
||||
kMaskBursty11_8,
|
||||
kMaskBursty11_9,
|
||||
kMaskBursty11_10,
|
||||
kMaskBursty11_11
|
||||
};
|
||||
|
||||
const uint8_t* const kPacketMaskBursty12[12] = {
|
||||
kMaskBursty12_1,
|
||||
kMaskBursty12_2,
|
||||
kMaskBursty12_3,
|
||||
kMaskBursty12_4,
|
||||
kMaskBursty12_5,
|
||||
kMaskBursty12_6,
|
||||
kMaskBursty12_7,
|
||||
kMaskBursty12_8,
|
||||
kMaskBursty12_9,
|
||||
kMaskBursty12_10,
|
||||
kMaskBursty12_11,
|
||||
kMaskBursty12_12
|
||||
};
|
||||
|
||||
const uint8_t* const* const kPacketMaskBurstyTbl[12] = {
|
||||
kPacketMaskBursty1,
|
||||
kPacketMaskBursty2,
|
||||
kPacketMaskBursty3,
|
||||
kPacketMaskBursty4,
|
||||
kPacketMaskBursty5,
|
||||
kPacketMaskBursty6,
|
||||
kPacketMaskBursty7,
|
||||
kPacketMaskBursty8,
|
||||
kPacketMaskBursty9,
|
||||
kPacketMaskBursty10,
|
||||
kPacketMaskBursty11,
|
||||
kPacketMaskBursty12
|
||||
};
|
||||
extern const uint8_t kPacketMaskBurstyTbl[];
|
||||
|
||||
} // namespace fec_private_tables
|
||||
} // namespace webrtc
|
||||
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/rtp_rtcp/source/fec_private_tables_bursty.h"
|
||||
#include "modules/rtp_rtcp/source/fec_private_tables_random.h"
|
||||
#include "modules/rtp_rtcp/source/forward_error_correction_internal.h"
|
||||
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace fec_private_tables {
|
||||
|
||||
using internal::LookUpInFecTable;
|
||||
|
||||
TEST(FecTable, TestBurstyLookup) {
|
||||
rtc::ArrayView<const uint8_t> result;
|
||||
result = LookUpInFecTable(&kPacketMaskBurstyTbl[0], 0, 0);
|
||||
// Should match kMaskBursty1_1.
|
||||
EXPECT_EQ(2u, result.size());
|
||||
EXPECT_EQ(0x80u, result[0]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskBurstyTbl[0], 3, 0);
|
||||
// Should match kMaskBursty4_1.
|
||||
EXPECT_EQ(2u, result.size());
|
||||
EXPECT_EQ(0xf0u, result[0]);
|
||||
EXPECT_EQ(0x00u, result[1]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskBurstyTbl[0], 1, 1);
|
||||
// Should match kMaskBursty2_2.
|
||||
EXPECT_EQ(4u, result.size());
|
||||
EXPECT_EQ(0x80u, result[0]);
|
||||
EXPECT_EQ(0xc0u, result[2]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskBurstyTbl[0], 11, 11);
|
||||
// Should match kMaskBursty12_12.
|
||||
EXPECT_EQ(24u, result.size());
|
||||
EXPECT_EQ(0x80u, result[0]);
|
||||
EXPECT_EQ(0x30u, result[23]);
|
||||
}
|
||||
|
||||
TEST(FecTable, TestRandomLookup) {
|
||||
rtc::ArrayView<const uint8_t> result;
|
||||
result = LookUpInFecTable(&kPacketMaskRandomTbl[0], 0, 0);
|
||||
EXPECT_EQ(2u, result.size());
|
||||
EXPECT_EQ(0x80u, result[0]);
|
||||
EXPECT_EQ(0x00u, result[1]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskRandomTbl[0], 4, 1);
|
||||
// kMaskRandom5_2.
|
||||
EXPECT_EQ(4u, result.size());
|
||||
EXPECT_EQ(0xa8u, result[0]);
|
||||
EXPECT_EQ(0xd0u, result[2]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskRandomTbl[0], 16, 0);
|
||||
// kMaskRandom17_1.
|
||||
EXPECT_EQ(6u, result.size());
|
||||
EXPECT_EQ(0xffu, result[0]);
|
||||
EXPECT_EQ(0x00u, result[5]);
|
||||
|
||||
result = LookUpInFecTable(&kPacketMaskRandomTbl[0], 47, 47);
|
||||
// kMaskRandom48_48.
|
||||
EXPECT_EQ(6u * 48, result.size());
|
||||
EXPECT_EQ(0x10u, result[0]);
|
||||
EXPECT_EQ(0x02u, result[6]);
|
||||
}
|
||||
|
||||
} // namespace fec_private_tables
|
||||
} // namespace webrtc
|
23298
modules/rtp_rtcp/source/fec_private_tables_random.cc
Normal file
23298
modules/rtp_rtcp/source/fec_private_tables_random.cc
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -10,9 +10,6 @@
|
||||
|
||||
#include "modules/rtp_rtcp/source/forward_error_correction_internal.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "modules/rtp_rtcp/source/fec_private_tables_bursty.h"
|
||||
@ -20,9 +17,6 @@
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace {
|
||||
using webrtc::fec_private_tables::kPacketMaskBurstyTbl;
|
||||
using webrtc::fec_private_tables::kPacketMaskRandomTbl;
|
||||
|
||||
// Allow for different modes of protection for packets in UEP case.
|
||||
enum ProtectionMode {
|
||||
kModeNoOverlap,
|
||||
@ -140,6 +134,7 @@ void ShiftFitSubMask(int num_mask_bytes,
|
||||
packet_mask[pkt_mask_idx] = shift_right_curr_byte;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace webrtc {
|
||||
@ -147,50 +142,31 @@ namespace internal {
|
||||
|
||||
PacketMaskTable::PacketMaskTable(FecMaskType fec_mask_type,
|
||||
int num_media_packets)
|
||||
: fec_mask_type_(InitMaskType(fec_mask_type, num_media_packets)),
|
||||
fec_packet_mask_table_(InitMaskTable(fec_mask_type_)) {}
|
||||
: table_(PickTable(fec_mask_type, num_media_packets)) {}
|
||||
|
||||
// Sets |fec_mask_type_| to the type of packet mask selected. The type of
|
||||
// packet mask selected is based on |fec_mask_type| and |num_media_packets|.
|
||||
// If |num_media_packets| is larger than the maximum allowed by |fec_mask_type|
|
||||
// for the bursty type, then the random type is selected.
|
||||
FecMaskType PacketMaskTable::InitMaskType(FecMaskType fec_mask_type,
|
||||
int num_media_packets) {
|
||||
// The mask should not be bigger than |packetMaskTbl|.
|
||||
assert(num_media_packets <= static_cast<int>(sizeof(kPacketMaskRandomTbl) /
|
||||
sizeof(*kPacketMaskRandomTbl)));
|
||||
switch (fec_mask_type) {
|
||||
case kFecMaskRandom: {
|
||||
return kFecMaskRandom;
|
||||
}
|
||||
case kFecMaskBursty: {
|
||||
int max_media_packets = static_cast<int>(sizeof(kPacketMaskBurstyTbl) /
|
||||
sizeof(*kPacketMaskBurstyTbl));
|
||||
if (num_media_packets > max_media_packets) {
|
||||
return kFecMaskRandom;
|
||||
} else {
|
||||
return kFecMaskBursty;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
return kFecMaskRandom;
|
||||
PacketMaskTable::~PacketMaskTable() = default;
|
||||
|
||||
rtc::ArrayView<const uint8_t> PacketMaskTable::LookUp(int media_packet_index,
|
||||
int fec_index) const {
|
||||
return LookUpInFecTable(table_, media_packet_index, fec_index);
|
||||
}
|
||||
|
||||
// Returns the pointer to the packet mask tables corresponding to type
|
||||
// |fec_mask_type|.
|
||||
const uint8_t* const* const* PacketMaskTable::InitMaskTable(
|
||||
FecMaskType fec_mask_type) {
|
||||
switch (fec_mask_type) {
|
||||
case kFecMaskRandom: {
|
||||
return kPacketMaskRandomTbl;
|
||||
// If |num_media_packets| is larger than the maximum allowed by |fec_mask_type|
|
||||
// for the bursty type, or the random table is explicitly asked for, then the
|
||||
// random type is selected. Otherwise the bursty table callback is returned.
|
||||
const uint8_t* PacketMaskTable::PickTable(FecMaskType fec_mask_type,
|
||||
int num_media_packets) {
|
||||
RTC_DCHECK_GE(num_media_packets, 0);
|
||||
RTC_DCHECK_LE(static_cast<size_t>(num_media_packets),
|
||||
fec_private_tables::kPacketMaskRandomTbl[0]);
|
||||
|
||||
if (fec_mask_type != kFecMaskRandom &&
|
||||
num_media_packets <=
|
||||
static_cast<int>(fec_private_tables::kPacketMaskBurstyTbl[0])) {
|
||||
return &fec_private_tables::kPacketMaskBurstyTbl[0];
|
||||
}
|
||||
case kFecMaskBursty: {
|
||||
return kPacketMaskBurstyTbl;
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
return kPacketMaskRandomTbl;
|
||||
|
||||
return &fec_private_tables::kPacketMaskRandomTbl[0];
|
||||
}
|
||||
|
||||
// Remaining protection after important (first partition) packet protection
|
||||
@ -207,24 +183,20 @@ void RemainingPacketProtection(int num_media_packets,
|
||||
const int res_mask_bytes =
|
||||
PacketMaskSize(num_media_packets - num_fec_for_imp_packets);
|
||||
|
||||
const uint8_t* packet_mask_sub_21 =
|
||||
mask_table.fec_packet_mask_table()[num_media_packets -
|
||||
num_fec_for_imp_packets -
|
||||
1][num_fec_remaining - 1];
|
||||
auto end_row = (num_fec_for_imp_packets + num_fec_remaining);
|
||||
rtc::ArrayView<const uint8_t> packet_mask_sub_21 = mask_table.LookUp(
|
||||
num_media_packets - num_fec_for_imp_packets - 1, num_fec_remaining - 1);
|
||||
|
||||
ShiftFitSubMask(num_mask_bytes, res_mask_bytes, num_fec_for_imp_packets,
|
||||
(num_fec_for_imp_packets + num_fec_remaining),
|
||||
packet_mask_sub_21, packet_mask);
|
||||
end_row, &packet_mask_sub_21[0], packet_mask);
|
||||
|
||||
} else if (mode == kModeOverlap || mode == kModeBiasFirstPacket) {
|
||||
// sub_mask22
|
||||
|
||||
const uint8_t* packet_mask_sub_22 =
|
||||
mask_table.fec_packet_mask_table()[num_media_packets -
|
||||
1][num_fec_remaining - 1];
|
||||
rtc::ArrayView<const uint8_t> packet_mask_sub_22 =
|
||||
mask_table.LookUp(num_media_packets - 1, num_fec_remaining - 1);
|
||||
|
||||
FitSubMask(num_mask_bytes, num_mask_bytes, num_fec_remaining,
|
||||
packet_mask_sub_22,
|
||||
&packet_mask_sub_22[0],
|
||||
&packet_mask[num_fec_for_imp_packets * num_mask_bytes]);
|
||||
|
||||
if (mode == kModeBiasFirstPacket) {
|
||||
@ -234,7 +206,7 @@ void RemainingPacketProtection(int num_media_packets,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assert(false);
|
||||
RTC_NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,12 +219,11 @@ void ImportantPacketProtection(int num_fec_for_imp_packets,
|
||||
const int num_imp_mask_bytes = PacketMaskSize(num_imp_packets);
|
||||
|
||||
// Get sub_mask1 from table
|
||||
const uint8_t* packet_mask_sub_1 =
|
||||
mask_table.fec_packet_mask_table()[num_imp_packets -
|
||||
1][num_fec_for_imp_packets - 1];
|
||||
rtc::ArrayView<const uint8_t> packet_mask_sub_1 =
|
||||
mask_table.LookUp(num_imp_packets - 1, num_fec_for_imp_packets - 1);
|
||||
|
||||
FitSubMask(num_mask_bytes, num_imp_mask_bytes, num_fec_for_imp_packets,
|
||||
packet_mask_sub_1, packet_mask);
|
||||
&packet_mask_sub_1[0], packet_mask);
|
||||
}
|
||||
|
||||
// This function sets the protection allocation: i.e., how many FEC packets
|
||||
@ -362,15 +333,72 @@ void UnequalProtectionMask(int num_media_packets,
|
||||
}
|
||||
}
|
||||
|
||||
// This algorithm is tailored to look up data in the |kPacketMaskRandomTbl| and
|
||||
// |kPacketMaskBurstyTbl| tables.
|
||||
// The format of those arrays is that they're essentially a 3 dimensional array
|
||||
// with the following dimensions:
|
||||
// * media packet
|
||||
// * Size for kPacketMaskRandomTbl: 48
|
||||
// * Size for kPacketMaskBurstyTbl: 12
|
||||
// * fec index
|
||||
// * Size for both random and bursty table increases from 1 to number of rows.
|
||||
// (i.e. 1-48, or 1-12 respectively).
|
||||
// * Fec data (what actually gets returned)
|
||||
// * Size for kPacketMaskRandomTbl:
|
||||
// * For the first 16 entries: 2 * fec index (1 based)
|
||||
// * For entries >= 17: 6 * fec index (1 based)
|
||||
// * Size for kPacketMaskBurstyTbl: 2 bytes.
|
||||
// * For all entries: 2 * fec index (1 based)
|
||||
rtc::ArrayView<const uint8_t> LookUpInFecTable(const uint8_t* table,
|
||||
int media_packet_index,
|
||||
int fec_index) {
|
||||
RTC_DCHECK_GE(media_packet_index, 0);
|
||||
RTC_DCHECK_GE(fec_index, 0);
|
||||
RTC_DCHECK_LT(media_packet_index, table[0]);
|
||||
|
||||
// Skip over the table size.
|
||||
const uint8_t* entry = &table[1];
|
||||
|
||||
uint8_t entry_size_increment = 2; // 0-16 are 2 byte wide, then changes to 6.
|
||||
|
||||
// Hop over un-interesting array entries.
|
||||
for (int i = 0; i < media_packet_index; ++i) {
|
||||
if (i == 16)
|
||||
entry_size_increment = 6;
|
||||
uint8_t count = entry[0];
|
||||
++entry; // skip over the count.
|
||||
for (int j = 0; j < count; ++j) {
|
||||
entry += entry_size_increment * (j + 1); // skip over the data.
|
||||
}
|
||||
}
|
||||
|
||||
if (media_packet_index == 16)
|
||||
entry_size_increment = 6;
|
||||
|
||||
RTC_DCHECK_LT(fec_index, entry[0]);
|
||||
++entry; // Skip over the size.
|
||||
|
||||
// Find the appropriate data in the second dimension.
|
||||
|
||||
// Find the specific data we're looking for.
|
||||
for (int i = 0; i < fec_index; ++i)
|
||||
entry += entry_size_increment * (i + 1); // skip over the data.
|
||||
|
||||
size_t size = entry_size_increment * (fec_index + 1);
|
||||
return {&entry[0], size};
|
||||
}
|
||||
|
||||
void GeneratePacketMasks(int num_media_packets,
|
||||
int num_fec_packets,
|
||||
int num_imp_packets,
|
||||
bool use_unequal_protection,
|
||||
const PacketMaskTable& mask_table,
|
||||
uint8_t* packet_mask) {
|
||||
assert(num_media_packets > 0);
|
||||
assert(num_fec_packets <= num_media_packets && num_fec_packets > 0);
|
||||
assert(num_imp_packets <= num_media_packets && num_imp_packets >= 0);
|
||||
RTC_DCHECK_GT(num_media_packets, 0);
|
||||
RTC_DCHECK_GT(num_fec_packets, 0);
|
||||
RTC_DCHECK_LE(num_fec_packets, num_media_packets);
|
||||
RTC_DCHECK_LE(num_imp_packets, num_media_packets);
|
||||
RTC_DCHECK_GE(num_imp_packets, 0);
|
||||
|
||||
const int num_mask_bytes = PacketMaskSize(num_media_packets);
|
||||
|
||||
@ -379,10 +407,9 @@ void GeneratePacketMasks(int num_media_packets,
|
||||
// Retrieve corresponding mask table directly:for equal-protection case.
|
||||
// Mask = (k,n-k), with protection factor = (n-k)/k,
|
||||
// where k = num_media_packets, n=total#packets, (n-k)=num_fec_packets.
|
||||
memcpy(packet_mask,
|
||||
mask_table.fec_packet_mask_table()[num_media_packets -
|
||||
1][num_fec_packets - 1],
|
||||
num_fec_packets * num_mask_bytes);
|
||||
rtc::ArrayView<const uint8_t> mask =
|
||||
mask_table.LookUp(num_media_packets - 1, num_fec_packets - 1);
|
||||
memcpy(packet_mask, &mask[0], mask.size());
|
||||
} else { // UEP case
|
||||
UnequalProtectionMask(num_media_packets, num_fec_packets, num_imp_packets,
|
||||
num_mask_bytes, packet_mask, mask_table);
|
||||
|
@ -12,7 +12,8 @@
|
||||
#define MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_
|
||||
|
||||
#include "modules/include/module_common_types.h"
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
#include "api/array_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -33,19 +34,21 @@ namespace internal {
|
||||
class PacketMaskTable {
|
||||
public:
|
||||
PacketMaskTable(FecMaskType fec_mask_type, int num_media_packets);
|
||||
~PacketMaskTable() {}
|
||||
FecMaskType fec_mask_type() const { return fec_mask_type_; }
|
||||
const uint8_t* const* const* fec_packet_mask_table() const {
|
||||
return fec_packet_mask_table_;
|
||||
}
|
||||
~PacketMaskTable();
|
||||
|
||||
rtc::ArrayView<const uint8_t> LookUp(int media_packet_index,
|
||||
int fec_index) const;
|
||||
|
||||
private:
|
||||
FecMaskType InitMaskType(FecMaskType fec_mask_type, int num_media_packets);
|
||||
const uint8_t* const* const* InitMaskTable(FecMaskType fec_mask_type_);
|
||||
const FecMaskType fec_mask_type_;
|
||||
const uint8_t* const* const* fec_packet_mask_table_;
|
||||
static const uint8_t* PickTable(FecMaskType fec_mask_type,
|
||||
int num_media_packets);
|
||||
const uint8_t* table_;
|
||||
};
|
||||
|
||||
rtc::ArrayView<const uint8_t> LookUpInFecTable(const uint8_t* table,
|
||||
int media_packet_index,
|
||||
int fec_index);
|
||||
|
||||
// Returns an array of packet masks. The mask of a single FEC packet
|
||||
// corresponds to a number of mask bytes. The mask indicates which
|
||||
// media packets should be protected by the FEC packet.
|
||||
|
@ -725,8 +725,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
fprintf(fp_mask_, "\n");
|
||||
}
|
||||
|
||||
int ProcessXORPacketMasks(CodeType code_type,
|
||||
FecMaskType fec_mask_type) {
|
||||
int ProcessXORPacketMasks(CodeType code_type, FecMaskType fec_mask_type) {
|
||||
int code_index = 0;
|
||||
// Maximum number of media packets allowed for the mask type.
|
||||
const int packet_mask_max = kMaxMediaPackets[fec_mask_type];
|
||||
@ -734,17 +733,16 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
new uint8_t[packet_mask_max * kUlpfecMaxPacketMaskSize]);
|
||||
// Loop through codes up to |kMaxMediaPacketsTest|.
|
||||
for (int num_media_packets = 1; num_media_packets <= kMaxMediaPacketsTest;
|
||||
num_media_packets++) {
|
||||
++num_media_packets) {
|
||||
const int mask_bytes_fec_packet =
|
||||
static_cast<int>(internal::PacketMaskSize(num_media_packets));
|
||||
internal::PacketMaskTable mask_table(fec_mask_type, num_media_packets);
|
||||
for (int num_fec_packets = 1; num_fec_packets <= num_media_packets;
|
||||
num_fec_packets++) {
|
||||
memset(packet_mask.get(), 0, num_media_packets * mask_bytes_fec_packet);
|
||||
memcpy(packet_mask.get(),
|
||||
mask_table.fec_packet_mask_table()[num_media_packets - 1]
|
||||
[num_fec_packets - 1],
|
||||
num_fec_packets * mask_bytes_fec_packet);
|
||||
rtc::ArrayView<const uint8_t> mask =
|
||||
mask_table.LookUp(num_media_packets - 1, num_fec_packets - 1);
|
||||
memcpy(packet_mask.get(), &mask[0], mask.size());
|
||||
// Convert to bit mask.
|
||||
GetPacketMaskConvertToBitMask(packet_mask.get(), num_media_packets,
|
||||
num_fec_packets, mask_bytes_fec_packet,
|
||||
|
Reference in New Issue
Block a user