comparison libmpcodecs/vf_smartblur.c @ 9494:543ab3909b78

sws_ prefix, more seperation between internal & external swscaler API sws_scale() returns the number of outputed lines
author michael
date Sun, 23 Feb 2003 22:05:55 +0000
parents 442ea8b6733c
children e9a2af584986
comparison
equal deleted inserted replaced
9493:d1f82707ad78 9494:543ab3909b78
44 typedef struct FilterParam{ 44 typedef struct FilterParam{
45 float radius; 45 float radius;
46 float strength; 46 float strength;
47 int threshold; 47 int threshold;
48 float quality; 48 float quality;
49 SwsContext *filterContext; 49 struct SwsContext *filterContext;
50 }FilterParam; 50 }FilterParam;
51 51
52 struct vf_priv_s { 52 struct vf_priv_s {
53 FilterParam luma; 53 FilterParam luma;
54 FilterParam chroma; 54 FilterParam chroma;
86 86
87 static int allocStuff(FilterParam *f, int width, int height){ 87 static int allocStuff(FilterParam *f, int width, int height){
88 SwsVector *vec; 88 SwsVector *vec;
89 SwsFilter swsF; 89 SwsFilter swsF;
90 90
91 vec = getGaussianVec(f->radius, f->quality); 91 vec = sws_getGaussianVec(f->radius, f->quality);
92 scaleVec(vec, f->strength); 92 sws_scaleVec(vec, f->strength);
93 vec->coeff[vec->length/2]+= 1.0 - f->strength; 93 vec->coeff[vec->length/2]+= 1.0 - f->strength;
94 swsF.lumH= swsF.lumV= vec; 94 swsF.lumH= swsF.lumV= vec;
95 swsF.chrH= swsF.chrV= NULL; 95 swsF.chrH= swsF.chrV= NULL;
96 f->filterContext= getSwsContext( 96 f->filterContext= sws_getContext(
97 width, height, IMGFMT_Y8, width, height, IMGFMT_Y8, 0, &swsF, NULL); 97 width, height, IMGFMT_Y8, width, height, IMGFMT_Y8, 0, &swsF, NULL);
98 98
99 freeVec(vec); 99 sws_freeVec(vec);
100 100
101 return 0; 101 return 0;
102 } 102 }
103 103
104 static int config(struct vf_instance_s* vf, 104 static int config(struct vf_instance_s* vf,
114 114
115 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); 115 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
116 } 116 }
117 117
118 static void freeBuffers(FilterParam *f){ 118 static void freeBuffers(FilterParam *f){
119 if(f->filterContext) freeSwsContext(f->filterContext); 119 if(f->filterContext) sws_freeContext(f->filterContext);
120 f->filterContext=NULL; 120 f->filterContext=NULL;
121 } 121 }
122 122
123 static void uninit(struct vf_instance_s* vf){ 123 static void uninit(struct vf_instance_s* vf){
124 if(!vf->priv) return; 124 if(!vf->priv) return;
136 uint8_t *srcArray[3]= {src, NULL, NULL}; 136 uint8_t *srcArray[3]= {src, NULL, NULL};
137 uint8_t *dstArray[3]= {dst, NULL, NULL}; 137 uint8_t *dstArray[3]= {dst, NULL, NULL};
138 int srcStrideArray[3]= {srcStride, 0, 0}; 138 int srcStrideArray[3]= {srcStride, 0, 0};
139 int dstStrideArray[3]= {dstStride, 0, 0}; 139 int dstStrideArray[3]= {dstStride, 0, 0};
140 140
141 f.filterContext->swScale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); 141 sws_scale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
142 142
143 if(f.threshold > 0){ 143 if(f.threshold > 0){
144 for(y=0; y<h; y++){ 144 for(y=0; y<h; y++){
145 for(x=0; x<w; x++){ 145 for(x=0; x<w; x++){
146 const int orig= src[x + y*srcStride]; 146 const int orig= src[x + y*srcStride];