mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 06:03:45 +01:00
better spatial interpolation
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18658 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
33bd78a28e
commit
790e5ae5b4
@ -89,7 +89,7 @@ struct vf_priv_s {
|
||||
};
|
||||
|
||||
static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height){
|
||||
int x, y, i, j;
|
||||
int x, y, i;
|
||||
int out_size;
|
||||
|
||||
for(i=0; i<3; i++){
|
||||
@ -118,21 +118,22 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
|
||||
uint8_t *srcp= &src[i][x + y*srcs];
|
||||
int diff0= filp[-fils] - srcp[-srcs];
|
||||
int diff1= filp[+fils] - srcp[+srcs];
|
||||
int diffscore= ABS(srcp[-srcs-1] - srcp[+srcs-1])
|
||||
+ABS(srcp[-srcs ] - srcp[+srcs ])
|
||||
+ABS(srcp[-srcs+1] - srcp[+srcs+1]);
|
||||
int spatial_score= ABS(srcp[-srcs-1] - srcp[+srcs-1])
|
||||
+ABS(srcp[-srcs ] - srcp[+srcs ])
|
||||
+ABS(srcp[-srcs+1] - srcp[+srcs+1]) - 1;
|
||||
int temp= filp[0];
|
||||
|
||||
for(j=-1; j<=1; j+=2){
|
||||
int score= ABS(srcp[-srcs+j-1] - srcp[+srcs-j-1])
|
||||
+ABS(srcp[-srcs+j ] - srcp[+srcs-j ])
|
||||
+ABS(srcp[-srcs+j+1] - srcp[+srcs-j+1]) + 1;
|
||||
if(score < diffscore){
|
||||
diffscore= score;
|
||||
diff0= filp[-fils+j] - srcp[-srcs+j];
|
||||
diff1= filp[+fils-j] - srcp[+srcs-j];
|
||||
}
|
||||
}
|
||||
#define CHECK(j)\
|
||||
{ int score= ABS(srcp[-srcs-1+j] - srcp[+srcs-1-j])\
|
||||
+ ABS(srcp[-srcs +j] - srcp[+srcs -j])\
|
||||
+ ABS(srcp[-srcs+1+j] - srcp[+srcs+1-j]);\
|
||||
if(score < spatial_score){\
|
||||
spatial_score= score;\
|
||||
diff0= filp[-fils+j] - srcp[-srcs+j];\
|
||||
diff1= filp[+fils-j] - srcp[+srcs-j];
|
||||
|
||||
CHECK(-1) CHECK(-2) }} }}
|
||||
CHECK( 1) CHECK( 2) }} }}
|
||||
#if 0
|
||||
if((diff0 ^ diff1) > 0){
|
||||
int mindiff= ABS(diff0) > ABS(diff1) ? diff1 : diff0;
|
||||
|
@ -65,7 +65,7 @@ static void store_ref(struct vf_priv_s *p, uint8_t *src[3], int src_stride[3], i
|
||||
}
|
||||
|
||||
static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int width, int height, int parity, int tff){
|
||||
int x, y, i, j;
|
||||
int x, y, i;
|
||||
|
||||
for(i=0; i<3; i++){
|
||||
int is_chroma= !!i;
|
||||
@ -91,18 +91,19 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int
|
||||
int diff= MAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
|
||||
int spatial_pred= (c+e)>>1;
|
||||
int spatial_score= ABS(cur[-refs-1] - cur[+refs-1]) + ABS(c-e)
|
||||
+ ABS(cur[-refs+1] - cur[+refs+1]);
|
||||
+ ABS(cur[-refs+1] - cur[+refs+1]) - 1;
|
||||
|
||||
for(j=-1; j<=1; j+=2){
|
||||
int score= ABS(cur[-refs-1+j] - cur[+refs-1-j])
|
||||
+ ABS(cur[-refs +j] - cur[+refs -j])
|
||||
+ ABS(cur[-refs+1+j] - cur[+refs+1-j]) + 1;
|
||||
#define CHECK(j)\
|
||||
{ int score= ABS(cur[-refs-1+j] - cur[+refs-1-j])\
|
||||
+ ABS(cur[-refs +j] - cur[+refs -j])\
|
||||
+ ABS(cur[-refs+1+j] - cur[+refs+1-j]);\
|
||||
if(score < spatial_score){\
|
||||
spatial_score= score;\
|
||||
spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;\
|
||||
|
||||
CHECK(-1) CHECK(-2) }} }}
|
||||
CHECK( 1) CHECK( 2) }} }}
|
||||
|
||||
if(score < spatial_score){
|
||||
spatial_score= score;
|
||||
spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;
|
||||
}
|
||||
}
|
||||
if(p->mode<2){
|
||||
int b= (prev2[-2*refs] + next2[-2*refs])>>1;
|
||||
int f= (prev2[+2*refs] + next2[+2*refs])>>1;
|
||||
|
Loading…
Reference in New Issue
Block a user