📄 mime_io.cpp
字号:
13, 10, 14, 24, 23, 22, 26, 8, 15, 53, 228, 31, 138, 313, 9, 33, 11, 139, 314, 54, 229, 28, 27, 140, 315, 34, 35, 29, 46, 32, 30, 55, 230, 37, 36, 39, 38, 40, 141, 316, 41, 42, 43, 44, 45, 56, 142, 231, 317, 63, 73, 92, 340, 82, 324, 149, 353, 159, 334, 165, 338, 178, 163, 254, 77, 168, 257, 153, 343, 57, 248, 238, 79, 252, 166, 67, 80, 201, 101, 267, 143, 164, 341, 255, 339, 187, 376, 318, 78, 328, 362, 115, 232, 242, 253, 290, 276, 62, 58, 158, 68, 93, 179, 319, 148, 169, 154, 72, 385, 329, 333, 344, 102, 83, 144, 233, 323, 124, 243, 192, 354, 237, 64, 247, 202, 209, 150, 116, 335, 268, 239, 299, 188, 196, 298, 94, 195, 258, 123, 363, 384, 109, 325, 371, 170, 370, 84, 110, 295, 180, 74, 210, 191, 106, 291, 205, 367, 381, 377, 206, 355, 122, 119, 120, 383, 160, 105, 108, 277, 380, 294, 284, 285, 345, 208, 269, 249, 366, 386, 300, 297, 259, 125, 369, 197, 97, 194, 286, 211, 281, 280, 183, 372, 87, 155, 283, 59, 348, 327, 184, 76, 111, 330, 203, 349, 69, 98, 152, 145, 189, 66, 320, 337, 173, 358, 251, 198, 174, 263, 262, 126, 241, 193, 88, 388, 117, 95, 387, 112, 359, 287, 244, 103, 272, 301, 171, 162, 234, 273, 127, 373, 181, 292, 85, 378, 302, 121, 107, 364, 346, 356, 212, 278, 213, 65, 382, 288, 207, 113, 175, 99, 296, 374, 368, 199, 260, 185, 336, 331, 161, 270, 264, 250, 240, 75, 350, 151, 60, 89, 321, 156, 274, 360, 326, 70, 282, 167, 146, 352, 81, 91, 389, 266, 245, 177, 235, 190, 256, 204, 342, 128, 118, 303, 104, 379, 182, 114, 375, 200, 96, 293, 172, 214, 365, 279, 86, 289, 351, 347, 357, 261, 186, 176, 271, 90, 100, 147, 322, 275, 361, 71, 332, 61, 265, 157, 246, 236};const int16 sort_2305[461] ={ 0, 4, 6, 145, 247, 352, 454, 7, 5, 3, 47, 48, 49, 50, 51, 254, 255, 256, 257, 258, 146, 248, 353, 455, 151, 253, 358, 460, 148, 250, 355, 457, 149, 251, 356, 458, 152, 359, 150, 252, 357, 459, 147, 249, 354, 456, 52, 2, 1, 153, 360, 259, 19, 21, 12, 17, 18, 20, 16, 25, 13, 10, 14, 24, 23, 22, 26, 8, 15, 53, 260, 31, 154, 361, 9, 33, 11, 155, 362, 54, 261, 28, 27, 156, 363, 34, 35, 29, 46, 32, 30, 55, 262, 37, 36, 39, 38, 40, 157, 364, 41, 42, 43, 44, 45, 56, 158, 263, 365, 181, 192, 170, 79, 57, 399, 90, 159, 297, 377, 366, 275, 68, 183, 388, 286, 194, 299, 92 , 70, 182, 401, 172, 59, 91, 58, 400, 368, 161, 81, 160, 264, 171, 80, 389, 390, 378, 379, 193, 298, 69, 266, 265, 367, 277, 288, 276, 287, 184, 60, 195, 82, 93, 71, 369, 402, 173, 162, 444, 300, 391, 98, 76, 278, 61, 267, 374, 135, 411, 167, 102, 380, 200, 87, 178, 65, 94, 204, 124, 72, 342, 189, 305, 381, 396, 433, 301, 226, 407, 289, 237, 113, 215, 185, 128, 309, 403, 116, 320, 196, 331, 370, 422, 174, 64, 392, 83, 425, 219, 134, 188, 432, 112, 427, 139, 279, 163, 436, 208, 447, 218, 236, 229, 97, 294, 385, 230, 166, 268, 177, 443, 225, 426, 101, 272, 138, 127, 290, 117, 347, 199, 414, 95, 140, 240, 410, 395, 209, 129, 283, 346, 105, 241, 437, 86, 308, 448, 203, 345, 186, 107, 220, 415, 334, 319, 106, 313, 118, 123, 73, 207, 421, 214, 384, 373, 438, 62, 371, 341, 75, 449, 168, 323, 164, 242, 416, 324, 304, 197, 335, 404, 271, 63, 191, 325, 96, 169, 231, 280, 312, 187, 406, 84, 201, 100, 67, 382, 175, 336, 202, 330, 269, 393, 376, 383, 293, 307, 409, 179, 285, 314, 302, 372, 398, 190, 180, 89, 99, 103, 232, 78, 88, 77, 136, 387, 165, 198, 394, 125, 176, 428, 74, 375, 238, 227, 66, 273, 282, 141, 306, 412, 114, 85, 130, 348, 119, 291, 296, 386, 233, 397, 303, 405, 284, 445, 423, 221, 210, 205, 450, 108, 274, 434, 216, 343, 337, 142, 243, 321, 408, 451, 310, 292, 120, 109, 281, 439, 270, 429, 332, 295, 418, 211, 315, 222, 326, 131, 430, 244, 327, 349, 417, 316, 143, 338, 440, 234, 110, 212, 452, 245, 121, 419, 350, 223, 132, 441, 328, 413, 317, 339, 126, 104, 137, 446, 344, 239, 435, 115, 333, 206, 322, 217, 228, 424, 453, 311, 351, 111, 442, 224, 213, 122, 431, 340, 235, 246, 133, 144, 420, 329, 318};const int16 sort_2385[477] ={ 0, 4, 6, 145, 251, 360, 466, 7, 5, 3, 47, 48, 49, 50, 51, 262, 263, 264, 265, 266, 146, 252, 361, 467, 151, 257, 366, 472, 148, 254, 363, 469, 149, 255, 364, 470, 156, 371, 150, 256, 365, 471, 147, 253, 362, 468, 52, 2, 1, 157, 372, 267, 19, 21, 12, 17, 18, 20, 16, 25, 13, 10, 14, 24, 23, 22, 26, 8, 15, 53, 268, 31, 152, 153, 154, 155, 258, 259, 260, 261, 367, 368, 369, 370, 473, 474, 475, 476, 158, 373, 9, 33, 11, 159, 374, 54, 269, 28, 27, 160, 375, 34, 35, 29, 46, 32, 30, 55, 270, 37, 36, 39, 38, 40, 161, 376, 41, 42, 43, 44, 45, 56, 162, 271, 377, 185, 196, 174, 79, 57, 411, 90, 163, 305, 389, 378, 283, 68, 187, 400, 294, 198, 307, 92, 70, 186, 413, 176, 59, 91, 58, 412, 380, 165, 81, 164, 272, 175, 80, 401, 402, 390, 391, 197, 306, 69, 274, 273, 379, 285, 296, 284, 295, 188, 60, 199, 82, 93, 71, 381, 414, 177, 166, 456, 308, 403, 98, 76, 286, 61, 275, 386, 135, 423, 171, 102, 392, 204, 87, 182, 65, 94, 208, 124, 72, 350, 193, 313, 393, 408, 445, 309, 230, 419, 297, 241, 113, 219, 189, 128, 317, 415, 116, 328, 200, 339, 382, 434, 178, 64, 404, 83, 437, 223, 134, 192, 444, 112, 439, 139, 287, 167, 448, 212, 459, 222, 240, 233, 97, 302, 397, 234, 170, 276, 181, 455, 229, 438, 101, 280, 138, 127, 298, 117, 355, 203, 426, 95, 140, 244, 422, 407, 213, 129, 291, 354, 105, 245, 449, 86, 316, 460, 207, 353, 190, 107, 224, 427, 342, 327, 106, 321, 118, 123, 73, 211, 433, 218, 396, 385, 450, 62, 383, 349, 75, 461, 172, 331, 168, 246, 428, 332, 312, 201, 343, 416, 279, 63, 195, 333, 96, 173, 235, 288, 320, 191, 418, 84, 205, 100, 67, 394, 179, 344, 206, 338, 277, 405, 388, 395, 301, 315, 421, 183, 293, 322, 310, 384, 410, 194, 184, 89, 99, 103, 236, 78, 88, 77, 136, 399, 169, 202, 406, 125, 180, 440, 74, 387, 242, 231, 66, 281, 290, 141, 314, 424, 114, 85, 130, 356, 119, 299, 304, 398, 237, 409, 311, 417, 292, 457, 435, 225, 214, 209, 462, 108, 282, 446, 220, 351, 345, 142, 247, 329, 420, 463, 318, 300, 120, 109, 289, 451, 278, 441, 340, 303, 430, 215, 323, 226, 334, 131, 442, 248, 335, 357, 429, 324, 143, 346, 452, 238, 110, 216, 464, 249, 121, 431, 358, 227, 132, 453, 336, 425, 325, 347, 126, 104, 137, 458, 352, 243, 447, 115, 341, 210, 330, 221, 232, 436, 465, 319, 359, 111, 454, 228, 217, 122, 443, 348, 239, 250, 133, 144, 432, 337, 326};const int16 sort_SID[35] ={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};/*----------------------------------------------------------------------------; EXTERNAL FUNCTION REFERENCES; Declare functions defined elsewhere and referenced in this module----------------------------------------------------------------------------*//*----------------------------------------------------------------------------; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES; Declare variables used in this module but defined elsewhere----------------------------------------------------------------------------*//*----------------------------------------------------------------------------; FUNCTION CODE----------------------------------------------------------------------------*/void mime_unsorting(uint8 unsorted_bits[], int16 sorted_bits_into_int16[], int16 * frame_type, int16 * mode, uint8 quality, RX_State *st){ int16 i; int16 j; uint8 temp = 0; uint8 *unsorted_bits_ptr = (uint8*)unsorted_bits; /* pointer table for bit sorting tables */ const int16 *AmrWbSortingTables[16] = { sort_660, sort_885, sort_1265, sort_1425, sort_1585, sort_1825, sort_1985, sort_2305, sort_2385, sort_SID, NULL, NULL, NULL, NULL, NULL, NULL }; const int16 * pt_AmrWbSortingTables = AmrWbSortingTables[*mode]; /* clear compressed speech bit buffer */ pv_memset(sorted_bits_into_int16, 0, unpacked_size[*mode]*sizeof(*sorted_bits_into_int16)); /* unpack and unsort speech or SID bits */ for (i = unpacked_size[*mode] >> 3; i != 0; i--) { temp = *(unsorted_bits_ptr++); for (j = 2; j != 0; j--) { switch (temp & 0xf0) { case 0xf0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0xe0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; break; case 0xd0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0xc0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables += 2; break; case 0xb0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0xa0: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; break; case 0x90: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables += 2; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0x80: sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables += 3; break; case 0x70: pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0x60: pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; break; case 0x50: pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0x40: pt_AmrWbSortingTables++; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables += 2; break; case 0x30: pt_AmrWbSortingTables += 2; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; case 0x20: pt_AmrWbSortingTables += 2; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; pt_AmrWbSortingTables++; break; case 0x10: pt_AmrWbSortingTables += 3; sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; break; default: pt_AmrWbSortingTables += 4; break; } temp <<= 4; } } if (unpacked_size[*mode] % 4) { temp <<= 1; if (temp & 0x80) { sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1; } } /* set frame type */ switch (*mode) { case MODE_7k: case MODE_9k: case MODE_12k: case MODE_14k: case MODE_16k: case MODE_18k: case MODE_20k: case MODE_23k: case MODE_24k: if (quality) { *frame_type = RX_SPEECH_GOOD; } else { *frame_type = RX_SPEECH_BAD; } break; case MRSID: if (quality) { if (temp & 0x80) { *frame_type = RX_SID_UPDATE; } else { *frame_type = RX_SID_FIRST; } } else { *frame_type = RX_SID_BAD; } /* set mode index */ *mode = st->prev_mode; break; case 14: /* SPEECH_LOST */ *frame_type = RX_SPEECH_LOST; *mode = st->prev_mode; break; case 15: /* NO_DATA */ *frame_type = RX_NO_DATA; *mode = st->prev_mode; break; default: /* replace frame with unused mode index by NO_DATA frame */ *frame_type = RX_NO_DATA; *mode = st->prev_mode; break; } st->prev_mode = *mode;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -