Mercurial > mplayer.hg
comparison libswscale/swscale.c @ 29411:0192dbbb3121
MMX2 scaler: factorize initMMX2Scaler().
author | ramiro |
---|---|
date | Tue, 28 Jul 2009 05:42:46 +0000 |
parents | fd9b0bd6c908 |
children | 139af822b6ce |
comparison
equal
deleted
inserted
replaced
29410:fd9b0bd6c908 | 29411:0192dbbb3121 |
---|---|
1887 int a=0; | 1887 int a=0; |
1888 int b=((xpos+xInc)>>16) - xx; | 1888 int b=((xpos+xInc)>>16) - xx; |
1889 int c=((xpos+xInc*2)>>16) - xx; | 1889 int c=((xpos+xInc*2)>>16) - xx; |
1890 int d=((xpos+xInc*3)>>16) - xx; | 1890 int d=((xpos+xInc*3)>>16) - xx; |
1891 int inc = (d+1<4); | 1891 int inc = (d+1<4); |
1892 uint8_t *fragment = (d+1<4) ? fragmentB : fragmentA; | |
1893 x86_reg imm8OfPShufW1 = (d+1<4) ? imm8OfPShufW1B : imm8OfPShufW1A; | |
1894 x86_reg imm8OfPShufW2 = (d+1<4) ? imm8OfPShufW2B : imm8OfPShufW2A; | |
1895 x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA; | |
1892 | 1896 |
1893 filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9; | 1897 filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9; |
1894 filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9; | 1898 filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9; |
1895 filter[i+2] = (((xpos+xInc*2) & 0xFFFF) ^ 0xFFFF)>>9; | 1899 filter[i+2] = (((xpos+xInc*2) & 0xFFFF) ^ 0xFFFF)>>9; |
1896 filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9; | 1900 filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9; |
1897 filterPos[i/2]= xx; | 1901 filterPos[i/2]= xx; |
1898 | 1902 |
1899 if (d+1<4) | |
1900 { | 1903 { |
1901 int maxShift= 3-(d+inc); | 1904 int maxShift= 3-(d+inc); |
1902 int shift=0; | 1905 int shift=0; |
1903 | 1906 |
1904 memcpy(funnyCode + fragmentPos, fragmentB, fragmentLengthB); | 1907 memcpy(funnyCode + fragmentPos, fragment, fragmentLength); |
1905 | 1908 |
1906 funnyCode[fragmentPos + imm8OfPShufW1B]= | 1909 funnyCode[fragmentPos + imm8OfPShufW1]= |
1907 (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); | 1910 (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); |
1908 funnyCode[fragmentPos + imm8OfPShufW2B]= | 1911 funnyCode[fragmentPos + imm8OfPShufW2]= |
1909 a | (b<<2) | (c<<4) | (d<<6); | 1912 a | (b<<2) | (c<<4) | (d<<6); |
1910 | 1913 |
1911 if (i+4-inc>=dstW) shift=maxShift; //avoid overread | 1914 if (i+4-inc>=dstW) shift=maxShift; //avoid overread |
1912 else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align | 1915 else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align |
1913 | 1916 |
1914 if (shift && i>=shift) | 1917 if (shift && i>=shift) |
1915 { | 1918 { |
1916 funnyCode[fragmentPos + imm8OfPShufW1B]+= 0x55*shift; | 1919 funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift; |
1917 funnyCode[fragmentPos + imm8OfPShufW2B]+= 0x55*shift; | 1920 funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift; |
1918 filterPos[i/2]-=shift; | 1921 filterPos[i/2]-=shift; |
1919 } | 1922 } |
1920 | 1923 |
1921 fragmentPos+= fragmentLengthB; | 1924 fragmentPos+= fragmentLength; |
1922 } | |
1923 else | |
1924 { | |
1925 int maxShift= 3-d; | |
1926 int shift=0; | |
1927 | |
1928 memcpy(funnyCode + fragmentPos, fragmentA, fragmentLengthA); | |
1929 | |
1930 funnyCode[fragmentPos + imm8OfPShufW1A]= | |
1931 funnyCode[fragmentPos + imm8OfPShufW2A]= | |
1932 a | (b<<2) | (c<<4) | (d<<6); | |
1933 | |
1934 if (i+4>=dstW) shift=maxShift; //avoid overread | |
1935 else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //partial align | |
1936 | |
1937 if (shift && i>=shift) | |
1938 { | |
1939 funnyCode[fragmentPos + imm8OfPShufW1A]+= 0x55*shift; | |
1940 funnyCode[fragmentPos + imm8OfPShufW2A]+= 0x55*shift; | |
1941 filterPos[i/2]-=shift; | |
1942 } | |
1943 | |
1944 fragmentPos+= fragmentLengthA; | |
1945 } | 1925 } |
1946 | 1926 |
1947 funnyCode[fragmentPos]= RET; | 1927 funnyCode[fragmentPos]= RET; |
1948 } | 1928 } |
1949 xpos+=xInc; | 1929 xpos+=xInc; |