⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 short_golay.c

📁 short golay code generator short golay code generator short golay code generator short golay code
💻 C
字号:
/****************************************************************************** *                                                                            * *  no prune, d1=1, d2=2 or d1=2, d2=1                                        * *        |~~~~~|          |~~~~~|                                            * *    ----| D1  |----{+}---| D2  |----{+}----- output                         * *     |  |_____|\ /       |_____|\ /                                         * *     |          X                X                                          * *     |         / \              / \                                         * *     ------o-------{+}------o-------{+}--                                   * *           W0     -        W1      -                                        * *                                                                            * *     i=#0: W0= 1, W1= 1                                                     * *      =#1: W0= 1, W1=-1                                                     * *      =#2: W0=-1, W1= 1                                                     * *      =#3: W0=-1, W1=-1                                                     * *                                                                            * *   w/prune, d1=1, d2=2 or d1=2, d2=1                                        * *        |~~~~~|          |~~~~~|                                            * *    ----| D1  |----{+}---| D2  |----{+}----- output                         * *     |  |_____|\ /     | |_____|\ /                                         * *     |          X      |         X                                          * *     |         / \     |        / \                                         * *     ------o-------    -----o-------{+}--                                   * *           W0              W1      -                                        * *                                                                            * *     i=#0: W0= 1, W1= 1                                                     * *      =#1: W0= 1, W1=-1                                                     * *      =#2: W0=-1, W1= 1                                                     * *      =#3: W0=-1, W1=-1                                                     * *                                                                            * *                                                                            * *                                                                            * * Last change:  LU   17 Mar 2001    2:34 pm ******************************************************************************/#include <stdio.h>typedef short int   INT16;int main(){    INT16       iUp[2];    INT16       iDn[2];    INT16       iReS1Out;    INT16       DELAY0, DELAY1, W0, W1;    INT16       S_IBUF0[3], S_IBUF1[3], S_PTR[2];    INT16       i, j, iReIn;/*  no prune, D1=1, D2=2 */    DELAY0=1+1; DELAY1=1+2;    for ( i=0; i<4; i++)    {        printf("#%d:  ", i);        W0 = ( i&2 )? -1: 1;        W1 = ( i&1 )? -1: 1;        for ( j=0; j<3; j++)        {            S_IBUF0[j] = S_IBUF1[j] = 0;        }        S_PTR[0] = S_PTR[1] = 0;        iReIn = 1;        for ( j=0; j<4; j++)        {            S_IBUF0[S_PTR[0]] = iReIn;            iUp[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] + W0 * iReIn;            iDn[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] - W0 * iReIn;            S_IBUF1[S_PTR[1]] = iUp[0];            iUp[1] = S_IBUF1[(S_PTR[1]+DELAY1-1)%DELAY1] + W1 * iDn[0];            printf("%3d  ", iUp[1]);            S_PTR[0] = (S_PTR[0]+DELAY0-1)%DELAY0;            S_PTR[1] = (S_PTR[1]+DELAY1-1)%DELAY1;            iReIn = 0;        }        printf("\n");    }    printf("\n");/*  no prune, D1=2, D2=1 */    DELAY0=1+2; DELAY1=1+1;    for ( i=0; i<4; i++)    {        printf("#%d:  ", i);        W0 = ( i&2 )? -1: 1;        W1 = ( i&1 )? -1: 1;        for ( j=0; j<3; j++)        {            S_IBUF0[j] = S_IBUF1[j] = 0;        }        S_PTR[0] = S_PTR[1] = 0;        iReIn = 1;        for ( j=0; j<4; j++)        {            S_IBUF0[S_PTR[0]] = iReIn;            iUp[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] + W0 * iReIn;            iDn[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] - W0 * iReIn;            S_IBUF1[S_PTR[1]] = iUp[0];            iUp[1] = S_IBUF1[(S_PTR[1]+DELAY1-1)%DELAY1] + W1 * iDn[0];            printf("%3d  ", iUp[1]);            S_PTR[0] = (S_PTR[0]+DELAY0-1)%DELAY0;            S_PTR[1] = (S_PTR[1]+DELAY1-1)%DELAY1;            iReIn = 0;        }        printf("\n");    }    printf("\n");/*  prune, D1=1, D2=2 */    DELAY0=1+1; DELAY1=1+2;    for ( i=0; i<4; i++)    {        printf("#%d:  ", i);        W0 = ( i&2 )? -1: 1;        W1 = ( i&1 )? -1: 1;        for ( j=0; j<3; j++)        {            S_IBUF0[j] = S_IBUF1[j] = 0;        }        S_PTR[0] = S_PTR[1] = 0;        iReIn = 1;        for ( j=0; j<4; j++)        {            S_IBUF0[S_PTR[0]] = iReIn;            iUp[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] + W0 * iReIn;            iDn[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] - W0 * iReIn;            S_IBUF1[S_PTR[1]] = iUp[0];            iUp[1] = S_IBUF1[(S_PTR[1]+DELAY1-1)%DELAY1] + W1 * iUp[0];            printf("%3d  ", iUp[1]);            S_PTR[0] = (S_PTR[0]+DELAY0-1)%DELAY0;            S_PTR[1] = (S_PTR[1]+DELAY1-1)%DELAY1;            iReIn = 0;        }        printf("\n");    }    printf("\n");/*  prune, D1=2, D2=1 */    DELAY0=1+2; DELAY1=1+1;    for ( i=0; i<4; i++)    {        printf("#%d:  ", i);        W0 = ( i&2 )? -1: 1;        W1 = ( i&1 )? -1: 1;        for ( j=0; j<3; j++)        {            S_IBUF0[j] = S_IBUF1[j] = 0;        }        S_PTR[0] = S_PTR[1] = 0;        iReIn = 1;        for ( j=0; j<4; j++)        {            S_IBUF0[S_PTR[0]] = iReIn;            iUp[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] + W0 * iReIn;            iDn[0] = S_IBUF0[(S_PTR[0]+DELAY0-1)%DELAY0] - W0 * iReIn;            S_IBUF1[S_PTR[1]] = iUp[0];            iUp[1] = S_IBUF1[(S_PTR[1]+DELAY1-1)%DELAY1] + W1 * iUp[0];            printf("%3d  ", iUp[1]);            S_PTR[0] = (S_PTR[0]+DELAY0-1)%DELAY0;            S_PTR[1] = (S_PTR[1]+DELAY1-1)%DELAY1;            iReIn = 0;        }        printf("\n");    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -