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