[MPlayer-dev-eng] [PATCH] suggested change for tfields=1
Michael Niedermayer
michaelni at gmx.at
Tue Jun 6 01:32:31 CEST 2006
Hi
tfields=1 currently checks each sample against the one above and below
and if the current sample is the largest or smallest of the 3 then it is
replaced by a interpolation of pixels from the lines above and below
attached patch changes this hard switching to a soft one to avoid some
artifacts in some videos (no it still flickers like hell on many parts)
btw, note, one possible improvement would be to compare each sample against
the past frame and only if that is quite diffrent perform any spatial
checks, but i was too lazy to try this
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
-------------- next part --------------
Index: vf_tfields.c
===================================================================
--- vf_tfields.c (revision 18584)
+++ vf_tfields.c (working copy)
@@ -44,14 +44,26 @@
}
for (y=h/2; y; y--) {
for (x=0; x<w; x++) {
- if (((src[x-ss] < src[x]) && (src[x+ss] < src[x])) ||
- ((src[x-ss] > src[x]) && (src[x+ss] > src[x]))) {
- //dest[x] = (src[x+ss] + src[x-ss])>>1;
- dest[x] = ((src[x+ss]<<1) + (src[x-ss]<<1)
- + src[x+ss+1] + src[x-ss+1]
- + src[x+ss-1] + src[x-ss-1])>>3;
- }
- else dest[x] = src[x];
+ int max, min, v, avg;
+ if(src[x+ss] > src[x-ss]){
+ max= src[x+ss];
+ min= src[x-ss];
+ }else{
+ max= src[x-ss];
+ min= src[x+ss];
+ }
+ v= src[x];
+ avg = ((src[x+ss ]<<1) + (src[x-ss ]<<1)
+ + src[x+ss+1] + src[x-ss+1]
+ + src[x+ss-1] + src[x-ss-1] + 4)>>3;
+ if(min > v){
+ v= 2*min-v;
+ if(avg < v) v=avg;
+ }else if(max < v){
+ v= 2*max-v;
+ if(avg > v) v=avg;
+ }
+ dest[x]= v;
}
dest += ds<<1;
src += ss<<1;
More information about the MPlayer-dev-eng
mailing list