Mercurial > mplayer.hg
changeset 17530:04d6525d59d6
change sws sharpen filter a little
author | michael |
---|---|
date | Sat, 04 Feb 2006 00:08:54 +0000 |
parents | 49715244bdb2 |
children | c6ad2343ec16 |
files | cfg-common.h postproc/swscale.c |
diffstat | 2 files changed, 20 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/cfg-common.h Fri Feb 03 17:07:43 2006 +0000 +++ b/cfg-common.h Sat Feb 04 00:08:54 2006 +0000 @@ -421,8 +421,8 @@ {"cgb", &sws_chr_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, {"cvs", &sws_chr_vshift, CONF_TYPE_INT, 0, 0, 0, NULL}, {"chs", &sws_chr_hshift, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"ls", &sws_lum_sharpen, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, - {"cs", &sws_chr_sharpen, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, + {"ls", &sws_lum_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL}, + {"cs", &sws_chr_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} };
--- a/postproc/swscale.c Fri Feb 03 17:07:43 2006 +0000 +++ b/postproc/swscale.c Sat Feb 04 00:08:54 2006 +0000 @@ -2346,24 +2346,20 @@ } if(chromaSharpen!=0.0){ - SwsVector *g= sws_getConstVec(-1.0, 3); - SwsVector *id= sws_getConstVec(10.0/chromaSharpen, 1); - g->coeff[1]=2.0; - sws_addVec(id, g); - sws_convVec(filter->chrH, id); - sws_convVec(filter->chrV, id); - sws_freeVec(g); + SwsVector *id= sws_getIdentityVec(); + sws_scaleVec(filter->chrH, -chromaSharpen); + sws_scaleVec(filter->chrV, -chromaSharpen); + sws_addVec(filter->chrH, id); + sws_addVec(filter->chrV, id); sws_freeVec(id); } if(lumaSharpen!=0.0){ - SwsVector *g= sws_getConstVec(-1.0, 3); - SwsVector *id= sws_getConstVec(10.0/lumaSharpen, 1); - g->coeff[1]=2.0; - sws_addVec(id, g); - sws_convVec(filter->lumH, id); - sws_convVec(filter->lumV, id); - sws_freeVec(g); + SwsVector *id= sws_getIdentityVec(); + sws_scaleVec(filter->lumH, -lumaSharpen); + sws_scaleVec(filter->lumV, -lumaSharpen); + sws_addVec(filter->lumH, id); + sws_addVec(filter->lumV, id); sws_freeVec(id); } @@ -2425,28 +2421,17 @@ SwsVector *sws_getIdentityVec(void){ - double *coeff= memalign(sizeof(double), sizeof(double)); - SwsVector *vec= malloc(sizeof(SwsVector)); - coeff[0]= 1.0; - - vec->coeff= coeff; - vec->length= 1; - - return vec; + return sws_getConstVec(1.0, 1); } -void sws_normalizeVec(SwsVector *a, double height){ +double sws_dcVec(SwsVector *a){ int i; - double sum=0; - double inv; + double sum=0; for(i=0; i<a->length; i++) sum+= a->coeff[i]; - inv= height/sum; - - for(i=0; i<a->length; i++) - a->coeff[i]*= inv; + return sum; } void sws_scaleVec(SwsVector *a, double scalar){ @@ -2456,6 +2441,10 @@ a->coeff[i]*= scalar; } +void sws_normalizeVec(SwsVector *a, double height){ + sws_scaleVec(a, height/sws_dcVec(a)); +} + static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b){ int length= a->length + b->length - 1; double *coeff= memalign(sizeof(double), length*sizeof(double));