1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ 13 14 // This file contains a set of packets masks for the FEC code. The masks in 15 // this table are specifically designed to favor recovery of bursty/consecutive 16 // loss network conditions. The tradeoff is worse recovery for random losses. 17 // These packet masks are currently defined to protect up to 12 media packets. 18 // They have the following property: for any packet mask defined by the 19 // parameters (k,m), where k = number of media packets, m = number of FEC 20 // packets, all "consecutive" losses of size <= m are completely recoverable. 21 // By consecutive losses we mean consecutive with respect to the sequence 22 // number ordering of the list (media and FEC) of packets. The difference 23 // between these masks (|kFecMaskBursty|) and |kFecMaskRandom| type, defined 24 // in fec_private_tables.h, is more significant for longer codes 25 // (i.e., more packets/symbols in the code, so larger (k,m), i.e., k > 4, 26 // m > 3). 27 28 #include "webrtc/typedefs.h" 29 30 namespace { 31 32 const uint8_t kMaskBursty1_1[2] = { 33 0x80, 0x00 34 }; 35 36 const uint8_t kMaskBursty2_1[2] = { 37 0xc0, 0x00 38 }; 39 40 const uint8_t kMaskBursty2_2[4] = { 41 0x80, 0x00, 42 0xc0, 0x00 43 }; 44 45 const uint8_t kMaskBursty3_1[2] = { 46 0xe0, 0x00 47 }; 48 49 const uint8_t kMaskBursty3_2[4] = { 50 0xc0, 0x00, 51 0xa0, 0x00 52 }; 53 54 const uint8_t kMaskBursty3_3[6] = { 55 0x80, 0x00, 56 0xc0, 0x00, 57 0x60, 0x00 58 }; 59 60 const uint8_t kMaskBursty4_1[2] = { 61 0xf0, 0x00 62 }; 63 64 const uint8_t kMaskBursty4_2[4] = { 65 0xa0, 0x00, 66 0xd0, 0x00 67 }; 68 69 const uint8_t kMaskBursty4_3[6] = { 70 0xc0, 0x00, 71 0x60, 0x00, 72 0x90, 0x00 73 }; 74 75 const uint8_t kMaskBursty4_4[8] = { 76 0x80, 0x00, 77 0xc0, 0x00, 78 0x60, 0x00, 79 0x30, 0x00 80 }; 81 82 const uint8_t kMaskBursty5_1[2] = { 83 0xf8, 0x00 84 }; 85 86 const uint8_t kMaskBursty5_2[4] = { 87 0xd0, 0x00, 88 0xa8, 0x00 89 }; 90 91 const uint8_t kMaskBursty5_3[6] = { 92 0x70, 0x00, 93 0x90, 0x00, 94 0xc8, 0x00 95 }; 96 97 const uint8_t kMaskBursty5_4[8] = { 98 0xc0, 0x00, 99 0x60, 0x00, 100 0x30, 0x00, 101 0x88, 0x00 102 }; 103 104 const uint8_t kMaskBursty5_5[10] = { 105 0x80, 0x00, 106 0xc0, 0x00, 107 0x60, 0x00, 108 0x30, 0x00, 109 0x18, 0x00 110 }; 111 112 const uint8_t kMaskBursty6_1[2] = { 113 0xfc, 0x00 114 }; 115 116 const uint8_t kMaskBursty6_2[4] = { 117 0xa8, 0x00, 118 0xd4, 0x00 119 }; 120 121 const uint8_t kMaskBursty6_3[6] = { 122 0x94, 0x00, 123 0xc8, 0x00, 124 0x64, 0x00 125 }; 126 127 const uint8_t kMaskBursty6_4[8] = { 128 0x60, 0x00, 129 0x38, 0x00, 130 0x88, 0x00, 131 0xc4, 0x00 132 }; 133 134 const uint8_t kMaskBursty6_5[10] = { 135 0xc0, 0x00, 136 0x60, 0x00, 137 0x30, 0x00, 138 0x18, 0x00, 139 0x84, 0x00 140 }; 141 142 const uint8_t kMaskBursty6_6[12] = { 143 0x80, 0x00, 144 0xc0, 0x00, 145 0x60, 0x00, 146 0x30, 0x00, 147 0x18, 0x00, 148 0x0c, 0x00 149 }; 150 151 const uint8_t kMaskBursty7_1[2] = { 152 0xfe, 0x00 153 }; 154 155 const uint8_t kMaskBursty7_2[4] = { 156 0xd4, 0x00, 157 0xaa, 0x00 158 }; 159 160 const uint8_t kMaskBursty7_3[6] = { 161 0xc8, 0x00, 162 0x74, 0x00, 163 0x92, 0x00 164 }; 165 166 const uint8_t kMaskBursty7_4[8] = { 167 0x38, 0x00, 168 0x8a, 0x00, 169 0xc4, 0x00, 170 0x62, 0x00 171 }; 172 173 const uint8_t kMaskBursty7_5[10] = { 174 0x60, 0x00, 175 0x30, 0x00, 176 0x1c, 0x00, 177 0x84, 0x00, 178 0xc2, 0x00 179 }; 180 181 const uint8_t kMaskBursty7_6[12] = { 182 0xc0, 0x00, 183 0x60, 0x00, 184 0x30, 0x00, 185 0x18, 0x00, 186 0x0c, 0x00, 187 0x82, 0x00 188 }; 189 190 const uint8_t kMaskBursty7_7[14] = { 191 0x80, 0x00, 192 0xc0, 0x00, 193 0x60, 0x00, 194 0x30, 0x00, 195 0x18, 0x00, 196 0x0c, 0x00, 197 0x06, 0x00 198 }; 199 200 const uint8_t kMaskBursty8_1[2] = { 201 0xff, 0x00 202 }; 203 204 const uint8_t kMaskBursty8_2[4] = { 205 0xaa, 0x00, 206 0xd5, 0x00 207 }; 208 209 const uint8_t kMaskBursty8_3[6] = { 210 0x74, 0x00, 211 0x92, 0x00, 212 0xc9, 0x00 213 }; 214 215 const uint8_t kMaskBursty8_4[8] = { 216 0x8a, 0x00, 217 0xc5, 0x00, 218 0x62, 0x00, 219 0x31, 0x00 220 }; 221 222 const uint8_t kMaskBursty8_5[10] = { 223 0x30, 0x00, 224 0x1c, 0x00, 225 0x85, 0x00, 226 0xc2, 0x00, 227 0x61, 0x00 228 }; 229 230 const uint8_t kMaskBursty8_6[12] = { 231 0x60, 0x00, 232 0x30, 0x00, 233 0x18, 0x00, 234 0x0e, 0x00, 235 0x82, 0x00, 236 0xc1, 0x00 237 }; 238 239 const uint8_t kMaskBursty8_7[14] = { 240 0xc0, 0x00, 241 0x60, 0x00, 242 0x30, 0x00, 243 0x18, 0x00, 244 0x0c, 0x00, 245 0x06, 0x00, 246 0x81, 0x00 247 }; 248 249 const uint8_t kMaskBursty8_8[16] = { 250 0x80, 0x00, 251 0xc0, 0x00, 252 0x60, 0x00, 253 0x30, 0x00, 254 0x18, 0x00, 255 0x0c, 0x00, 256 0x06, 0x00, 257 0x03, 0x00 258 }; 259 260 const uint8_t kMaskBursty9_1[2] = { 261 0xff, 0x80 262 }; 263 264 const uint8_t kMaskBursty9_2[4] = { 265 0xd5, 0x00, 266 0xaa, 0x80 267 }; 268 269 const uint8_t kMaskBursty9_3[6] = { 270 0x92, 0x00, 271 0xc9, 0x00, 272 0x74, 0x80 273 }; 274 275 const uint8_t kMaskBursty9_4[8] = { 276 0xc5, 0x00, 277 0x62, 0x00, 278 0x39, 0x00, 279 0x8a, 0x80 280 }; 281 282 const uint8_t kMaskBursty9_5[10] = { 283 0x1c, 0x00, 284 0x85, 0x00, 285 0xc2, 0x80, 286 0x61, 0x00, 287 0x30, 0x80 288 }; 289 290 const uint8_t kMaskBursty9_6[12] = { 291 0x30, 0x00, 292 0x18, 0x00, 293 0x0e, 0x00, 294 0x82, 0x80, 295 0xc1, 0x00, 296 0x60, 0x80 297 }; 298 299 const uint8_t kMaskBursty9_7[14] = { 300 0x60, 0x00, 301 0x30, 0x00, 302 0x18, 0x00, 303 0x0c, 0x00, 304 0x07, 0x00, 305 0x81, 0x00, 306 0xc0, 0x80 307 }; 308 309 const uint8_t kMaskBursty9_8[16] = { 310 0xc0, 0x00, 311 0x60, 0x00, 312 0x30, 0x00, 313 0x18, 0x00, 314 0x0c, 0x00, 315 0x06, 0x00, 316 0x03, 0x00, 317 0x80, 0x80 318 }; 319 320 const uint8_t kMaskBursty9_9[18] = { 321 0x80, 0x00, 322 0xc0, 0x00, 323 0x60, 0x00, 324 0x30, 0x00, 325 0x18, 0x00, 326 0x0c, 0x00, 327 0x06, 0x00, 328 0x03, 0x00, 329 0x01, 0x80 330 }; 331 332 const uint8_t kMaskBursty10_1[2] = { 333 0xff, 0xc0 334 }; 335 336 const uint8_t kMaskBursty10_2[4] = { 337 0xaa, 0x80, 338 0xd5, 0x40 339 }; 340 341 const uint8_t kMaskBursty10_3[6] = { 342 0xc9, 0x00, 343 0x74, 0x80, 344 0x92, 0x40 345 }; 346 347 const uint8_t kMaskBursty10_4[8] = { 348 0x62, 0x00, 349 0x39, 0x00, 350 0x8a, 0x80, 351 0xc5, 0x40 352 }; 353 354 const uint8_t kMaskBursty10_5[10] = { 355 0x85, 0x00, 356 0xc2, 0x80, 357 0x61, 0x40, 358 0x30, 0x80, 359 0x18, 0x40 360 }; 361 362 const uint8_t kMaskBursty10_6[12] = { 363 0x18, 0x00, 364 0x0e, 0x00, 365 0x82, 0x80, 366 0xc1, 0x40, 367 0x60, 0x80, 368 0x30, 0x40 369 }; 370 371 const uint8_t kMaskBursty10_7[14] = { 372 0x30, 0x00, 373 0x18, 0x00, 374 0x0c, 0x00, 375 0x07, 0x00, 376 0x81, 0x40, 377 0xc0, 0x80, 378 0x60, 0x40 379 }; 380 381 const uint8_t kMaskBursty10_8[16] = { 382 0x60, 0x00, 383 0x30, 0x00, 384 0x18, 0x00, 385 0x0c, 0x00, 386 0x06, 0x00, 387 0x03, 0x00, 388 0x80, 0x80, 389 0xc0, 0x40 390 }; 391 392 const uint8_t kMaskBursty10_9[18] = { 393 0xc0, 0x00, 394 0x60, 0x00, 395 0x30, 0x00, 396 0x18, 0x00, 397 0x0c, 0x00, 398 0x06, 0x00, 399 0x03, 0x00, 400 0x01, 0x80, 401 0x80, 0x40 402 }; 403 404 const uint8_t kMaskBursty10_10[20] = { 405 0x80, 0x00, 406 0xc0, 0x00, 407 0x60, 0x00, 408 0x30, 0x00, 409 0x18, 0x00, 410 0x0c, 0x00, 411 0x06, 0x00, 412 0x03, 0x00, 413 0x01, 0x80, 414 0x00, 0xc0 415 }; 416 417 const uint8_t kMaskBursty11_1[2] = { 418 0xff, 0xe0 419 }; 420 421 const uint8_t kMaskBursty11_2[4] = { 422 0xd5, 0x40, 423 0xaa, 0xa0 424 }; 425 426 const uint8_t kMaskBursty11_3[6] = { 427 0x74, 0x80, 428 0x92, 0x40, 429 0xc9, 0x20 430 }; 431 432 const uint8_t kMaskBursty11_4[8] = { 433 0x39, 0x00, 434 0x8a, 0x80, 435 0xc5, 0x40, 436 0x62, 0x20 437 }; 438 439 const uint8_t kMaskBursty11_5[10] = { 440 0xc2, 0xc0, 441 0x61, 0x00, 442 0x30, 0xa0, 443 0x1c, 0x40, 444 0x85, 0x20 445 }; 446 447 const uint8_t kMaskBursty11_6[12] = { 448 0x0e, 0x00, 449 0x82, 0x80, 450 0xc1, 0x40, 451 0x60, 0xa0, 452 0x30, 0x40, 453 0x18, 0x20 454 }; 455 456 const uint8_t kMaskBursty11_7[14] = { 457 0x18, 0x00, 458 0x0c, 0x00, 459 0x07, 0x00, 460 0x81, 0x40, 461 0xc0, 0xa0, 462 0x60, 0x40, 463 0x30, 0x20 464 }; 465 466 const uint8_t kMaskBursty11_8[16] = { 467 0x30, 0x00, 468 0x18, 0x00, 469 0x0c, 0x00, 470 0x06, 0x00, 471 0x03, 0x40, 472 0x80, 0xa0, 473 0xc0, 0x40, 474 0x60, 0x20 475 }; 476 477 const uint8_t kMaskBursty11_9[18] = { 478 0x60, 0x00, 479 0x30, 0x00, 480 0x18, 0x00, 481 0x0c, 0x00, 482 0x06, 0x00, 483 0x03, 0x00, 484 0x01, 0x80, 485 0x80, 0x40, 486 0xc0, 0x20 487 }; 488 489 const uint8_t kMaskBursty11_10[20] = { 490 0xc0, 0x00, 491 0x60, 0x00, 492 0x30, 0x00, 493 0x18, 0x00, 494 0x0c, 0x00, 495 0x06, 0x00, 496 0x03, 0x00, 497 0x01, 0x80, 498 0x00, 0xc0, 499 0x80, 0x20 500 }; 501 502 const uint8_t kMaskBursty11_11[22] = { 503 0x80, 0x00, 504 0xc0, 0x00, 505 0x60, 0x00, 506 0x30, 0x00, 507 0x18, 0x00, 508 0x0c, 0x00, 509 0x06, 0x00, 510 0x03, 0x00, 511 0x01, 0x80, 512 0x00, 0xc0, 513 0x00, 0x60 514 }; 515 516 const uint8_t kMaskBursty12_1[2] = { 517 0xff, 0xf0 518 }; 519 520 const uint8_t kMaskBursty12_2[4] = { 521 0xaa, 0xa0, 522 0xd5, 0x50 523 }; 524 525 const uint8_t kMaskBursty12_3[6] = { 526 0x92, 0x40, 527 0xc9, 0x20, 528 0x74, 0x90 529 }; 530 531 const uint8_t kMaskBursty12_4[8] = { 532 0x8a, 0x80, 533 0xc5, 0x40, 534 0x62, 0x20, 535 0x39, 0x10 536 }; 537 538 const uint8_t kMaskBursty12_5[10] = { 539 0x61, 0x00, 540 0x30, 0xa0, 541 0x1c, 0x50, 542 0x85, 0x20, 543 0xc2, 0x90 544 }; 545 546 const uint8_t kMaskBursty12_6[12] = { 547 0x82, 0x90, 548 0xc1, 0x40, 549 0x60, 0xa0, 550 0x30, 0x50, 551 0x18, 0x20, 552 0x0c, 0x10 553 }; 554 555 const uint8_t kMaskBursty12_7[14] = { 556 0x0c, 0x00, 557 0x07, 0x00, 558 0x81, 0x40, 559 0xc0, 0xa0, 560 0x60, 0x50, 561 0x30, 0x20, 562 0x18, 0x10 563 }; 564 565 const uint8_t kMaskBursty12_8[16] = { 566 0x18, 0x00, 567 0x0c, 0x00, 568 0x06, 0x00, 569 0x03, 0x00, 570 0x80, 0xa0, 571 0xc0, 0x50, 572 0x60, 0x20, 573 0x30, 0x10 574 }; 575 576 const uint8_t kMaskBursty12_9[18] = { 577 0x30, 0x00, 578 0x18, 0x00, 579 0x0c, 0x00, 580 0x06, 0x00, 581 0x03, 0x00, 582 0x01, 0x80, 583 0x80, 0x50, 584 0xc0, 0x20, 585 0x60, 0x10 586 }; 587 588 const uint8_t kMaskBursty12_10[20] = { 589 0x60, 0x00, 590 0x30, 0x00, 591 0x18, 0x00, 592 0x0c, 0x00, 593 0x06, 0x00, 594 0x03, 0x00, 595 0x01, 0x80, 596 0x00, 0xc0, 597 0x80, 0x20, 598 0xc0, 0x10 599 }; 600 601 const uint8_t kMaskBursty12_11[22] = { 602 0xc0, 0x00, 603 0x60, 0x00, 604 0x30, 0x00, 605 0x18, 0x00, 606 0x0c, 0x00, 607 0x06, 0x00, 608 0x03, 0x00, 609 0x01, 0x80, 610 0x00, 0xc0, 611 0x00, 0x60, 612 0x80, 0x10 613 }; 614 615 const uint8_t kMaskBursty12_12[24] = { 616 0x80, 0x00, 617 0xc0, 0x00, 618 0x60, 0x00, 619 0x30, 0x00, 620 0x18, 0x00, 621 0x0c, 0x00, 622 0x06, 0x00, 623 0x03, 0x00, 624 0x01, 0x80, 625 0x00, 0xc0, 626 0x00, 0x60, 627 0x00, 0x30 628 }; 629 630 const uint8_t* kPacketMaskBursty1[1] = { 631 kMaskBursty1_1 632 }; 633 634 const uint8_t* kPacketMaskBursty2[2] = { 635 kMaskBursty2_1, 636 kMaskBursty2_2 637 }; 638 639 const uint8_t* kPacketMaskBursty3[3] = { 640 kMaskBursty3_1, 641 kMaskBursty3_2, 642 kMaskBursty3_3 643 }; 644 645 const uint8_t* kPacketMaskBursty4[4] = { 646 kMaskBursty4_1, 647 kMaskBursty4_2, 648 kMaskBursty4_3, 649 kMaskBursty4_4 650 }; 651 652 const uint8_t* kPacketMaskBursty5[5] = { 653 kMaskBursty5_1, 654 kMaskBursty5_2, 655 kMaskBursty5_3, 656 kMaskBursty5_4, 657 kMaskBursty5_5 658 }; 659 660 const uint8_t* kPacketMaskBursty6[6] = { 661 kMaskBursty6_1, 662 kMaskBursty6_2, 663 kMaskBursty6_3, 664 kMaskBursty6_4, 665 kMaskBursty6_5, 666 kMaskBursty6_6 667 }; 668 669 const uint8_t* kPacketMaskBursty7[7] = { 670 kMaskBursty7_1, 671 kMaskBursty7_2, 672 kMaskBursty7_3, 673 kMaskBursty7_4, 674 kMaskBursty7_5, 675 kMaskBursty7_6, 676 kMaskBursty7_7 677 }; 678 679 const uint8_t* kPacketMaskBursty8[8] = { 680 kMaskBursty8_1, 681 kMaskBursty8_2, 682 kMaskBursty8_3, 683 kMaskBursty8_4, 684 kMaskBursty8_5, 685 kMaskBursty8_6, 686 kMaskBursty8_7, 687 kMaskBursty8_8 688 }; 689 690 const uint8_t* kPacketMaskBursty9[9] = { 691 kMaskBursty9_1, 692 kMaskBursty9_2, 693 kMaskBursty9_3, 694 kMaskBursty9_4, 695 kMaskBursty9_5, 696 kMaskBursty9_6, 697 kMaskBursty9_7, 698 kMaskBursty9_8, 699 kMaskBursty9_9 700 }; 701 702 const uint8_t* kPacketMaskBursty10[10] = { 703 kMaskBursty10_1, 704 kMaskBursty10_2, 705 kMaskBursty10_3, 706 kMaskBursty10_4, 707 kMaskBursty10_5, 708 kMaskBursty10_6, 709 kMaskBursty10_7, 710 kMaskBursty10_8, 711 kMaskBursty10_9, 712 kMaskBursty10_10 713 }; 714 715 const uint8_t* kPacketMaskBursty11[11] = { 716 kMaskBursty11_1, 717 kMaskBursty11_2, 718 kMaskBursty11_3, 719 kMaskBursty11_4, 720 kMaskBursty11_5, 721 kMaskBursty11_6, 722 kMaskBursty11_7, 723 kMaskBursty11_8, 724 kMaskBursty11_9, 725 kMaskBursty11_10, 726 kMaskBursty11_11 727 }; 728 729 const uint8_t* kPacketMaskBursty12[12] = { 730 kMaskBursty12_1, 731 kMaskBursty12_2, 732 kMaskBursty12_3, 733 kMaskBursty12_4, 734 kMaskBursty12_5, 735 kMaskBursty12_6, 736 kMaskBursty12_7, 737 kMaskBursty12_8, 738 kMaskBursty12_9, 739 kMaskBursty12_10, 740 kMaskBursty12_11, 741 kMaskBursty12_12 742 }; 743 744 const uint8_t** kPacketMaskBurstyTbl[12] = { 745 kPacketMaskBursty1, 746 kPacketMaskBursty2, 747 kPacketMaskBursty3, 748 kPacketMaskBursty4, 749 kPacketMaskBursty5, 750 kPacketMaskBursty6, 751 kPacketMaskBursty7, 752 kPacketMaskBursty8, 753 kPacketMaskBursty9, 754 kPacketMaskBursty10, 755 kPacketMaskBursty11, 756 kPacketMaskBursty12 757 }; 758 759 } // namespace 760 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ 761