comparison aactab.c @ 9846:4cac4001dd23 libavcodec

Move TNS and swb_offset tables from aacdectab.h to aactab.c so that they can be shared with the AAC encoder.
author alexc
date Fri, 12 Jun 2009 21:14:45 +0000
parents 541889e539b8
children 69d79f51b8ce
comparison
equal deleted inserted replaced
9845:45d331133468 9846:4cac4001dd23
897 codebook_vector2, codebook_vector4, codebook_vector4, 897 codebook_vector2, codebook_vector4, codebook_vector4,
898 codebook_vector6, codebook_vector6, codebook_vector8, 898 codebook_vector6, codebook_vector6, codebook_vector8,
899 codebook_vector8, codebook_vector10, 899 codebook_vector8, codebook_vector10,
900 }; 900 };
901 901
902 /* @name swb_offsets
903 * Sample offset into the window indicating the beginning of a scalefactor
904 * window band
905 *
906 * scalefactor window band - term for scalefactor bands within a window,
907 * given in Table 4.110 to Table 4.128.
908 *
909 * scalefactor band - a set of spectral coefficients which are scaled by one
910 * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
911 * may contain several scalefactor window bands of corresponding frequency. For
912 * all other window_sequences scalefactor bands and scalefactor window bands are
913 * identical.
914 * @{
915 */
916
917 static const uint16_t swb_offset_1024_96[] = {
918 0, 4, 8, 12, 16, 20, 24, 28,
919 32, 36, 40, 44, 48, 52, 56, 64,
920 72, 80, 88, 96, 108, 120, 132, 144,
921 156, 172, 188, 212, 240, 276, 320, 384,
922 448, 512, 576, 640, 704, 768, 832, 896,
923 960, 1024
924 };
925
926 static const uint16_t swb_offset_128_96[] = {
927 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
928 };
929
930 static const uint16_t swb_offset_1024_64[] = {
931 0, 4, 8, 12, 16, 20, 24, 28,
932 32, 36, 40, 44, 48, 52, 56, 64,
933 72, 80, 88, 100, 112, 124, 140, 156,
934 172, 192, 216, 240, 268, 304, 344, 384,
935 424, 464, 504, 544, 584, 624, 664, 704,
936 744, 784, 824, 864, 904, 944, 984, 1024
937 };
938
939 static const uint16_t swb_offset_1024_48[] = {
940 0, 4, 8, 12, 16, 20, 24, 28,
941 32, 36, 40, 48, 56, 64, 72, 80,
942 88, 96, 108, 120, 132, 144, 160, 176,
943 196, 216, 240, 264, 292, 320, 352, 384,
944 416, 448, 480, 512, 544, 576, 608, 640,
945 672, 704, 736, 768, 800, 832, 864, 896,
946 928, 1024
947 };
948
949 static const uint16_t swb_offset_128_48[] = {
950 0, 4, 8, 12, 16, 20, 28, 36,
951 44, 56, 68, 80, 96, 112, 128
952 };
953
954 static const uint16_t swb_offset_1024_32[] = {
955 0, 4, 8, 12, 16, 20, 24, 28,
956 32, 36, 40, 48, 56, 64, 72, 80,
957 88, 96, 108, 120, 132, 144, 160, 176,
958 196, 216, 240, 264, 292, 320, 352, 384,
959 416, 448, 480, 512, 544, 576, 608, 640,
960 672, 704, 736, 768, 800, 832, 864, 896,
961 928, 960, 992, 1024
962 };
963
964 static const uint16_t swb_offset_1024_24[] = {
965 0, 4, 8, 12, 16, 20, 24, 28,
966 32, 36, 40, 44, 52, 60, 68, 76,
967 84, 92, 100, 108, 116, 124, 136, 148,
968 160, 172, 188, 204, 220, 240, 260, 284,
969 308, 336, 364, 396, 432, 468, 508, 552,
970 600, 652, 704, 768, 832, 896, 960, 1024
971 };
972
973 static const uint16_t swb_offset_128_24[] = {
974 0, 4, 8, 12, 16, 20, 24, 28,
975 36, 44, 52, 64, 76, 92, 108, 128
976 };
977
978 static const uint16_t swb_offset_1024_16[] = {
979 0, 8, 16, 24, 32, 40, 48, 56,
980 64, 72, 80, 88, 100, 112, 124, 136,
981 148, 160, 172, 184, 196, 212, 228, 244,
982 260, 280, 300, 320, 344, 368, 396, 424,
983 456, 492, 532, 572, 616, 664, 716, 772,
984 832, 896, 960, 1024
985 };
986
987 static const uint16_t swb_offset_128_16[] = {
988 0, 4, 8, 12, 16, 20, 24, 28,
989 32, 40, 48, 60, 72, 88, 108, 128
990 };
991
992 static const uint16_t swb_offset_1024_8[] = {
993 0, 12, 24, 36, 48, 60, 72, 84,
994 96, 108, 120, 132, 144, 156, 172, 188,
995 204, 220, 236, 252, 268, 288, 308, 328,
996 348, 372, 396, 420, 448, 476, 508, 544,
997 580, 620, 664, 712, 764, 820, 880, 944,
998 1024
999 };
1000
1001 static const uint16_t swb_offset_128_8[] = {
1002 0, 4, 8, 12, 16, 20, 24, 28,
1003 36, 44, 52, 60, 72, 88, 108, 128
1004 };
1005
1006 const uint16_t *ff_swb_offset_1024[] = {
1007 swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64,
1008 swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32,
1009 swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16,
1010 swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8,
1011 swb_offset_1024_8
1012 };
1013
1014 const uint16_t *ff_swb_offset_128[] = {
1015 /* The last entry on the following row is swb_offset_128_64 but is a
1016 duplicate of swb_offset_128_96. */
1017 swb_offset_128_96, swb_offset_128_96, swb_offset_128_96,
1018 swb_offset_128_48, swb_offset_128_48, swb_offset_128_48,
1019 swb_offset_128_24, swb_offset_128_24, swb_offset_128_16,
1020 swb_offset_128_16, swb_offset_128_16, swb_offset_128_8,
1021 swb_offset_128_8
1022 };
1023
1024 // @}
1025
1026 /* @name ff_tns_max_bands
1027 * The maximum number of scalefactor bands on which TNS can operate for the long
1028 * and short transforms respectively. The index to these tables is related to
1029 * the sample rate of the audio.
1030 * @{
1031 */
1032 const uint8_t ff_tns_max_bands_1024[] = {
1033 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
1034 };
1035
1036 const uint8_t ff_tns_max_bands_128[] = {
1037 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
1038 };
1039 // @}
1040
1041
902 #if CONFIG_HARDCODED_TABLES 1042 #if CONFIG_HARDCODED_TABLES
903 1043
904 /** 1044 /**
905 * Table of pow(2, (i - 200)/4.) used for different purposes depending on the 1045 * Table of pow(2, (i - 200)/4.) used for different purposes depending on the
906 * range of indices to the table: 1046 * range of indices to the table: