Mercurial > libavcodec.hg
comparison libpostproc/postprocess_template.c @ 134:2c469e390117 libavcodec
dering in c
dering bugfix
| author | michael |
|---|---|
| date | Fri, 26 Oct 2001 00:35:41 +0000 |
| parents | e0bf2e9ce24c |
| children | 5083d662ff85 |
comparison
equal
deleted
inserted
replaced
| 133:e0bf2e9ce24c | 134:2c469e390117 |
|---|---|
| 24 doVertDefFilter Ec Ec Ec | 24 doVertDefFilter Ec Ec Ec |
| 25 isHorizDC Ec Ec | 25 isHorizDC Ec Ec |
| 26 isHorizMinMaxOk a E | 26 isHorizMinMaxOk a E |
| 27 doHorizLowPass E e e | 27 doHorizLowPass E e e |
| 28 doHorizDefFilter Ec Ec Ec | 28 doHorizDefFilter Ec Ec Ec |
| 29 deRing e e* | 29 deRing E e e* |
| 30 Vertical RKAlgo1 E a a | 30 Vertical RKAlgo1 E a a |
| 31 Horizontal RKAlgo1 a a | 31 Horizontal RKAlgo1 a a |
| 32 Vertical X1 a E E | 32 Vertical X1 a E E |
| 33 Horizontal X1 a E E | 33 Horizontal X1 a E E |
| 34 LinIpolDeinterlace e E E* | 34 LinIpolDeinterlace e E E* |
| 90 #ifdef HAVE_MMX2 | 90 #ifdef HAVE_MMX2 |
| 91 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" | 91 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" |
| 92 #elif defined (HAVE_3DNOW) | 92 #elif defined (HAVE_3DNOW) |
| 93 #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" | 93 #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" |
| 94 #endif | 94 #endif |
| 95 | |
| 96 #ifdef HAVE_MMX2 | |
| 97 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t" | |
| 98 #elif defined (HAVE_MMX) | |
| 99 #define PMINUB(b,a,t) \ | |
| 100 "movq " #a ", " #t " \n\t"\ | |
| 101 "psubusb " #b ", " #t " \n\t"\ | |
| 102 "psubb " #t ", " #a " \n\t" | |
| 103 #endif | |
| 104 | |
| 105 #ifdef HAVE_MMX2 | |
| 106 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t" | |
| 107 #elif defined (HAVE_MMX) | |
| 108 #define PMAXUB(a,b) \ | |
| 109 "psubusb " #a ", " #b " \n\t"\ | |
| 110 "paddb " #a ", " #b " \n\t" | |
| 111 #endif | |
| 112 | |
| 95 | 113 |
| 96 #define GET_MODE_BUFFER_SIZE 500 | 114 #define GET_MODE_BUFFER_SIZE 500 |
| 97 #define OPTIONS_ARRAY_SIZE 10 | 115 #define OPTIONS_ARRAY_SIZE 10 |
| 98 | 116 |
| 99 | 117 |
| 1970 "paddb " #t0 ", " #sx " \n\t"\ | 1988 "paddb " #t0 ", " #sx " \n\t"\ |
| 1971 \ | 1989 \ |
| 1972 PAVGB(lx, pplx) \ | 1990 PAVGB(lx, pplx) \ |
| 1973 PAVGB(plx, pplx) /* filtered */\ | 1991 PAVGB(plx, pplx) /* filtered */\ |
| 1974 "movq " #dst ", " #t0 " \n\t" /* dst */\ | 1992 "movq " #dst ", " #t0 " \n\t" /* dst */\ |
| 1975 "movq " #pplx ", " #t1 " \n\t"\ | 1993 "movq " #t0 ", " #t1 " \n\t" /* dst */\ |
| 1976 "psubusb " #t0 ", " #pplx " \n\t"\ | 1994 "psubusb pQPb2, " #t0 " \n\t"\ |
| 1977 "psubusb " #t1 ", " #t0 " \n\t"\ | 1995 "paddusb pQPb2, " #t1 " \n\t"\ |
| 1978 "por " #t0 ", " #pplx " \n\t" /* |filtered - dst| */\ | 1996 PMAXUB(t0, pplx)\ |
| 1979 "psubusb pQPb2, " #pplx " \n\t"\ | 1997 PMINUB(t1, pplx, t0)\ |
| 1980 "pcmpeqb b00, " #pplx " \n\t"\ | |
| 1981 "paddb " #sx ", " #ppsx " \n\t"\ | 1998 "paddb " #sx ", " #ppsx " \n\t"\ |
| 1982 "paddb " #psx ", " #ppsx " \n\t"\ | 1999 "paddb " #psx ", " #ppsx " \n\t"\ |
| 1983 "#paddb b02, " #ppsx " \n\t"\ | 2000 "#paddb b02, " #ppsx " \n\t"\ |
| 1984 "pand b08, " #ppsx " \n\t"\ | 2001 "pand b08, " #ppsx " \n\t"\ |
| 1985 "pcmpeqb b00, " #ppsx " \n\t"\ | 2002 "pcmpeqb b00, " #ppsx " \n\t"\ |
| 1986 "pand " #pplx ", " #ppsx " \n\t"\ | 2003 "pand " #ppsx ", " #pplx " \n\t"\ |
| 1987 "pand " #ppsx ", " #t1 " \n\t"\ | |
| 1988 "pandn " #dst ", " #ppsx " \n\t"\ | 2004 "pandn " #dst ", " #ppsx " \n\t"\ |
| 1989 "por " #t1 ", " #ppsx " \n\t"\ | 2005 "por " #pplx ", " #ppsx " \n\t"\ |
| 1990 "movq " #ppsx ", " #dst " \n\t" | 2006 "movq " #ppsx ", " #dst " \n\t" |
| 2007 | |
| 1991 /* | 2008 /* |
| 1992 0000000 | 2009 0000000 |
| 1993 1111111 | 2010 1111111 |
| 1994 | 2011 |
| 1995 1111110 | 2012 1111110 |
| 2016 | 2033 |
| 2017 : : "r" (src), "r" (stride), "r" (QP) | 2034 : : "r" (src), "r" (stride), "r" (QP) |
| 2018 : "%eax", "%ebx" | 2035 : "%eax", "%ebx" |
| 2019 ); | 2036 ); |
| 2020 #else | 2037 #else |
| 2021 | 2038 int y; |
| 2022 //FIXME | 2039 int min=255; |
| 2040 int max=0; | |
| 2041 int avg; | |
| 2042 uint8_t *p; | |
| 2043 int s[10]; | |
| 2044 | |
| 2045 for(y=1; y<9; y++) | |
| 2046 { | |
| 2047 int x; | |
| 2048 p= src + stride*y; | |
| 2049 for(x=1; x<9; x++) | |
| 2050 { | |
| 2051 p++; | |
| 2052 if(*p > max) max= *p; | |
| 2053 if(*p < min) min= *p; | |
| 2054 } | |
| 2055 } | |
| 2056 avg= (min + max + 1)/2; | |
| 2057 | |
| 2058 for(y=0; y<10; y++) | |
| 2059 { | |
| 2060 int x; | |
| 2061 int t = 0; | |
| 2062 p= src + stride*y; | |
| 2063 for(x=0; x<10; x++) | |
| 2064 { | |
| 2065 if(*p > avg) t |= (1<<x); | |
| 2066 p++; | |
| 2067 } | |
| 2068 t |= (~t)<<16; | |
| 2069 t &= (t<<1) & (t>>1); | |
| 2070 s[y] = t; | |
| 2071 } | |
| 2072 | |
| 2073 for(y=1; y<9; y++) | |
| 2074 { | |
| 2075 int x; | |
| 2076 int t = s[y-1] & s[y] & s[y+1]; | |
| 2077 t|= t>>16; | |
| 2078 | |
| 2079 p= src + stride*y; | |
| 2080 for(x=1; x<9; x++) | |
| 2081 { | |
| 2082 p++; | |
| 2083 if(t & (1<<x)) | |
| 2084 { | |
| 2085 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1)) | |
| 2086 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1)) | |
| 2087 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1)); | |
| 2088 f= (f + 8)>>4; | |
| 2089 | |
| 2090 if (*p + 2*QP < f) *p= *p + 2*QP; | |
| 2091 else if(*p - 2*QP > f) *p= *p - 2*QP; | |
| 2092 else *p=f; | |
| 2093 } | |
| 2094 } | |
| 2095 } | |
| 2096 | |
| 2023 #endif | 2097 #endif |
| 2024 } | 2098 } |
| 2025 | 2099 |
| 2026 /** | 2100 /** |
| 2027 * Deinterlaces the given block | 2101 * Deinterlaces the given block |
