summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-06-18 12:33:47 +0000
committerMonty <xiphmont@xiph.org>2000-06-18 12:33:47 +0000
commit3c933c57401cc707d9998ec158b506a29b2da7d3 (patch)
treeaec87a0f50a3eb0586236b8785f62667980b3714
parent1f9c20fbff63a72f4091221d61478b4bd7c37364 (diff)
downloadlibvorbis-git-3c933c57401cc707d9998ec158b506a29b2da7d3.tar.gz
Short block bugfix + tuning. I'm still not satisfied with the short
block triggering algorithm, but it is functioning reasonably well at this point. Monty svn path=/trunk/vorbis/; revision=456
-rw-r--r--include/vorbis/book/lsp12_0.vqh238
-rw-r--r--include/vorbis/book/lsp30_0.vqh430
-rw-r--r--include/vorbis/codec.h4
-rw-r--r--include/vorbis/internal.h15
-rw-r--r--include/vorbis/modes.h4
-rw-r--r--lib/analysis.c6
-rw-r--r--lib/block.c33
-rw-r--r--lib/envelope.c110
-rw-r--r--lib/mdct.h11
-rw-r--r--lib/psy.c12
-rw-r--r--lib/sharedbook.c39
-rw-r--r--todo.txt2
12 files changed, 146 insertions, 758 deletions
diff --git a/include/vorbis/book/lsp12_0.vqh b/include/vorbis/book/lsp12_0.vqh
index ec40036d..431d4aed 100644
--- a/include/vorbis/book/lsp12_0.vqh
+++ b/include/vorbis/book/lsp12_0.vqh
@@ -417,248 +417,12 @@ static long _vq_lengthlist_lsp12_0[] = {
13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,
};
-static long _vq_ptr0_lsp12_0[] = {
- -1, -2, -3, -4, -5, -6, -7, -8,
- 40, 34, 12, -12, 27, 15, -15, -16,
- -17, 72, 60, -20, -21, 60, -23, 60,
- 46, -26, -27, -28, -29, -30, -31, 11,
- 44, 31, 46, -36, -37, 30, 31, -40,
- -41, -42, 73, -44, 11, 30, 56, 73,
- 100, 73, -51, -52, -53, -54, -55, 11,
- 44, -58, 56, 5, -61, -62, 5, 10,
- -65, 21, 91, -68, 56, 86, -71, -72,
- 11, 26, 106, -76, -77, -78, 41, 54,
- 71, 104, -83, -84, -85, -86, -87, 70,
- -89, 121, 27, 90, -93, -94, -95, 56,
- -87, 77, 21, -100, -101, -102, 57, 21,
- 37, 102, -107, -108, 70, 102, -111, -112,
- -113, -114, -115, 76, 51, -118, -119, -120,
- 74, 7, -123, 43, 122, 124, -127, -128,
- 75, 103, 33, -132, -133, -134, 7, 4,
- -137, -138, -121, -97, 33, -142, -143, -144,
- 32, -146, 2, 20, -140, 124, 2, 7,
- -153, -154, -155, -156, -157, -158, 9, -160,
- 1, 23, 3, -164, 2, -166, -167, -168,
- 4, 2, 33, -172, -173, -174, 74, 20,
- -177, -178, 7, 20, -168, -149, 13, 124,
- 62, -186, -187, -188, -189, -190, 7, 8,
- -193, 4, 8, -168, 13, 8, -197, -196,
- 22, -202, -203, -194, 63, -206, 23, -208,
- 23, 22, -211, -197, -194, 16, -215, -216,
- -217, -218, -219, -220, 0, 19, 17, -224,
- 86, -226, -227, 0, 5, 18, 19, -232,
- -233, -234, -235, 1, -237, -238, 0, -240,
- 1, 18, -243, 0, 18, -243, -213, -248,
- 9, -250, -251, -252, -240, -246, 19, -253,
- 19, -255, -259, -260, 100, 108, -263, -222,
- 79, -266, 108, 123, -269, 78, -271, -272,
- -273, -274, 0, 5, -277, -278, 17, 24,
- -309, -194, -196, -284, 106, 110, -287, -288,
- 21, 10, -291, -292, -227, -282, -293, 43,
- -297, -298, -299, 0, 10, -164, -295, -248,
- 7, 13, -307, -308, -229, -305, -311, 6,
- 10, -314, 2, -316, -317, 2, -319, 37,
- 38, -322, -323, -324, -325, 41, 14, 54,
- -329, -330, -331, 98, 111, 83, 48, -336,
- 52, 109, -339, 85, 36, -342, -343, -344,
- -345, -346, 50, 28, -349, 28, 98, -352,
- -353, -354, 28, 83, -357, -358, -359, 99,
- 87, 101, 69, -364, -365, -366, -367, -368,
- -369, -370, 53, 77, 45, -374, -375, -376,
- -377, 50, 55, 55, 105, -382, -383, 50,
- 55, 81, -387, 99, -389, -390, 105, 65,
- -393, -394, -395, 82, -397, -398, -399, 54,
- 107, -402, -403, -404, 51, 79, 75, -408,
- -409, 42, 45, -412, -413, -414, 53, 42,
- 45, -418, 16, 42, -421, -422, -423, -424,
- 51,
-};
-
-static long _vq_ptr1_lsp12_0[] = {
- -321, -110, -75, -25, -14, -11, -10, -9,
- 47, 47, 34, -13, 12, 12, -19, 47,
- -18, 80, 80, -22, 84, 31, -24, 47,
- 47, -50, -39, -35, -34, -33, -32, 31,
- 31, 46, 68, 46, -38, 80, 80, -48,
- -46, -43, 30, -45, 5, 5, -47, 5,
- -49, 80, -70, -67, -60, -57, -56, 21,
- 21, -59, 21, 21, -64, -63, 26, 26,
- -63, 26, 93, -69, 5, 6, -74, -73,
- 68, 68, 127, -82, -80, -79, 14, 25,
- -81, 76, -92, -90, -88, 112, 44, 68,
- 56, 112, -91, 92, -106, -99, -96, 57,
- -98, 93, 68, -104, -103, 6, 37, 6,
- -105, 39, 103, 106, -109, 118, -214, -152,
- -126, -124, -117, -116, 67, -122, 67, -121,
- 20, 20, 67, 7, -125, 110, -131, -129,
- 32, -130, 24, -136, 24, -135, 33, 33,
- -151, -141, -140, -66, 20, -148, -145, 20,
- 38, -147, 38, 38, -150, 83, 20, 67,
- -185, -171, -165, -163, -162, -159, 23, -161,
- 3, 3, 49, 3, 49, 35, -170, -169,
- 3, 3, 2, -183, -176, -175, 49, 49,
- -180, -179, 3, 3, -179, -139, 88, -184,
- 3, -201, -198, -195, -192, -191, 24, 24,
- -191, 24, 22, -197, 22, 3, -200, -194,
- 3, -210, -205, 63, 22, -207, 63, -209,
- 97, 97, 62, -161, -204, 22, -270, -258,
- -231, -223, -222, -221, 9, 9, 19, -230,
- -225, -229, -228, 6, 6, 6, 86, -249,
- -245, -242, -236, 4, -239, 18, 35, -241,
- 35, 35, -244, 2, 2, -247, -204, 2,
- 49, -256, -208, -254, 97, -212, 35, -199,
- -158, -182, -268, -262, -261, 89, -265, 5,
- 24, -267, 19, 119, 114, 97, -286, -283,
- -276, -275, 10, 10, -61, -63, 26, 22,
- -302, -279, 24, -285, 126, 127, -306, -290,
- -289, 126, -296, -244, -229, -281, -264, 8,
- -303, -301, -300, 49, 49, 10, 7, -164,
- 8, 8, -310, 33, 2, -304, -313, -312,
- 39, -315, 10, -318, 38, 39, -320, 39,
- 39, -363, -341, -328, -326, 59, -327, 59,
- -335, -333, -332, 94, 94, -334, 94, -337,
- 101, -338, -340, 48, 48, -356, -351, -350,
- -348, -347, 29, 29, 61, 117, 96, -355,
- 109, 117, 81, 91, -361, 58, -360, 120,
- 96, -362, 58, -396, -386, -373, -371, 16,
- 65, 77, 95, -372, 64, -381, -379, -378,
- 64, 91, 64, -380, 61, -385, -384, 77,
- 65, 117, -392, -388, -391, 115, 65, 113,
- 65, 114, 116, 95, -181, -411, -401, -400,
- 125, -407, -406, -405, 66, 66, 79, 64,
- -410, 66, 66, -420, -417, -415, 88, -416,
- 88, -419, 88, 88, -257, -294, -280, -123,
- 7,
-};
-
-static long _vq_p_lsp12_0[] = {
- 318, 210, 30, 120, 120, 120, 120, 120,
- 120, 102, 36, 81, 81, 45, 216, 216,
- 216, 216, 180, 93, 93, 180, 180, 180,
- 138, 90, 132, 33, 33, 33, 33, 33,
- 132, 93, 138, 93, 90, 90, 93, 90,
- 33, 219, 219, 33, 33, 90, 168, 219,
- 300, 219, 258, 63, 33, 33, 33, 33,
- 132, 168, 168, 15, 15, 15, 15, 30,
- 63, 63, 273, 15, 168, 258, 33, 33,
- 33, 78, 318, 228, 162, 42, 123, 162,
- 213, 312, 132, 336, 210, 210, 210, 210,
- 363, 363, 81, 270, 63, 210, 171, 168,
- 210, 231, 63, 63, 171, 171, 171, 63,
- 111, 306, 306, 306, 210, 306, 129, 228,
- 222, 153, 153, 228, 153, 222, 60, 222,
- 222, 21, 21, 129, 366, 372, 309, 225,
- 225, 309, 99, 12, 21, 21, 21, 12,
- 96, 21, 21, 231, 99, 96, 96, 96,
- 96, 6, 6, 60, 99, 372, 6, 21,
- 3, 6, 3, 3, 27, 27, 27, 3,
- 3, 69, 9, 6, 6, 12, 12, 12,
- 12, 6, 99, 222, 222, 222, 222, 60,
- 21, 21, 21, 60, 12, 249, 39, 372,
- 186, 12, 12, 21, 21, 21, 21, 24,
- 12, 12, 24, 12, 39, 24, 24, 39,
- 66, 66, 24, 24, 189, 189, 69, 69,
- 69, 66, 24, 24, 24, 48, 57, 54,
- 15, 51, 0, 0, 0, 57, 51, 0,
- 258, 0, 0, 0, 15, 54, 57, 0,
- 3, 3, 12, 3, 0, 0, 0, 3,
- 3, 54, 0, 0, 54, 0, 48, 27,
- 27, 3, 3, 3, 3, 48, 57, 48,
- 57, 48, 57, 300, 300, 324, 51, 51,
- 237, 57, 324, 369, 234, 234, 15, 51,
- 0, 0, 0, 15, 51, 51, 51, 72,
- 39, 24, 39, 318, 318, 330, 0, 63,
- 63, 30, 18, 0, 0, 39, 39, 129,
- 0, 0, 0, 0, 30, 6, 129, 27,
- 21, 39, 54, 54, 54, 39, 18, 18,
- 30, 30, 6, 6, 6, 6, 111, 111,
- 114, 87, 156, 123, 123, 123, 42, 162,
- 249, 294, 294, 294, 333, 249, 144, 156,
- 156, 327, 255, 255, 108, 150, 87, 84,
- 150, 150, 150, 84, 84, 84, 294, 84,
- 84, 84, 84, 249, 297, 360, 360, 297,
- 261, 303, 207, 150, 192, 159, 159, 159,
- 159, 159, 159, 231, 135, 315, 150, 150,
- 150, 150, 165, 165, 315, 165, 150, 150,
- 165, 243, 339, 297, 315, 315, 315, 195,
- 246, 246, 246, 246, 24, 321, 321, 162,
- 321, 153, 153, 153, 153, 237, 225, 135,
- 126, 126, 135, 126, 159, 159, 159, 126,
- 135, 48, 48, 126, 153, 21, 153, 153,
- 153,
-};
-
-static long _vq_q_lsp12_0[] = {
- 192, 147, 117, 258, 216, 81, 36, 102,
- 141, 141, 102, 45, 36, 36, 252, 141,
- 180, 240, 240, 138, 252, 93, 138, 141,
- 141, 78, 168, 90, 204, 138, 132, 93,
- 93, 138, 204, 138, 93, 240, 240, 240,
- 168, 15, 90, 90, 15, 15, 15, 15,
- 219, 240, 381, 18, 78, 15, 132, 63,
- 63, 15, 63, 63, 63, 30, 78, 78,
- 30, 78, 279, 18, 15, 18, 318, 78,
- 204, 204, 381, 111, 228, 162, 42, 75,
- 312, 228, 63, 270, 363, 336, 132, 204,
- 168, 336, 270, 276, 354, 111, 63, 171,
- 63, 279, 204, 117, 63, 18, 111, 18,
- 117, 117, 309, 318, 354, 354, 15, 291,
- 6, 366, 129, 201, 201, 129, 201, 21,
- 60, 60, 201, 21, 372, 330, 114, 99,
- 96, 99, 72, 60, 72, 12, 99, 99,
- 201, 96, 99, 273, 60, 99, 6, 60,
- 114, 60, 114, 114, 6, 249, 60, 201,
- 66, 60, 12, 6, 147, 9, 69, 69,
- 9, 9, 147, 9, 147, 105, 99, 6,
- 9, 9, 6, 186, 9, 60, 147, 147,
- 12, 60, 9, 9, 60, 279, 264, 186,
- 9, 69, 66, 9, 12, 24, 72, 72,
- 24, 72, 66, 24, 66, 9, 66, 24,
- 9, 9, 69, 189, 66, 291, 189, 66,
- 291, 291, 186, 69, 189, 66, 30, 267,
- 69, 15, 51, 57, 27, 27, 57, 57,
- 18, 54, 15, 18, 18, 18, 258, 57,
- 27, 6, 105, 12, 3, 54, 105, 54,
- 105, 105, 54, 6, 6, 27, 189, 6,
- 147, 27, 69, 57, 291, 24, 105, 39,
- 27, 264, 291, 369, 267, 267, 357, 15,
- 72, 357, 57, 357, 342, 291, 18, 318,
- 51, 15, 30, 30, 15, 30, 78, 66,
- 129, 72, 72, 381, 378, 381, 111, 18,
- 30, 378, 30, 6, 54, 24, 237, 24,
- 27, 6, 30, 147, 147, 30, 21, 6,
- 24, 24, 111, 99, 6, 21, 111, 117,
- 117, 117, 30, 111, 114, 117, 114, 117,
- 117, 192, 174, 144, 42, 177, 177, 177,
- 108, 144, 333, 282, 282, 282, 282, 108,
- 303, 108, 108, 144, 144, 360, 273, 288,
- 183, 84, 87, 87, 183, 351, 288, 273,
- 327, 351, 243, 273, 207, 174, 261, 360,
- 288, 174, 174, 279, 348, 165, 135, 48,
- 195, 231, 285, 135, 192, 195, 315, 165,
- 192, 273, 192, 315, 183, 243, 165, 231,
- 195, 351, 342, 339, 339, 345, 195, 339,
- 195, 342, 348, 285, 249, 189, 198, 375,
- 375, 135, 225, 237, 198, 198, 237, 192,
- 135, 198, 198, 39, 48, 135, 264, 135,
- 264, 126, 264, 264, 264, 72, 39, 129,
- 21,
-};
-
-static encode_aux_nearestmatch _vq_auxn_lsp12_0 = {
- _vq_ptr0_lsp12_0,
- _vq_ptr1_lsp12_0,
- _vq_p_lsp12_0,
- _vq_q_lsp12_0,
- 425, 425
-};
-
static static_codebook _vq_book_lsp12_0 = {
3, 128,
_vq_lengthlist_lsp12_0,
2, 1602090201, 1593036045, 8, 1,
_vq_quantlist_lsp12_0,
- &_vq_auxn_lsp12_0,
+ NULL,
NULL,
};
diff --git a/include/vorbis/book/lsp30_0.vqh b/include/vorbis/book/lsp30_0.vqh
index 704f8124..21f8033c 100644
--- a/include/vorbis/book/lsp30_0.vqh
+++ b/include/vorbis/book/lsp30_0.vqh
@@ -417,440 +417,12 @@ static long _vq_lengthlist_lsp30_0[] = {
14,14,14,14,14,15,15,15,15,15,15,16,16,16,17,17,
};
-static long _vq_ptr0_lsp30_0[] = {
- -1, -2, -3, -4, -5, -6, -7, -8,
- -9, 63, 22, -12, 113, 39, -15, -16,
- 113, 93, 93, -20, -21, 63, 93, -24,
- -25, -26, 91, 96, -17, 90, 118, -32,
- -33, -34, -35, -36, 86, 114, -39, 88,
- 106, -42, 91, 114, -45, -46, -47, -48,
- -49, 28, -30, -52, 88, -54, -55, 28,
- 73, -58, 88, 59, 91, 93, -63, -64,
- -55, 90, 16, -68, 8, 36, -71, -72,
- -49, 59, 23, -76, 16, 90, 93, -80,
- -81, -82, -83, -84, 34, -78, -77, 22,
- -89, 63, 12, -92, -93, 34, 86, -96,
- -93, -90, 1, -97, -101, -102, -103, 14,
- 9, -106, -98, 21, 0, -110, 9, -112,
- -113, -114, 8, 1, -117, -118, -115, -107,
- -119, 9, -120, 62, -125, -126, -127, -128,
- -129, -130, 83, 15, -133, -134, 19, 12,
- 15, -138, -139, -140, 6, 17, -143, 19,
- -135, 56, -147, -148, 14, -150, 0, -152,
- -153, -154, -155, 29, 67, -158, 5, 11,
- 67, -162, 83, -164, -165, 6, 5, -168,
- -169, -170, 29, 17, -173, -141, 7, -176,
- 2, 0, -179, 5, 17, -182, -183, -184,
- -185, 111, -187, 111, 83, -190, -191, -192,
- 6, -194, 20, 5, -197, -198, 80, 6,
- 89, -202, -203, -204, 6, 17, 20, -208,
- 20, 67, -211, -212, 5, -209, -174, -135,
- -217, -218, -219, -220, 111, -222, -223, 80,
- 19, -226, 83, -228, 80, 56, -231, -232,
- -233, -234, -235, 13, -215, 13, 20, -240,
- -241, -68, 11, 25, -66, -90, 79, -158,
- -246, 16, -251, -252, -253, 29, -255, -103,
- -248, 2, -259, 1, -256, -262, -263, 29,
- -265, 8, 1, -268, -155, -260, 2, -158,
- 36, -272, -275, -276, -277, -235, -273, -278,
- 95, 10, 0, -284, -285, 8, -282, 1,
- -289, -290, -291, 13, 6, -294, -295, 13,
- 15, -298, 6, -296, 108, -299, 3, -304,
- -305, -277, -806, 10, -307, -310, 86, -312,
- -313, -314, -291, 4, 56, 1, -319, -320,
- 6, -315, 56, 109, -325, -326, -140, -321,
- -143, -327, -329, -332, -333, 56, 10, -782,
- -334, 4, -339, -194, -337, -342, -343, 13,
- -340, -346, 6, 40, -349, -350, -351, -352,
- 13, 4, 106, -354, -353, 16, 16, -360,
- -361, -362, -363, -364, -365, -366, 54, 14,
- -369, 88, -367, -372, 52, -374, 49, -376,
- 54, 35, 122, -380, -381, -382, -383, -384,
- 52, -370, -58, -385, -387, -390, -391, -392,
- 52, -394, 37, 27, -397, 37, 16, -400,
- -401, 106, -403, 106, 58, 46, 10, 15,
- -409, -410, -411, -412, -413, -414, 20, -407,
- -398, -415, 15, -398, 105, 38, -423, -195,
- -420, 81, 16, -428, 5, 67, -156, -425,
- -244, -405, -431, -434, -437, 38, 79, -440,
- -441, -442, -443, 49, 35, -446, -447, -448,
- 48, -450, 64, 70, -453, -454, -450, 40,
- 76, -458, 60, -455, 64, -462, -463, 48,
- 103, 126, -467, -468, 89, -470, -471, -472,
- -206, 81, 65, 112, -477, 112, -473, -480,
- 112, -478, -483, -484, 112, -486, 65, -481,
- 38, -490, -491, -492, -493, -494, 20, 87,
- 79, -498, 87, 107, -501, -502, 87, -498,
- -496, 60, 107, -508, 87, 65, -511, -512,
- -392, -504, -513, -516, 60, -514, -519, -520,
- -521, 20, 65, -517, -421, 105, 85, -528,
- -529, -530, -531, -532, -533, -534, -535, 47,
- 57, -538, 33, -526, -541, -542, 33, 55,
- 55, -546, -547, 57, 92, -550, 66, 79,
- -553, 124, -555, 57, -107, -558, -559, 57,
- 98, -562, -563, 117, 124, 119, 120, -568,
- -569, -570, -571, -572, 50, 97, 66, -576,
- -577, 31, 24, 97, -581, 102, -246, 123,
- -585, 50, -587, -588, 102, 68, -591, 84,
- -582, -594, -595, -596, -597, 12, 31, -598,
- -592, -602, -603, 31, -578, -600, 44, -608,
- -544, -605, -611, 66, 24, -614, -615, -616,
- 50, -609, 3, -620, 31, -108, -623, -624,
- -625, -626, -627, -628, -629, -630, -631, 47,
- -633, 30, -635, -636, 30, 99, -9, -333,
- -639, -642, -643, 30, 32, -646, 34, 63,
- -649, 63, -651, 94, 99, -654, 30, 115,
- -657, -658, -659, -660, -661, -662, 82, 36,
- -665, 32, 19, -668, -669, 82, 74, -672,
- 32, -666, -675, -646, -673, 46, -662, -677,
- -679, -682, -683, -684, -685, 30, 32, 30,
- -680, -542, 46, -671, -433, -690, 21, 55,
- -694, -698, -699, -700, -701, 12, 24, -704,
- -705, 55, -696, -708, 7, -272, -711, 12,
- -709, -714, -715, 55, -717, 36, -719, -720,
- 36, 36, -723, 7, 36, -726, -727, -728,
- -729, -730, -636, 46, 40, -734, 9, -731,
- -737, 34, 9, -735, -741, 12, -743, 30,
- -708, -739, 26, -748, -749, -743, -745, 115,
- -753, 40, -755, -756, 62, -750, -655, 15,
- -224, -762, -763, -764, 34, -766, -767, 14,
- 46, -770, 4, -768, -773, -93, -771, -774,
- -777, -778, -779, 4, 95, -692, 85, -782,
- -110, -226, -785, -788, -789, -790, -791, -315,
- -786, -794, 7, -792, -797, -272, 72, 108,
- -663, -107, 85, -135, -802, -794, -804, -808,
- -809, -810, -811, -812, -781,
-};
-
-static long _vq_ptr1_lsp30_0[] = {
- -527, -359, -124, -31, -23, -19, -14, -11,
- -10, 77, 77, -10, 77, 61, -18, -17,
- 73, 73, 22, 78, -22, 94, 94, 122,
- -28, -27, 73, 73, -27, -13, 39, -79,
- -44, -38, -37, 23, 74, 74, -41, -40,
- 100, -43, 100, 100, -62, -60, -53, -51,
- -42, 100, -29, 91, 100, -57, -56, 43,
- 43, -56, 43, 61, -61, 100, -70, -67,
- -66, -59, 43, -66, 43, -65, -78, -75,
- -74, 72, 100, -74, 100, 72, 23, -100,
- -91, 74, -88, -85, 23, -87, -73, 23,
- -18, 22, 72, -95, -94, 18, 18, -84,
- -98, 59, 18, -86, -111, -105, -104, 0,
- 0, -109, -108, 72, 18, 0, 18, -116,
- 43, -115, 23, 23, -10, -121, -87, -99,
- -69, -87, -50, 26, -230, -181, -146, -137,
- -132, -131, 17, 17, -136, -131, 17, 26,
- 71, -145, -142, -141, 0, 0, -141, 0,
- -123, 0, -151, -149, 41, 41, 10, -161,
- -160, -157, -156, 25, 25, -156, 25, 26,
- 41, -163, 41, -167, -166, 17, 17, -178,
- -172, -171, 41, 41, -175, 41, 26, -177,
- 41, 41, -180, 2, 2, -216, -189, -186,
- 89, 80, -188, 75, 75, -201, -196, -193,
- 5, -195, 58, 58, -200, -199, 89, 89,
- 58, -207, -206, -205, 75, 75, 75, -210,
- -209, 75, -213, 17, 75, -205, -159, -159,
- -227, -221, 80, 95, 83, -225, -224, 71,
- 71, 17, 71, -229, 109, 109, -303, -250,
- -238, -237, -114, 23, -214, 16, -239, -247,
- -244, -243, 72, 43, -243, -242, 72, -249,
- -242, 25, -274, -261, -254, 14, -258, -257,
- -245, 0, -257, 0, -236, -267, -264, 8,
- -266, 2, 2, -271, -270, -144, 25, -270,
- 11, -107, -288, -283, -113, -115, -269, -122,
- 116, 3, 3, -287, -158, 25, -281, 5,
- -258, -293, -292, 1, 1, -297, -179, 2,
- 3, -179, 2, -281, 71, -286, 11, -338,
- -311, -309, -798, 11, -302, 109, 23, -324,
- -322, -318, -316, 11, -317, 109, -229, 1,
- 109, -302, -323, 18, -331, -328, 56, -308,
- -145, -301, -108, -106, -108, 18, 26, -300,
- -159, 26, -348, -341, -159, -345, -195, 58,
- -336, -195, 58, 10, -358, -355, -354, -40,
- 100, 10, 58, -357, -347, 58, 23, -439,
- -379, -373, -371, -368, 91, -27, 73, 10,
- -56, 91, -347, 37, 54, -378, -375, -377,
- 37, 37, 125, -408, -399, -389, -386, -66,
- 43, -356, -66, -344, -330, -396, -393, 27,
- 45, -395, 45, 45, -398, 27, 27, -396,
- -402, 16, -404, 27, 27, 108, 41, 41,
- -430, -427, -422, -419, -416, -404, 27, -406,
- -404, -150, 10, -421, 10, 27, -426, -357,
- -418, 10, 38, -429, 38, 38, -432, -418,
- -436, 71, -424, -417, -243, 43, -435, -466,
- -461, -445, -444, 45, 45, -452, -449, 70,
- 110, -451, 110, 110, -460, -457, -456, 26,
- 110, -456, 110, -334, 45, -464, 53, 51,
- -465, 104, -489, -482, -469, -479, -476, -475,
- -474, 26, 75, 65, -209, 75, -334, -429,
- 38, -459, -488, -485, 110, -458, 110, -370,
- 60, -510, -500, -497, -194, -495, 89, 89,
- 26, -499, 27, 27, -506, -503, 65, -505,
- -159, 27, -507, -509, 76, 76, -518, -515,
- -395, -336, -487, -395, 45, -438, -524, -505,
- -522, 60, 60, -388, -505, 15, -525, -622,
- -561, -552, -545, -540, 99, -537, -536, 66,
- 66, -536, 66, -282, -544, -543, 42, 42,
- 66, -549, -548, 69, 69, -548, 69, 105,
- -554, 121, -557, -548, -242, 122, -560, 78,
- 78, -567, -565, -564, 120, -566, 127, -593,
- -583, -575, -573, 66, 24, -574, 101, -580,
- -579, -578, 101, 101, -579, 101, 11, -584,
- -586, 97, -590, -589, 97, 97, -589, 97,
- -556, -613, -607, -599, -598, 62, 62, -601,
- -302, -604, 101, 44, -606, -551, 101, -612,
- -610, -539, 44, 24, 61, -619, -611, -13,
- 61, -523, 18, -30, 24, -618, -807, -725,
- -656, -653, -648, -641, -634, -632, 32, 63,
- 32, 63, -638, -637, 77, 77, -637, -618,
- -621, -645, -644, 34, 34, -647, 74, 74,
- -650, 99, -652, 78, 78, -655, 44, 44,
- -697, -681, -674, -667, -664, -663, 18, 18,
- -663, 18, 3, -671, -670, 42, 42, -670,
- 42, -282, -678, -36, -640, 18, -94, -618,
- -639, -689, -643, -687, -686, 7, 7, 55,
- -676, -691, 21, -695, -335, -688, 59, -670,
- 11, -713, -710, -703, -702, 44, 44, -707,
- -702, 44, -302, -702, 44, -302, -612, 61,
- -706, -718, -716, 61, 61, 42, -722, -59,
- 61, 3, -59, 61, 59, -761, -740, -736,
- -637, -733, -732, 59, 77, 77, 40, -724,
- -9, -738, 77, -721, -747, -742, -744, 26,
- -746, -712, 44, -754, -752, -751, 72, 26,
- 26, 115, -758, -746, 44, -693, -746, 0,
- -136, -787, -772, -765, 9, -769, -734, 40,
- 71, -734, 40, -136, -776, -110, -760, -759,
- -784, -621, -618, 18, 71, -780, 71, -136,
- -108, -136, -783, -803, -800, -796, -793, 3,
- -780, -302, 11, -775, -794, 3, 116, 72,
- -618, -799, 72, -805, 108, 26, -801, -279,
- -617, -757, -795, -306, -280,
-};
-
-static long _vq_p_lsp30_0[] = {
- 105, 258, 282, 282, 282, 339, 189, 189,
- 189, 189, 66, 339, 339, 117, 339, 339,
- 339, 279, 279, 282, 189, 189, 279, 273,
- 273, 273, 273, 288, 279, 270, 354, 84,
- 342, 69, 258, 258, 258, 342, 264, 264,
- 318, 273, 273, 342, 264, 84, 273, 84,
- 84, 84, 354, 264, 264, 84, 84, 84,
- 219, 264, 264, 177, 273, 279, 24, 84,
- 84, 270, 48, 24, 24, 108, 84, 84,
- 84, 177, 69, 48, 48, 270, 279, 102,
- 189, 102, 102, 102, 102, 279, 270, 66,
- 189, 189, 36, 258, 102, 102, 258, 3,
- 102, 36, 3, 36, 42, 42, 42, 42,
- 27, 3, 3, 63, 0, 27, 27, 24,
- 24, 24, 24, 3, 27, 3, 3, 63,
- 36, 27, 36, 186, 249, 42, 45, 249,
- 249, 249, 249, 45, 57, 57, 57, 36,
- 45, 57, 18, 18, 18, 51, 57, 57,
- 36, 168, 42, 42, 42, 0, 0, 201,
- 87, 87, 87, 87, 201, 15, 15, 33,
- 201, 249, 249, 18, 18, 18, 15, 87,
- 87, 87, 87, 51, 51, 51, 21, 6,
- 6, 0, 15, 15, 51, 18, 249, 267,
- 240, 333, 333, 333, 249, 267, 60, 18,
- 18, 60, 60, 15, 18, 240, 240, 18,
- 267, 18, 18, 18, 18, 51, 60, 60,
- 60, 201, 15, 15, 15, 201, 21, 36,
- 57, 333, 333, 333, 333, 57, 240, 240,
- 57, 249, 249, 240, 240, 168, 87, 48,
- 39, 24, 39, 39, 36, 39, 60, 24,
- 24, 24, 33, 75, 48, 36, 237, 15,
- 237, 48, 87, 42, 87, 87, 42, 42,
- 237, 6, 3, 3, 237, 24, 87, 87,
- 24, 24, 3, 87, 87, 237, 6, 15,
- 108, 33, 24, 39, 39, 39, 108, 33,
- 285, 30, 0, 24, 24, 24, 0, 3,
- 18, 3, 39, 39, 18, 39, 39, 39,
- 45, 18, 18, 45, 324, 45, 9, 327,
- 258, 39, 324, 30, 30, 258, 258, 39,
- 3, 39, 39, 12, 168, 3, 18, 18,
- 18, 12, 168, 327, 18, 18, 18, 12,
- 57, 12, 9, 168, 168, 168, 30, 255,
- 30, 12, 15, 60, 12, 39, 39, 39,
- 12, 18, 18, 120, 39, 39, 39, 39,
- 39, 12, 318, 318, 12, 48, 48, 162,
- 105, 156, 264, 162, 162, 162, 162, 42,
- 264, 264, 42, 162, 156, 147, 147, 162,
- 162, 105, 366, 156, 264, 264, 156, 156,
- 156, 42, 264, 120, 42, 156, 156, 156,
- 156, 111, 111, 81, 111, 111, 48, 318,
- 48, 318, 318, 318, 174, 138, 30, 45,
- 15, 60, 60, 60, 60, 60, 60, 45,
- 48, 45, 45, 48, 315, 114, 15, 15,
- 315, 243, 48, 15, 15, 201, 201, 243,
- 48, 138, 243, 243, 114, 114, 237, 144,
- 147, 147, 147, 147, 105, 210, 144, 144,
- 144, 192, 192, 210, 180, 192, 192, 120,
- 228, 180, 180, 120, 192, 159, 153, 144,
- 309, 378, 336, 60, 267, 60, 60, 60,
- 60, 243, 195, 336, 336, 336, 243, 336,
- 336, 243, 336, 336, 336, 195, 195, 243,
- 114, 321, 60, 60, 261, 60, 60, 261,
- 237, 261, 261, 321, 180, 195, 261, 261,
- 237, 180, 321, 261, 261, 195, 156, 156,
- 156, 237, 237, 180, 180, 42, 60, 60,
- 60, 60, 195, 243, 114, 315, 255, 291,
- 141, 141, 99, 141, 141, 141, 141, 141,
- 171, 99, 99, 45, 99, 99, 99, 165,
- 165, 171, 171, 171, 276, 198, 198, 237,
- 372, 372, 276, 171, 63, 171, 171, 171,
- 294, 351, 372, 351, 372, 357, 360, 204,
- 93, 150, 150, 150, 150, 291, 198, 93,
- 93, 93, 72, 291, 306, 306, 237, 369,
- 150, 150, 306, 306, 306, 204, 252, 252,
- 237, 36, 36, 36, 36, 36, 93, 186,
- 63, 93, 93, 93, 72, 63, 132, 165,
- 165, 63, 72, 198, 72, 150, 150, 150,
- 150, 63, 9, 93, 93, 0, 96, 96,
- 141, 141, 141, 141, 141, 141, 141, 141,
- 90, 90, 90, 90, 90, 297, 189, 168,
- 168, 90, 90, 90, 96, 102, 102, 189,
- 189, 189, 282, 282, 297, 90, 90, 345,
- 90, 108, 96, 108, 246, 246, 246, 108,
- 96, 96, 57, 246, 246, 246, 222, 96,
- 96, 57, 102, 102, 57, 138, 246, 138,
- 138, 21, 96, 96, 90, 90, 96, 90,
- 138, 99, 138, 96, 138, 63, 63, 165,
- 63, 36, 21, 36, 36, 36, 72, 165,
- 165, 165, 63, 21, 21, 108, 36, 36,
- 108, 165, 165, 165, 126, 108, 108, 108,
- 108, 108, 21, 21, 108, 90, 27, 90,
- 90, 90, 90, 138, 120, 27, 27, 138,
- 102, 102, 27, 138, 36, 36, 90, 90,
- 21, 138, 78, 90, 90, 90, 63, 345,
- 120, 120, 186, 186, 186, 108, 345, 45,
- 57, 120, 42, 102, 102, 42, 42, 42,
- 138, 12, 12, 138, 102, 102, 138, 57,
- 12, 12, 12, 12, 285, 324, 255, 255,
- 27, 249, 249, 12, 12, 12, 12, 12,
- 255, 21, 21, 249, 108, 108, 216, 324,
- 108, 63, 255, 36, 255, 21, 255, 249,
- 138, 45, 63, 138, 324,
-};
-
-static long _vq_q_lsp30_0[] = {
- 204, 135, 225, 69, 288, 282, 279, 339,
- 66, 231, 231, 66, 231, 183, 66, 279,
- 219, 219, 66, 234, 279, 282, 282, 366,
- 279, 288, 219, 219, 288, 117, 117, 66,
- 279, 300, 342, 69, 222, 222, 273, 318,
- 300, 342, 300, 300, 48, 279, 219, 264,
- 273, 300, 270, 273, 300, 264, 219, 129,
- 129, 219, 129, 183, 279, 300, 69, 24,
- 48, 177, 129, 48, 129, 177, 279, 48,
- 69, 216, 300, 69, 300, 216, 69, 27,
- 258, 222, 189, 66, 69, 66, 177, 69,
- 279, 66, 216, 69, 258, 54, 54, 69,
- 3, 177, 54, 270, 66, 3, 27, 0,
- 0, 27, 0, 216, 54, 0, 54, 66,
- 129, 3, 69, 69, 231, 27, 66, 177,
- 183, 66, 117, 78, 69, 267, 123, 18,
- 213, 45, 51, 51, 213, 45, 51, 78,
- 213, 168, 57, 51, 0, 0, 51, 0,
- 186, 0, 6, 0, 123, 123, 30, 51,
- 123, 15, 201, 75, 75, 201, 75, 78,
- 123, 51, 123, 6, 15, 51, 51, 15,
- 6, 51, 123, 123, 6, 123, 78, 0,
- 123, 123, 51, 6, 6, 57, 51, 225,
- 267, 240, 249, 225, 225, 225, 267, 60,
- 15, 15, 174, 174, 174, 18, 267, 267,
- 174, 15, 60, 51, 225, 225, 225, 15,
- 225, 225, 201, 51, 225, 51, 33, 33,
- 168, 213, 240, 285, 249, 51, 57, 213,
- 213, 51, 213, 168, 327, 327, 327, 6,
- 15, 48, 24, 69, 21, 48, 15, 15,
- 48, 75, 216, 129, 75, 33, 216, 48,
- 33, 75, 39, 24, 6, 42, 3, 6,
- 36, 0, 6, 0, 78, 75, 6, 24,
- 3, 6, 6, 15, 6, 186, 75, 6,
- 33, 216, 6, 15, 24, 3, 21, 177,
- 348, 9, 9, 3, 15, 75, 30, 15,
- 0, 6, 18, 3, 3, 18, 15, 6,
- 9, 15, 6, 30, 213, 0, 33, 174,
- 54, 327, 348, 33, 9, 327, 69, 0,
- 54, 18, 327, 33, 327, 327, 168, 3,
- 327, 9, 327, 54, 3, 57, 168, 30,
- 168, 0, 54, 3, 0, 54, 78, 324,
- 33, 78, 48, 15, 33, 18, 15, 174,
- 30, 15, 174, 30, 69, 48, 174, 318,
- 300, 30, 174, 48, 120, 174, 69, 192,
- 135, 105, 111, 264, 273, 288, 219, 30,
- 219, 273, 120, 111, 162, 375, 105, 105,
- 111, 111, 375, 114, 318, 111, 264, 48,
- 129, 12, 48, 78, 0, 48, 111, 81,
- 135, 81, 135, 135, 48, 81, 81, 111,
- 174, 48, 174, 81, 81, 324, 123, 123,
- 75, 201, 15, 114, 48, 174, 81, 30,
- 174, 0, 30, 114, 30, 81, 114, 48,
- 45, 30, 114, 201, 114, 114, 114, 45,
- 114, 213, 315, 123, 75, 129, 315, 267,
- 159, 192, 105, 135, 135, 228, 192, 210,
- 330, 210, 330, 330, 135, 180, 228, 78,
- 330, 228, 330, 30, 135, 378, 159, 153,
- 312, 312, 81, 180, 225, 114, 201, 336,
- 195, 78, 225, 195, 201, 225, 30, 201,
- 114, 120, 114, 195, 330, 180, 330, 42,
- 180, 135, 195, 81, 174, 261, 267, 267,
- 78, 321, 81, 81, 228, 180, 195, 180,
- 33, 81, 228, 195, 228, 228, 114, 180,
- 81, 30, 243, 81, 135, 123, 114, 81,
- 195, 180, 180, 9, 180, 45, 45, 30,
- 132, 294, 207, 165, 297, 99, 171, 198,
- 198, 171, 198, 9, 198, 165, 126, 126,
- 198, 198, 276, 207, 207, 276, 207, 315,
- 171, 363, 294, 276, 33, 366, 294, 234,
- 234, 252, 357, 360, 360, 360, 381, 117,
- 204, 93, 291, 198, 72, 303, 303, 306,
- 291, 303, 303, 303, 291, 303, 33, 204,
- 204, 291, 252, 204, 291, 291, 204, 291,
- 63, 117, 183, 72, 93, 186, 186, 132,
- 9, 72, 303, 132, 132, 315, 303, 183,
- 72, 45, 132, 72, 183, 93, 72, 117,
- 183, 30, 54, 117, 72, 9, 63, 12,
- 165, 132, 234, 222, 297, 90, 96, 189,
- 96, 189, 189, 297, 231, 231, 297, 9,
- 0, 189, 96, 102, 102, 189, 222, 222,
- 282, 297, 297, 234, 234, 345, 132, 132,
- 132, 21, 102, 126, 96, 108, 54, 54,
- 108, 54, 9, 96, 222, 126, 126, 222,
- 126, 0, 54, 258, 168, 54, 258, 9,
- 168, 126, 102, 165, 96, 21, 21, 165,
- 57, 165, 63, 165, 255, 9, 177, 126,
- 33, 177, 183, 21, 72, 132, 132, 21,
- 72, 132, 9, 72, 132, 9, 72, 183,
- 63, 21, 126, 183, 183, 126, 21, 177,
- 183, 9, 177, 183, 177, 12, 78, 102,
- 297, 27, 120, 177, 231, 231, 120, 108,
- 189, 27, 231, 9, 186, 132, 21, 78,
- 78, 63, 132, 132, 120, 345, 216, 78,
- 78, 345, 345, 78, 132, 54, 78, 0,
- 45, 78, 0, 12, 27, 12, 27, 120,
- 213, 27, 120, 45, 12, 27, 57, 0,
- 27, 0, 9, 54, 213, 285, 213, 45,
- 0, 45, 255, 78, 54, 108, 21, 9,
- 285, 9, 33, 57, 21, 9, 348, 216,
- 9, 324, 216, 21, 324, 78, 63, 117,
- 30, 9, 45, 63, 348,
-};
-
-static encode_aux_nearestmatch _vq_auxn_lsp30_0 = {
- _vq_ptr0_lsp30_0,
- _vq_ptr1_lsp30_0,
- _vq_p_lsp30_0,
- _vq_q_lsp30_0,
- 813, 813
-};
-
static static_codebook _vq_book_lsp30_0 = {
3, 128,
_vq_lengthlist_lsp30_0,
2, 1601492961, 1590858881, 8, 1,
_vq_quantlist_lsp30_0,
- &_vq_auxn_lsp30_0,
+ NULL,
NULL,
};
diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h
index b18abfbf..4313242b 100644
--- a/include/vorbis/codec.h
+++ b/include/vorbis/codec.h
@@ -12,7 +12,7 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.18 2000/06/14 22:41:53 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.19 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -270,7 +270,7 @@ typedef struct vorbis_dsp_state{
int64_t res_bits;
/* local lookup storage */
- envelope_lookup ve;
+ envelope_lookup ve; /* envelope */
double **window[2][2][2]; /* block, leadin, leadout, type */
vorbis_look_transform **transform[2]; /* block, type */
codebook *fullbooks;
diff --git a/include/vorbis/internal.h b/include/vorbis/internal.h
index c3ef48bb..02bf95b9 100644
--- a/include/vorbis/internal.h
+++ b/include/vorbis/internal.h
@@ -13,7 +13,7 @@
function: libvorbis codec internal types. These structures are
'visible', but generally uninteresting to the developer
- last mod: $Id: internal.h,v 1.5 2000/05/08 20:49:43 xiphmont Exp $
+ last mod: $Id: internal.h,v 1.6 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -23,18 +23,9 @@
/* lookup structures for various simple transforms *****************/
typedef struct {
- int n;
- int log2n;
-
- double *trig;
- int *bitrev;
-
-} mdct_lookup;
-
-typedef struct {
- int winlen;
double *window;
- mdct_lookup mdct;
+ long winlen;
+ void *fft;
} envelope_lookup;
/* structures for various internal data abstractions ********************/
diff --git a/include/vorbis/modes.h b/include/vorbis/modes.h
index c47428ef..00e96b09 100644
--- a/include/vorbis/modes.h
+++ b/include/vorbis/modes.h
@@ -12,7 +12,7 @@
********************************************************************
function: predefined encoding modes
- last mod: $Id: modes.h,v 1.12 2000/06/14 08:19:22 xiphmont Exp $
+ last mod: $Id: modes.h,v 1.13 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -197,7 +197,7 @@ vorbis_info info_A={
/* psy */
{&_psy_set0},
/* thresh sample period, preecho clamp trigger threshhold, range */
- 128, 4, 2
+ 128, 20, 2
};
#define PREDEF_INFO_MAX 0
diff --git a/lib/analysis.c b/lib/analysis.c
index 5d8a0b9a..173e0f22 100644
--- a/lib/analysis.c
+++ b/lib/analysis.c
@@ -12,7 +12,7 @@
********************************************************************
function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.27 2000/06/14 01:38:30 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.28 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -52,9 +52,9 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
if(vb->W){
_oggpack_write(&vb->opb,vb->lW,1);
_oggpack_write(&vb->opb,vb->nW,1);
- /*fprintf(stderr,"*");
+ fprintf(stderr,"*");
}else{
- fprintf(stderr,".");*/
+ fprintf(stderr,".");
}
if(_mapping_P[type]->forward(vb,vd->mode[mode]))
diff --git a/lib/block.c b/lib/block.c
index ba744589..4399d999 100644
--- a/lib/block.c
+++ b/lib/block.c
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.32 2000/06/15 12:17:03 xiphmont Exp $
+ last mod: $Id: block.c,v 1.33 2000/06/18 12:33:47 xiphmont Exp $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
@@ -404,30 +404,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
which lets us compute the shape of the current block's window */
if(vi->blocksizes[0]<vi->blocksizes[1]){
-
- if(v->W)
- /* this is a long window; we start the search forward of centerW
- because that's the fastest we could react anyway */
- i=v->centerW+vi->blocksizes[1]/4-vi->blocksizes[0]/4;
- else
- /* short window. Search from centerW */
- i=v->centerW;
- i/=vi->envelopesa;
-
+ long i=v->centerW/vi->envelopesa;
+
for(;i<v->envelope_current-1;i++){
/* Compare last with current; do we have an abrupt energy change? */
-
- if(v->multipliers[i-1]*vi->preecho_thresh<
- v->multipliers[i])break;
-
- /* because the overlapping nature of the delta finding
- 'smears' the energy cliffs, also compare completely
- unoverlapped areas just in case the plosive happened in an
- unlucky place */
-
- if(v->multipliers[i-1]*vi->preecho_thresh<
- v->multipliers[i+1])break;
-
+ if(v->multipliers[i]>vi->preecho_thresh)break;
+ if(v->multipliers[i]+v->multipliers[i+1]>vi->preecho_thresh)break;
}
if(i<v->envelope_current-1){
@@ -439,10 +421,10 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]/4;
else
/* min boundary; nW large, next small */
- largebound=v->centerW+vi->blocksizes[0]/2+vi->blocksizes[1]/2;
+ largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]*3/4;
largebound/=vi->envelopesa;
- if(i>=largebound)
+ if(i>largebound)
v->nW=1;
else
v->nW=0;
@@ -519,7 +501,6 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
int movementM=movementW/vi->envelopesa;
-
/* the multipliers and pcm stay synced up because the blocksize
must be multiples of samples_per_envelope_step (minimum
multiple is 2) */
diff --git a/lib/envelope.c b/lib/envelope.c
index a808f976..8064b720 100644
--- a/lib/envelope.c
+++ b/lib/envelope.c
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.18 2000/06/14 01:38:31 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.19 2000/06/18 12:33:47 xiphmont Exp $
Preecho calculation.
@@ -25,7 +25,8 @@
#include "vorbis/codec.h"
#include "os.h"
-#include "mdct.h"
+#include "scales.h"
+#include "smallft.h"
#include "envelope.h"
#include "bitwise.h"
#include "window.h"
@@ -33,43 +34,84 @@
void _ve_envelope_init(envelope_lookup *e,int samples_per){
int i;
-
- e->winlen=samples_per;
+ e->winlen=samples_per*2;
e->window=malloc(e->winlen*sizeof(double));
- mdct_init(&e->mdct,e->winlen);
- /* We just use a straight sin^2(x) window for this */
- for(i=0;i<e->winlen;i++){
+ e->fft=calloc(1,sizeof(drft_lookup));
+ drft_init(e->fft,samples_per*2);
+
+ /* We just use a straight sin(x) window for this */
+ for(i=0;i<e->winlen;i++)
e->window[i]=sin((i+.5)/e->winlen*M_PI);
- e->window[i]*=e->window[i];
- }
}
void _ve_envelope_clear(envelope_lookup *e){
+ drft_clear(e->fft);
+ free(e->fft);
if(e->window)free(e->window);
- mdct_clear(&e->mdct);
memset(e,0,sizeof(envelope_lookup));
}
-/* use MDCT for spectral power estimation */
+static void smooth_noise(long n,double *f,double *noise){
+ long i;
+ long lo=0,hi=0;
+ double acc=0.;
+
+ for(i=0;i<n;i++){
+ /* not exactly correct, (the center frequency should be centered
+ on a *log* scale), but not worth quibbling */
+ long newhi=i*1.0442718740+5;
+ long newlo=i*.8781245150-5;
+ if(newhi>n)newhi=n;
+
+ for(;lo<newlo;lo++)
+ acc-=todB(f[lo]); /* yeah, this ain't RMS */
+ for(;hi<newhi;hi++)
+ acc+=todB(f[hi]);
+ noise[i]=acc/(hi-lo);
+ }
+}
+
+/* use FFT for spectral power estimation */
+static int frameno=0;
+static int frameno2=0;
static void _ve_deltas(double *deltas,double *pcm,int n,double *window,
- int winsize,mdct_lookup *m){
+ int samples_per,drft_lookup *l){
int i,j;
- double *out=alloca(sizeof(double)*winsize);
+ double *out=alloca(sizeof(double)*samples_per*2);
+ double *cache=alloca(sizeof(double)*samples_per*2);
- for(j=0;j<n;j++){
- double acc=0.;
-
- memcpy(out,pcm+j*winsize,winsize*sizeof(double));
- for(i=0;i<winsize;i++)
- out[i]*=window[i];
+ for(j=-1;j<n;j++){
- mdct_forward(m,out,out);
+ memcpy(out,pcm+(j+1)*samples_per,samples_per*2*sizeof(double));
+ for(i=0;i<samples_per*2;i++)
+ out[i]*=window[i];
- for(i=winsize/10;i<winsize/2;i++)
- acc+=fabs(out[i]);
- if(deltas[j]<acc)deltas[j]=acc;
+ _analysis_output("Dpcm",frameno*1000+frameno2,out,samples_per*2,0,0);
+
+
+ drft_forward(l,out);
+ for(i=1;i<samples_per;i++)
+ out[i]=hypot(out[i*2],out[i*2-1]);
+ _analysis_output("Dfft",frameno*1000+frameno2,out,samples_per,0,1);
+ smooth_noise(samples_per,out,out+samples_per);
+
+ if(j==-1){
+ for(i=samples_per/10;i<samples_per;i++)
+ cache[i]=out[i+samples_per];
+ }else{
+ double max=0;
+ _analysis_output("Dcache",frameno*1000+frameno2,cache,samples_per,0,0);
+ for(i=samples_per/10;i<samples_per;i++){
+ double val=out[i+samples_per]-cache[i];
+ cache[i]=out[i+samples_per];
+ if(val>0)max+=val;
+ }
+ max/=samples_per;
+ if(deltas[j]<max)deltas[j]=max;
+ }
+ _analysis_output("Dnoise",frameno*1000+frameno2++,out+samples_per,samples_per,0,0);
}
}
@@ -77,7 +119,7 @@ void _ve_envelope_deltas(vorbis_dsp_state *v){
vorbis_info *vi=v->vi;
int step=vi->envelopesa;
- int dtotal=v->pcm_current/vi->envelopesa;
+ int dtotal=v->pcm_current/vi->envelopesa-1;
int dcurr=v->envelope_current;
int pch;
@@ -86,11 +128,25 @@ void _ve_envelope_deltas(vorbis_dsp_state *v){
memset(mult,0,sizeof(double)*(dtotal-dcurr));
for(pch=0;pch<vi->channels;pch++){
- double *pcm=v->pcm[pch]+dcurr*step;
- _ve_deltas(mult,pcm,dtotal-dcurr,v->ve.window,v->ve.winlen,&v->ve.mdct);
+ double *pcm=v->pcm[pch]+(dcurr-1)*step;
+ _ve_deltas(mult,pcm,dtotal-dcurr,v->ve.window,step,v->ve.fft);
+
+ {
+ double *multexp=alloca(sizeof(double)*v->pcm_current);
+ int i,j,k;
+
+ memset(multexp,0,sizeof(double)*v->pcm_current);
+ j=0;
+ for(i=0;i<dtotal;i++)
+ for(k=0;k<step;k++)
+ multexp[j++]=v->multipliers[i];
+
+ _analysis_output("Apcm",frameno,v->pcm[pch],v->pcm_current,0,0);
+ _analysis_output("Amult",frameno++,multexp,v->pcm_current,0,0);
+ }
+
}
v->envelope_current=dtotal;
-
}
}
diff --git a/lib/mdct.h b/lib/mdct.h
index c08827cc..06ee975f 100644
--- a/lib/mdct.h
+++ b/lib/mdct.h
@@ -12,7 +12,7 @@
********************************************************************
function: modified discrete cosine transform prototypes
- last mod: $Id: mdct.h,v 1.10 2000/01/22 13:28:26 xiphmont Exp $
+ last mod: $Id: mdct.h,v 1.11 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -21,6 +21,15 @@
#include "vorbis/codec.h"
+typedef struct {
+ int n;
+ int log2n;
+
+ double *trig;
+ int *bitrev;
+
+} mdct_lookup;
+
extern void mdct_init(mdct_lookup *lookup,int n);
extern void mdct_clear(mdct_lookup *l);
extern void mdct_forward(mdct_lookup *init, double *in, double *out);
diff --git a/lib/psy.c b/lib/psy.c
index 0da6aad6..f70fa315 100644
--- a/lib/psy.c
+++ b/lib/psy.c
@@ -12,7 +12,7 @@
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.21 2000/06/14 01:38:31 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.22 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -509,16 +509,16 @@ static void max_seeds(vorbis_look_psy *p,double *flr){
had in Grad Skool... I didn't solve it at the time ;-) */
}
-#define noiseBIAS 5
-static void quarter_octave_noise(vorbis_look_psy *p,double *f,double *noise){
- long i,n=p->n;
+#define noiseBIAS 2
+static void quarter_octave_noise(long n,double *f,double *noise){
+ long i;
long lo=0,hi=0;
double acc=0.;
for(i=0;i<n;i++){
/* not exactly correct, (the center frequency should be centered
on a *log* scale), but not worth quibbling */
- long newhi=i*_eights[18]+noiseBIAS;
+ long newhi=i*_eights[17]+noiseBIAS;
long newlo=i*_eights[15]-noiseBIAS;
if(newhi>n)newhi=n;
@@ -562,7 +562,7 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
/* don't use the smoothed data for noise */
if(p->vi->noisemaskp){
- quarter_octave_noise(p,f,work2);
+ quarter_octave_noise(p->n,f,work2);
seed_generic(p,p->noisecurves,work2,flr,specmax);
}
diff --git a/lib/sharedbook.c b/lib/sharedbook.c
index 117b3fb7..85ee6f45 100644
--- a/lib/sharedbook.c
+++ b/lib/sharedbook.c
@@ -12,7 +12,7 @@
********************************************************************
function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.4 2000/06/14 01:38:32 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.5 2000/06/18 12:33:47 xiphmont Exp $
********************************************************************/
@@ -319,6 +319,16 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
return(-1);
}
+static double _dist(int el,double *ref, double *b,int step){
+ int i;
+ double acc=0.;
+ for(i=0;i<el;i++){
+ double val=(ref[i]-b[i*step]);
+ acc+=val*val;
+ }
+ return(acc);
+}
+
int _best(codebook *book, double *a, int step){
encode_aux_nearestmatch *nt=book->c->nearest_tree;
encode_aux_threshmatch *tt=book->c->thresh_tree;
@@ -365,17 +375,24 @@ int _best(codebook *book, double *a, int step){
return(-ptr);
}
- return(-1);
-}
-
-static double _dist(int el,double *a, double *b){
- int i;
- double acc=0.;
- for(i=0;i<el;i++){
- double val=(a[i]-b[i]);
- acc+=val*val;
+ /* brute force it! */
+ {
+ const static_codebook *c=book->c;
+ int i,besti=-1;
+ double best;
+ double *e=book->valuelist;
+ for(i=0;i<book->entries;i++){
+ if(c->lengthlist[i]>0){
+ double this=_dist(dim,e,a,step);
+ if(besti==-1 || this<best){
+ best=this;
+ besti=i;
+ }
+ }
+ e+=dim;
+ }
+ return(besti);
}
- return(acc);
}
/* returns the entry number and *modifies a* to the remainder value ********/
diff --git a/todo.txt b/todo.txt
index dccd1d04..152522b8 100644
--- a/todo.txt
+++ b/todo.txt
@@ -7,8 +7,6 @@ Meaningful error code returns
Option for brute-forcing vq search on maptype 2 (helps on undertrained
sets).
-vorbisfile instantaneous bitrate info
-
encoder switch interface for binary compat through changes; ioctl()-like?
API changes: