comparison postproc/swscale.c @ 11000:6e35326c742f

many small typo and grammar fixes Based on Bernard Leak's mail <bernard 4t brenda-arkle.demon.co.uk>
author gabucino
date Sat, 04 Oct 2003 17:29:08 +0000
parents b1c40065bcff
children f33f908ae085
comparison
equal deleted inserted replaced
10999:6d85ca7c3165 11000:6e35326c742f
726 #include "swscale_template.c" 726 #include "swscale_template.c"
727 #endif 727 #endif
728 728
729 #endif //ARCH_X86 729 #endif //ARCH_X86
730 730
731 // minor note: the HAVE_xyz is messed up after that line so dont use it 731 // minor note: the HAVE_xyz is messed up after that line so don't use it
732 732
733 static double getSplineCoeff(double a, double b, double c, double d, double dist) 733 static double getSplineCoeff(double a, double b, double c, double d, double dist)
734 { 734 {
735 // printf("%f %f %f %f %f\n", a,b,c,d,dist); 735 // printf("%f %f %f %f %f\n", a,b,c,d,dist);
736 if(dist<=1.0) return ((d*dist + c)*dist + b)*dist +a; 736 if(dist<=1.0) return ((d*dist + c)*dist + b)*dist +a;
981 int k; 981 int k;
982 cutOff += ABS(filter2[i*filter2Size]); 982 cutOff += ABS(filter2[i*filter2Size]);
983 983
984 if(cutOff > SWS_MAX_REDUCE_CUTOFF) break; 984 if(cutOff > SWS_MAX_REDUCE_CUTOFF) break;
985 985
986 /* preserve Monotonicity because the core cant handle the filter otherwise */ 986 /* preserve Monotonicity because the core can't handle the filter otherwise */
987 if(i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break; 987 if(i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
988 988
989 // Move filter coeffs left 989 // Move filter coeffs left
990 for(k=1; k<filter2Size; k++) 990 for(k=1; k<filter2Size; k++)
991 filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k]; 991 filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
1700 #endif 1700 #endif
1701 #endif 1701 #endif
1702 if(clip_table[512] != 255) globalInit(); 1702 if(clip_table[512] != 255) globalInit();
1703 if(rgb15to16 == NULL) sws_rgb2rgb_init(flags); 1703 if(rgb15to16 == NULL) sws_rgb2rgb_init(flags);
1704 1704
1705 /* avoid dupplicate Formats, so we dont need to check to much */ 1705 /* avoid duplicate Formats, so we don't need to check to much */
1706 srcFormat = remove_dup_fourcc(origSrcFormat); 1706 srcFormat = remove_dup_fourcc(origSrcFormat);
1707 dstFormat = remove_dup_fourcc(origDstFormat); 1707 dstFormat = remove_dup_fourcc(origDstFormat);
1708 1708
1709 unscaled = (srcW == dstW && srcH == dstH); 1709 unscaled = (srcW == dstW && srcH == dstH);
1710 needsDither= (isBGR(dstFormat) || isRGB(dstFormat)) 1710 needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
1870 if(c->canMMX2BeUsed) 1870 if(c->canMMX2BeUsed)
1871 { 1871 {
1872 c->lumXInc+= 20; 1872 c->lumXInc+= 20;
1873 c->chrXInc+= 20; 1873 c->chrXInc+= 20;
1874 } 1874 }
1875 //we dont use the x86asm scaler if mmx is available 1875 //we don't use the x86asm scaler if mmx is available
1876 else if(flags & SWS_CPU_CAPS_MMX) 1876 else if(flags & SWS_CPU_CAPS_MMX)
1877 { 1877 {
1878 c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; 1878 c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
1879 c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; 1879 c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
1880 } 1880 }
1892 c->chrSrcW, c->chrDstW, filterAlign, 1<<14, 1892 c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
1893 (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, 1893 (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
1894 srcFilter->chrH, dstFilter->chrH); 1894 srcFilter->chrH, dstFilter->chrH);
1895 1895
1896 #ifdef ARCH_X86 1896 #ifdef ARCH_X86
1897 // cant downscale !!! 1897 // can't downscale !!!
1898 if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) 1898 if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
1899 { 1899 {
1900 c->lumMmx2Filter = (int16_t*)memalign(8, (dstW /8+8)*sizeof(int16_t)); 1900 c->lumMmx2Filter = (int16_t*)memalign(8, (dstW /8+8)*sizeof(int16_t));
1901 c->chrMmx2Filter = (int16_t*)memalign(8, (c->chrDstW /4+8)*sizeof(int16_t)); 1901 c->chrMmx2Filter = (int16_t*)memalign(8, (c->chrDstW /4+8)*sizeof(int16_t));
1902 c->lumMmx2FilterPos= (int32_t*)memalign(8, (dstW /2/8+8)*sizeof(int32_t)); 1902 c->lumMmx2FilterPos= (int32_t*)memalign(8, (dstW /2/8+8)*sizeof(int32_t));
1918 initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, 1918 initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
1919 c->chrSrcH, c->chrDstH, 1, (1<<12)-4, 1919 c->chrSrcH, c->chrDstH, 1, (1<<12)-4,
1920 (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, 1920 (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
1921 srcFilter->chrV, dstFilter->chrV); 1921 srcFilter->chrV, dstFilter->chrV);
1922 1922
1923 // Calculate Buffer Sizes so that they wont run out while handling these damn slices 1923 // Calculate Buffer Sizes so that they won't run out while handling these damn slices
1924 c->vLumBufSize= c->vLumFilterSize; 1924 c->vLumBufSize= c->vLumFilterSize;
1925 c->vChrBufSize= c->vChrFilterSize; 1925 c->vChrBufSize= c->vChrFilterSize;
1926 for(i=0; i<dstH; i++) 1926 for(i=0; i<dstH; i++)
1927 { 1927 {
1928 int chrI= i*c->chrDstH / dstH; 1928 int chrI= i*c->chrDstH / dstH;
2077 c->swScale= getSwsFunc(flags); 2077 c->swScale= getSwsFunc(flags);
2078 return c; 2078 return c;
2079 } 2079 }
2080 2080
2081 /** 2081 /**
2082 * swscale warper, so we dont need to export the SwsContext. 2082 * swscale warper, so we don't need to export the SwsContext.
2083 * assumes planar YUV to be in YUV order instead of YVU 2083 * assumes planar YUV to be in YUV order instead of YVU
2084 */ 2084 */
2085 int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 2085 int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2086 int srcSliceH, uint8_t* dst[], int dstStride[]){ 2086 int srcSliceH, uint8_t* dst[], int dstStride[]){
2087 return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); 2087 return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
2088 } 2088 }
2089 2089
2090 /** 2090 /**
2091 * swscale warper, so we dont need to export the SwsContext 2091 * swscale warper, so we don't need to export the SwsContext
2092 */ 2092 */
2093 int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, 2093 int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
2094 int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){ 2094 int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
2095 int srcStride[3]; 2095 int srcStride[3];
2096 int dstStride[3]; 2096 int dstStride[3];