Revision 469fd9b0 libswscale/swscale.c

View differences:

libswscale/swscale.c
1893 1893
            x86_reg imm8OfPShufW1  = (d+1<4) ? imm8OfPShufW1B  : imm8OfPShufW1A;
1894 1894
            x86_reg imm8OfPShufW2  = (d+1<4) ? imm8OfPShufW2B  : imm8OfPShufW2A;
1895 1895
            x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA;
1896
            int maxShift= 3-(d+inc);
1897
            int shift=0;
1896 1898

  
1897 1899
            filter[i  ] = (( xpos         & 0xFFFF) ^ 0xFFFF)>>9;
1898 1900
            filter[i+1] = (((xpos+xInc  ) & 0xFFFF) ^ 0xFFFF)>>9;
......
1900 1902
            filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9;
1901 1903
            filterPos[i/2]= xx;
1902 1904

  
1903
            {
1904
                int maxShift= 3-(d+inc);
1905
                int shift=0;
1906

  
1907
                memcpy(funnyCode + fragmentPos, fragment, fragmentLength);
1905
            memcpy(funnyCode + fragmentPos, fragment, fragmentLength);
1908 1906

  
1909
                funnyCode[fragmentPos + imm8OfPShufW1]=
1910
                    (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
1911
                funnyCode[fragmentPos + imm8OfPShufW2]=
1912
                    a | (b<<2) | (c<<4) | (d<<6);
1907
            funnyCode[fragmentPos + imm8OfPShufW1]=
1908
                (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
1909
            funnyCode[fragmentPos + imm8OfPShufW2]=
1910
                a | (b<<2) | (c<<4) | (d<<6);
1913 1911

  
1914
                if (i+4-inc>=dstW) shift=maxShift; //avoid overread
1915
                else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
1912
            if (i+4-inc>=dstW) shift=maxShift; //avoid overread
1913
            else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
1916 1914

  
1917
                if (shift && i>=shift)
1918
                {
1919
                    funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
1920
                    funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
1921
                    filterPos[i/2]-=shift;
1922
                }
1923

  
1924
                fragmentPos+= fragmentLength;
1915
            if (shift && i>=shift)
1916
            {
1917
                funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
1918
                funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
1919
                filterPos[i/2]-=shift;
1925 1920
            }
1926 1921

  
1922
            fragmentPos+= fragmentLength;
1923

  
1927 1924
            funnyCode[fragmentPos]= RET;
1928 1925
        }
1929 1926
        xpos+=xInc;

Also available in: Unified diff