comparison libpostproc/postprocess_template.c @ 2036:6a6c678517b3 libavcodec

altivec optimizations and horizontal filter fix by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michael
date Wed, 26 May 2004 20:15:15 +0000
parents 4225c131a2eb
children 98d8283534bb
comparison
equal deleted inserted replaced
2035:e1b69326ae36 2036:6a6c678517b3
168 168
169 /** 169 /**
170 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle) 170 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle)
171 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 171 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
172 */ 172 */
173 #ifndef HAVE_ALTIVEC
173 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c) 174 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
174 { 175 {
175 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) 176 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
176 src+= stride*3; 177 src+= stride*3;
177 asm volatile( //"movv %0 %1 %2\n\t" 178 asm volatile( //"movv %0 %1 %2\n\t"
338 339
339 src++; 340 src++;
340 } 341 }
341 #endif 342 #endif
342 } 343 }
344 #endif //HAVE_ALTIVEC
343 345
344 #if 0 346 #if 0
345 /** 347 /**
346 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar 348 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar
347 * values are correctly clipped (MMX2) 349 * values are correctly clipped (MMX2)
580 src++; 582 src++;
581 } 583 }
582 #endif 584 #endif
583 } 585 }
584 586
587 #ifndef HAVE_ALTIVEC
585 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c) 588 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
586 { 589 {
587 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) 590 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
588 /* 591 /*
589 uint8_t tmp[16]; 592 uint8_t tmp[16];
1147 } 1150 }
1148 src++; 1151 src++;
1149 } 1152 }
1150 #endif 1153 #endif
1151 } 1154 }
1152 1155 #endif //HAVE_ALTIVEC
1156
1157 #ifndef HAVE_ALTIVEC
1153 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c) 1158 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
1154 { 1159 {
1155 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) 1160 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
1156 asm volatile( 1161 asm volatile(
1157 "pxor %%mm6, %%mm6 \n\t" 1162 "pxor %%mm6, %%mm6 \n\t"
1503 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255; 1508 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
1504 } 1509 }
1505 #endif 1510 #endif
1506 #endif 1511 #endif
1507 } 1512 }
1513 #endif //HAVE_ALTIVEC
1508 1514
1509 /** 1515 /**
1510 * Deinterlaces the given block by linearly interpolating every second line. 1516 * Deinterlaces the given block by linearly interpolating every second line.
1511 * will be called for every 8x8 block and can read & write from line 4-15 1517 * will be called for every 8x8 block and can read & write from line 4-15
1512 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too 1518 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too
3132 #else 3138 #else
3133 if(mode & H_X1_FILTER) 3139 if(mode & H_X1_FILTER)
3134 horizX1Filter(dstBlock-4, stride, QP); 3140 horizX1Filter(dstBlock-4, stride, QP);
3135 else if(mode & H_DEBLOCK) 3141 else if(mode & H_DEBLOCK)
3136 { 3142 {
3137 if( isHorizDC(dstBlock-4, stride, &c)) 3143 const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
3138 { 3144
3139 if(isHorizMinMaxOk(dstBlock-4, stride, QP)) 3145 if(t==1)
3140 doHorizLowPass(dstBlock-4, stride, QP); 3146 RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
3141 } 3147 else if(t==2)
3142 else 3148 RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
3143 doHorizDefFilter(dstBlock-4, stride, QP);
3144 } 3149 }
3145 #endif 3150 #endif
3146 if(mode & DERING) 3151 if(mode & DERING)
3147 { 3152 {
3148 //FIXME filter first line 3153 //FIXME filter first line