static void getChannelWeights (int indx, int flag, float ch[2]){
    if (indx == 7) {
        ch[0] = 1.0;
        ch[1] = 1.0;
    } else {
        ch[0] = (float)(indx & 7) / 7.0;
        ch[1] = sqrt(2 - ch[0]*ch[0]);
        if(flag)
            FFSWAP(float, ch[0], ch[1]);
    }
}
['static void channelWeighting (float *su1, float *su2, int *p3)\n{\n    int   band, nsample;\n    float w[2][2];\n    if (p3[1] != 7 || p3[3] != 7){\n        getChannelWeights(p3[1], p3[0], w[0]);\n        getChannelWeights(p3[3], p3[2], w[1]);\n        for(band = 1; band < 4; band++) {\n            for(nsample = 0; nsample < 8; nsample++) {\n                su1[band*256+nsample] *= INTERPOLATE(w[0][0], w[0][1], nsample);\n                su2[band*256+nsample] *= INTERPOLATE(w[1][0], w[1][1], nsample);\n            }\n            for(; nsample < 256; nsample++) {\n                su1[band*256+nsample] *= w[1][0];\n                su2[band*256+nsample] *= w[1][1];\n            }\n        }\n    }\n}', 'static void getChannelWeights (int indx, int flag, float ch[2]){\n    if (indx == 7) {\n        ch[0] = 1.0;\n        ch[1] = 1.0;\n    } else {\n        ch[0] = (float)(indx & 7) / 7.0;\n        ch[1] = sqrt(2 - ch[0]*ch[0]);\n        if(flag)\n            FFSWAP(float, ch[0], ch[1]);\n    }\n}']