[MPlayer-dev-eng] Direct3D OSD discussion

Georgi Petrov gogothebee at gmail.com
Mon Dec 8 19:16:43 CET 2008


Question:

    for (y = 0; y < h; y++) {
        unsigned short *dst = (unsigned short*)dstbase;
        int x;
        for (x = 0; x < w; x++) {
            dst[x] = (-srca[x] << 8) | src[x];
        }
        src     += srcstride;
        srca    += srcstride;
        dstbase += dststride;
    }

What's C "speed policy" about such declared pointers inside the for
statement? Would it be better this this way (speed wise):

    unsigned short *dst;
    for (y = 0; y < h; y++) {
        dst = (unsigned short*)dstbase;
        int x;
        for (x = 0; x < w; x++) {
            dst[x] = (-srca[x] << 8) | src[x];
        }
        src     += srcstride;
        srca    += srcstride;
        dstbase += dststride;
    }



More information about the MPlayer-dev-eng mailing list