Mercurial > mplayer.hg
annotate libmpcodecs/vf_filmdint.c @ 16397:8dac3fb10a1b
Properly initialize osdtexCnt
author | reimar |
---|---|
date | Mon, 05 Sep 2005 10:08:04 +0000 |
parents | 821f464b4d90 |
children | 6ff3379a0862 |
rev | line source |
---|---|
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1 #include <stdio.h> |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
2 #include <stdlib.h> |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
3 #include <string.h> |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
4 #include <signal.h> |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
5 #include <sys/time.h> |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
6 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
7 #include "../config.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
8 #include "../mp_msg.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
9 #include "../cpudetect.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
10 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
11 #include "img_format.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
12 #include "mp_image.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
13 #include "vf.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
14 #include "cmmx.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
15 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
16 #include "../libvo/fastmemcpy.h" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
17 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
18 #define NUM_STORED 4 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
19 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
20 enum pu_field_type_t { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
21 PU_1ST_OF_3, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
22 PU_2ND_OF_3, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
23 PU_3RD_OF_3, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
24 PU_1ST_OF_2, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
25 PU_2ND_OF_2, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
26 PU_INTERLACED |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
27 }; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
28 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
29 struct metrics { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
30 /* This struct maps to a packed word 64-bit MMX register */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
31 unsigned short int even; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
32 unsigned short int odd; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
33 unsigned short int noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
34 unsigned short int temp; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
35 } __attribute__ ((aligned (8))); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
36 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
37 struct frame_stats { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
38 struct metrics tiny, low, high, bigger, twox, max; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
39 struct { unsigned int even, odd, noise, temp; } sad; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
40 unsigned short interlaced_high; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
41 unsigned short interlaced_low; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
42 unsigned short num_blocks; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
43 }; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
44 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
45 struct vf_priv_s { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
46 unsigned long inframes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
47 unsigned long outframes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
48 enum pu_field_type_t prev_type; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
49 unsigned swapped, chroma_swapped; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
50 unsigned luma_only; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
51 unsigned verbose; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
52 unsigned fast; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
53 unsigned long w, h, cw, ch, stride, chroma_stride, nplanes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
54 unsigned long sad_thres; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
55 unsigned long dint_thres; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
56 unsigned char *memory_allocated; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
57 unsigned char *planes[2*NUM_STORED][4]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
58 unsigned char **old_planes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
59 unsigned long static_idx; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
60 unsigned long temp_idx; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
61 unsigned long crop_x, crop_y, crop_cx, crop_cy; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
62 unsigned long export_count, merge_count; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
63 unsigned long num_breaks; |
12255 | 64 unsigned long num_copies; |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
65 long in_inc, out_dec, iosync; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
66 long num_fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
67 long prev_fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
68 long notout; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
69 long mmx2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
70 unsigned small_bytes[2]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
71 unsigned mmx_temp[2]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
72 struct frame_stats stats[2]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
73 struct metrics thres; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
74 char chflag; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
75 double diff_time, merge_time, decode_time, vo_time, filter_time; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
76 }; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
77 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
78 #define PPZ { 2000, 2000, 0, 2000 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
79 #define PPR { 2000, 2000, 0, 2000 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
80 static const struct frame_stats ppzs = {PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,0,0,9999}; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
81 static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999}; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
82 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
83 extern int opt_screen_size_x; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
84 extern int opt_screen_size_y; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
85 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
86 #ifndef MIN |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
87 #define MIN(a,b) (((a)<(b))?(a):(b)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
88 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
89 #ifndef MAX |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
90 #define MAX(a,b) (((a)>(b))?(a):(b)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
91 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
92 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
93 static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
94 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
95 int i; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
96 void *retval=dst; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
97 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
98 for(i=0; i<height; i++) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
99 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
100 memcpy(dst, src, bytesPerLine); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
101 src+= srcStride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
102 dst+= dstStride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
103 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
104 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
105 return retval; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
106 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
107 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
108 #define PDIFFUB(X,Y,T) "movq " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
109 "psubusb " #Y "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
110 "psubusb " #X "," #Y "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
111 "paddusb " #Y "," #T "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
112 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
113 #define PDIFFUBT(X,Y,T) "movq " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
114 "psubusb " #Y "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
115 "psubusb " #X "," #Y "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
116 "paddusb " #T "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
117 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
118 #define PSUMBW(X,T,Z) "movq " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
119 "punpcklbw " #Z "," #X "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
120 "punpckhbw " #Z "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
121 "paddw " #T "," #X "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
122 "movq " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
123 "psllq $32, " #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
124 "paddw " #T "," #X "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
125 "movq " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
126 "psllq $16, " #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
127 "paddw " #T "," #X "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
128 "psrlq $48, " #X "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
129 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
130 #define PSADBW(X,Y,T,Z) PDIFFUBT(X,Y,T) PSUMBW(Y,T,Z) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
131 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
132 #define PMAXUB(X,Y) "psubusb " #X "," #Y "\n\tpaddusb " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
133 #define PMAXUW(X,Y) "psubusw " #X "," #Y "\n\tpaddusw " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
134 #define PMINUBT(X,Y,T) "movq " #Y "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
135 "psubusb " #X "," #T "\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
136 "psubusb " #T "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
137 #define PAVGB(X,Y) "pavgusb " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
138 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
139 static inline void |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
140 get_metrics_c(unsigned char *a, unsigned char *b, int as, int bs, int lines, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
141 struct metrics *m) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
142 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
143 a -= as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
144 b -= bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
145 do { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
146 cmmx_t old_po = *(cmmx_t*)(a ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
147 cmmx_t po = *(cmmx_t*)(b ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
148 cmmx_t e = *(cmmx_t*)(b + bs); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
149 cmmx_t old_o = *(cmmx_t*)(a + 2*as); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
150 cmmx_t o = *(cmmx_t*)(b + 2*bs); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
151 cmmx_t ne = *(cmmx_t*)(b + 3*bs); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
152 cmmx_t old_no = *(cmmx_t*)(a + 4*as); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
153 cmmx_t no = *(cmmx_t*)(b + 4*bs); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
154 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
155 cmmx_t qup_old_odd = p31avgb(old_o, old_po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
156 cmmx_t qup_odd = p31avgb( o, po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
157 cmmx_t qdown_old_odd = p31avgb(old_o, old_no); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
158 cmmx_t qdown_odd = p31avgb( o, no); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
159 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
160 cmmx_t qup_even = p31avgb(ne, e); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
161 cmmx_t qdown_even = p31avgb(e, ne); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
162 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
163 cmmx_t temp_up_diff = pdiffub(qdown_even, qup_old_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
164 cmmx_t noise_up_diff = pdiffub(qdown_even, qup_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
165 cmmx_t temp_down_diff = pdiffub(qup_even, qdown_old_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
166 cmmx_t noise_down_diff = pdiffub(qup_even, qdown_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
167 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
168 cmmx_t odd_diff = pdiffub(o, old_o); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
169 m->odd += psumbw(odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
170 m->even += psadbw(e, *(cmmx_t*)(a+as)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
171 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
172 temp_up_diff = pminub(temp_up_diff, temp_down_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
173 temp_up_diff = pminub(temp_up_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
174 m->temp += psumbw(temp_up_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
175 noise_up_diff = pminub(noise_up_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
176 noise_up_diff = pminub(noise_up_diff, noise_down_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
177 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
178 m->noise += psumbw(noise_up_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
179 a += 2*as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
180 b += 2*bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
181 } while (--lines); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
182 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
183 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
184 static inline void |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
185 get_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
186 int lines, struct metrics *m) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
187 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
188 a -= as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
189 b -= bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
190 do { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
191 cmmx_t old_po = (*(cmmx_t*)(a ) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
192 cmmx_t po = (*(cmmx_t*)(b ) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
193 cmmx_t old_e = (*(cmmx_t*)(a + as) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
194 cmmx_t e = (*(cmmx_t*)(b + bs) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
195 cmmx_t old_o = (*(cmmx_t*)(a + 2*as) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
196 cmmx_t o = (*(cmmx_t*)(b + 2*bs) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
197 cmmx_t ne = (*(cmmx_t*)(b + 3*bs) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
198 cmmx_t old_no = (*(cmmx_t*)(a + 4*as) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
199 cmmx_t no = (*(cmmx_t*)(b + 4*bs) >> 1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
200 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
201 cmmx_t qup_old_odd = p31avgb_s(old_o, old_po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
202 cmmx_t qup_odd = p31avgb_s( o, po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
203 cmmx_t qdown_old_odd = p31avgb_s(old_o, old_no); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
204 cmmx_t qdown_odd = p31avgb_s( o, no); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
205 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
206 cmmx_t qup_even = p31avgb_s(ne, e); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
207 cmmx_t qdown_even = p31avgb_s(e, ne); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
208 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
209 cmmx_t temp_up_diff = pdiffub_s(qdown_even, qup_old_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
210 cmmx_t noise_up_diff = pdiffub_s(qdown_even, qup_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
211 cmmx_t temp_down_diff = pdiffub_s(qup_even, qdown_old_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
212 cmmx_t noise_down_diff = pdiffub_s(qup_even, qdown_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
213 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
214 cmmx_t odd_diff = pdiffub_s(o, old_o); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
215 m->odd += psumbw_s(odd_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
216 m->even += psadbw_s(e, old_e) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
217 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
218 temp_up_diff = pminub_s(temp_up_diff, temp_down_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
219 temp_up_diff = pminub_s(temp_up_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
220 m->temp += psumbw_s(temp_up_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
221 noise_up_diff = pminub_s(noise_up_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
222 noise_up_diff = pminub_s(noise_up_diff, noise_down_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
223 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
224 m->noise += psumbw_s(noise_up_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
225 a += 2*as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
226 b += 2*bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
227 } while (--lines); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
228 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
229 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
230 static inline void |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
231 get_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
232 int lines, struct metrics *m) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
233 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
234 a -= as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
235 b -= bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
236 do { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
237 cmmx_t old_po = (*(cmmx_t*)(a )>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
238 cmmx_t po = (*(cmmx_t*)(b )>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
239 cmmx_t old_e = (*(cmmx_t*)(a + as)>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
240 cmmx_t e = (*(cmmx_t*)(b + bs)>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
241 cmmx_t old_o = (*(cmmx_t*)(a + 2*as)>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
242 cmmx_t o = (*(cmmx_t*)(b + 2*bs)>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
243 cmmx_t ne = (*(cmmx_t*)(b + 3*bs)>>1) & ~SIGN_BITS; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
244 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
245 cmmx_t down_even = p31avgb_s(e, ne); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
246 cmmx_t up_odd = p31avgb_s(o, po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
247 cmmx_t up_old_odd = p31avgb_s(old_o, old_po); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
248 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
249 cmmx_t odd_diff = pdiffub_s(o, old_o); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
250 cmmx_t temp_diff = pdiffub_s(down_even, up_old_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
251 cmmx_t noise_diff = pdiffub_s(down_even, up_odd); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
252 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
253 m->even += psadbw_s(e, old_e) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
254 m->odd += psumbw_s(odd_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
255 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
256 temp_diff = pminub_s(temp_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
257 noise_diff = pminub_s(noise_diff, odd_diff); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
258 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
259 m->noise += psumbw_s(noise_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
260 m->temp += psumbw_s(temp_diff) << 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
261 a += 2*as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
262 b += 2*bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
263 } while (--lines); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
264 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
265 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
266 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
267 static inline void |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
268 get_block_stats(struct metrics *m, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
269 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
270 unsigned two_e = m->even + MAX(m->even , p->thres.even ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
271 unsigned two_o = m->odd + MAX(m->odd , p->thres.odd ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
272 unsigned two_n = m->noise + MAX(m->noise, p->thres.noise); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
273 unsigned two_t = m->temp + MAX(m->temp , p->thres.temp ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
274 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
275 unsigned e_big = m->even >= (m->odd + two_o + 1)/2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
276 unsigned o_big = m->odd >= (m->even + two_e + 1)/2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
277 unsigned n_big = m->noise >= (m->temp + two_t + 1)/2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
278 unsigned t_big = m->temp >= (m->noise + two_n + 1)/2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
279 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
280 unsigned e2x = m->even >= two_o; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
281 unsigned o2x = m->odd >= two_e; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
282 unsigned n2x = m->noise >= two_t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
283 unsigned t2x = m->temp >= two_n; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
284 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
285 unsigned ntiny_e = m->even > p->thres.even ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
286 unsigned ntiny_o = m->odd > p->thres.odd ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
287 unsigned ntiny_n = m->noise > p->thres.noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
288 unsigned ntiny_t = m->temp > p->thres.temp ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
289 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
290 unsigned nlow_e = m->even > 2*p->thres.even ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
291 unsigned nlow_o = m->odd > 2*p->thres.odd ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
292 unsigned nlow_n = m->noise > 2*p->thres.noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
293 unsigned nlow_t = m->temp > 2*p->thres.temp ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
294 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
295 unsigned high_e = m->even > 4*p->thres.even ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
296 unsigned high_o = m->odd > 4*p->thres.odd ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
297 unsigned high_n = m->noise > 4*p->thres.noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
298 unsigned high_t = m->temp > 4*p->thres.temp ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
299 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
300 unsigned low_il = !n_big && !t_big && ntiny_n && ntiny_t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
301 unsigned high_il = !n_big && !t_big && nlow_n && nlow_t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
302 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
303 if (low_il | high_il) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
304 s->interlaced_low += low_il; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
305 s->interlaced_high += high_il; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
306 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
307 s->tiny.even += ntiny_e; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
308 s->tiny.odd += ntiny_o; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
309 s->tiny.noise += ntiny_n; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
310 s->tiny.temp += ntiny_t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
311 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
312 s->low .even += nlow_e ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
313 s->low .odd += nlow_o ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
314 s->low .noise += nlow_n ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
315 s->low .temp += nlow_t ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
316 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
317 s->high.even += high_e ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
318 s->high.odd += high_o ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
319 s->high.noise += high_n ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
320 s->high.temp += high_t ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
321 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
322 if (m->even >= p->sad_thres) s->sad.even += m->even ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
323 if (m->odd >= p->sad_thres) s->sad.odd += m->odd ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
324 if (m->noise >= p->sad_thres) s->sad.noise += m->noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
325 if (m->temp >= p->sad_thres) s->sad.temp += m->temp ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
326 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
327 s->num_blocks++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
328 s->max.even = MAX(s->max.even , m->even ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
329 s->max.odd = MAX(s->max.odd , m->odd ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
330 s->max.noise = MAX(s->max.noise, m->noise); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
331 s->max.temp = MAX(s->max.temp , m->temp ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
332 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
333 s->bigger.even += e_big ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
334 s->bigger.odd += o_big ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
335 s->bigger.noise += n_big ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
336 s->bigger.temp += t_big ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
337 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
338 s->twox.even += e2x ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
339 s->twox.odd += o2x ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
340 s->twox.noise += n2x ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
341 s->twox.temp += t2x ; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
342 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
343 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
344 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
345 static inline struct metrics |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
346 block_metrics_c(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
347 int lines, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
348 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
349 struct metrics tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
350 tm.even = tm.odd = tm.noise = tm.temp = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
351 get_metrics_c(a, b, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
352 if (sizeof(cmmx_t) < 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
353 get_metrics_c(a+4, b+4, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
354 get_block_stats(&tm, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
355 return tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
356 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
357 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
358 static inline struct metrics |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
359 block_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
360 int lines, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
361 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
362 struct metrics tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
363 tm.even = tm.odd = tm.noise = tm.temp = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
364 get_metrics_fast_c(a, b, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
365 if (sizeof(cmmx_t) < 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
366 get_metrics_fast_c(a+4, b+4, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
367 get_block_stats(&tm, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
368 return tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
369 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
370 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
371 static inline struct metrics |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
372 block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
373 int lines, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
374 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
375 struct metrics tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
376 tm.even = tm.odd = tm.noise = tm.temp = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
377 get_metrics_faster_c(a, b, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
378 if (sizeof(cmmx_t) < 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
379 get_metrics_faster_c(a+4, b+4, as, bs, lines, &tm); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
380 get_block_stats(&tm, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
381 return tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
382 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
383 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
384 #define MEQ(X,Y) ((X).even == (Y).even && (X).odd == (Y).odd && (X).temp == (Y).temp && (X).noise == (Y).noise) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
385 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
386 #define BLOCK_METRICS_TEMPLATE() \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
387 asm volatile("pxor %mm7, %mm7\n\t" /* The result is colleted in mm7 */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
388 "pxor %mm6, %mm6\n\t" /* Temp to stay at 0 */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
389 ); \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
390 a -= as; \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
391 b -= bs; \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
392 do { \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
393 asm volatile( \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
394 "movq (%0,%2), %%mm0\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
395 "movq (%1,%3), %%mm1\n\t" /* mm1 = even */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
396 PSADBW(%%mm1, %%mm0, %%mm4, %%mm6) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
397 "paddusw %%mm0, %%mm7\n\t" /* even diff */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
398 "movq (%0,%2,2), %%mm0\n\t" /* mm0 = old odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
399 "movq (%1,%3,2), %%mm2\n\t" /* mm2 = odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
400 "movq (%0), %%mm3\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
401 "psubusb %4, %%mm3\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
402 PAVGB(%%mm0, %%mm3) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
403 PAVGB(%%mm0, %%mm3) /* mm3 = qup old odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
404 "movq %%mm0, %%mm5\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
405 PSADBW(%%mm2, %%mm0, %%mm4, %%mm6) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
406 "psllq $16, %%mm0\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
407 "paddusw %%mm0, %%mm7\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
408 "movq (%1), %%mm4\n\t" \ |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12255
diff
changeset
|
409 "lea (%0,%2,2), %0\n\t" \ |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12255
diff
changeset
|
410 "lea (%1,%3,2), %1\n\t" \ |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
411 "psubusb %4, %%mm4\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
412 PAVGB(%%mm2, %%mm4) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
413 PAVGB(%%mm2, %%mm4) /* mm4 = qup odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
414 PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 =abs(oldodd-odd) */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
415 "movq (%1,%3), %%mm5\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
416 "psubusb %4, %%mm5\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
417 PAVGB(%%mm1, %%mm5) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
418 PAVGB(%%mm5, %%mm1) /* mm1 = qdown even */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
419 PAVGB((%1,%3), %%mm5) /* mm5 = qup next even */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
420 PDIFFUBT(%%mm1, %%mm3, %%mm0) /* mm3 = abs(qupoldo-qde) */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
421 PDIFFUBT(%%mm1, %%mm4, %%mm0) /* mm4 = abs(qupodd-qde) */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
422 PMINUBT(%%mm2, %%mm3, %%mm0) /* limit temp to odd diff */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
423 PMINUBT(%%mm2, %%mm4, %%mm0) /* limit noise to odd diff */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
424 "movq (%1,%3,2), %%mm2\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
425 "psubusb %4, %%mm2\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
426 PAVGB((%1), %%mm2) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
427 PAVGB((%1), %%mm2) /* mm2 = qdown odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
428 "movq (%0,%2,2), %%mm1\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
429 "psubusb %4, %%mm1\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
430 PAVGB((%0), %%mm1) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
431 PAVGB((%0), %%mm1) /* mm1 = qdown old odd */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
432 PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 = abs(qdo-qune) */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
433 PDIFFUBT(%%mm5, %%mm1, %%mm0) /* mm1 = abs(qdoo-qune) */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
434 PMINUBT(%%mm4, %%mm2, %%mm0) /* current */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
435 PMINUBT(%%mm3, %%mm1, %%mm0) /* old */ \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
436 PSUMBW(%%mm2, %%mm0, %%mm6) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
437 PSUMBW(%%mm1, %%mm0, %%mm6) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
438 "psllq $32, %%mm2\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
439 "psllq $48, %%mm1\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
440 "paddusw %%mm2, %%mm7\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
441 "paddusw %%mm1, %%mm7\n\t" \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
442 : "=r" (a), "=r" (b) \ |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12255
diff
changeset
|
443 : "r"((long)as), "r"((long)bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \ |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
444 ); \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
445 } while (--lines); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
446 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
447 static inline struct metrics |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
448 block_metrics_3dnow(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
449 int lines, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
450 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
451 struct metrics tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
452 #ifndef HAVE_3DNOW |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
453 mp_msg(MSGT_VFILTER, MSGL_FATAL, "block_metrics_3dnow: internal error\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
454 #else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
455 static const unsigned long long ones = 0x0101010101010101ull; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
456 unsigned long interlaced; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
457 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
458 BLOCK_METRICS_TEMPLATE(); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
459 asm volatile("movq %%mm7, %0\n\temms" : "=m" (tm)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
460 get_block_stats(&tm, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
461 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
462 return tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
463 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
464 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
465 #undef PSUMBW |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
466 #undef PSADBW |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
467 #undef PMAXUB |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
468 #undef PMINUBT |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
469 #undef PAVGB |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
470 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
471 #define PSUMBW(X,T,Z) "psadbw " #Z "," #X "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
472 #define PSADBW(X,Y,T,Z) "psadbw " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
473 #define PMAXUB(X,Y) "pmaxub " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
474 #define PMINUBT(X,Y,T) "pminub " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
475 #define PAVGB(X,Y) "pavgb " #X "," #Y "\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
476 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
477 static inline struct metrics |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
478 block_metrics_mmx2(unsigned char *a, unsigned char *b, int as, int bs, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
479 int lines, struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
480 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
481 struct metrics tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
482 #ifndef HAVE_MMX |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
483 mp_msg(MSGT_VFILTER, MSGL_FATAL, "block_metrics_mmx2: internal error\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
484 #else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
485 static const unsigned long long ones = 0x0101010101010101ull; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
486 unsigned long interlaced; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
487 unsigned long prefetch_line = (((long)a>>3) & 7) + 10; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
488 #ifdef DEBUG |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
489 struct frame_stats ts = *s; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
490 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
491 asm volatile("prefetcht0 (%0,%2)\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
492 "prefetcht0 (%1,%3)\n\t" : |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
493 : "r" (a), "r" (b), |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
494 "r" (prefetch_line * as), "r" (prefetch_line * bs)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
495 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
496 BLOCK_METRICS_TEMPLATE(); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
497 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
498 s->num_blocks++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
499 asm volatile( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
500 "movq %3, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
501 "movq %%mm7, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
502 "psubusw %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
503 "movq %%mm1, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
504 "paddusw %%mm0, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
505 "paddusw %%mm7, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
506 "pshufw $0xb1, %%mm2, %%mm3\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
507 "pavgw %%mm7, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
508 "pshufw $0xb1, %%mm2, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
509 "psubusw %%mm7, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
510 "pcmpeqw %%mm6, %%mm2\n\t" /* 1 if >= 1.5x */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
511 "psubusw %%mm7, %%mm3\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
512 "pcmpeqw %%mm6, %%mm3\n\t" /* 1 if >= 2x */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
513 "movq %1, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
514 "movq %2, %%mm5\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
515 "psubw %%mm2, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
516 "psubw %%mm3, %%mm5\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
517 "movq %%mm4, %1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
518 "movq %%mm5, %2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
519 "pxor %%mm4, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
520 "pcmpeqw %%mm1, %%mm4\n\t" /* 1 if <= t */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
521 "psubusw %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
522 "pxor %%mm5, %%mm5\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
523 "pcmpeqw %%mm1, %%mm5\n\t" /* 1 if <= 2t */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
524 "psubusw %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
525 "psubusw %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
526 "pcmpeqw %%mm6, %%mm1\n\t" /* 1 if <= 4t */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
527 "pshufw $0xb1, %%mm2, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
528 "por %%mm2, %%mm0\n\t" /* 1 if not close */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
529 "punpckhdq %%mm0, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
530 "movq %%mm4, %%mm2\n\t" /* tttt */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
531 "punpckhdq %%mm5, %%mm2\n\t" /* ttll */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
532 "por %%mm2, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
533 "pcmpeqd %%mm6, %%mm0\n\t" /* close && big */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
534 "psrlq $16, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
535 "psrlw $15, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
536 "movd %%mm0, %0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
537 : "=r" (interlaced), "=m" (s->bigger), "=m" (s->twox) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
538 : "m" (p->thres) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
539 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
540 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
541 if (interlaced) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
542 s->interlaced_high += interlaced >> 16; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
543 s->interlaced_low += interlaced; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
544 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
545 asm volatile( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
546 "pcmpeqw %%mm0, %%mm0\n\t" /* -1 */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
547 "psubw %%mm0, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
548 "psubw %%mm0, %%mm5\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
549 "psubw %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
550 "paddw %0, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
551 "paddw %1, %%mm5\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
552 "paddw %2, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
553 "movq %%mm4, %0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
554 "movq %%mm5, %1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
555 "movq %%mm1, %2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
556 : "=m" (s->tiny), "=m" (s->low), "=m" (s->high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
557 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
558 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
559 asm volatile( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
560 "pshufw $0, %2, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
561 "psubusw %%mm7, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
562 "pcmpeqw %%mm6, %%mm0\n\t" /* 0 if below sad_thres */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
563 "pand %%mm7, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
564 "movq %%mm0, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
565 "punpcklwd %%mm6, %%mm0\n\t" /* sad even, odd */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
566 "punpckhwd %%mm6, %%mm1\n\t" /* sad noise, temp */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
567 "paddd %0, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
568 "paddd %1, %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
569 "movq %%mm0, %0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
570 "movq %%mm1, %1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
571 : "=m" (s->sad.even), "=m" (s->sad.noise) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
572 : "m" (p->sad_thres) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
573 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
574 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
575 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
576 asm volatile( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
577 "movq %%mm7, (%1)\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
578 PMAXUW((%0), %%mm7) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
579 "movq %%mm7, (%0)\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
580 "emms" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
581 : : "r" (&s->max), "r" (&tm), "X" (s->max) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
582 : "memory" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
583 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
584 #ifdef DEBUG |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
585 if (1) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
586 struct metrics cm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
587 a -= 7*as; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
588 b -= 7*bs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
589 cm = block_metrics_c(a, b, as, bs, 4, p, &ts); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
590 if (!MEQ(tm, cm)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
591 mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad metrics\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
592 if (s) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
593 # define CHECK(X) if (!MEQ(s->X, ts.X)) \ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
594 mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad " #X "\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
595 CHECK(tiny); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
596 CHECK(low); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
597 CHECK(high); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
598 CHECK(sad); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
599 CHECK(max); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
600 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
601 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
602 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
603 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
604 return tm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
605 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
606 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
607 static inline int |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
608 dint_copy_line_mmx2(unsigned char *dst, unsigned char *a, long bos, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
609 long cos, int ds, int ss, int w, int t) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
610 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
611 #ifndef HAVE_MMX |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
612 mp_msg(MSGT_VFILTER, MSGL_FATAL, "dint_copy_line_mmx2: internal error\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
613 return 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
614 #else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
615 unsigned long len = (w+7) >> 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
616 int ret; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
617 asm volatile ( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
618 "pxor %%mm6, %%mm6 \n\t" /* deinterlaced pixel counter */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
619 "movd %0, %%mm7 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
620 "punpcklbw %%mm7, %%mm7 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
621 "punpcklwd %%mm7, %%mm7 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
622 "punpckldq %%mm7, %%mm7 \n\t" /* mm7 = threshold */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
623 : /* no output */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
624 : "rm" (t) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
625 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
626 do { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
627 asm volatile ( |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
628 "movq (%0), %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
629 "movq (%0,%3,2), %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
630 "movq %%mm0, (%2)\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
631 "pmaxub %%mm1, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
632 "pavgb (%0), %%mm1\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
633 "psubusb %%mm1, %%mm0\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
634 "paddusb %%mm7, %%mm0\n\t" /* mm0 = max-avg+thr */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
635 "movq (%0,%1), %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
636 "movq (%0,%5), %%mm3\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
637 "movq %%mm2, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
638 PDIFFUBT(%%mm1, %%mm2, %%mm5) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
639 PDIFFUBT(%%mm1, %%mm3, %%mm5) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
640 "pminub %%mm2, %%mm3\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
641 "pcmpeqb %%mm3, %%mm2\n\t" /* b = min */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
642 "pand %%mm2, %%mm4\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
643 "pandn (%0,%5), %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
644 "por %%mm4, %%mm2\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
645 "pminub %%mm0, %%mm3\n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
646 "pcmpeqb %%mm0, %%mm3\n\t" /* set to 1s if >= threshold */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
647 "psubb %%mm3, %%mm6\n\t" /* count pixels above thr. */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
648 "pand %%mm3, %%mm1 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
649 "pandn %%mm2, %%mm3 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
650 "por %%mm3, %%mm1 \n\t" /* avg if >= threshold */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
651 "movq %%mm1, (%2,%4) \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
652 : /* no output */ |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12255
diff
changeset
|
653 : "r" (a), "r" (bos), "r" (dst), "r" ((long)ss), "r" ((long)ds), "r" (cos) |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
654 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
655 a += 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
656 dst += 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
657 } while (--len); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
658 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
659 asm volatile ("pxor %%mm7, %%mm7 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
660 "psadbw %%mm6, %%mm7 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
661 "movd %%mm7, %0 \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
662 "emms \n\t" |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
663 : "=r" (ret) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
664 ); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
665 return ret; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
666 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
667 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
668 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
669 static inline int |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
670 dint_copy_line(unsigned char *dst, unsigned char *a, long bos, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
671 long cos, int ds, int ss, int w, int t) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
672 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
673 unsigned long len = ((unsigned long)w+sizeof(cmmx_t)-1) / sizeof(cmmx_t); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
674 cmmx_t dint_count = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
675 cmmx_t thr; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
676 t |= t << 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
677 thr = t | (t << 16); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
678 if (sizeof(cmmx_t) > 4) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
679 thr |= thr << (sizeof(cmmx_t)*4); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
680 do { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
681 cmmx_t e = *(cmmx_t*)a; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
682 cmmx_t ne = *(cmmx_t*)(a+2*ss); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
683 cmmx_t o = *(cmmx_t*)(a+bos); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
684 cmmx_t oo = *(cmmx_t*)(a+cos); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
685 cmmx_t maxe = pmaxub(e, ne); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
686 cmmx_t avge = pavgb(e, ne); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
687 cmmx_t max_diff = maxe - avge + thr; /* 0<=max-avg<128, thr<128 */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
688 cmmx_t diffo = pdiffub(avge, o); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
689 cmmx_t diffoo = pdiffub(avge, oo); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
690 cmmx_t diffcmp = pcmpgtub(diffo, diffoo); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
691 cmmx_t bo = ((oo ^ o) & diffcmp) ^ o; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
692 cmmx_t diffbo = ((diffoo ^ diffo) & diffcmp) ^ diffo; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
693 cmmx_t above_thr = ~pcmpgtub(max_diff, diffbo); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
694 cmmx_t bo_or_avg = ((avge ^ bo) & above_thr) ^ bo; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
695 dint_count += above_thr & ONE_BYTES; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
696 *(cmmx_t*)(dst) = e; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
697 *(cmmx_t*)(dst+ds) = bo_or_avg; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
698 a += sizeof(cmmx_t); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
699 dst += sizeof(cmmx_t); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
700 } while (--len); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
701 return psumbw(dint_count); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
702 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
703 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
704 static int |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
705 dint_copy_plane(unsigned char *d, unsigned char *a, unsigned char *b, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
706 unsigned char *c, unsigned long w, unsigned long h, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
707 unsigned long ds, unsigned long ss, unsigned long threshold, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
708 long field, long mmx2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
709 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
710 unsigned long ret = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
711 long bos = b - a; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
712 long cos = c - a; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
713 if (field) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
714 memcpy(d, b, w); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
715 h--; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
716 d += ds; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
717 a += ss; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
718 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
719 bos += ss; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
720 cos += ss; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
721 while (h > 2) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
722 if (threshold >= 128) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
723 memcpy(d, a, w); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
724 memcpy(d+ds, a+bos, w); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
725 } else if (mmx2 == 1) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
726 ret += dint_copy_line_mmx2(d, a, bos, cos, ds, ss, w, threshold); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
727 } else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
728 ret += dint_copy_line(d, a, bos, cos, ds, ss, w, threshold); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
729 h -= 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
730 d += 2*ds; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
731 a += 2*ss; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
732 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
733 memcpy(d, a, w); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
734 if (h == 2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
735 memcpy(d+ds, a+bos, w); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
736 return ret; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
737 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
738 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
739 static void |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
740 copy_merge_fields(struct vf_priv_s *p, mp_image_t *dmpi, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
741 unsigned char **old, unsigned char **new, unsigned long show) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
742 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
743 unsigned long threshold = 256; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
744 unsigned long field = p->swapped; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
745 unsigned long dint_pixels = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
746 unsigned char **other = old; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
747 if (show >= 12 || !(show & 3)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
748 show >>= 2, other = new, new = old; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
749 if (show <= 2) { /* Single field: de-interlace */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
750 threshold = p->dint_thres; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
751 field ^= show & 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
752 old = new; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
753 } else if (show == 3) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
754 old = new; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
755 else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
756 field ^= 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
757 dint_pixels +=dint_copy_plane(dmpi->planes[0], old[0], new[0], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
758 other[0], p->w, p->h, dmpi->stride[0], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
759 p->stride, threshold, field, p->mmx2); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
760 if (dmpi->flags & MP_IMGFLAG_PLANAR) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
761 if (p->luma_only) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
762 old = new, other = new; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
763 else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
764 threshold = threshold/2 + 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
765 field ^= p->chroma_swapped; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
766 dint_copy_plane(dmpi->planes[1], old[1], new[1], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
767 other[1], p->cw, p->ch, dmpi->stride[1], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
768 p->chroma_stride, threshold, field, p->mmx2); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
769 dint_copy_plane(dmpi->planes[2], old[2], new[2], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
770 other[2], p->cw, p->ch, dmpi->stride[2], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
771 p->chroma_stride, threshold, field, p->mmx2); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
772 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
773 if (dint_pixels > 0 && p->verbose) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
774 mp_msg(MSGT_VFILTER,MSGL_INFO,"Deinterlaced %lu pixels\n",dint_pixels); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
775 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
776 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
777 static void diff_planes(struct vf_priv_s *p, struct frame_stats *s, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
778 unsigned char *of, unsigned char *nf, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
779 int w, int h, int os, int ns, int swapped) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
780 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
781 int i, y; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
782 int align = -(long)nf & 7; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
783 of += align; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
784 nf += align; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
785 w -= align; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
786 if (swapped) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
787 of -= os, nf -= ns; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
788 i = (h*3 >> 7) & ~1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
789 of += i*os + 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
790 nf += i*ns + 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
791 h -= i; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
792 w -= 16; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
793 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
794 memset(s, 0, sizeof(*s)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
795 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
796 for (y = (h-8) >> 3; y; y--) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
797 if (p->mmx2 == 1) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
798 for (i = 0; i < w; i += 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
799 block_metrics_mmx2(of+i, nf+i, os, ns, 4, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
800 } else if (p->mmx2 == 2) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
801 for (i = 0; i < w; i += 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
802 block_metrics_3dnow(of+i, nf+i, os, ns, 4, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
803 } else if (p->fast > 3) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
804 for (i = 0; i < w; i += 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
805 block_metrics_faster_c(of+i, nf+i, os, ns, 4, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
806 } else if (p->fast > 1) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
807 for (i = 0; i < w; i += 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
808 block_metrics_fast_c(of+i, nf+i, os, ns, 4, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
809 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
810 for (i = 0; i < w; i += 8) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
811 block_metrics_c(of+i, nf+i, os, ns, 4, p, s); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
812 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
813 of += 8*os; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
814 nf += 8*ns; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
815 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
816 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
817 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
818 #define METRICS(X) (X).even, (X).odd, (X).noise, (X).temp |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
819 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
820 static void diff_fields(struct vf_priv_s *p, struct frame_stats *s, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
821 unsigned char **old, unsigned char **new) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
822 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
823 diff_planes(p, s, old[0], new[0], p->w, p->h, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
824 p->stride, p->stride, p->swapped); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
825 s->sad.even = (s->sad.even * 16ul) / s->num_blocks; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
826 s->sad.odd = (s->sad.odd * 16ul) / s->num_blocks; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
827 s->sad.noise = (s->sad.noise * 16ul) / s->num_blocks; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
828 s->sad.temp = (s->sad.temp * 16ul) / s->num_blocks; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
829 if (p->verbose) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
830 mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu%c M:%d/%d/%d/%d - %d, " |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
831 "t:%d/%d/%d/%d, l:%d/%d/%d/%d, h:%d/%d/%d/%d, bg:%d/%d/%d/%d, " |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
832 "2x:%d/%d/%d/%d, sad:%d/%d/%d/%d, lil:%d, hil:%d, ios:%.1f\n", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
833 p->inframes, p->chflag, METRICS(s->max), s->num_blocks, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
834 METRICS(s->tiny), METRICS(s->low), METRICS(s->high), |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
835 METRICS(s->bigger), METRICS(s->twox), METRICS(s->sad), |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
836 s->interlaced_low, s->interlaced_high, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
837 p->iosync / (double) p->in_inc); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
838 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
839 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
840 static const char *parse_args(struct vf_priv_s *p, const char *args) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
841 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
842 args--; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
843 while (args && *++args && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
844 (sscanf(args, "io=%lu:%lu", &p->out_dec, &p->in_inc) == 2 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
845 sscanf(args, "diff_thres=%hu", &p->thres.even ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
846 sscanf(args, "comb_thres=%hu", &p->thres.noise) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
847 sscanf(args, "sad_thres=%lu", &p->sad_thres ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
848 sscanf(args, "dint_thres=%lu", &p->dint_thres ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
849 sscanf(args, "fast=%u", &p->fast ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
850 sscanf(args, "mmx2=%lu", &p->mmx2 ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
851 sscanf(args, "luma_only=%u", &p->luma_only ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
852 sscanf(args, "verbose=%u", &p->verbose ) == 1 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
853 sscanf(args, "crop=%lu:%lu:%lu:%lu", &p->w, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
854 &p->h, &p->crop_x, &p->crop_y) == 4)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
855 args = strchr(args, '/'); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
856 return args; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
857 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
858 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
859 static unsigned long gcd(unsigned long x, unsigned long y) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
860 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
861 unsigned long t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
862 if (x > y) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
863 t = x, x = y, y = t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
864 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
865 while (x) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
866 t = y % x; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
867 y = x; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
868 x = t; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
869 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
870 return y; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
871 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
872 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
873 static void init(struct vf_priv_s *p, mp_image_t *mpi) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
874 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
875 unsigned long i; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
876 unsigned long plane_size, chroma_plane_size; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
877 unsigned char *plane; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
878 unsigned long cos, los; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
879 p->crop_cx = p->crop_x >> mpi->chroma_x_shift; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
880 p->crop_cy = p->crop_y >> mpi->chroma_y_shift; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
881 if (mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
882 p->stride = (mpi->w + 15) & ~15; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
883 p->chroma_stride = p->stride >> mpi->chroma_x_shift; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
884 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
885 p->stride = mpi->width; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
886 p->chroma_stride = mpi->chroma_width; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
887 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
888 p->cw = p->w >> mpi->chroma_x_shift; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
889 p->ch = p->h >> mpi->chroma_y_shift; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
890 p->nplanes = 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
891 p->static_idx = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
892 p->temp_idx = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
893 p->old_planes = p->planes[0]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
894 plane_size = mpi->h * p->stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
895 chroma_plane_size = mpi->flags & MP_IMGFLAG_PLANAR ? |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
896 mpi->chroma_height * p->chroma_stride : 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
897 p->memory_allocated = |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
898 malloc(NUM_STORED * (plane_size+2*chroma_plane_size) + |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
899 8*p->chroma_stride + 4096); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
900 /* align to page boundary */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
901 plane = p->memory_allocated + (-(long)p->memory_allocated & 4095); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
902 memset(plane, 0, NUM_STORED * plane_size); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
903 los = p->crop_x + p->crop_y * p->stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
904 cos = p->crop_cx + p->crop_cy * p->chroma_stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
905 for (i = 0; i != NUM_STORED; i++, plane += plane_size) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
906 p->planes[i][0] = plane; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
907 p->planes[NUM_STORED + i][0] = plane + los; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
908 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
909 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
910 p->nplanes = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
911 memset(plane, 0x80, NUM_STORED * 2 * chroma_plane_size); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
912 for (i = 0; i != NUM_STORED; i++) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
913 p->planes[i][1] = plane; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
914 p->planes[NUM_STORED + i][1] = plane + cos; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
915 plane += chroma_plane_size; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
916 p->planes[i][2] = plane; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
917 p->planes[NUM_STORED + i][2] = plane + cos; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
918 plane += chroma_plane_size; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
919 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
920 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
921 p->out_dec <<= 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
922 i = gcd(p->in_inc, p->out_dec); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
923 p->in_inc /= i; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
924 p->out_dec /= i; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
925 p->iosync = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
926 p->num_fields = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
927 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
928 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
929 static inline double get_time(void) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
930 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
931 struct timeval tv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
932 gettimeofday(&tv, 0); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
933 return tv.tv_sec + tv.tv_usec * 1e-6; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
934 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
935 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
936 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
937 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
938 struct vf_priv_s *p = vf->priv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
939 static unsigned char **planes, planes_idx; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
940 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
941 if (mpi->type == MP_IMGTYPE_STATIC) return; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
942 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
943 if (!p->planes[0][0]) init(p, mpi); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
944 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
945 if (mpi->type == MP_IMGTYPE_TEMP || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
946 (mpi->type == MP_IMGTYPE_IPB && !(mpi->flags & MP_IMGFLAG_READABLE))) |
12255 | 947 planes_idx = NUM_STORED/2 + (++p->temp_idx % (NUM_STORED/2)); |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
948 else |
12255 | 949 planes_idx = ++p->static_idx % (NUM_STORED/2); |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
950 planes = p->planes[planes_idx]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
951 mpi->priv = p->planes[NUM_STORED + planes_idx]; |
12255 | 952 if (mpi->priv == p->old_planes) { |
953 unsigned char **old_planes = | |
954 p->planes[NUM_STORED + 2 + (++p->temp_idx & 1)]; | |
955 my_memcpy_pic(old_planes[0], p->old_planes[0], | |
956 p->w, p->h, p->stride, p->stride); | |
957 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
958 my_memcpy_pic(old_planes[1], p->old_planes[1], | |
959 p->cw, p->ch, p->chroma_stride, p->chroma_stride); | |
960 my_memcpy_pic(old_planes[2], p->old_planes[2], | |
961 p->cw, p->ch, p->chroma_stride, p->chroma_stride); | |
962 } | |
963 p->old_planes = old_planes; | |
964 p->num_copies++; | |
965 } | |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
966 mpi->planes[0] = planes[0]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
967 mpi->stride[0] = p->stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
968 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
969 mpi->planes[1] = planes[1]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
970 mpi->planes[2] = planes[2]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
971 mpi->stride[1] = mpi->stride[2] = p->chroma_stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
972 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
973 mpi->width = p->stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
974 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
975 mpi->flags |= MP_IMGFLAG_DIRECT; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
976 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
977 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
978 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
979 static inline long |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
980 cmpe(unsigned long x, unsigned long y, unsigned long err, unsigned long e) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
981 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
982 long diff = x-y; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
983 long unit = ((x+y+err) >> e); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
984 long ret = (diff > unit) - (diff < -unit); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
985 unit >>= 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
986 return ret + (diff > unit) - (diff < -unit); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
987 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
988 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
989 static unsigned long |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
990 find_breaks(struct vf_priv_s *p, struct frame_stats *s) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
991 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
992 struct frame_stats *ps = &p->stats[(p->inframes-1) & 1]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
993 long notfilm = 5*p->in_inc - p->out_dec; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
994 unsigned long n = s->num_blocks >> 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
995 unsigned long sad_comb_cmp = cmpe(s->sad.temp, s->sad.noise, 512, 1); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
996 unsigned long ret = 8; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
997 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
998 if (cmpe(s->sad.temp, s->sad.even, 512, 1) > 0) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
999 mp_msg(MSGT_VFILTER, MSGL_WARN, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1000 "@@@@@@@@ Bottom-first field??? @@@@@@@@\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1001 if (s->sad.temp > 1000 && s->sad.noise > 1000) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1002 return 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1003 if (s->interlaced_high >= 2*n && s->sad.temp > 256 && s->sad.noise > 256) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1004 return 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1005 if (s->high.noise > s->num_blocks/4 && s->sad.noise > 10000 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1006 s->sad.noise > 2*s->sad.even && s->sad.noise > 2*ps->sad.odd) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1007 // Mid-frame scene change |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1008 if (s->tiny.temp + s->interlaced_low < n || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1009 s->low.temp + s->interlaced_high < n/4 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1010 s->high.temp + s->interlaced_high < n/8 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1011 s->sad.temp < 160) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1012 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1013 return 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1014 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1015 if (s->high.temp > s->num_blocks/4 && s->sad.temp > 10000 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1016 s->sad.temp > 2*ps->sad.odd && s->sad.temp > 2*ps->sad.even) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1017 // Start frame scene change |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1018 if (s->tiny.noise + s->interlaced_low < n || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1019 s->low.noise + s->interlaced_high < n/4 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1020 s->high.noise + s->interlaced_high < n/8 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1021 s->sad.noise < 160) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1022 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1023 return 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1024 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1025 if (sad_comb_cmp == 2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1026 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1027 if (sad_comb_cmp == -2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1028 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1029 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1030 if (s->tiny.odd > 3*MAX(n,s->tiny.even) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1031 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1032 if (s->tiny.even > 3*MAX(n,s->tiny.odd)+s->interlaced_low && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1033 (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1034 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1035 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1036 if (s->sad.noise < 64 && s->sad.temp < 64 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1037 s->low.noise <= n/2 && s->high.noise <= n/4 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1038 s->low.temp <= n/2 && s->high.temp <= n/4) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1039 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1040 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1041 if (s->tiny.temp > 3*MAX(n,s->tiny.noise) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1042 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1043 if (s->tiny.noise > 3*MAX(n,s->tiny.temp) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1044 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1045 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1046 if (s->low.odd > 3*MAX(n/4,s->low.even) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1047 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1048 if (s->low.even > 3*MAX(n/4,s->low.odd)+s->interlaced_high && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1049 s->sad.even > 2*s->sad.odd && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1050 (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1051 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1052 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1053 if (s->low.temp > 3*MAX(n/4,s->low.noise) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1054 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1055 if (s->low.noise > 3*MAX(n/4,s->low.temp) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1056 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1057 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1058 if (sad_comb_cmp == 1 && s->sad.noise < 64) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1059 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1060 if (sad_comb_cmp == -1 && s->sad.temp < 64) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1061 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1062 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1063 if (s->tiny.odd <= n || (s->tiny.noise <= n/2 && s->tiny.temp <= n/2)) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1064 if (s->interlaced_low <= n) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1065 if (p->num_fields == 1) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1066 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1067 if (s->tiny.even <= n || ps->tiny.noise <= n/2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1068 /* Still frame */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1069 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1070 if (s->bigger.even >= 2*MAX(n,s->bigger.odd) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1071 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1072 if (s->low.even >= 2*n + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1073 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1074 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1075 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1076 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1077 if (s->low.odd <= n/4) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1078 if (s->interlaced_high <= n/4) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1079 if (p->num_fields == 1) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1080 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1081 if (s->low.even <= n/4) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1082 /* Still frame */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1083 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1084 if (s->bigger.even >= 2*MAX(n/4,s->bigger.odd)+s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1085 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1086 if (s->low.even >= n/2 + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1087 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1088 goto still; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1089 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1090 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1091 if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1092 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1093 if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_low) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1094 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1095 if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1096 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1097 if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1098 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1099 if (s->twox.temp > 2*MAX(n,s->twox.noise) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1100 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1101 if (s->twox.noise > 2*MAX(n,s->twox.temp) + s->interlaced_high) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1102 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1103 if (s->bigger.even > 2*MAX(n,s->bigger.odd) + s->interlaced_low && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1104 s->bigger.temp < n && s->bigger.noise < n) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1105 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1106 if (s->interlaced_low > MIN(2*n, s->tiny.odd)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1107 return 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1108 ret = 8 + (1 << (s->sad.temp > s->sad.noise)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1109 still: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1110 if (p->num_fields == 1 && p->prev_fields == 3 && notfilm >= 0 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1111 (s->tiny.temp <= s->tiny.noise || s->sad.temp < s->sad.noise+16)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1112 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1113 if (p->notout < p->num_fields && p->iosync > 2*p->in_inc && notfilm < 0) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1114 notfilm = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1115 if (p->num_fields < 2 || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1116 (p->num_fields == 2 && p->prev_fields == 2 && notfilm < 0)) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1117 return ret; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1118 if (!notfilm && (p->prev_fields&~1) == 2) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1119 if (p->prev_fields + p->num_fields == 5) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1120 if (s->tiny.noise <= s->tiny.temp || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1121 s->low.noise == 0 || s->low.noise < s->low.temp || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1122 s->sad.noise < s->sad.temp+16) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1123 return 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1124 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1125 if (p->prev_fields + p->num_fields == 4) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1126 if (s->tiny.temp <= s->tiny.noise || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1127 s->low.temp == 0 || s->low.temp < s->low.noise || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1128 s->sad.temp < s->sad.noise+16) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1129 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1130 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1131 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1132 if (p->num_fields > 2 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1133 ps->sad.noise > s->sad.noise && ps->sad.noise > s->sad.temp) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1134 return 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1135 return 2 >> (s->sad.noise > s->sad.temp); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1136 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1137 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1138 #define ITOC(X) (!(X) ? ' ' : (X) + ((X)>9 ? 'a'-10 : '0')) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1139 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1140 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1141 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1142 mp_image_t *dmpi; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1143 struct vf_priv_s *p = vf->priv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1144 unsigned char **planes, **old_planes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1145 struct frame_stats *s = &p->stats[p->inframes & 1]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1146 struct frame_stats *ps = &p->stats[(p->inframes-1) & 1]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1147 int swapped = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1148 const int flags = mpi->fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1149 int breaks, prev; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1150 int show_fields = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1151 int dropped_fields = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1152 double start_time, diff_time; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1153 char prev_chflag = p->chflag; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1154 int keep_rate; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1155 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1156 if (!p->planes[0][0]) init(p, mpi); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1157 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1158 old_planes = p->old_planes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1159 |
12255 | 1160 if ((mpi->flags & MP_IMGFLAG_DIRECT) && mpi->priv) { |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1161 planes = mpi->priv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1162 mpi->priv = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1163 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1164 planes = p->planes[2 + (++p->temp_idx & 1)]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1165 my_memcpy_pic(planes[0], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1166 mpi->planes[0] + p->crop_x + p->crop_y * mpi->stride[0], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1167 p->w, p->h, p->stride, mpi->stride[0]); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1168 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1169 my_memcpy_pic(planes[1], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1170 mpi->planes[1] + p->crop_cx + p->crop_cy * mpi->stride[1], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1171 p->cw, p->ch, p->chroma_stride, mpi->stride[1]); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1172 my_memcpy_pic(planes[2], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1173 mpi->planes[2] + p->crop_cx + p->crop_cy * mpi->stride[2], |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1174 p->cw, p->ch, p->chroma_stride, mpi->stride[2]); |
12255 | 1175 p->num_copies++; |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1176 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1177 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1178 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1179 p->old_planes = planes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1180 p->chflag = ';'; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1181 if (flags & MP_IMGFIELD_ORDERED) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1182 swapped = !(flags & MP_IMGFIELD_TOP_FIRST); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1183 p->chflag = (flags & MP_IMGFIELD_REPEAT_FIRST ? '|' : |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1184 flags & MP_IMGFIELD_TOP_FIRST ? ':' : '.'); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1185 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1186 p->swapped = swapped; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1187 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1188 start_time = get_time(); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1189 if (p->chflag == '|') { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1190 *s = ppzs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1191 p->iosync += p->in_inc; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1192 } else if ((p->fast & 1) && prev_chflag == '|') |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1193 *s = pprs; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1194 else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1195 diff_fields(p, s, old_planes, planes); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1196 diff_time = get_time(); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1197 p->diff_time += diff_time - start_time; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1198 breaks = p->inframes ? find_breaks(p, s) : 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1199 p->inframes++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1200 keep_rate = 4*p->in_inc == p->out_dec; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1201 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1202 switch (breaks) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1203 case 0: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1204 case 8: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1205 case 9: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1206 case 10: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1207 if (!keep_rate && p->notout < p->num_fields && p->iosync < 2*p->in_inc) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1208 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1209 if (p->notout < p->num_fields) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1210 dropped_fields = -2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1211 case 4: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1212 if (keep_rate || p->iosync >= -2*p->in_inc) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1213 show_fields = (4<<p->num_fields)-1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1214 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1215 case 3: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1216 if (keep_rate) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1217 show_fields = 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1218 else if (p->iosync > 0) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1219 if (p->notout >= p->num_fields && p->iosync > 2*p->in_inc) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1220 show_fields = 4; /* prev odd only */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1221 if (p->num_fields > 1) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1222 show_fields |= 8; /* + prev even */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1223 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1224 show_fields = 2; /* even only */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1225 if (p->notout >= p->num_fields) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1226 dropped_fields += p->num_fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1227 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1228 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1229 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1230 case 2: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1231 if (p->iosync <= -3*p->in_inc) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1232 if (p->notout >= p->num_fields) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1233 dropped_fields = p->num_fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1234 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1235 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1236 if (p->num_fields == 1) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1237 int prevbreak = ps->sad.noise >= 128; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1238 if (p->iosync < 4*p->in_inc) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1239 show_fields = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1240 dropped_fields = prevbreak; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1241 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1242 show_fields = 4 | (!prevbreak << 3); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1243 if (p->notout < 1 + p->prev_fields) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1244 dropped_fields = -!prevbreak; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1245 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1246 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1247 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1248 default: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1249 if (keep_rate) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1250 show_fields = 3 << (breaks & 1); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1251 else if (p->notout >= p->num_fields && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1252 p->iosync >= (breaks == 1 ? -p->in_inc : |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1253 p->in_inc << (p->num_fields == 1))) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1254 show_fields = (1 << (2 + p->num_fields)) - (1<<breaks); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1255 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1256 if (p->notout >= p->num_fields) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1257 dropped_fields += p->num_fields + 2 - breaks; |
11623 | 1258 if (breaks == 1) { |
1259 if (p->iosync >= 4*p->in_inc) | |
1260 show_fields = 6; | |
1261 } else if (p->iosync > -3*p->in_inc) | |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1262 show_fields = 3; /* odd+even */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1263 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1264 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1265 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1266 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1267 show_fields &= 15; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1268 prev = p->prev_fields; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1269 if (breaks < 8) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1270 if (p->num_fields == 1) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1271 breaks &= ~4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1272 if (breaks) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1273 p->num_breaks++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1274 if (breaks == 3) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1275 p->prev_fields = p->num_fields = 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1276 else if (breaks) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1277 p->prev_fields = p->num_fields + (breaks==1) - (breaks==4); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1278 p->num_fields = breaks - (breaks == 4) + (p->chflag == '|'); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1279 } else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1280 p->num_fields += 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1281 } else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1282 p->num_fields += 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1283 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1284 p->iosync += 4 * p->in_inc; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1285 if (p->chflag == '|') |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1286 p->iosync += p->in_inc; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1287 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1288 if (show_fields) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1289 p->iosync -= p->out_dec; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1290 p->notout = !(show_fields & 1) + !(show_fields & 3); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1291 if (((show_fields & 3) == 3 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1292 (s->low.noise + s->interlaced_low < (s->num_blocks>>8) || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1293 s->sad.noise < 160)) || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1294 ((show_fields & 12) == 12 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1295 (ps->low.noise + ps->interlaced_low < (s->num_blocks>>8) || |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1296 ps->sad.noise < 160))) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1297 p->export_count++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1298 dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1299 MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1300 p->w, p->h); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1301 if ((show_fields & 3) != 3) planes = old_planes; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1302 dmpi->planes[0] = planes[0]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1303 dmpi->stride[0] = p->stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1304 dmpi->width = mpi->width; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1305 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1306 dmpi->planes[1] = planes[1]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1307 dmpi->planes[2] = planes[2]; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1308 dmpi->stride[1] = p->chroma_stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1309 dmpi->stride[2] = p->chroma_stride; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1310 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1311 } else { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1312 p->merge_count++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1313 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1314 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1315 p->w, p->h); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1316 copy_merge_fields(p, dmpi, old_planes, planes, show_fields); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1317 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1318 p->outframes++; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1319 } else |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1320 p->notout += 2; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1321 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1322 if (p->verbose) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1323 mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu %lu: %x %c %c %lu%s%s%c%s\n", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1324 p->inframes, p->outframes, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1325 breaks, breaks<8 && breaks>0 ? (int) p->prev_fields+'0' : ' ', |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1326 ITOC(show_fields), |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1327 p->num_breaks, 5*p->in_inc == p->out_dec && breaks<8 && |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1328 breaks>0 && ((prev&~1)!=2 || prev+p->prev_fields!=5) ? |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1329 " ######## bad telecine ########" : "", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1330 dropped_fields ? " ======== dropped ":"", ITOC(dropped_fields), |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1331 !show_fields || (show_fields & (show_fields-1)) ? |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1332 "" : " @@@@@@@@@@@@@@@@@"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1333 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1334 p->merge_time += get_time() - diff_time; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1335 return show_fields ? vf_next_put_image(vf, dmpi) : 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1336 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1337 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1338 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1339 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1340 /* FIXME - support more formats */ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1341 switch (fmt) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1342 case IMGFMT_YV12: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1343 case IMGFMT_IYUV: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1344 case IMGFMT_I420: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1345 case IMGFMT_411P: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1346 case IMGFMT_422P: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1347 case IMGFMT_444P: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1348 return vf_next_query_format(vf, fmt); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1349 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1350 return 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1351 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1352 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1353 static int config(struct vf_instance_s* vf, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1354 int width, int height, int d_width, int d_height, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1355 unsigned int flags, unsigned int outfmt) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1356 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1357 unsigned long cxm = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1358 unsigned long cym = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1359 struct vf_priv_s *p = vf->priv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1360 // rounding: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1361 if(!IMGFMT_IS_RGB(outfmt) && !IMGFMT_IS_BGR(outfmt)){ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1362 switch(outfmt){ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1363 case IMGFMT_444P: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1364 case IMGFMT_Y800: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1365 case IMGFMT_Y8: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1366 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1367 case IMGFMT_YVU9: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1368 case IMGFMT_IF09: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1369 cym = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1370 case IMGFMT_411P: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1371 cxm = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1372 break; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1373 case IMGFMT_YV12: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1374 case IMGFMT_I420: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1375 case IMGFMT_IYUV: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1376 cym = 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1377 default: |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1378 cxm = 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1379 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1380 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1381 p->chroma_swapped = !!(p->crop_y & (cym+1)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1382 if (p->w) p->w += p->crop_x & cxm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1383 if (p->h) p->h += p->crop_y & cym; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1384 p->crop_x &= ~cxm; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1385 p->crop_y &= ~cym; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1386 if (!p->w || p->w > width ) p->w = width; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1387 if (!p->h || p->h > height) p->h = height; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1388 if (p->crop_x + p->w > width ) p->crop_x = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1389 if (p->crop_y + p->h > height) p->crop_y = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1390 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1391 if(!opt_screen_size_x && !opt_screen_size_y){ |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1392 d_width = d_width * p->w/width; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1393 d_height = d_height * p->h/height; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1394 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1395 return vf_next_config(vf, p->w, p->h, d_width, d_height, flags, outfmt); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1396 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1397 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1398 static void uninit(struct vf_instance_s* vf) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1399 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1400 struct vf_priv_s *p = vf->priv; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1401 mp_msg(MSGT_VFILTER, MSGL_INFO, "diff_time: %.3f, merge_time: %.3f, " |
12255 | 1402 "export: %lu, merge: %lu, copy: %lu\n", p->diff_time, p->merge_time, |
1403 p->export_count, p->merge_count, p->num_copies); | |
11600
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1404 free(p->memory_allocated); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1405 free(p); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1406 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1407 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1408 static int open(vf_instance_t *vf, char* args) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1409 { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1410 struct vf_priv_s *p; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1411 vf->get_image = get_image; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1412 vf->put_image = put_image; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1413 vf->config = config; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1414 vf->query_format = query_format; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1415 vf->uninit = uninit; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1416 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1417 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1418 p->out_dec = 5; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1419 p->in_inc = 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1420 p->thres.noise = 128; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1421 p->thres.even = 128; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1422 p->sad_thres = 64; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1423 p->dint_thres = 4; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1424 p->luma_only = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1425 p->fast = 3; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1426 p->mmx2 = gCpuCaps.hasMMX2 ? 1 : gCpuCaps.has3DNow ? 2 : 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1427 if (args) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1428 const char *args_remain = parse_args(p, args); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1429 if (args_remain) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1430 mp_msg(MSGT_VFILTER, MSGL_FATAL, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1431 "filmdint: unknown suboption: %s\n", args_remain); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1432 return 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1433 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1434 if (p->out_dec < p->in_inc) { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1435 mp_msg(MSGT_VFILTER, MSGL_FATAL, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1436 "filmdint: increasing the frame rate is not supported\n"); |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1437 return 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1438 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1439 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1440 if (p->mmx2 > 2) |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1441 p->mmx2 = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1442 #ifndef HAVE_MMX |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1443 p->mmx2 = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1444 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1445 #ifndef HAVE_3DNOW |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1446 p->mmx2 &= 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1447 #endif |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1448 p->thres.odd = p->thres.even; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1449 p->thres.temp = p->thres.noise; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1450 p->diff_time = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1451 p->merge_time = 0; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1452 return 1; |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1453 } |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1454 |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1455 vf_info_t vf_info_filmdint = { |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1456 "Advanced inverse telecine filer", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1457 "filmdint", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1458 "Zoltan Hidvegi", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1459 "", |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1460 open, |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1461 NULL |
5eb66d37d539
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff
changeset
|
1462 }; |