Mercurial > libavcodec.hg
comparison libpostproc/postprocess_template.c @ 224:8b3e70afa2ba libavcodec
top row bugfix
| author | michael |
|---|---|
| date | Tue, 29 Jan 2002 04:21:27 +0000 |
| parents | f0e15c953995 |
| children | 3912b37ba121 |
comparison
equal
deleted
inserted
replaced
| 223:f0e15c953995 | 224:8b3e70afa2ba |
|---|---|
| 2444 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, | 2444 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 2445 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode); | 2445 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode); |
| 2446 | 2446 |
| 2447 /** | 2447 /** |
| 2448 * Copies a block from src to dst and fixes the blacklevel | 2448 * Copies a block from src to dst and fixes the blacklevel |
| 2449 * numLines must be a multiple of 4 | |
| 2450 * levelFix == 0 -> dont touch the brighness & contrast | 2449 * levelFix == 0 -> dont touch the brighness & contrast |
| 2451 */ | 2450 */ |
| 2452 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride, | 2451 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride, |
| 2453 int levelFix) | 2452 int levelFix) |
| 2454 { | 2453 { |
| 2568 &(src[srcStride*i]), BLOCK_SIZE); | 2567 &(src[srcStride*i]), BLOCK_SIZE); |
| 2569 #endif | 2568 #endif |
| 2570 } | 2569 } |
| 2571 } | 2570 } |
| 2572 | 2571 |
| 2572 /** | |
| 2573 * Duplicates the given 8 src pixels ? times upward | |
| 2574 */ | |
| 2575 static inline void RENAME(duplicate)(uint8_t src[], int stride) | |
| 2576 { | |
| 2577 #ifdef HAVE_MMX | |
| 2578 asm volatile( | |
| 2579 "movq (%0), %%mm0 \n\t" | |
| 2580 "addl %1, %0 \n\t" | |
| 2581 "movq %%mm0, (%0) \n\t" | |
| 2582 "movq %%mm0, (%0, %1) \n\t" | |
| 2583 "movq %%mm0, (%0, %1, 2) \n\t" | |
| 2584 : "+r" (src) | |
| 2585 : "r" (-stride) | |
| 2586 ); | |
| 2587 #else | |
| 2588 int i; | |
| 2589 uint8_t *p=src; | |
| 2590 for(i=0; i<3; i++) | |
| 2591 { | |
| 2592 p-= stride; | |
| 2593 memcpy(p, src, 8); | |
| 2594 } | |
| 2595 #endif | |
| 2596 } | |
| 2573 | 2597 |
| 2574 /** | 2598 /** |
| 2575 * Filters array of bytes (Y or U or V values) | 2599 * Filters array of bytes (Y or U or V values) |
| 2576 */ | 2600 */ |
| 2577 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, | 2601 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 2738 } | 2762 } |
| 2739 | 2763 |
| 2740 /* copy & deinterlace first row of blocks */ | 2764 /* copy & deinterlace first row of blocks */ |
| 2741 y=-BLOCK_SIZE; | 2765 y=-BLOCK_SIZE; |
| 2742 { | 2766 { |
| 2743 //1% speedup if these are here instead of the inner loop | |
| 2744 uint8_t *srcBlock= &(src[y*srcStride]); | 2767 uint8_t *srcBlock= &(src[y*srcStride]); |
| 2745 uint8_t *dstBlock= &(dst[y*dstStride]); | 2768 uint8_t *dstBlock= tempDst + dstStride; |
| 2746 | |
| 2747 dstBlock= tempDst + dstStride; | |
| 2748 | 2769 |
| 2749 // From this point on it is guranteed that we can read and write 16 lines downward | 2770 // From this point on it is guranteed that we can read and write 16 lines downward |
| 2750 // finish 1 block before the next otherwise weŽll might have a problem | 2771 // finish 1 block before the next otherwise weŽll might have a problem |
| 2751 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing | 2772 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing |
| 2752 for(x=0; x<width; x+=BLOCK_SIZE) | 2773 for(x=0; x<width; x+=BLOCK_SIZE) |
| 2786 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | 2807 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); |
| 2787 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | 2808 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); |
| 2788 */ | 2809 */ |
| 2789 #endif | 2810 #endif |
| 2790 | 2811 |
| 2791 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride, | 2812 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride, |
| 2792 srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX); | 2813 srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX); |
| 2814 | |
| 2815 RENAME(duplicate)(dstBlock + dstStride*8, dstStride); | |
| 2793 | 2816 |
| 2794 if(mode & LINEAR_IPOL_DEINT_FILTER) | 2817 if(mode & LINEAR_IPOL_DEINT_FILTER) |
| 2795 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride); | 2818 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride); |
| 2796 else if(mode & LINEAR_BLEND_DEINT_FILTER) | 2819 else if(mode & LINEAR_BLEND_DEINT_FILTER) |
| 2797 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride); | 2820 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride); |
| 2803 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride); | 2826 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride); |
| 2804 */ | 2827 */ |
| 2805 dstBlock+=8; | 2828 dstBlock+=8; |
| 2806 srcBlock+=8; | 2829 srcBlock+=8; |
| 2807 } | 2830 } |
| 2808 memcpy(&(dst[y*dstStride]) + 8*dstStride, tempDst + 9*dstStride, copyAhead*dstStride ); | 2831 memcpy(dst, tempDst + 9*dstStride, copyAhead*dstStride ); |
| 2809 } | 2832 } |
| 2810 | 2833 |
| 2811 for(y=0; y<height; y+=BLOCK_SIZE) | 2834 for(y=0; y<height; y+=BLOCK_SIZE) |
| 2812 { | 2835 { |
| 2813 //1% speedup if these are here instead of the inner loop | 2836 //1% speedup if these are here instead of the inner loop |
