00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdint.h>
00022
00023 #include "rmsipr.h"
00024
00025 const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
00026
00027 static const unsigned char sipr_swaps[38][2] = {
00028 { 0, 63 }, { 1, 22 }, { 2, 44 }, { 3, 90 },
00029 { 5, 81 }, { 7, 31 }, { 8, 86 }, { 9, 58 },
00030 { 10, 36 }, { 12, 68 }, { 13, 39 }, { 14, 73 },
00031 { 15, 53 }, { 16, 69 }, { 17, 57 }, { 19, 88 },
00032 { 20, 34 }, { 21, 71 }, { 24, 46 }, { 25, 94 },
00033 { 26, 54 }, { 28, 75 }, { 29, 50 }, { 32, 70 },
00034 { 33, 92 }, { 35, 74 }, { 38, 85 }, { 40, 56 },
00035 { 42, 87 }, { 43, 65 }, { 45, 59 }, { 48, 79 },
00036 { 49, 93 }, { 51, 89 }, { 55, 95 }, { 61, 76 },
00037 { 67, 83 }, { 77, 80 }
00038 };
00039
00040
00041 void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
00042 {
00043 int n, bs = sub_packet_h * framesize * 2 / 96;
00044
00045 for (n = 0; n < 38; n++) {
00046 int j;
00047 int i = bs * sipr_swaps[n][0];
00048 int o = bs * sipr_swaps[n][1];
00049
00050
00051 for (j = 0; j < bs; j++, i++, o++) {
00052 int x = (buf[i >> 1] >> (4 * (i & 1))) & 0xF,
00053 y = (buf[o >> 1] >> (4 * (o & 1))) & 0xF;
00054
00055 buf[o >> 1] = (x << (4 * (o & 1))) |
00056 (buf[o >> 1] & (0xF << (4 * !(o & 1))));
00057 buf[i >> 1] = (y << (4 * (i & 1))) |
00058 (buf[i >> 1] & (0xF << (4 * !(i & 1))));
00059 }
00060 }
00061 }