Commit f0e7c3da authored by letr's avatar letr Committed by Florian Kaltenberger

new algorithm

parent 1cdf7af3
......@@ -9,6 +9,8 @@ short Gen_shift_values_BG1_a_11[2109]={294,77,226,97,118,35,94,167,225,213,330,9
short Gen_shift_values_BG1_a_13[2109]={-1,21,131,3,-1,36,5,-1,10,20,-1,123,32,-1,179,112,-1,9,3,-1,148,48,-1,47,20,-1,37,5,-1,1,121,-1,194,150,-1,15,82,-1,59,153,-1,154,86,-1,27,4,-1,5,84,-1,29,91,-1,46,172,-1,178,119,-1,167,41,-1,65,1,-1,30,141,0,-1,21,131,3,0,-1,36,5,0,-1,10,20,0,-1,123,32,-1,179,112,0,-1,9,3,0,-1,148,48,-1,47,20,-1,37,5,0,-1,1,121,0,-1,194,150,0,-1,15,82,0,-1,59,153,0,-1,154,86,-1,27,4,0,-1,5,84,0,-1,29,91,-1,46,172,0,-1,178,119,0,-1,167,41,0,-1,65,1,0,-1,30,141,-1,21,132,131,4,3,-1,37,36,6,5,-1,10,21,20,-1,123,33,32,-1,180,179,113,112,-1,9,4,3,-1,149,148,49,48,-1,48,47,21,20,-1,38,37,6,5,-1,1,122,121,-1,195,194,151,150,-1,15,83,82,-1,59,154,153,-1,155,154,87,86,-1,28,27,5,4,-1,5,85,84,-1,29,92,91,-1,47,46,173,172,-1,179,178,120,119,-1,167,42,41,-1,66,65,2,1,-1,30,142,141,-1,21,131,4,3,-1,36,6,5,-1,10,20,-1,123,33,32,-1,179,113,112,-1,9,3,-1,148,49,48,-1,47,21,20,-1,37,6,5,-1,1,121,-1,194,151,150,-1,15,83,82,-1,59,154,153,-1,154,87,86,-1,27,5,4,-1,5,84,-1,29,92,91,-1,46,173,172,-1,178,120,119,-1,167,41,-1,65,2,1,-1,30,142,141,24,204,71,93,203,75,185,71,108,77,100,71,82,92,71,195,104,24,71,251,184,71,81,75,71,220,120,71,119,92,71,109,77,71,73,193,71,266,222,71,87,154,71,131,225,65,71,226,158,71,99,76,71,77,156,71,101,163,207,71,118,244,71,250,191,71,239,113,71,137,73,71,102,213,161,6,27,163,50,48,24,38,91,145,88,112,153,159,76,34,115,56,137,166,248,247,38,120,119,172,34,115,71,153,152,40,122,121,2,34,115,45,126,55,137,136,34,115,158,239,67,149,148,131,34,115,214,296,295,147,229,228,34,115,44,125,38,120,119,34,115,183,265,264,83,165,164,34,115,82,164,163,55,137,136,34,115,72,154,153,40,122,121,34,115,36,117,156,238,237,34,115,229,311,310,185,267,266,34,115,50,131,117,199,198,34,115,94,175,188,270,269,141,34,115,189,271,270,121,203,202,34,115,62,144,143,39,121,120,34,115,40,121,119,201,200,34,115,64,145,126,208,207,96,34,115,81,163,162,207,289,288,34,115,213,295,294,154,236,235,34,115,202,283,76,158,157,99,34,115,100,182,181,36,118,117,34,115,65,146,176,258,257,101,6,10,145,53,201,4,164,173,126,77,156,16,12,70,108,124,123,130,145,240,255,112,127,184,108,124,123,145,160,114,129,194,108,124,123,119,134,129,144,108,124,123,232,247,141,156,108,123,288,303,221,236,108,124,123,118,133,112,127,108,124,123,257,272,157,172,108,123,156,171,129,144,108,123,146,161,114,129,108,124,123,110,125,230,245,108,124,123,303,318,259,274,108,124,123,124,139,191,206,108,124,123,168,183,262,277,123,108,124,123,263,278,195,210,108,123,136,151,113,128,108,124,123,114,129,193,208,108,124,123,138,153,200,215,16,108,123,155,170,281,296,108,124,123,287,302,228,243,108,124,123,276,291,150,165,108,124,123,174,189,110,125,108,124,123,139,154,250,265,104,6,20,203,153,104,207,46,45,67,177,49,52,46,45,82,51,46,45,56,66,46,45,169,78,147,45,225,158,46,45,55,49,46,45,194,94,45,93,66,1,45,83,51,46,45,47,167,46,45,240,196,46,45,61,128,46,45,105,199,46,45,200,132,45,73,50,46,45,51,130,46,45,75,137,45,92,218,46,45,224,165,46,45,213,87,46,45,111,47,16,46,45,76,187,1,202,118,130,1,2,45,67,177,50,49,173,45,82,52,51,6,45,56,66,45,169,79,78,45,225,159,158,45,55,49,45,194,95,94,45,93,67,66,45,83,52,51,45,47,167,45,240,197,196,81,45,61,129,128,45,105,200,199,45,200,133,132,182,45,73,51,50,45,51,130,45,75,138,137,45,92,219,218,45,224,166,165,53,45,213,87,45,111,48,47,45,76,188,187,181,203,313,185,181,218,187,88,181,192,202,181,305,214,198,181,361,294,181,191,185,181,330,230,181,229,202,181,219,187,181,183,303,181,376,332,181,197,264,160,181,241,335,181,336,268,181,209,186,181,187,266,181,211,273,181,228,354,181,360,301,181,349,223,181,247,183,122,181,212,323,91,184,30,3,155,1,41,167,68,148,12,6,166,184,191,29,51,161,33,6,29,66,35,29,40,50,29,153,62,12,29,209,142,29,39,33,29,178,78,29,77,50,29,67,35,29,31,151,15,29,224,180,29,45,112,5,29,89,183,29,184,116,29,57,34,29,35,114,29,59,121,29,76,202,29,208,149,29,197,71,29,95,31,29,60,171,6,86,96,42,199,44,58,130,131,45,18,132,100,5,27,137,9,9,5,42,11,5,16,26,5,129,38,125,5,185,118,191,5,15,9,5,154,54,5,53,26,5,43,11,5,7,127,5,200,156,5,21,88,28,5,65,159,5,160,92,5,33,10,5,11,90,5,35,97,5,52,178,5,184,125,5,173,47,5,71,7,5,36,147,4,74,16,28,21,142,192,197,98,140,22,4,1,40,93,5,27,137,10,9,5,42,12,11,92,5,16,26,5,129,39,38,5,185,119,118,5,15,9,5,154,55,54,5,53,27,26,5,43,12,11,5,7,127,5,200,157,156,5,21,89,88,5,65,160,159,5,160,93,92,5,33,11,10,136,5,11,90,5,35,98,97,5,52,179,178,5,184,126,125,106,5,173,47,5,71,8,7,5,36,148,147,19,41,152,151,24,23,2,19,57,56,26,25,19,30,41,40,19,143,53,52,19,200,199,133,132,19,29,24,23,19,169,168,69,68,19,68,67,41,40,19,58,57,26,25,19,21,142,141,19,215,214,171,170,88,19,35,103,102,19,79,174,173,19,175,174,107,106,112,19,48,47,25,24,19,25,105,104,19,49,112,111,19,67,66,193,192,19,199,198,140,139,19,187,62,61,19,86,85,22,21,19,50,162,161,124,193,146,215,256,325,128,198,197,124,193,161,230,130,200,199,4,124,193,135,204,145,214,124,193,248,317,157,227,226,124,193,304,373,237,307,306,124,193,134,203,128,197,124,193,273,342,173,243,242,124,193,172,241,145,215,214,49,124,193,162,231,130,200,199,124,193,126,195,246,315,124,193,319,388,275,345,344,124,193,140,209,207,277,276,124,193,184,253,278,348,347,124,193,279,348,211,281,280,124,193,152,221,129,199,198,124,193,130,199,209,278,124,193,154,223,216,286,285,124,193,171,240,297,367,366,124,193,303,372,244,314,313,124,193,292,361,166,235,124,193,190,259,126,196,195,124,193,155,224,266,336,335,19,41,152,151,24,23,6,19,57,56,26,25,19,30,41,40,19,143,53,52,19,200,199,133,132,19,29,24,23,19,169,168,69,68,19,68,67,41,40,19,58,57,26,25,19,21,142,141,19,215,214,171,170,19,35,103,102,19,79,174,173,126,19,175,174,107,106,19,48,47,25,24,63,19,25,105,104,19,49,112,111,19,67,66,193,192,19,199,198,140,139,19,187,62,61,19,86,85,22,21,19,50,162,161,10,30,6,92,4,153,197,155,184,206,316,188,184,221,190,4,184,195,205,184,308,217,184,364,297,184,194,188,184,333,233,45,184,232,205,184,222,190,184,186,306,184,379,335,184,200,267,184,244,338,168,184,339,271,184,212,189,184,190,269,184,214,276,184,231,357,184,363,304,184,352,226,184,250,186,184,215,326,6,200,177,43,135,134,156,266,138,135,134,171,140,82,135,134,145,155,135,134,258,167,134,314,247,135,134,144,138,135,134,283,183,134,182,155,134,172,140,135,134,136,256,135,134,329,285,135,134,150,217,135,134,194,288,135,134,289,221,2,134,162,139,135,134,140,219,135,134,164,226,134,181,307,135,134,313,254,135,134,302,176,135,134,200,136,135,134,165,276,91,64,198,100,4,28,109,188,10,84,12,2,75,142,128,161,183,294,293,166,165,163,161,199,198,168,167,161,172,183,182,161,285,195,194,161,342,341,275,274,10,161,171,166,165,161,311,310,211,210,161,210,209,183,182,161,200,199,168,167,161,163,284,283,161,357,356,313,312,161,177,245,244,161,221,316,315,161,317,316,249,248,161,190,189,167,166,161,167,247,246,161,191,254,253,161,209,208,335,334,161,341,340,282,281,161,329,204,203,161,228,227,164,163,161,192,304,303,97,119,229,102,101,97,134,104,103,1,97,108,118,97,221,131,130,97,277,211,210,97,107,101,97,246,147,146,97,145,119,118,97,135,104,103,97,99,219,97,292,249,248,97,113,181,180,97,157,252,251,97,252,185,184,97,125,103,102,97,103,182,97,127,190,189,163,97,144,271,270,97,276,218,217,99,97,265,139,97,163,100,99,97,128,240,239,2,24,134,6,4,2,39,8,2,13,23,2,126,35,2,182,115,2,12,6,2,151,51,2,50,23,6,2,40,8,2,4,124,142,2,197,153,2,18,85,2,62,156,2,157,89,2,30,7,2,8,87,2,32,94,2,49,175,2,181,122,2,170,44,2,68,4,2,33,144,181,45,153};
short Gen_shift_values_BG1_a_15[2109]={135,96,189,128,227,4,23,126,236,225,134,136,162,221,151,220,84,128,236,83,117,43,92,179,186,172,92,96,53,56,24,225,68,1,205,11,216,128,189,22,75,6,24,95,101,167,135,85,33,217,153,200,87,96,32,220,125,235,90,163,67,105,230,172,137,216,219,135,136,97,190,129,227,228,5,24,126,127,237,226,134,135,137,163,222,152,221,84,85,129,237,83,84,118,44,93,180,187,173,93,97,53,54,57,25,225,226,69,2,205,206,12,217,128,129,190,23,75,76,7,25,96,102,168,135,136,86,34,217,218,154,201,88,97,33,220,221,126,236,90,91,164,68,105,106,231,173,137,138,217,220,136,97,189,190,128,129,228,4,5,23,24,127,237,225,226,135,137,162,163,222,151,152,220,221,85,129,236,237,84,117,118,43,44,93,179,180,186,187,173,92,93,96,97,54,57,24,25,226,68,69,1,2,206,12,216,217,129,190,22,23,76,6,7,24,25,96,101,102,167,168,136,86,33,34,218,154,200,201,88,96,97,32,33,221,125,126,235,236,91,164,67,68,106,230,231,172,173,138,217,219,220,136,97,190,128,129,228,5,23,24,127,237,226,135,137,162,163,222,152,220,221,85,129,237,84,118,43,44,93,180,186,187,173,93,96,97,54,57,25,226,69,1,2,206,12,216,217,129,190,22,23,76,7,24,25,96,102,167,168,136,86,34,218,154,200,201,88,97,32,33,221,126,235,236,91,164,68,106,231,172,173,138,217,219,220,64,211,315,276,369,308,2,407,184,203,171,306,416,405,314,316,342,47,401,331,400,264,308,416,263,297,223,272,359,366,352,272,276,233,236,204,405,248,181,385,191,396,308,369,202,143,255,186,204,275,281,347,315,265,213,397,333,380,210,267,276,212,400,305,415,270,343,247,285,410,352,317,396,399,180,199,22,23,100,92,207,52,13,77,146,209,32,166,18,288,174,249,135,342,227,228,281,166,167,181,380,266,157,42,43,176,61,62,105,279,165,389,275,378,263,264,287,173,289,175,315,200,201,141,374,260,304,189,190,373,258,259,237,123,281,167,389,274,275,236,122,270,155,156,196,81,82,245,131,332,217,218,339,224,225,325,211,245,130,131,249,134,135,206,92,209,95,177,62,63,378,264,221,106,107,154,39,40,358,244,164,50,369,254,255,281,167,342,228,175,60,61,223,228,114,159,44,45,177,62,63,248,134,254,139,140,320,205,206,288,174,238,124,186,71,72,370,256,306,192,353,238,239,177,240,126,249,134,135,185,70,71,373,259,278,163,164,388,273,274,243,129,316,202,220,105,106,145,258,144,383,268,269,325,210,211,290,176,369,255,372,257,258,199,169,12,206,221,17,212,92,205,116,151,70,230,115,84,300,242,243,261,204,354,297,293,236,45,392,334,335,169,112,188,131,115,291,233,234,401,344,390,333,299,241,242,301,244,327,270,386,329,316,259,385,328,249,191,192,293,236,401,344,248,190,191,282,225,208,151,257,200,344,287,351,294,337,280,257,200,261,204,218,160,161,221,164,189,132,390,332,333,233,176,166,109,370,312,313,176,119,381,324,293,235,236,354,297,187,130,134,240,182,183,171,114,189,132,260,203,266,209,332,275,300,242,243,250,193,198,141,382,324,325,318,261,365,308,1,252,195,261,204,197,140,385,327,328,290,233,400,343,255,197,198,328,271,232,175,270,212,213,395,338,337,280,302,244,245,381,324,384,327,152,186,215,124,180,98,80,285,286,247,340,279,220,377,378,155,174,276,277,387,376,284,285,287,313,185,372,302,371,234,235,279,387,233,234,268,194,243,330,337,154,323,243,247,203,204,207,175,375,376,219,152,355,356,162,367,278,279,340,173,225,226,157,175,246,252,318,285,286,236,184,367,368,304,351,238,247,183,370,371,276,386,240,241,314,218,255,256,381,323,178,287,288,367,370,124,144,182,95,72,76,185,146,239,177,178,39,277,54,72,73,138,176,286,275,184,186,211,212,271,201,269,270,134,178,286,133,167,92,93,142,229,235,236,222,142,145,146,103,106,74,275,118,50,51,220,255,61,265,266,178,239,71,72,125,56,73,74,173,145,151,216,217,185,135,83,267,203,249,250,137,146,81,82,270,175,284,285,142,140,213,117,155,280,221,222,187,266,268,269,340,301,394,333,432,209,228,78,331,441,430,339,341,367,152,426,356,425,289,333,441,288,322,248,297,384,391,377,297,301,258,261,229,430,273,206,410,216,421,84,333,394,227,280,211,229,300,306,372,340,290,238,422,358,405,292,301,237,425,330,440,295,368,272,310,435,377,5,342,421,424,183,112,106,219,129,183,215,180,143,14,179,108,159,138,196,265,226,319,258,77,357,134,153,256,366,355,264,266,292,187,351,281,350,214,258,366,213,247,173,222,309,316,302,222,226,183,186,154,203,355,198,131,335,141,346,167,258,319,152,205,136,154,225,231,297,265,215,163,347,283,330,217,226,162,350,255,365,220,293,197,235,360,302,267,346,349,197,122,215,65,216,25,47,126,178,185,127,117,199,193,154,247,186,32,285,62,81,184,294,283,192,194,220,178,279,209,278,2,142,186,294,141,175,101,150,237,244,230,150,154,111,114,82,283,126,59,263,69,274,156,186,247,80,133,64,82,153,159,225,193,143,91,275,211,258,145,154,90,278,183,293,148,221,125,163,288,230,195,274,277,27,141,11,181,163,131,169,98,165,232,9,32,43,200,205,239,200,293,231,232,331,108,126,127,232,230,340,329,238,240,265,266,325,255,323,324,188,232,340,187,221,146,147,196,283,289,290,276,196,199,200,157,160,128,329,172,104,105,309,115,319,320,232,293,125,126,179,110,127,128,199,205,270,271,32,239,189,137,321,257,303,304,191,200,135,136,324,229,338,339,118,194,267,171,209,334,275,276,241,320,322,323,241,202,294,295,233,234,170,333,109,110,128,129,232,342,330,331,240,242,267,268,327,256,257,325,326,190,234,341,342,189,222,223,148,149,198,284,285,291,292,278,197,198,201,202,159,162,129,130,331,173,174,106,107,199,311,117,321,322,234,295,127,128,181,111,112,129,130,26,201,206,207,272,273,241,191,138,139,323,259,305,306,193,201,202,137,138,326,230,231,340,341,196,269,172,173,211,335,336,277,278,243,322,324,325,310,244,271,205,364,298,303,236,237,402,336,179,113,198,131,132,73,301,235,411,345,400,334,309,243,311,245,337,270,271,396,330,326,260,395,328,329,259,193,303,237,411,345,258,192,292,226,218,151,152,267,201,354,288,361,294,295,149,347,281,267,201,271,204,205,228,162,231,165,199,133,400,334,243,177,176,109,110,380,314,186,120,391,324,325,303,237,364,298,197,130,131,250,184,181,115,199,132,133,270,204,276,210,342,275,276,310,244,260,194,208,142,392,326,328,262,375,308,309,262,196,271,205,207,140,141,395,329,300,234,410,343,344,265,199,338,272,242,176,280,214,405,339,347,280,281,312,246,391,325,394,327,328,347,308,400,401,339,340,103,439,215,216,234,235,338,448,436,437,346,348,373,374,433,362,363,431,432,296,340,447,448,295,328,329,254,255,304,390,391,397,398,384,303,304,307,308,265,268,235,236,437,279,280,212,213,417,223,427,428,340,401,233,234,110,287,217,218,235,236,307,312,313,378,379,151,347,297,244,245,429,365,411,412,299,307,308,243,244,432,336,337,446,447,302,375,278,279,317,441,442,383,384,349,428,430,431,199,132,172,65,161,237,142,180,235,196,289,228,327,104,123,231,226,336,325,234,236,262,321,251,320,184,228,336,183,217,143,174,192,279,286,272,192,196,153,156,124,325,168,101,305,111,316,228,289,122,145,175,106,124,195,201,267,235,185,133,317,253,300,187,196,132,320,225,335,190,263,167,205,330,272,237,316,319,11,207,42,100,296,297,258,351,290,388,389,166,185,59,287,288,398,387,295,296,298,324,383,313,382,245,246,290,398,244,245,279,205,254,341,348,334,254,258,214,215,218,186,386,387,230,163,366,367,173,378,289,290,351,184,236,237,168,186,204,257,263,329,296,297,247,195,378,379,315,362,249,258,194,381,382,287,397,251,252,325,229,266,267,392,334,298,299,378,381,121,90,26,140,115,188,168,52,4,103,30,53,189,215,24,207,168,260,261,199,200,222,299,75,76,94,95,198,308,296,297,206,208,233,234,293,222,223,291,292,170,156,200,307,308,155,188,189,114,115,164,250,251,257,258,244,163,164,167,168,125,128,95,96,297,139,140,72,73,277,83,287,288,200,261,93,94,147,77,78,95,96,167,172,173,238,239,207,157,104,105,289,225,271,272,159,167,168,103,104,292,196,197,306,307,162,235,138,139,177,301,302,243,244,209,288,290,291,261,222,315,253,254,353,130,148,149,22,252,362,351,260,262,287,288,347,277,345,346,210,254,362,209,243,168,169,218,305,311,312,298,218,221,222,179,182,150,351,194,126,127,331,137,341,342,254,315,147,148,201,132,149,150,221,227,292,293,261,211,159,343,279,325,326,127,213,222,157,158,346,251,360,361,49,216,289,193,231,356,297,298,263,342,344,345,283,244,337,276,191,375,152,171,274,384,373,282,284,310,369,299,368,232,276,384,231,265,191,240,327,334,211,320,240,244,201,204,172,187,373,216,149,353,159,364,276,337,170,223,154,172,243,249,315,283,233,181,365,301,348,235,244,180,368,273,383,238,311,215,253,378,320,285,364,367,177,114,93};
short Gen_shift_values_BG1_Z_384[2109]={306,75,204,275,18,249,86,49,75,327,368,72,383,287,331,274,180,143,255,215,160,198,330,266,152,330,159,55,316,177,62,287,128,131,108,294,304,16,341,230,356,199,340,216,87,211,214,98,52,105,353,303,113,130,299,241,239,270,179,330,204,329,12,38,345,111,356,306,307,76,205,276,18,19,250,87,49,50,76,328,368,369,73,0,288,332,275,180,181,144,256,215,216,161,199,331,267,153,331,160,56,316,317,178,63,287,288,129,132,108,109,295,305,16,17,342,231,356,357,200,341,217,88,212,214,215,99,53,105,106,354,304,114,131,300,241,242,240,271,179,180,331,205,329,330,13,39,345,346,112,357,307,76,204,205,275,276,19,249,250,86,87,50,76,327,328,369,73,383,0,288,331,332,274,275,181,144,255,256,216,160,161,198,199,331,266,267,152,153,331,159,160,55,56,317,178,62,63,288,128,129,131,132,109,295,304,305,17,342,230,231,357,199,200,340,341,217,87,88,211,212,215,99,52,53,106,354,303,304,114,130,131,299,300,242,239,240,270,271,180,331,204,205,330,12,13,38,39,346,112,356,357,307,76,205,275,276,19,250,86,87,50,76,328,369,73,383,0,288,332,274,275,181,144,256,216,161,198,199,331,267,152,153,331,160,55,56,317,178,63,288,129,131,132,109,295,304,305,17,342,230,231,357,200,340,341,217,88,211,212,215,99,53,106,354,303,304,114,131,299,300,242,240,270,271,180,331,205,330,13,38,39,346,112,356,357,331,180,79,232,361,48,194,175,22,243,13,206,232,100,141,229,156,114,60,104,47,337,300,28,372,317,355,103,39,309,103,316,212,89,334,219,60,285,288,265,67,77,173,114,3,165,129,356,113,373,244,368,371,255,209,262,126,76,240,270,287,72,14,12,43,336,103,361,102,169,195,118,268,129,50,277,256,0,350,91,252,17,224,8,61,315,332,289,113,373,93,142,246,271,374,375,342,61,62,306,85,189,316,35,36,153,256,257,178,116,220,142,246,10,113,114,51,155,139,243,66,169,170,164,354,74,14,117,118,341,60,61,247,351,210,314,322,41,42,282,2,227,330,331,265,368,369,13,117,333,52,53,219,322,323,13,117,226,329,330,122,225,226,383,103,244,348,129,232,233,354,74,195,298,299,198,301,302,175,279,361,81,371,90,91,83,187,24,128,297,16,17,17,39,143,266,369,370,23,126,127,283,3,154,257,258,278,381,382,281,1,165,269,119,222,223,172,276,36,140,370,89,90,38,180,284,197,300,301,366,85,86,308,28,306,25,26,337,56,57,246,350,13,117,271,374,375,223,12,116,79,182,183,105,208,209,28,132,178,282,39,142,143,367,365,231,320,132,56,302,62,81,100,338,273,110,382,353,256,37,38,25,191,154,320,225,7,47,352,133,134,199,365,36,202,101,383,164,165,25,191,277,59,318,99,100,22,188,333,115,237,19,281,63,224,6,130,295,296,93,259,205,371,165,330,331,110,276,148,314,280,62,216,382,102,268,280,62,109,275,5,171,266,47,48,127,293,12,178,237,18,19,78,244,81,247,58,223,224,244,26,254,36,350,131,132,291,73,180,346,7,306,87,88,149,315,290,72,166,332,37,203,161,327,164,329,330,48,214,2,168,55,220,221,303,85,253,35,46,63,229,80,246,249,31,191,356,357,189,355,220,2,129,294,295,280,62,154,320,279,60,61,346,128,372,154,295,76,77,61,227,306,88,187,76,185,173,231,49,73,292,293,62,191,262,312,4,5,236,73,35,36,62,314,354,355,59,370,176,274,318,261,166,167,130,242,201,202,147,185,317,253,139,265,317,146,42,302,303,164,49,273,274,115,118,94,95,281,291,2,3,328,217,342,343,186,327,203,74,198,200,201,85,39,91,92,340,290,100,117,286,227,228,226,257,165,166,317,191,315,316,383,25,114,331,332,98,343,141,247,136,88,346,11,192,345,90,160,161,240,288,135,355,356,1,319,345,213,254,342,268,269,173,217,159,160,66,29,141,101,46,83,84,216,152,37,38,216,45,324,325,202,63,332,173,14,16,17,209,378,180,189,190,286,227,115,116,242,85,225,226,317,102,357,96,97,100,368,322,375,239,188,189,383,16,184,185,127,125,155,156,54,65,216,90,215,282,307,308,231,381,241,242,363,132,261,332,75,306,143,12,106,132,0,41,129,56,337,344,4,331,237,200,312,272,217,255,3,323,209,3,216,112,373,234,119,344,185,188,165,351,361,56,73,14,287,29,256,13,273,144,268,271,155,109,162,26,360,170,187,356,298,296,327,236,3,261,2,69,95,288,18,168,29,259,302,80,357,374,129,162,279,131,3,144,212,343,241,196,365,134,263,334,186,77,308,145,108,134,2,43,131,58,205,346,6,333,239,202,314,274,219,257,5,325,211,5,218,114,375,236,121,263,346,187,190,167,353,363,340,75,16,289,31,258,15,275,146,270,273,157,111,164,28,362,172,189,358,300,298,329,238,5,263,4,71,97,20,170,31,204,101,327,212,96,29,10,232,21,23,88,60,26,156,309,54,125,297,252,99,320,283,309,177,218,306,233,157,137,181,124,234,30,377,105,65,10,48,180,116,2,180,9,289,166,27,296,137,362,365,342,144,154,338,250,191,80,206,49,190,66,321,61,64,332,286,339,203,153,347,364,149,91,89,120,29,180,54,179,246,272,195,345,206,71,16,382,311,70,80,75,135,193,193,100,221,18,243,273,1,154,283,353,354,97,328,164,165,251,128,154,22,63,151,77,78,366,26,352,353,259,222,334,294,239,276,277,25,345,230,231,25,238,133,134,11,256,141,366,207,209,210,187,373,382,383,95,36,308,309,51,278,34,35,295,166,289,290,4,293,177,131,184,48,381,382,192,209,377,378,320,318,348,349,146,258,25,283,24,91,116,117,40,190,50,51,13,166,294,295,365,366,158,109,339,340,176,177,140,166,33,34,75,163,89,90,378,37,38,364,365,271,234,345,346,306,250,251,288,289,37,356,357,242,243,37,249,250,145,146,23,268,152,153,378,218,219,221,222,228,199,1,10,11,107,48,320,321,63,289,290,46,47,259,307,177,178,301,302,305,189,142,143,196,60,9,10,204,220,221,5,6,332,329,330,360,361,270,37,294,295,36,102,103,128,129,52,202,62,63,180,179,333,332,78,77,149,147,148,276,275,123,122,344,342,343,99,307,306,333,332,201,200,242,241,330,329,257,255,256,161,160,205,204,148,146,147,54,53,17,16,129,128,89,88,34,33,72,70,71,204,203,140,139,26,24,25,214,204,203,33,32,313,311,312,190,189,51,50,320,319,161,160,2,1,5,3,4,366,365,168,167,178,176,177,274,273,215,214,104,102,103,230,229,73,72,214,212,213,90,89,345,344,85,83,84,88,87,356,355,310,309,363,362,227,226,177,175,176,371,370,4,3,173,171,172,115,114,113,112,144,142,143,53,52,204,203,78,77,203,202,270,269,296,294,295,219,218,369,368,230,228,229,210,363,107,108,178,179,101,306,152,153,373,374,337,363,230,231,272,360,286,287,191,234,235,177,178,84,47,158,159,119,63,64,101,102,234,169,170,55,56,234,62,63,342,343,220,81,349,350,191,31,32,34,35,12,198,207,208,304,245,133,134,200,260,102,103,243,244,120,374,375,114,115,174,118,2,339,340,9,257,206,207,17,33,34,202,203,145,142,143,173,174,83,234,107,108,233,299,300,325,326,249,15,259,260,322,7,360,104,229,147,201,311,188,341,86,157,284,131,352,319,315,341,209,250,338,265,169,213,156,62,25,137,97,42,80,334,212,148,34,212,41,321,198,59,328,169,10,13,374,176,186,282,223,112,1,238,81,222,98,353,93,96,364,318,371,235,185,379,12,181,123,121,152,61,212,86,211,278,304,227,377,238,209,312,296,20,37,38,191,320,7,133,134,365,202,268,164,165,191,59,99,100,188,115,19,63,6,295,296,259,371,330,331,276,314,62,382,268,62,275,171,47,48,293,178,18,19,244,247,223,224,26,36,131,132,73,346,87,88,315,72,81,332,203,327,329,330,214,168,220,221,85,35,229,246,31,356,357,355,2,294,295,62,320,60,61,128,154,76,77,227,88,184,176,288,213,257,92,345,296,174,36,311,51,313,138,287,141,294,38,39,109,110,112,237,83,84,304,305,268,294,161,162,203,291,217,218,122,165,166,108,109,13,15,362,89,90,50,378,379,32,33,165,100,101,370,371,165,377,378,273,274,151,12,280,281,122,346,347,349,350,327,129,138,139,235,176,64,65,191,33,34,174,175,51,305,306,45,46,49,317,270,271,324,188,137,138,332,348,349,133,134,76,73,74,104,105,14,165,38,39,164,230,231,256,257,180,330,190,191,91,244,373,59,60,187,34,254,255,112,218,244,112,153,241,167,168,72,116,58,59,349,312,40,0,329,366,367,115,51,320,321,115,328,223,224,101,346,231,72,297,299,300,277,79,88,89,185,126,14,15,141,368,124,125,1,256,379,380,383,267,221,274,138,87,88,131,282,299,83,84,26,24,54,55,113,348,115,373,114,181,206,207,130,280,140,141,196,349,94,165,79,292,139,360,323,349,217,258,346,273,177,221,164,70,33,145,105,50,88,220,156,42,77,220,49,329,206,67,336,162,177,18,21,382,184,194,290,231,120,246,89,230,106,361,101,104,372,326,379,243,193,3,20,189,131,129,160,69,220,94,219,286,312,235,1,246,134,148,14};
short no_shift_values_BG2[420]={3,3,2,3,3,2,3,2,3,3,4,4,3,4,3,2,4,2,3,4,5,4,3,5,4,3,5,3,4,5,3,4,3,3,4,3,4,3,4,4,5,5,3,4,3,2,4,2,3,4,5,5,3,4,3,3,4,3,3,4,5,4,3,4,3,3,4,3,3,5,7,9,6,7,7,6,8,6,7,8,6,5,3,5,4,3,5,3,4,5,7,8,5,7,6,4,7,4,7,7,1,1,0,0,0,0,1,1,0,0,4,4,3,3,4,3,4,4,4,5,4,5,3,5,3,2,4,2,3,4,4,5,3,3,4,3,4,3,5,4,7,9,6,7,7,5,9,5,7,8,8,7,5,7,6,4,7,4,6,7,9,9,6,9,7,5,9,5,7,10,9,9,6,9,7,6,9,5,7,9,1,0,0,0,0,0,1,1,0,0,4,4,2,3,3,2,3,2,3,3,4,5,3,4,4,2,4,2,3,4,4,4,3,3,4,3,4,3,5,4,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,8,8,7,8,8,6,9,7,8,9,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,3,5,3,3,4,3,4,3,4,4,6,4,3,5,4,4,5,3,4,5,3,3,3,3,3,2,3,3,3,3,9,8,6,8,8,6,9,6,8,9,4,5,3,4,3,3,4,2,3,4,1,0,1,0,0,0,0,1,0,0,6,7,5,6,7,5,7,5,7,7,4,5,3,4,3,3,4,2,3,4,6,4,3,5,4,3,5,4,4,5,6,7,6,6,7,5,7,5,7,7,4,5,3,4,3,3,4,2,3,4};
short pointer_shift_values_BG2[420]={0,3,6,8,11,14,16,19,21,24,27,31,35,38,42,45,47,51,53,56,60,65,69,72,77,81,84,89,92,96,101,104,108,111,114,118,121,125,128,132,136,141,146,149,153,156,158,162,164,167,171,176,181,184,188,191,194,198,201,204,208,213,217,220,224,227,230,234,237,240,245,252,261,267,274,281,287,295,301,308,316,322,327,330,335,339,342,347,350,354,359,366,374,379,386,392,396,403,407,414,421,422,423,423,423,423,423,424,425,425,425,429,433,436,439,443,446,450,454,458,463,467,472,475,480,483,485,489,491,494,498,502,507,510,513,517,520,524,527,532,536,543,552,558,565,572,577,586,591,598,606,614,621,626,633,639,643,650,654,660,667,676,685,691,700,707,712,721,726,733,743,752,761,767,776,783,789,798,803,810,819,820,820,820,820,820,820,821,822,822,822,826,830,832,835,838,840,843,845,848,851,855,860,863,867,871,873,877,879,882,886,890,894,897,900,904,907,911,914,919,923,923,924,925,925,925,925,925,925,925,925,926,926,926,927,927,928,928,928,928,928,928,929,930,930,930,930,930,930,930,931,932,932,932,932,932,933,933,933,933,933,941,949,956,964,972,978,987,994,1002,1011,1012,1012,1012,1012,1012,1012,1013,1013,1013,1013,1013,1014,1015,1015,1015,1016,1016,1016,1016,1016,1017,1017,1017,1017,1018,1018,1018,1018,1018,1018,1018,1018,1019,1019,1019,1020,1020,1021,1021,1022,1025,1030,1033,1036,1040,1043,1047,1050,1054,1058,1064,1068,1071,1076,1080,1084,1089,1092,1096,1101,1104,1107,1110,1113,1116,1118,1121,1124,1127,1130,1139,1147,1153,1161,1169,1175,1184,1190,1198,1207,1211,1216,1219,1223,1226,1229,1233,1235,1238,1242,1243,1243,1244,1244,1244,1244,1244,1245,1245,1245,1251,1258,1263,1269,1276,1281,1288,1293,1300,1307,1311,1316,1319,1323,1326,1329,1333,1335,1338,1342,1348,1352,1355,1360,1364,1367,1372,1376,1380,1385,1391,1398,1404,1410,1417,1422,1429,1434,1441,1448,1452,1457,1460,1464,1467,1470,1474,1476,1479};
short Gen_shift_values_BG2_a_2[1483]={8,166,80,116,113,7,203,57,25,165,43,252,51,157,124,103,188,225,208,155,53,223,239,17,204,251,127,9,8,166,80,117,116,113,7,204,203,57,26,25,165,43,252,51,157,124,103,189,188,225,208,155,53,223,239,17,205,204,251,127,9,8,167,166,80,117,116,113,7,204,203,57,26,25,166,165,43,253,252,51,157,125,124,103,189,188,226,225,208,156,155,53,224,223,239,17,205,204,252,251,127,8,166,80,116,113,8,7,203,58,57,25,165,43,252,51,158,157,124,104,103,188,225,209,208,155,54,53,223,239,18,17,204,251,128,127,80,79,237,151,179,188,187,184,78,214,275,274,128,97,96,236,114,323,122,228,195,174,260,259,296,279,226,124,294,310,88,276,275,322,198,112,111,269,183,231,220,219,216,110,41,307,306,160,129,128,268,146,355,154,260,227,206,194,292,291,328,311,258,156,159,326,342,120,308,307,354,230,167,166,324,238,155,275,274,271,165,362,361,215,184,183,323,201,410,209,315,282,261,228,347,346,383,366,313,211,45,381,397,175,363,362,409,285,28,12,11,124,169,282,83,196,120,119,232,116,229,124,10,123,129,207,206,319,174,60,173,29,28,141,168,281,46,159,255,368,54,167,274,160,273,127,240,220,106,219,147,192,191,304,228,341,325,211,324,158,271,170,56,169,140,226,339,242,355,134,20,133,208,207,320,254,367,244,130,243,239,238,397,396,310,142,347,346,343,237,94,434,433,287,256,255,396,395,273,483,482,281,387,355,354,333,419,418,456,455,438,386,385,283,454,453,469,247,435,434,482,481,357,256,69,255,227,413,141,327,364,177,363,174,360,68,254,203,451,264,450,118,304,273,86,272,226,412,104,290,313,499,112,298,218,404,185,371,164,350,436,249,435,286,472,269,455,216,402,114,300,284,470,300,486,78,264,205,452,265,451,312,498,188,374,11,185,0,117,64,222,136,11,172,169,64,63,259,114,113,81,221,99,308,107,214,213,180,160,159,244,281,265,264,211,110,109,236,279,295,74,73,260,307,184,183,210,23,22,180,94,131,130,127,21,63,218,217,71,40,39,179,57,111,266,65,171,138,117,203,202,239,222,169,67,237,253,31,219,218,265,141,230,388,302,83,338,335,230,229,2,425,280,279,247,387,265,474,273,380,379,346,326,325,410,447,431,430,377,276,275,445,461,240,239,38,426,473,350,349,12,11,240,169,398,83,312,120,119,348,116,345,240,10,239,115,207,206,435,290,60,289,29,28,257,168,397,46,275,255,484,54,283,390,160,389,127,356,336,106,335,192,191,420,228,457,441,211,440,145,158,387,286,56,285,226,455,242,471,250,20,249,208,207,436,254,483,360,130,359,222,183,221,341,379,255,293,51,330,291,329,288,326,182,220,417,378,416,232,270,239,200,238,340,378,218,256,427,465,226,264,332,370,299,337,278,316,402,363,401,400,438,383,421,330,368,228,266,398,436,414,452,192,230,418,379,417,426,464,302,340,17,251,16,250,409,174,408,88,322,125,359,124,358,121,355,15,249,203,212,446,211,445,65,299,34,268,33,267,408,173,407,51,285,495,260,494,59,293,165,399,367,132,366,111,345,197,431,196,430,468,233,467,216,450,398,163,397,61,295,466,231,465,247,481,25,259,213,447,212,446,494,259,493,135,369,142,123,73,122,72,231,280,230,194,144,231,181,230,180,227,177,121,71,254,318,268,317,267,171,121,140,90,139,89,230,279,229,157,107,317,366,316,165,115,271,221,189,238,188,217,167,124,303,253,302,252,290,339,289,322,272,220,269,219,167,117,288,337,287,353,303,131,81,319,269,318,268,316,365,315,241,191,220,194,50,193,351,265,87,301,298,192,20,388,242,210,350,228,437,236,342,309,288,373,410,393,340,238,408,424,202,389,436,312,38,37,195,109,146,145,142,36,26,233,232,86,55,54,194,72,281,80,186,105,153,132,218,217,254,237,184,82,252,268,46,234,233,280,156,218,376,290,76,326,323,218,217,413,268,267,235,375,253,462,261,368,367,334,314,313,398,435,419,418,365,264,263,433,449,228,227,42,414,461,338,337,222,63,23,235,238,46,139,8,228,156,169,168,130,327,326,288,240,202,277,276,238,273,235,130,167,129,364,363,325,180,217,179,29,186,185,147,326,325,287,203,165,413,412,374,211,173,280,317,279,285,284,246,226,263,225,349,348,310,386,385,347,331,368,330,316,315,277,176,213,175,143,384,383,345,399,361,140,177,139,365,364,326,412,411,373,250,287,249,8,151,98,101,135,18,28,71,240,9,84,9,167,81,117,114,9,8,106,204,59,58,26,166,44,253,52,159,158,125,105,104,189,226,210,209,156,55,54,224,240,19,18,205,252,129,128,175,174,333,332,246,242,283,282,279,173,370,369,223,192,191,332,331,209,419,418,217,323,291,290,269,44,355,354,392,391,374,322,321,219,390,389,405,183,371,370,418,417,293,243,401,315,351,348,242,438,292,132,260,400,278,487,286,392,359,338,423,460,443,390,288,164,458,474,252,439,486,362,94,93,44,252,251,202,165,116,147,202,201,152,198,149,44,92,43,289,288,239,94,142,93,111,110,61,251,250,201,128,79,338,337,288,136,87,194,242,193,210,209,160,140,188,139,274,273,224,311,310,261,245,293,244,241,240,191,90,138,89,309,308,259,324,275,54,102,53,290,289,240,337,336,287,164,212,163,72,71,229,143,180,179,176,70,57,267,266,120,89,88,228,106,315,114,220,187,166,40,252,251,288,271,218,116,286,302,80,268,267,314,190,140,38,154,227,159,385,317,299,231,335,267,332,264,159,226,158,422,354,209,276,208,244,176,384,316,262,194,471,403,270,202,309,376,308,343,275,255,322,254,407,339,444,376,360,427,359,374,306,205,272,204,442,374,458,390,169,236,168,423,355,470,402,279,346,278,47,46,204,118,155,154,151,45,31,242,241,95,64,63,203,81,290,89,195,162,141,66,227,226,263,246,193,91,261,277,55,243,242,289,165,43,42,201,200,114,239,151,150,147,41,238,237,91,60,59,200,199,77,287,286,85,191,159,158,137,223,222,260,259,242,190,189,87,172,258,257,273,51,239,238,286,285,161,83,128,241,286,155,200,191,236,188,233,128,82,127,278,323,178,132,177,0,100,145,240,285,118,163,327,372,126,171,278,232,277,199,244,224,178,223,263,308,300,345,329,283,328,230,275,174,128,173,298,343,314,359,138,92,137,279,324,326,371,248,202,247,127,126,284,198,235,234,231,125,129,322,321,175,144,143,283,161,370,169,275,242,221,229,307,306,343,326,273,171,341,357,135,323,322,369,245};
......@@ -19,3 +21,5 @@ short Gen_shift_values_BG2_a_9[1483]={2,18,94,25,105,119,52,120,34,93,91,103,109
short Gen_shift_values_BG2_a_11[1483]={155,16,97,142,167,52,13,173,2,64,106,62,81,173,0,126,39,54,16,36,88,170,141,16,122,132,104,156,155,16,97,143,142,167,52,14,13,173,3,2,64,106,62,81,173,0,126,40,39,54,16,36,88,170,141,16,123,122,132,104,156,155,17,16,97,143,142,167,52,14,13,173,3,2,65,64,106,63,62,81,173,1,0,126,40,39,55,54,16,37,36,88,171,170,141,16,123,122,133,132,104,155,16,97,142,167,53,52,13,174,173,2,64,106,62,81,174,173,0,127,126,39,54,17,16,36,89,88,170,141,17,16,122,132,105,104,239,238,99,180,86,226,225,250,135,67,97,96,256,86,85,147,189,145,164,256,83,209,123,122,137,99,119,171,253,224,99,206,205,215,187,216,215,76,157,79,203,202,227,112,84,74,73,233,63,62,124,166,122,141,233,60,186,35,100,99,114,76,96,148,103,230,201,76,183,182,192,164,185,184,45,126,47,172,171,196,81,43,42,202,32,31,93,135,91,110,202,29,155,154,69,68,83,45,65,117,10,199,170,45,152,151,161,133,155,203,202,210,63,71,144,152,190,189,197,214,222,99,108,107,48,61,60,68,220,229,228,50,49,57,111,119,153,161,109,117,128,136,220,229,228,47,55,173,182,181,125,87,86,94,101,109,63,72,71,83,91,135,144,143,24,217,225,188,196,63,72,71,170,169,177,179,187,151,160,159,317,316,178,177,258,53,304,303,328,213,31,175,174,334,164,163,226,225,267,224,223,242,334,162,161,287,201,200,216,215,177,198,197,249,332,331,302,177,284,283,294,293,265,254,220,219,115,80,196,161,241,207,206,266,231,151,116,104,112,78,77,272,237,101,67,66,163,128,205,170,161,126,180,145,272,237,99,64,225,190,138,104,103,153,118,115,80,135,100,187,152,269,234,240,205,115,80,142,221,187,186,231,196,203,168,111,25,174,23,296,157,238,91,283,308,194,193,154,315,314,143,205,247,203,222,315,314,141,268,267,180,195,158,157,177,230,229,175,311,282,158,157,263,273,246,245,24,160,159,20,101,147,146,171,56,122,18,17,177,7,6,68,110,11,66,85,177,4,130,44,43,58,20,40,92,174,145,20,127,126,136,108,282,143,224,29,269,294,180,179,91,140,301,300,129,191,233,189,208,301,300,127,254,253,166,181,144,143,163,216,215,297,268,144,143,27,249,259,232,231,164,163,321,24,182,105,263,151,150,308,175,333,60,219,218,11,22,21,179,181,340,339,11,10,168,72,230,114,272,70,228,89,247,181,340,339,8,166,134,293,292,48,47,205,62,220,24,183,182,145,44,202,96,255,254,178,336,149,307,24,183,182,131,130,288,140,298,112,271,270,258,196,195,119,56,200,137,137,245,183,182,270,207,155,92,116,54,53,276,213,105,43,42,167,104,209,146,165,102,184,121,276,213,103,40,229,166,142,80,79,157,94,119,56,139,76,191,128,273,210,244,181,119,56,225,163,162,235,172,207,144,173,172,321,320,33,182,181,114,262,160,159,308,307,184,332,69,217,78,31,30,179,178,190,338,20,19,168,167,81,230,229,123,271,79,228,227,98,246,190,338,17,166,165,143,291,57,56,205,204,71,220,219,33,181,53,202,201,105,253,187,336,335,158,306,33,181,140,139,288,287,149,298,297,121,269,158,218,217,319,318,78,180,179,159,260,205,204,306,305,229,330,114,215,134,76,75,177,176,235,336,65,64,166,165,126,228,227,168,269,124,226,225,143,244,235,336,62,164,163,188,289,23,102,101,203,202,116,218,217,78,179,98,200,199,150,251,232,334,333,203,304,78,179,185,184,286,285,194,296,295,166,267,173,31,22,300,161,242,13,287,312,197,135,158,318,147,209,251,207,226,318,145,271,184,199,161,181,233,315,286,161,267,277,249,329,328,189,270,316,315,340,225,128,187,186,346,176,175,237,279,235,254,346,52,173,299,213,212,227,189,209,261,343,314,189,296,295,305,277,195,56,137,156,182,207,93,92,53,214,213,42,104,146,102,121,214,213,40,167,166,79,94,57,56,76,129,128,210,181,57,56,166,162,172,145,144,18,163,110,132,150,113,108,61,72,136,209,208,300,70,69,161,150,242,196,195,287,220,312,105,198,197,67,66,158,226,319,318,36,56,55,147,118,117,209,159,251,116,115,207,134,226,226,319,318,54,53,145,179,272,271,93,92,184,108,107,199,69,162,161,90,89,181,141,234,233,38,224,223,315,194,286,69,162,161,176,175,267,186,185,277,157,250,249,42,104,64,24,149,139,161,84,173,93,29,303,164,245,290,315,201,200,117,161,322,321,150,212,254,210,229,322,321,148,275,274,187,202,165,164,184,237,236,318,289,165,164,270,280,253,252,298,297,159,158,239,116,285,284,309,194,156,155,315,145,144,207,206,248,205,204,223,315,143,142,268,73,182,181,197,196,158,179,178,230,313,312,283,158,265,264,275,274,246,184,45,126,171,196,81,42,202,105,31,93,135,91,110,202,29,155,68,83,45,65,117,137,199,170,45,151,161,133,197,196,317,58,57,178,138,259,11,184,183,304,208,329,93,215,214,55,54,175,214,336,335,44,43,164,106,105,226,147,268,104,103,224,122,243,214,336,335,42,41,162,167,289,288,81,80,201,96,95,216,57,179,178,78,77,198,129,251,250,212,211,332,182,303,57,179,178,164,163,284,174,173,294,145,267,266,328,327,188,269,315,314,339,224,126,186,185,345,175,174,236,278,234,253,345,172,298,152,212,211,226,188,208,260,342,313,188,295,294,304,276,73,154,129,322,193,183,54,264,135,309,180,334,205,219,91,90,180,51,340,212,211,169,40,231,102,273,144,229,100,248,119,340,212,211,167,38,293,165,164,206,77,221,92,183,55,54,203,74,255,127,126,337,208,308,179,183,55,54,289,160,299,170,271,143,142,175,174,35,116,162,161,186,71,112,33,32,192,22,21,83,125,81,100,192,19,145,7,59,58,73,35,55,107,189,160,35,142,141,151,123,261,260,122,121,202,109,248,247,272,157,119,118,278,108,107,170,169,211,168,167,186,278,106,105,231,145,144,160,159,121,142,141,193,6,276,275,246,121,228,227,238,237,209,311,237,172,98,253,179,298,224,323,249,208,135,134,169,95,329,256,255,160,158,84,220,146,262,188,218,144,237,163,329,256,255,156,82,282,209,208,195,121,210,136,172,99,98,192,118,244,171,170,326,252,297,223,172,99,98,278,204,288,214,260,187,186,164,163,24,105,151,150,175,60,132,22,21,181,11,10,72,114,70,89,181,8,134,6,48,47,62,24,44,96,178,149,24,131,130,140,112};
short Gen_shift_values_BG2_a_13[1483]={142,17,125,18,162,35,175,47,164,26,46,2,182,17,101,110,195,184,202,16,2,13,131,190,12,179,159,143,142,17,125,19,18,162,35,176,175,47,165,164,26,46,2,182,17,101,110,196,195,184,202,16,2,13,131,190,13,12,179,159,143,142,18,17,125,19,18,162,35,176,175,47,165,164,27,26,46,3,2,182,17,102,101,110,196,195,185,184,202,17,16,2,14,13,131,190,13,12,180,179,159,142,17,125,18,162,36,35,175,48,47,164,26,46,2,182,18,17,101,111,110,195,184,203,202,16,3,2,13,131,191,190,12,179,160,159,260,259,134,242,43,136,135,279,152,27,293,292,164,282,281,143,163,119,299,134,218,227,313,312,301,319,133,119,130,248,307,130,129,296,276,205,204,79,187,136,81,80,224,97,49,238,237,109,227,226,88,108,64,244,79,163,172,36,258,257,246,264,78,64,132,75,193,252,75,74,241,221,155,154,29,137,7,31,30,174,47,188,187,59,177,176,38,58,14,194,29,113,122,34,208,207,196,214,28,14,198,25,143,202,25,24,191,171,168,250,249,200,124,75,232,183,126,125,76,269,220,142,94,93,163,283,282,233,154,106,105,272,271,222,133,84,153,104,109,60,289,240,124,76,75,208,159,217,169,168,78,303,302,253,291,242,309,261,260,123,74,109,61,60,143,120,71,238,189,297,249,248,120,119,70,286,237,266,218,217,165,164,40,39,147,101,41,40,184,57,177,198,197,69,187,186,49,48,68,25,24,204,39,124,123,132,218,217,207,206,224,39,38,24,36,35,153,212,35,34,202,201,181,347,224,223,222,98,330,206,223,100,99,367,243,240,116,186,380,257,256,252,128,369,246,245,231,107,251,127,207,83,387,263,222,98,306,182,315,191,400,277,276,389,265,407,283,221,97,207,83,218,94,336,212,395,271,27,217,94,93,384,260,364,240,125,60,177,51,150,25,133,39,26,170,44,43,183,56,55,172,34,54,10,190,26,25,109,119,118,203,192,211,210,24,11,10,29,21,139,199,198,20,187,168,167,35,192,191,66,174,68,67,211,84,18,225,224,96,214,213,75,95,155,51,231,66,150,159,245,244,233,251,65,51,62,180,239,62,61,228,208,328,203,311,32,204,348,222,221,53,361,234,233,350,212,232,188,368,204,203,287,297,296,381,370,389,388,202,189,188,199,317,377,376,95,198,365,346,345,195,194,251,69,126,177,234,71,70,127,214,271,87,145,144,91,228,227,284,99,157,156,217,216,273,78,135,98,155,54,111,234,291,69,127,126,153,210,162,220,219,248,247,304,236,293,254,312,311,20,68,125,54,112,111,65,122,183,240,242,300,299,65,64,121,231,288,211,269,268,250,245,244,125,119,233,227,174,126,121,120,270,264,143,137,283,278,277,155,149,272,267,266,134,128,154,148,110,104,290,284,125,119,209,203,218,212,303,298,297,292,286,310,304,124,118,110,104,121,115,239,233,298,292,120,115,114,287,281,267,261,197,196,319,318,71,194,193,179,301,73,72,195,194,216,338,89,211,125,230,229,352,351,101,223,219,218,341,340,80,203,202,100,222,56,179,178,236,358,71,193,155,278,277,164,286,250,249,372,371,238,361,360,256,378,70,193,192,56,178,67,190,189,185,307,244,366,67,66,189,188,233,356,355,213,335,31,285,284,178,177,159,53,52,267,160,161,160,54,53,304,197,177,70,57,318,317,211,210,189,82,307,306,200,199,168,62,61,188,81,144,38,37,324,217,159,52,243,137,136,252,145,201,338,337,231,230,326,220,219,344,237,158,52,51,144,37,155,49,48,273,166,332,225,155,154,48,47,321,215,214,301,194,129,203,140,194,69,177,110,70,214,87,124,227,99,216,78,98,54,234,69,153,162,247,236,254,68,54,65,183,242,64,231,211,257,256,131,239,133,132,276,149,196,290,289,161,279,278,140,160,116,296,131,35,215,224,310,309,298,316,130,116,127,245,304,127,126,293,273,165,40,148,10,41,185,59,58,198,71,70,187,49,69,25,205,41,40,124,134,133,218,207,226,225,39,26,25,36,154,214,213,122,35,202,183,182,202,126,52,170,13,113,161,88,197,194,192,191,303,67,66,178,174,286,68,67,179,211,323,84,197,196,225,224,336,96,209,208,164,214,213,325,76,75,187,95,207,52,51,163,231,343,66,179,178,151,150,262,159,272,271,245,244,356,234,233,345,251,364,363,66,65,177,51,164,163,172,63,62,174,180,292,239,352,351,62,61,173,229,228,340,208,321,320,168,193,14,186,46,50,27,70,17,50,6,331,206,314,207,351,225,224,115,364,237,236,353,215,235,191,371,207,206,290,300,299,384,373,392,391,205,192,191,202,320,380,379,201,368,349,348,306,305,181,180,288,110,182,181,325,198,339,338,210,328,327,190,189,209,166,165,345,180,265,264,273,0,359,358,348,347,365,180,179,165,177,176,294,353,176,175,343,342,322,321,196,304,197,341,214,354,226,163,343,205,225,181,361,196,280,289,374,363,381,195,181,173,192,310,369,191,358,338,334,333,335,209,208,210,316,318,197,210,209,211,353,355,226,229,228,367,366,368,238,241,240,356,355,357,218,217,219,237,239,194,193,195,373,375,208,211,210,293,292,294,301,304,303,387,386,388,376,375,377,393,396,395,208,207,209,193,196,195,205,204,206,322,324,381,384,383,204,203,205,371,370,372,350,353,352,324,323,198,306,200,199,343,216,157,357,356,228,346,345,207,227,183,363,198,282,291,167,377,376,365,383,197,183,194,312,371,194,193,360,340,197,167,179,323,335,198,210,306,318,199,211,343,355,216,229,228,356,368,228,241,240,345,357,207,219,227,239,183,195,363,375,198,211,210,282,294,291,304,303,376,388,365,377,383,396,395,197,209,183,196,195,194,206,312,324,371,384,383,193,205,360,372,340,353,352,334,333,208,316,210,209,353,226,157,367,366,238,356,355,217,237,193,373,208,292,301,173,387,386,375,393,207,193,204,322,381,204,203,370,350,316,315,191,190,298,181,192,191,335,208,349,348,220,338,337,200,199,219,176,175,355,190,275,274,283,369,368,358,357,375,190,189,175,157,187,186,304,363,186,185,353,352,332,305,321,180,196,288,304,181,197,325,341,198,215,214,338,354,210,227,226,193,327,343,189,205,209,225,165,181,345,361,180,197,196,264,280,273,290,289,358,374,347,363,365,382,381,179,195,165,182,181,176,192,294,310,353,370,369,175,191,342,358,322,339,338,310,309,184,292,186,185,329,202,191,343,342,214,332,331,193,213,169,349,184,268,277,197,363,362,351,369,183,169,180,298,357,180,179,346,326};
short Gen_shift_values_BG2_a_15[1483]={145,142,74,131,31,239,71,171,21,174,3,183,53,95,27,110,23,96,159,23,199,9,155,43,112,167,75,145,146,143,75,131,132,32,240,71,72,172,21,22,175,4,184,54,96,28,111,23,24,97,160,24,200,10,156,44,112,113,168,76,145,146,142,143,75,131,132,32,240,71,72,172,21,22,174,175,4,183,184,54,96,27,28,111,23,24,96,97,160,23,24,200,9,10,156,44,112,113,167,168,76,146,143,75,132,32,239,240,72,171,172,22,175,4,184,54,95,96,28,110,111,24,97,159,160,24,199,200,10,156,43,44,113,168,75,76,325,326,323,255,29,311,312,212,420,140,251,252,352,201,202,355,184,364,234,276,208,291,203,204,277,340,204,380,190,336,224,292,293,348,256,352,353,350,282,121,338,339,239,447,41,278,279,379,228,229,382,211,391,261,303,235,318,169,230,231,304,367,231,407,88,217,363,251,319,320,375,283,201,202,199,131,137,187,188,88,296,127,128,228,77,78,231,60,240,110,152,84,167,72,79,80,153,216,80,256,172,66,212,100,168,169,224,132,124,317,318,300,315,297,247,229,303,304,286,204,186,412,393,394,86,243,244,226,344,325,326,193,194,176,347,329,176,158,356,338,226,208,268,249,250,200,182,283,264,265,186,195,196,178,269,251,332,313,314,196,178,372,353,354,87,182,164,328,310,216,197,198,284,285,267,340,322,248,229,230,370,371,367,368,300,176,356,357,257,465,169,296,297,397,246,247,399,400,229,408,409,279,321,252,253,336,248,249,321,322,385,248,249,425,234,235,381,269,337,338,392,393,301,193,213,214,190,211,122,143,179,199,200,79,100,287,308,167,119,139,140,219,240,69,89,90,222,243,51,72,231,252,101,122,143,164,75,96,158,179,71,91,92,144,165,207,228,71,92,247,268,57,78,203,224,91,112,238,160,180,181,215,236,123,144,38,217,208,232,197,194,126,178,183,83,290,291,123,222,223,73,226,55,235,105,146,147,79,161,162,75,148,210,211,75,250,251,214,61,207,94,95,164,219,126,127,168,217,218,215,147,203,204,104,312,124,143,144,244,93,94,247,76,122,256,126,168,100,183,95,96,169,232,96,272,82,228,116,184,185,240,148,365,362,294,48,351,251,458,459,57,291,390,391,241,394,223,403,273,314,315,247,329,330,243,316,378,379,243,418,419,229,375,262,263,167,332,387,294,295,349,350,308,347,305,279,237,335,336,294,236,194,444,401,402,82,275,276,234,376,333,334,225,226,184,379,337,208,166,388,346,258,216,300,257,258,232,190,315,272,273,227,228,186,301,259,364,321,322,232,228,186,404,361,362,214,172,360,318,248,205,206,316,317,275,372,330,280,237,238,362,302,303,359,300,291,232,38,348,288,289,248,189,456,397,288,228,229,388,329,238,178,179,391,332,220,161,400,341,270,211,312,253,244,185,327,268,240,180,181,313,254,376,317,240,181,416,357,226,167,372,313,260,201,329,269,270,384,325,292,233,320,321,347,348,318,344,345,250,277,306,307,333,334,207,234,415,442,170,246,247,273,274,347,374,196,197,223,224,350,376,377,179,206,359,385,386,229,256,271,298,203,229,230,286,313,198,199,225,226,272,298,299,335,362,199,225,226,375,402,185,211,212,331,358,219,246,287,288,314,315,343,369,370,251,278,23,340,341,363,364,338,360,361,270,293,326,327,349,350,227,250,435,458,196,266,267,289,290,367,390,216,217,239,240,370,392,393,199,222,379,401,402,249,272,291,314,223,245,246,306,329,173,218,219,241,242,292,314,315,355,378,219,241,242,395,418,205,227,228,351,374,239,262,307,308,330,331,363,385,386,271,294,128,211,210,233,230,162,39,219,119,327,84,159,259,109,262,91,271,141,183,115,198,111,184,247,111,287,97,243,131,200,255,163,151,152,149,81,137,138,38,246,117,77,78,178,27,28,181,10,190,60,102,227,34,117,29,30,103,166,30,206,16,162,50,118,119,174,82,157,154,86,238,143,43,250,251,83,182,183,33,186,15,195,65,106,107,39,121,122,35,108,170,171,35,210,211,21,167,54,55,13,124,179,86,87,195,44,5,94,111,81,19,130,66,95,335,336,232,332,333,229,265,161,321,322,218,222,118,430,325,326,261,262,158,362,257,258,146,211,212,108,364,365,261,194,90,373,374,270,244,140,286,181,182,217,218,114,301,196,197,213,214,110,286,287,183,350,245,246,213,214,110,390,285,286,66,199,200,96,346,242,234,129,130,302,303,199,357,358,254,266,161,162,64,181,7,144,16,25,57,37,139,221,17,192,189,121,178,78,285,286,201,118,217,218,68,221,50,230,100,141,142,74,156,157,70,143,205,206,70,245,246,56,202,89,90,159,214,121,122,261,262,258,259,191,179,247,248,148,356,187,188,288,137,138,290,291,120,299,300,170,212,143,144,227,14,139,140,212,213,276,139,140,316,125,126,272,160,228,229,283,284,192,251,248,180,237,137,345,177,277,46,127,280,109,289,159,201,133,216,129,202,265,129,305,2,115,261,149,218,273,181,280,281,287,277,278,284,210,216,184,266,267,273,167,173,375,380,381,206,207,213,307,312,313,156,157,163,309,310,316,139,145,318,319,325,189,195,231,236,237,162,163,169,246,251,252,158,159,165,231,232,238,295,300,301,158,159,165,335,340,341,144,145,151,291,297,179,184,185,247,248,254,302,303,309,211,216,217,320,321,318,250,306,307,207,415,85,246,247,347,196,197,350,179,359,229,271,203,286,225,198,199,272,335,199,375,185,331,219,287,288,343,251,178,112,106,299,260,296,257,228,189,285,246,185,146,393,353,354,225,186,325,285,286,175,136,328,289,157,118,337,298,207,168,249,209,210,181,142,264,224,225,177,138,250,211,313,273,274,177,138,353,313,314,163,124,309,270,197,157,158,266,227,321,282,229,189,190,250,251,248,180,236,237,137,345,42,176,177,277,126,127,280,109,289,159,201,133,216,41,128,129,202,265,129,305,115,261,149,217,218,273,181,334,335,331,332,264,167,320,321,221,429,260,261,361,210,211,363,364,193,372,373,243,285,216,217,300,212,213,285,286,349,212,213,389,45,198,199,345,233,301,302,356,357,265,212,326,209,323,141,255,198,312,98,212,306,419,420,138,252,238,351,352,78,88,202,241,355,70,184,250,364,120,234,162,275,276,94,208,177,290,291,90,204,163,277,226,339,340,90,204,266,379,380,76,190,222,336,110,223,224,179,293,234,348,142,255,256,375,376,373,305,361,362,262,470,53,301,302,402,251,252,405,234,414,284,326,258,341,215,253,254,327,390,254,430,240,386,274,342,343,398,306};
short Gen_shift_values_BG2_Z_128[1483]={7,37,79,115,112,6,74,56,24,36,42,123,50,28,123,102,59,96,79,26,52,94,110,16,75,122,126,8,7,37,79,116,115,112,6,75,74,56,25,24,36,42,123,50,28,123,102,60,59,96,79,26,52,94,110,16,76,75,122,126,8,7,38,37,79,116,115,112,6,75,74,56,25,24,37,36,42,124,123,50,28,124,123,102,60,59,97,96,79,27,26,52,95,94,110,16,76,75,123,122,126,7,37,79,115,112,7,6,74,57,56,24,36,42,123,50,29,28,123,103,102,59,96,80,79,26,53,52,94,110,17,16,75,122,127,126,79,78,108,22,50,59,58,55,77,85,18,17,127,96,95,107,113,66,121,99,66,45,3,2,39,22,97,123,37,53,87,19,18,65,69,111,110,12,54,102,91,90,87,109,40,50,49,31,0,127,11,17,98,25,3,98,77,65,35,34,71,54,1,27,30,69,85,119,51,50,97,101,38,37,67,109,26,18,17,14,36,105,104,86,55,54,66,72,25,80,58,25,4,99,90,89,126,109,56,82,44,124,12,46,106,105,24,28,27,11,10,123,40,25,82,67,119,118,103,115,100,123,9,122,0,78,77,62,45,59,44,28,27,12,39,24,45,30,126,111,53,38,17,31,16,126,111,91,105,90,18,63,62,47,99,84,68,82,67,29,14,41,55,40,11,97,82,113,98,5,19,4,79,78,63,125,110,115,1,114,110,109,12,11,53,13,90,89,86,108,93,49,48,30,127,126,11,10,16,98,97,24,2,98,97,76,34,33,71,70,53,1,0,26,69,68,84,118,50,49,97,96,100,127,68,126,98,28,12,70,107,48,106,45,103,67,125,74,66,7,65,117,47,16,85,15,97,27,103,33,56,114,111,41,89,19,56,114,35,93,51,120,50,29,87,12,70,87,17,113,43,27,85,43,101,77,7,76,67,8,66,55,113,59,117,10,56,127,116,63,93,7,10,43,40,63,62,2,113,112,80,92,98,51,106,85,84,51,31,30,115,24,8,7,82,109,108,107,22,38,73,72,3,50,55,54,81,22,21,51,93,2,1,126,20,62,89,88,70,39,38,50,56,110,9,64,42,9,116,74,73,110,93,40,66,108,124,30,90,89,8,12,101,3,45,82,81,78,101,100,1,40,23,22,118,2,8,89,16,123,122,89,69,68,25,62,46,45,120,19,18,60,76,111,110,37,41,88,93,92,11,10,111,40,13,82,55,119,118,91,115,88,111,9,110,114,78,77,50,33,59,32,28,27,0,39,12,45,18,126,99,53,26,5,31,4,126,99,79,105,78,63,62,35,99,72,56,82,55,16,29,2,29,55,28,97,70,113,86,121,19,120,79,78,51,125,98,103,1,102,93,54,92,84,122,126,36,50,73,34,72,31,69,53,91,32,121,31,103,13,110,71,109,83,121,89,127,42,80,97,7,75,113,42,80,21,59,17,106,16,15,53,126,36,73,111,99,9,13,51,29,67,63,101,33,122,32,41,79,45,83,16,122,15,121,24,45,23,87,65,124,102,123,101,120,98,14,120,74,83,61,82,60,64,42,33,11,32,10,23,44,22,50,28,110,3,109,58,36,36,14,110,3,109,110,88,68,46,67,45,83,104,82,87,65,13,34,12,60,38,81,102,80,118,96,24,2,84,62,83,61,109,2,108,6,112,13,122,72,121,71,102,23,101,65,15,102,52,101,51,98,48,120,70,125,61,11,60,10,42,120,11,89,10,88,101,22,100,28,106,60,109,59,36,114,14,92,60,109,59,88,38,123,46,124,45,123,33,82,32,65,15,91,12,90,38,116,31,80,30,96,46,2,80,62,12,61,11,59,108,58,112,62,91,65,49,64,94,8,86,44,41,63,19,3,113,81,93,99,52,107,85,52,31,116,25,8,83,109,23,39,73,4,51,55,37,36,66,108,17,16,13,35,25,104,103,85,54,53,65,71,24,79,57,104,24,3,89,88,125,108,55,81,123,11,45,105,104,23,27,89,119,33,75,69,66,89,88,28,11,10,106,118,124,77,4,111,110,77,57,56,13,50,34,33,108,7,6,48,64,99,98,41,29,76,81,80,93,62,22,106,109,45,10,7,99,27,40,39,1,70,69,31,111,73,20,19,109,16,106,1,38,0,107,106,68,51,88,50,28,57,56,18,69,68,30,74,36,28,27,117,82,44,23,60,22,28,27,117,97,6,96,92,91,53,1,0,90,74,111,73,59,58,20,47,84,46,14,127,126,88,14,104,11,48,10,108,107,69,27,26,116,121,30,120,7,22,97,100,6,17,27,70,111,8,83,8,38,80,116,113,8,7,105,75,58,57,25,37,43,124,51,30,29,124,104,103,60,97,81,80,27,54,53,95,111,18,17,76,123,0,127,46,45,76,75,117,113,26,25,22,44,113,112,94,63,62,75,74,80,34,33,88,66,34,33,12,43,98,97,7,6,117,65,64,90,5,4,20,54,114,113,33,32,36,114,16,58,94,91,113,53,35,3,3,15,21,102,29,7,102,81,38,75,58,5,31,35,73,89,123,54,101,105,93,92,43,123,122,73,36,115,18,73,72,23,69,20,43,91,42,32,31,110,93,13,92,110,109,60,122,121,72,127,78,81,80,31,7,86,65,113,64,81,80,31,11,59,10,17,16,95,54,53,4,116,36,115,112,111,62,89,9,88,52,51,2,67,18,53,101,52,33,32,111,80,79,30,35,83,34,71,70,100,14,51,50,47,69,56,10,9,119,88,87,99,105,58,113,91,58,37,39,123,122,31,14,89,115,29,45,79,11,10,57,61,11,37,25,98,30,0,60,42,102,78,10,75,7,30,97,29,37,97,80,19,79,115,47,127,59,5,65,86,18,13,73,52,119,51,86,18,126,65,125,22,82,59,119,103,42,102,117,49,76,15,75,57,117,73,5,40,107,39,38,98,85,17,22,89,21,46,45,75,117,26,25,22,44,30,113,112,94,63,62,74,80,33,88,66,33,12,65,98,97,6,117,64,90,4,20,54,114,113,32,36,42,41,72,71,113,110,22,21,18,40,109,108,90,59,58,71,70,76,30,29,84,62,30,29,8,94,93,3,2,113,61,60,86,43,1,0,16,50,110,109,29,28,32,82,127,112,29,26,71,62,107,59,104,127,81,126,21,66,49,3,48,127,99,16,111,28,117,34,70,115,125,42,21,103,20,70,115,95,49,94,6,51,43,88,72,26,71,101,18,45,127,44,41,86,57,102,9,91,8,22,67,69,114,119,73,118,126,125,27,69,106,105,102,124,0,65,64,46,15,14,26,32,113,40,18,113,92,100,50,49,86,69,16,42,84,100,6,66,65,112,116};
\ No newline at end of file
......@@ -65,18 +65,7 @@ char quantize(double D,double x,unsigned char B)
}
#define MAX_BLOCK_LENGTH 8448
/*
int test_ldpc(unsigned int coded_bits,
double sigma,
unsigned char qbits,
unsigned int block_length,
unsigned int ntrials,
unsigned int *errors,
unsigned int *trials,
unsigned int *uerrors,
unsigned int *crc_misses,
unsigned int *iterations)
*/
int test_ldpc(short No_iteration,
double rate,
double SNR,
......@@ -87,6 +76,11 @@ int test_ldpc(short No_iteration,
unsigned int *crc_misses)
{
//clock initiate
time_stats_t time;
opp_enabled=1;
cpu_freq_GHz = get_cpu_freq_GHz();
short test_input[block_length];
short *c; //padded codeword
short *esimated_output;
......@@ -98,7 +92,7 @@ int test_ldpc(short No_iteration,
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
short BG,Zc,Kb,nrows,ncols;
int i1,i2,i3,i4,t;
int i1,i2,i3,i4,i5,i6,t,temp,k;
//Table of possible lifting sizes
short lift_size[51]={2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
......@@ -113,7 +107,9 @@ for (i=0; i<block_length; i++) {
//test_input[i] = (unsigned char)(taus()&0xff);
test_input[i]=rand()%2;
//test_input[i]=i%2;
}
start_meas(&time);
//determine number of bits in codeword
if (block_length>3840)
......@@ -156,8 +152,10 @@ for (i=0; i<block_length; i++) {
pointer_shift_values=(short*) pointer_shift_values_BG1;
if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_2;
else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_3;
// else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
//Gen_shift_values=(short*) Gen_shift_values_BG1_a_3;
else if (Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG1_Z_384;
else if (Zc==5||Zc==10||Zc==20||Zc==40||Zc==80||Zc==160||Zc==320)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_5;
else if (Zc==7||Zc==14||Zc==28||Zc==56||Zc==112||Zc==224)
......@@ -176,8 +174,10 @@ for (i=0; i<block_length; i++) {
{
no_shift_values=(short*) no_shift_values_BG2;
pointer_shift_values=(short*) pointer_shift_values_BG2;
if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
Gen_shift_values=(short*) Gen_shift_values_BG2_a_2;
//if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
// Gen_shift_values=(short*) Gen_shift_values_BG2_a_2;
if (Zc==128)
Gen_shift_values=(short*) Gen_shift_values_BG2_Z_128;
else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG2_a_3;
else if (Zc==5||Zc==10||Zc==20||Zc==40||Zc==80||Zc==160||Zc==320)
......@@ -194,55 +194,82 @@ for (i=0; i<block_length; i++) {
Gen_shift_values=(short*) Gen_shift_values_BG2_a_15;
}
c=(short *)malloc(sizeof(short) * Kb * Zc);
channel_input = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
modulated_input = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
channel_output_fixed = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_input = (short *)malloc( (Kb+nrows) * Zc *sizeof(short));
//padded input sequence
memset(c,0,sizeof(short) * Kb * Zc);
memcpy(c,test_input,block_length * sizeof(short));
//start_meas(&time);
//encode the input sequence
memset(channel_input,0,(Kb+nrows) * Zc*sizeof(short));
// parity check part
for (i1=0,t=Kb*Zc; i1 < nrows; i1++)
{
for (i2=0; i2 < Zc; i2++)
{
t=Kb*Zc+i2;
//rotate matrix here
for (i5=0; i5 < Kb; i5++)
{
temp = c[i5*Zc];
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(short));
c[i5*Zc+Zc-1] = temp;
//for (i6 = 0; i6 < Zc-1; i6++)
//for (i6 = i5*Zc; i6 < i5*Zc + Zc-1; i6++)
//{
//c[i5*Zc+i6] = c[i5*Zc+i6+1];
//c[i6] = c[i6+1];
//}
//c[i5*Zc+i6] = temp;
//c[i6] = temp;
}
for (i1=0; i1 < nrows; i1++)
{
for (i3=0; i3 < Kb; i3++)
{
for (i4=0; i4 < no_shift_values[i1 * ncols + i3]; i4++)
{
channel_input[t] = channel_input[t] + c[ i3*Zc + (Gen_shift_values[ pointer_shift_values[i1 * ncols + i3]+i4 ] + i2 + Zc) % Zc ];
//start pointer %element %shift Z
channel_input[t+i1*Zc] = channel_input[t+i1*Zc] + c[ i3*Zc + Gen_shift_values[ pointer_shift_values[i1 * ncols + i3]+i4 ] ];
}
}
channel_input[t]=channel_input[t]&1;
t++;
channel_input[t+i1*Zc]=channel_input[t+i1*Zc]&1;
}
/*
for (i1=0; i1 < nrows; i1++)
{
k=i1*Zc;
for (i3=0; i3 < Kb; i3++)
{
for (i4=0; i4 < no_shift_values[i1 * ncols + i3]; i4++)
{
channel_input[t+k] = channel_input[t+k] + c[ i3*Zc + Gen_shift_values[ i4] ];
}
}
channel_input[t+k]=channel_input[t+k]&1;
}
*/
}
//stop_meas(&time);
// information part
memcpy(channel_input,c,Kb*Zc*sizeof(short));
stop_meas(&time);
//for (i=0;i<(Kb+nrows) * Zc;i++)
print_meas_now(&time, "", stdout);
//for (i=(Kb+nrows) * Zc-10;i<(Kb+nrows) * Zc;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//replace with ldpc encoder, write to channel_input
/*
dlsch_encoding(test_input,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[0][0],
0,
subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats,
&PHY_vars_eNB->dlsch_interleaving_stats);
*/
for (i = 0; i < (Kb+nrows) * Zc; i++) {
//channel
modulated_input = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
channel_output_fixed = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
memset(channel_output_fixed,0,(Kb+nrows) * Zc*sizeof(short));
for (i = 2*Zc; i < (Kb+nrows) * Zc; i++) {
#ifdef DEBUG_CODER
if ((i&0xf)==0)
printf("\ne %d..%d: ",i,i+15);
......@@ -257,27 +284,20 @@ channel_output_fixed[i] = (short) ((channel_output[i]*128)<0?(channel_output[i]*
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);
}
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
//{
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);}
#ifdef DEBUG_CODER
printf("\n");
exit(-1);
#endif
/*
esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, rate);
//for (i=0;i<(Kb+nrows) * Zc;i++)
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
// replace this with ldpc decoder
/*
ret = dlsch_decoding(PHY_vars_UE,
channel_output,
&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
frame,
subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1);
*/
for (i=0;i<(Kb+nrows) * Zc;i++) {
if (esimated_output[i] != channel_input[i]) {
......@@ -286,6 +306,12 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
}
*/
free(c);
free(channel_input);
free(modulated_input);
free(channel_output);
free(channel_output_fixed);
}
//printf("%d\n",*errors);
......@@ -294,23 +320,23 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
//#define NTRIALS 10000
#define NTRIALS 300
#define NTRIALS 30
int main(int argc, char *argv[])
{
unsigned int errors,crc_misses;
unsigned int block_length=1280;
unsigned int block_length=22*384;
short No_iteration=25;
double rate=0.2;
double SNR,SNR_lin;
unsigned char qbits;
time_stats_t time;
//time_stats_t time;
int i=0;
opp_enabled=1;
cpu_freq_GHz = get_cpu_freq_GHz();
//opp_enabled=1;
// cpu_freq_GHz = get_cpu_freq_GHz();
randominit(0);
//logInit();
......@@ -324,7 +350,7 @@ int main(int argc, char *argv[])
unsigned int decoded_errors[100]; // initiate the size of matrix equivalent to
// size of SNR
for (SNR=-3.5; SNR<-2.5; SNR+=.1) {
for (SNR=-2.1; SNR<-2; SNR+=.1) {
SNR_lin = pow(10,SNR/10);
......@@ -341,7 +367,7 @@ int main(int argc, char *argv[])
&iterations);
*/
start_meas(&time);
// start_meas(&time);
decoded_errors[i]=test_ldpc(No_iteration,
rate,
SNR_lin, // noise standard deviation
......@@ -350,9 +376,9 @@ int main(int argc, char *argv[])
NTRIALS,
&errors,
&crc_misses);
stop_meas(&time);
// stop_meas(&time);
print_meas_now(&time, "", stdout);
//print_meas_now(&time, "", stdout);
printf("SNR %f, BLER %f (%d/%d)\n",SNR,(float)decoded_errors[i]/(float)NTRIALS,decoded_errors[i],NTRIALS);
......
......@@ -27,7 +27,7 @@
#include "SIMULATION/TOOLS/defs.h"
#include "Gen_shift_value.h"
#include "test.h"
// 4-bit quantizer
char quantize4bit(double D,double x)
{
......@@ -64,20 +64,8 @@ char quantize(double D,double x,unsigned char B)
return((char)qxd);
}
//#define MAX_BLOCK_LENGTH 6000
#define MAX_BLOCK_LENGTH 8448
/*
int test_ldpc(unsigned int coded_bits,
double sigma,
unsigned char qbits,
unsigned int block_length,
unsigned int ntrials,
unsigned int *errors,
unsigned int *trials,
unsigned int *uerrors,
unsigned int *crc_misses,
unsigned int *iterations)
*/
int test_ldpc(short No_iteration,
double rate,
double SNR,
......@@ -88,43 +76,40 @@ int test_ldpc(short No_iteration,
unsigned int *crc_misses)
{
//unsigned char test_input[block_length+1];
//clock initiate
time_stats_t time;
opp_enabled=1;
cpu_freq_GHz = get_cpu_freq_GHz();
short test_input[block_length];
short *c; //padded codeword
short *esimated_output;
short *esimated_output;
short *channel_input;
double *channel_output;
double *channel_output;
double *modulated_input;
short *channel_output_fixed;
short *channel_output_fixed;
unsigned int i,trial=0;
unsigned char crc_type;
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
short BG,Zc,Kb,nrows,ncols;
int i1,i2,i3,i4,t;
int i1,i2,i3,i4,i5,i6,t,temp,k;
//Table of possible lifting sizes
short lift_size[51]={2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
*errors=0;
*crc_misses=0;
while (trial++ < ntrials) {
// printf("encoding\n");
// test_input[0] = 0x80;
// generate input block
for (i=0; i<block_length; i++) {
//test_input[i] = (unsigned char)(taus()&0xff);
test_input[i]=rand()%2;
//test_input[i]=i%2;
}
start_meas(&time);
//determine number of bits in codeword
if (block_length>3840)
......@@ -167,8 +152,10 @@ for (i=0; i<block_length; i++) {
pointer_shift_values=(short*) pointer_shift_values_BG1;
if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_2;
else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_3;
// else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
//Gen_shift_values=(short*) Gen_shift_values_BG1_a_3;
else if (Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG1_Z_384;
else if (Zc==5||Zc==10||Zc==20||Zc==40||Zc==80||Zc==160||Zc==320)
Gen_shift_values=(short*) Gen_shift_values_BG1_a_5;
else if (Zc==7||Zc==14||Zc==28||Zc==56||Zc==112||Zc==224)
......@@ -187,8 +174,10 @@ for (i=0; i<block_length; i++) {
{
no_shift_values=(short*) no_shift_values_BG2;
pointer_shift_values=(short*) pointer_shift_values_BG2;
if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
Gen_shift_values=(short*) Gen_shift_values_BG2_a_2;
//if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
// Gen_shift_values=(short*) Gen_shift_values_BG2_a_2;
if (Zc==128)
Gen_shift_values=(short*) Gen_shift_values_BG2_Z_128;
else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
Gen_shift_values=(short*) Gen_shift_values_BG2_a_3;
else if (Zc==5||Zc==10||Zc==20||Zc==40||Zc==80||Zc==160||Zc==320)
......@@ -205,57 +194,80 @@ for (i=0; i<block_length; i++) {
Gen_shift_values=(short*) Gen_shift_values_BG2_a_15;
}
c=(short *)malloc(sizeof(short) * Kb * Zc);
channel_input = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
modulated_input = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
channel_output_fixed = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_input = (short *)malloc( (Kb+nrows) * Zc *sizeof(short));
//padded input sequence
memset(c,0,sizeof(short) * Kb * Zc);
memcpy(c,test_input,block_length * sizeof(short));
//start_meas(&time);
//encode the input sequence
memset(channel_input,0,(Kb+nrows) * Zc*sizeof(short));
// parity check part
for (i1=0,t=Kb*Zc; i1 < nrows; i1++)
{
for (i2=0; i2 < Zc; i2++)
{
t=Kb*Zc+i2;
//rotate matrix here
for (i5=0; i5 < Kb; i5++)
{
temp = c[i5*Zc];
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(short));
c[i5*Zc+Zc-1] = temp;
//for (i6 = 0; i6 < Zc-1; i6++)
//for (i6 = i5*Zc; i6 < i5*Zc + Zc-1; i6++)
//{
//c[i5*Zc+i6] = c[i5*Zc+i6+1];
//c[i6] = c[i6+1];
//}
//c[i5*Zc+i6] = temp;
//c[i6] = temp;
}
/*
for (i1=0; i1 < nrows; i1++)
{
for (i3=0; i3 < Kb; i3++)
{
for (i4=0; i4 < no_shift_values[i1 * ncols + i3]; i4++)
{
channel_input[t+i1*Zc] = channel_input[t+i1*Zc] + c[ i3*Zc + Gen_shift_values[ pointer_shift_values[i1 * ncols + i3]+i4 ] ];
}
}
channel_input[t+i1*Zc]=channel_input[t+i1*Zc]&1;
}
*/
for (i1=0; i1 < nrows; i1++)
{
k=i1*Zc;
for (i3=0; i3 < Kb; i3++)
{
for (i4=0; i4 < no_shift_values[i1 * ncols + i3]; i4++)
{
channel_input[t] = channel_input[t] + c[ i3*Zc + (Gen_shift_values[ pointer_shift_values[i1 * ncols + i3]+i4 ] + i2 + Zc) % Zc ];
//start pointer %element %shift Z
channel_input[t+k] = channel_input[t+k] + c[ i3*Zc + Gen_shift_values[ i4] ];
}
}
channel_input[t]=channel_input[t]&1;
t++;
channel_input[t+k]=channel_input[t+k]&1;
}
}
//stop_meas(&time);
// information part
memcpy(channel_input,c,Kb*Zc*sizeof(short));
//for (i=0;i<(Kb+nrows) * Zc;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//replace with ldpc encoder, write to channel_input
/*
dlsch_encoding(test_input,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[0][0],
0,
subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats,
&PHY_vars_eNB->dlsch_interleaving_stats);
*/
// uerr=0;
stop_meas(&time);
print_meas_now(&time, "", stdout);
//for (i=(Kb+nrows) * Zc-10;i<(Kb+nrows) * Zc;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//for (i = 0; i < coded_bits; i++) {
for (i = 0; i < (Kb+nrows) * Zc; i++) {
//channel
modulated_input = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output = (double *)malloc( (Kb+nrows) * Zc*sizeof(double));
channel_output_fixed = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
memset(channel_output_fixed,0,(Kb+nrows) * Zc*sizeof(short));
for (i = 2*Zc; i < (Kb+nrows) * Zc; i++) {
#ifdef DEBUG_CODER
if ((i&0xf)==0)
printf("\ne %d..%d: ",i,i+15);
......@@ -270,27 +282,20 @@ channel_output_fixed[i] = (short) ((channel_output[i]*128)<0?(channel_output[i]*
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);
}
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
//{
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);}
#ifdef DEBUG_CODER
printf("\n");
exit(-1);
#endif
/*
esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, rate);
//for (i=0;i<(Kb+nrows) * Zc;i++)
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
// replace this with ldpc decoder
/*
ret = dlsch_decoding(PHY_vars_UE,
channel_output,
&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
frame,
subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1);
*/
for (i=0;i<(Kb+nrows) * Zc;i++) {
if (esimated_output[i] != channel_input[i]) {
......@@ -299,6 +304,12 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
}
*/
free(c);
free(channel_input);
free(modulated_input);
free(channel_output);
free(channel_output_fixed);
}
//printf("%d\n",*errors);
......@@ -307,24 +318,23 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
//#define NTRIALS 10000
#define NTRIALS 300
#define NTRIALS 30
int main(int argc, char *argv[])
{
unsigned int errors,crc_misses;
unsigned int block_length=1280;
short No_iteration=25;
double rate=0.2;
unsigned int block_length=22*384;
short No_iteration=25;
double rate=0.2;
double SNR,SNR_lin;
unsigned char qbits;
//time_stats_t time;
unsigned char NB_RB=25;
int num_pdcch_symbols = 1;
int subframe = 6;
int i=0;
int i=0;
//opp_enabled=1;
// cpu_freq_GHz = get_cpu_freq_GHz();
randominit(0);
//logInit();
......@@ -336,9 +346,9 @@ int i=0;
//printf("Quantization bits %d\n",qbits);
unsigned int decoded_errors[2]; // initiate the size of matrix equivalent to
unsigned int decoded_errors[100]; // initiate the size of matrix equivalent to
// size of SNR
for (SNR=-3; SNR<-2.8; SNR+=.1) {
for (SNR=-2.1; SNR<-2; SNR+=.1) {
SNR_lin = pow(10,SNR/10);
......@@ -354,22 +364,26 @@ for (SNR=-3; SNR<-2.8; SNR+=.1) {
&crc_misses,
&iterations);
*/
decoded_errors[i]=test_ldpc(No_iteration,
// start_meas(&time);
decoded_errors[i]=test_ldpc(No_iteration,
rate,
SNR_lin, // noise standard deviation
qbits,
block_length, // block length bytes
NTRIALS,
&errors,
&crc_misses);
// stop_meas(&time);
//print_meas_now(&time, "", stdout);
&crc_misses);
i=i+1;
printf("SNR %f, BLER %f (%d/%d)\n",SNR,(float)decoded_errors[i]/(float)NTRIALS,decoded_errors[i],NTRIALS);
i=i+1;
}
printf("%d\n",decoded_errors[0]);
printf("%d\n",decoded_errors[1]);
//printf("%d\n",errors[2]);
return(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment