Revision eb8aa13b

View differences:

libswscale/swscale.c
1857 1857
    return srcSliceH;
1858 1858
}
1859 1859

  
1860
#define DITHER_COPY(dst, dstStride, src, srcStride)\
1860
#define DITHER_COPY(dst, dstStride, src, srcStride, bswap)\
1861 1861
    for (i = 0; i < height; i++) {\
1862 1862
        int shift= src_depth-dst_depth;\
1863 1863
        uint8_t *dither= dithers[src_depth-9][i&7];\
1864 1864
        for (j = 0; j < length-7; j+=8){\
1865
            dst[j+0] = (src[j+0] + dither[0])>>shift;\
1866
            dst[j+1] = (src[j+1] + dither[1])>>shift;\
1867
            dst[j+2] = (src[j+2] + dither[2])>>shift;\
1868
            dst[j+3] = (src[j+3] + dither[3])>>shift;\
1869
            dst[j+4] = (src[j+4] + dither[4])>>shift;\
1870
            dst[j+5] = (src[j+5] + dither[5])>>shift;\
1871
            dst[j+6] = (src[j+6] + dither[6])>>shift;\
1872
            dst[j+7] = (src[j+7] + dither[7])>>shift;\
1865
            dst[j+0] = (bswap(src[j+0]) + dither[0])>>shift;\
1866
            dst[j+1] = (bswap(src[j+1]) + dither[1])>>shift;\
1867
            dst[j+2] = (bswap(src[j+2]) + dither[2])>>shift;\
1868
            dst[j+3] = (bswap(src[j+3]) + dither[3])>>shift;\
1869
            dst[j+4] = (bswap(src[j+4]) + dither[4])>>shift;\
1870
            dst[j+5] = (bswap(src[j+5]) + dither[5])>>shift;\
1871
            dst[j+6] = (bswap(src[j+6]) + dither[6])>>shift;\
1872
            dst[j+7] = (bswap(src[j+7]) + dither[7])>>shift;\
1873 1873
        }\
1874 1874
        for (; j < length; j++)\
1875
            dst[j] = (src[j] + dither[j&7])>>shift;\
1875
            dst[j] = (bswap(src[j]) + dither[j&7])>>shift;\
1876 1876
        dst += dstStride;\
1877 1877
        src += srcStride;\
1878 1878
    }
......
1904 1904
                uint16_t *dstPtr2 = (uint16_t*)dstPtr;
1905 1905

  
1906 1906
                if (dst_depth == 8) {
1907
                    DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2)
1907
                    DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, )
1908 1908
                } else if (src_depth == 8) {
1909 1909
                    for (i = 0; i < height; i++) {
1910 1910
                        for (j = 0; j < length; j++)
......
1928 1928
                        srcPtr2 += srcStride[plane]/2;
1929 1929
                    }
1930 1930
                } else {
1931
                    DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2)
1931
                    //FIXME non native endian
1932
                    DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, )
1932 1933
                }
1933 1934
            } else if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) {
1934 1935
                //FIXME add dither

Also available in: Unified diff