Mercurial > mplayer.hg
annotate postproc/postprocess_template.c @ 2964:ab8df016b2f1
Qualitative speedup of decoding
author | nick |
---|---|
date | Sun, 18 Nov 2001 09:45:29 +0000 |
parents | 6885bf566271 |
children | 71384f064a3e |
rev | line source |
---|---|
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1 /* |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2 Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
6 the Free Software Foundation; either version 2 of the License, or |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
7 (at your option) any later version. |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
8 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
12 GNU General Public License for more details. |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
13 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
17 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
18 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
19 /* |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
20 C MMX MMX2 3DNow |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
21 isVertDC Ec Ec |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
22 isVertMinMaxOk Ec Ec |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
23 doVertLowPass E e e |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
24 doVertDefFilter Ec Ec Ec |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
25 isHorizDC Ec Ec |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
26 isHorizMinMaxOk a E |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
27 doHorizLowPass E e e |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
28 doHorizDefFilter Ec Ec Ec |
2477 | 29 deRing E e e* |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
30 Vertical RKAlgo1 E a a |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
31 Horizontal RKAlgo1 a a |
2860 | 32 Vertical X1# a E E |
33 Horizontal X1# a E E | |
2246 | 34 LinIpolDeinterlace e E E* |
35 CubicIpolDeinterlace a e e* | |
36 LinBlendDeinterlace e E E* | |
2860 | 37 MedianDeinterlace# Ec Ec |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
38 TempDeNoiser# E e e |
2860 | 39 |
40 * i dont have a 3dnow CPU -> its untested, but noone said it doesnt work so it seems to work | |
41 # more or less selfinvented filters so the exactness isnt too meaningfull | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
42 E = Exact implementation |
2246 | 43 e = allmost exact implementation (slightly different rounding,...) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
44 a = alternative / approximate impl |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
45 c = checked against the other implementations (-vo md5) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
46 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
47 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
48 /* |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
49 TODO: |
2179 | 50 verify that everything workes as it should (how?) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
51 reduce the time wasted on the mem transfer |
2159 | 52 implement everything in C at least (done at the moment but ...) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
53 unroll stuff if instructions depend too much on the prior one |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
54 we use 8x8 blocks for the horizontal filters, opendivx seems to use 8x4? |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
55 move YScale thing to the end instead of fixing QP |
2159 | 56 write a faster and higher quality deblocking filter :) |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
57 make the mainloop more flexible (variable number of blocks at once |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
58 (the if/else stuff per block is slowing things down) |
2179 | 59 compare the quality & speed of all filters |
60 split this huge file | |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
61 border remover |
2570 | 62 optimize c versions |
2860 | 63 try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
64 smart blur |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
65 ... |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
66 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
67 Notes: |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
68 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
69 |
2221 | 70 //Changelog: use the CVS log |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
71 |
2775 | 72 #include "../config.h" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
73 #include <inttypes.h> |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
74 #include <stdio.h> |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
75 #include <stdlib.h> |
2389 | 76 #include <string.h> |
2476 | 77 #ifdef HAVE_MALLOC_H |
78 #include <malloc.h> | |
79 #endif | |
2159 | 80 //#undef HAVE_MMX2 |
81 //#define HAVE_3DNOW | |
82 //#undef HAVE_MMX | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
83 #include "postprocess.h" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
84 |
2189 | 85 #define MIN(a,b) ((a) > (b) ? (b) : (a)) |
86 #define MAX(a,b) ((a) < (b) ? (b) : (a)) | |
87 #define ABS(a) ((a) > 0 ? (a) : (-(a))) | |
88 #define SIGN(a) ((a) > 0 ? 1 : -1) | |
89 | |
90 #ifdef HAVE_MMX2 | |
91 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" | |
92 #elif defined (HAVE_3DNOW) | |
93 #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" | |
94 #endif | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
95 |
2477 | 96 #ifdef HAVE_MMX2 |
97 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t" | |
98 #elif defined (HAVE_MMX) | |
99 #define PMINUB(b,a,t) \ | |
100 "movq " #a ", " #t " \n\t"\ | |
101 "psubusb " #b ", " #t " \n\t"\ | |
102 "psubb " #t ", " #a " \n\t" | |
103 #endif | |
104 | |
105 #ifdef HAVE_MMX2 | |
106 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t" | |
107 #elif defined (HAVE_MMX) | |
108 #define PMAXUB(a,b) \ | |
109 "psubusb " #a ", " #b " \n\t"\ | |
110 "paddb " #a ", " #b " \n\t" | |
111 #endif | |
112 | |
113 | |
2389 | 114 #define GET_MODE_BUFFER_SIZE 500 |
115 #define OPTIONS_ARRAY_SIZE 10 | |
116 | |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
117 #ifdef HAVE_MMX |
2750
9ef09e232505
gcc does optimize writes to non volatile variables away if it didnt know that they were read in between
michael
parents:
2742
diff
changeset
|
118 static volatile uint64_t __attribute__((aligned(8))) packedYOffset= 0x0000000000000000LL; |
9ef09e232505
gcc does optimize writes to non volatile variables away if it didnt know that they were read in between
michael
parents:
2742
diff
changeset
|
119 static volatile uint64_t __attribute__((aligned(8))) packedYScale= 0x0100010001000100LL; |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
120 static uint64_t __attribute__((aligned(8))) w05= 0x0005000500050005LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
121 static uint64_t __attribute__((aligned(8))) w20= 0x0020002000200020LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
122 static uint64_t __attribute__((aligned(8))) w1400= 0x1400140014001400LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
123 static uint64_t __attribute__((aligned(8))) bm00000001= 0x00000000000000FFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
124 static uint64_t __attribute__((aligned(8))) bm00010000= 0x000000FF00000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
125 static uint64_t __attribute__((aligned(8))) bm00001000= 0x00000000FF000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
126 static uint64_t __attribute__((aligned(8))) bm10000000= 0xFF00000000000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
127 static uint64_t __attribute__((aligned(8))) bm10000001= 0xFF000000000000FFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
128 static uint64_t __attribute__((aligned(8))) bm11000011= 0xFFFF00000000FFFFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
129 static uint64_t __attribute__((aligned(8))) bm00000011= 0x000000000000FFFFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
130 static uint64_t __attribute__((aligned(8))) bm11111110= 0xFFFFFFFFFFFFFF00LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
131 static uint64_t __attribute__((aligned(8))) bm11000000= 0xFFFF000000000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
132 static uint64_t __attribute__((aligned(8))) bm00011000= 0x000000FFFF000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
133 static uint64_t __attribute__((aligned(8))) bm00110011= 0x0000FFFF0000FFFFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
134 static uint64_t __attribute__((aligned(8))) bm11001100= 0xFFFF0000FFFF0000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
135 static uint64_t __attribute__((aligned(8))) b00= 0x0000000000000000LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
136 static uint64_t __attribute__((aligned(8))) b01= 0x0101010101010101LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
137 static uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
138 static uint64_t __attribute__((aligned(8))) b0F= 0x0F0F0F0F0F0F0F0FLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
139 static uint64_t __attribute__((aligned(8))) b04= 0x0404040404040404LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
140 static uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
141 static uint64_t __attribute__((aligned(8))) bFF= 0xFFFFFFFFFFFFFFFFLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
142 static uint64_t __attribute__((aligned(8))) b20= 0x2020202020202020LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
143 static uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
144 static uint64_t __attribute__((aligned(8))) b7E= 0x7E7E7E7E7E7E7E7ELL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
145 static uint64_t __attribute__((aligned(8))) b7C= 0x7C7C7C7C7C7C7C7CLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
146 static uint64_t __attribute__((aligned(8))) b3F= 0x3F3F3F3F3F3F3F3FLL; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
147 static uint64_t __attribute__((aligned(8))) temp0=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
148 static uint64_t __attribute__((aligned(8))) temp1=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
149 static uint64_t __attribute__((aligned(8))) temp2=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
150 static uint64_t __attribute__((aligned(8))) temp3=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
151 static uint64_t __attribute__((aligned(8))) temp4=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
152 static uint64_t __attribute__((aligned(8))) temp5=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
153 static uint64_t __attribute__((aligned(8))) pQPb=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
154 static uint64_t __attribute__((aligned(8))) pQPb2=0; |
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
155 static uint8_t __attribute__((aligned(8))) tempBlocks[8*16*2]; //used for the horizontal code |
2899 | 156 static uint32_t __attribute__((aligned(4))) maxTmpNoise[4]; |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
157 #else |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
158 static uint64_t packedYOffset= 0x0000000000000000LL; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
159 static uint64_t packedYScale= 0x0100010001000100LL; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
160 static uint8_t tempBlocks[8*16*2]; //used for the horizontal code |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
161 #endif |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
162 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
163 int hFlatnessThreshold= 56 - 16; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
164 int vFlatnessThreshold= 56 - 16; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
165 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
166 //amount of "black" u r willing to loose to get a brightness corrected picture |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
167 double maxClippedThreshold= 0.01; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
168 |
2389 | 169 int maxAllowedY=234; |
2285 | 170 int minAllowedY=16; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
171 |
2389 | 172 static struct PPFilter filters[]= |
173 { | |
174 {"hb", "hdeblock", 1, 1, 3, H_DEBLOCK}, | |
175 {"vb", "vdeblock", 1, 2, 4, V_DEBLOCK}, | |
176 {"vr", "rkvdeblock", 1, 2, 4, H_RK1_FILTER}, | |
177 {"h1", "x1hdeblock", 1, 1, 3, H_X1_FILTER}, | |
178 {"v1", "x1vdeblock", 1, 2, 4, V_X1_FILTER}, | |
179 {"dr", "dering", 1, 5, 6, DERING}, | |
180 {"al", "autolevels", 0, 1, 2, LEVEL_FIX}, | |
181 {"lb", "linblenddeint", 0, 1, 6, LINEAR_BLEND_DEINT_FILTER}, | |
182 {"li", "linipoldeint", 0, 1, 6, LINEAR_IPOL_DEINT_FILTER}, | |
183 {"ci", "cubicipoldeint", 0, 1, 6, CUBIC_IPOL_DEINT_FILTER}, | |
184 {"md", "mediandeint", 0, 1, 6, MEDIAN_DEINT_FILTER}, | |
2860 | 185 {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER}, |
2389 | 186 {NULL, NULL,0,0,0,0} //End Marker |
187 }; | |
188 | |
189 static char *replaceTable[]= | |
190 { | |
2860 | 191 "default", "hdeblock:a,vdeblock:a,dering:a,autolevels,tmpnoise:a:150:200:400", |
192 "de", "hdeblock:a,vdeblock:a,dering:a,autolevels,tmpnoise:a:150:200:400", | |
193 "fast", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels,tmpnoise:a:150:200:400", | |
194 "fa", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels,tmpnoise:a:150:200:400", | |
2389 | 195 NULL //End Marker |
196 }; | |
197 | |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
198 #ifdef HAVE_MMX |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
199 static inline void unusedVariableWarningFixer() |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
200 { |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
201 if( |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
202 packedYOffset + packedYScale + w05 + w20 + w1400 + bm00000001 + bm00010000 |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
203 + bm00001000 + bm10000000 + bm10000001 + bm11000011 + bm00000011 + bm11111110 |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
204 + bm11000000 + bm00011000 + bm00110011 + bm11001100 + b00 + b01 + b02 + b0F |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
205 + bFF + b20 + b04+ b08 + pQPb2 + b80 + b7E + b7C + b3F + temp0 + temp1 + temp2 + temp3 + temp4 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
206 + temp5 + pQPb== 0) b00=0; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
207 } |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
208 #endif |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
209 |
2221 | 210 #ifdef TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
211 static inline long long rdtsc() |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
212 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
213 long long l; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
214 asm volatile( "rdtsc\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
215 : "=A" (l) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
216 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
217 // printf("%d\n", int(l/1000)); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
218 return l; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
219 } |
2185 | 220 #endif |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
221 |
2185 | 222 #ifdef HAVE_MMX2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
223 static inline void prefetchnta(void *p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
224 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
225 asm volatile( "prefetchnta (%0)\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
226 : : "r" (p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
227 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
228 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
229 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
230 static inline void prefetcht0(void *p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
231 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
232 asm volatile( "prefetcht0 (%0)\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
233 : : "r" (p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
234 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
235 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
236 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
237 static inline void prefetcht1(void *p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
238 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
239 asm volatile( "prefetcht1 (%0)\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
240 : : "r" (p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
241 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
242 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
243 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
244 static inline void prefetcht2(void *p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
245 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
246 asm volatile( "prefetcht2 (%0)\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
247 : : "r" (p) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
248 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
249 } |
2185 | 250 #endif |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
251 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
252 //FIXME? |255-0| = 1 (shouldnt be a problem ...) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
253 /** |
2246 | 254 * Check if the middle 8x8 Block in the given 8x16 block is flat |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
255 */ |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
256 static inline int isVertDC(uint8_t src[], int stride){ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
257 int numEq= 0; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
258 #ifndef HAVE_MMX |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
259 int y; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
260 #endif |
2246 | 261 src+= stride*4; // src points to begin of the 8x8 Block |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
262 #ifdef HAVE_MMX |
2413 | 263 asm volatile( |
264 "leal (%1, %2), %%eax \n\t" | |
265 "leal (%%eax, %2, 4), %%ebx \n\t" | |
266 // 0 1 2 3 4 5 6 7 8 9 | |
267 // %1 eax eax+%2 eax+2%2 %1+4%2 ebx ebx+%2 ebx+2%2 %1+8%2 ebx+4%2 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
268 "movq b7E, %%mm7 \n\t" // mm7 = 0x7F |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
269 "movq b7C, %%mm6 \n\t" // mm6 = 0x7D |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
270 "movq (%1), %%mm0 \n\t" |
2413 | 271 "movq (%%eax), %%mm1 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
272 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
273 "paddb %%mm7, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
274 "pcmpgtb %%mm6, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
275 |
2413 | 276 "movq (%%eax,%2), %%mm2 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
277 "psubb %%mm2, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
278 "paddb %%mm7, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
279 "pcmpgtb %%mm6, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
280 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
281 |
2413 | 282 "movq (%%eax, %2, 2), %%mm1 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
283 "psubb %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
284 "paddb %%mm7, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
285 "pcmpgtb %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
286 "paddb %%mm2, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
287 |
2413 | 288 "movq (%1, %2, 4), %%mm2 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
289 "psubb %%mm2, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
290 "paddb %%mm7, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
291 "pcmpgtb %%mm6, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
292 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
293 |
2413 | 294 "movq (%%ebx), %%mm1 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
295 "psubb %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
296 "paddb %%mm7, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
297 "pcmpgtb %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
298 "paddb %%mm2, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
299 |
2413 | 300 "movq (%%ebx, %2), %%mm2 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
301 "psubb %%mm2, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
302 "paddb %%mm7, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
303 "pcmpgtb %%mm6, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
304 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
305 |
2413 | 306 "movq (%%ebx, %2, 2), %%mm1 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
307 "psubb %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
308 "paddb %%mm7, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
309 "pcmpgtb %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
310 "paddb %%mm2, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
311 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
312 " \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
313 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
314 "psrlw $8, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
315 "paddb %%mm1, %%mm0 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
316 #ifdef HAVE_MMX2 |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
317 "pshufw $0xF9, %%mm0, %%mm1 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
318 "paddb %%mm1, %%mm0 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
319 "pshufw $0xFE, %%mm0, %%mm1 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
320 #else |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
321 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
322 "psrlq $16, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
323 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
324 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
325 "psrlq $32, %%mm0 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
326 #endif |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
327 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
328 "movd %%mm0, %0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
329 : "=r" (numEq) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
330 : "r" (src), "r" (stride) |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
331 : "%eax", "%ebx" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
332 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
333 |
2413 | 334 numEq= (256 - numEq) &0xFF; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
335 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
336 #else |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
337 for(y=0; y<BLOCK_SIZE-1; y++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
338 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
339 if(((src[0] - src[0+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
340 if(((src[1] - src[1+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
341 if(((src[2] - src[2+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
342 if(((src[3] - src[3+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
343 if(((src[4] - src[4+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
344 if(((src[5] - src[5+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
345 if(((src[6] - src[6+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
346 if(((src[7] - src[7+stride] + 1)&0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
347 src+= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
348 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
349 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
350 /* if(abs(numEq - asmEq) > 0) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
351 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
352 printf("\nasm:%d c:%d\n", asmEq, numEq); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
353 for(int y=0; y<8; y++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
354 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
355 for(int x=0; x<8; x++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
356 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
357 printf("%d ", temp[x + y*stride]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
358 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
359 printf("\n"); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
360 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
361 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
362 */ |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
363 // for(int i=0; i<numEq/8; i++) src[i]=255; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
364 return (numEq > vFlatnessThreshold) ? 1 : 0; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
365 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
366 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
367 static inline int isVertMinMaxOk(uint8_t src[], int stride, int QP) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
368 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
369 #ifdef HAVE_MMX |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
370 int isOk; |
2246 | 371 src+= stride*3; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
372 asm volatile( |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
373 // "int $3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
374 "movq (%1, %2), %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
375 "movq (%1, %2, 8), %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
376 "movq %%mm0, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
377 "psubusb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
378 "psubusb %%mm2, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
379 "por %%mm1, %%mm0 \n\t" // ABS Diff |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
380 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
381 "movq pQPb, %%mm7 \n\t" // QP,..., QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
382 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
383 "psubusb %%mm7, %%mm0 \n\t" // Diff <= 2QP -> 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
384 "pcmpeqd b00, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
385 "psrlq $16, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
386 "pcmpeqd bFF, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
387 // "movd %%mm0, (%1, %2, 4)\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
388 "movd %%mm0, %0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
389 : "=r" (isOk) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
390 : "r" (src), "r" (stride) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
391 ); |
2416 | 392 return isOk; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
393 #else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
394 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
395 int isOk2= 1; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
396 int x; |
2246 | 397 src+= stride*3; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
398 for(x=0; x<BLOCK_SIZE; x++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
399 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
400 if(abs((int)src[x + stride] - (int)src[x + (stride<<3)]) > 2*QP) isOk2=0; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
401 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
402 /* if(isOk && !isOk2 || !isOk && isOk2) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
403 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
404 printf("\nasm:%d c:%d QP:%d\n", isOk, isOk2, QP); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
405 for(int y=0; y<9; y++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
406 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
407 for(int x=0; x<8; x++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
408 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
409 printf("%d ", src[x + y*stride]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
410 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
411 printf("\n"); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
412 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
413 } */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
414 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
415 return isOk2; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
416 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
417 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
418 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
419 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
420 /** |
2246 | 421 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle) |
2221 | 422 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
423 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
424 static inline void doVertLowPass(uint8_t *src, int stride, int QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
425 { |
2159 | 426 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2246 | 427 src+= stride*3; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
428 asm volatile( //"movv %0 %1 %2\n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
429 "movq pQPb, %%mm0 \n\t" // QP,..., QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
430 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
431 "movq (%0), %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
432 "movq (%0, %1), %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
433 "movq %%mm5, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
434 "movq %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
435 "psubusb %%mm6, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
436 "psubusb %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
437 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
438 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
439 "pcmpeqb b00, %%mm2 \n\t" // diff <= QP -> FF |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
440 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
441 "pand %%mm2, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
442 "pandn %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
443 "por %%mm2, %%mm6 \n\t"// First Line to Filter |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
444 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
445 "movq (%0, %1, 8), %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
446 "leal (%0, %1, 4), %%eax \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
447 "leal (%0, %1, 8), %%ebx \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
448 "subl %1, %%ebx \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
449 "addl %1, %0 \n\t" // %0 points to line 1 not 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
450 "movq (%0, %1, 8), %%mm7 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
451 "movq %%mm5, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
452 "movq %%mm7, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
453 "psubusb %%mm7, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
454 "psubusb %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
455 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
456 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
457 "pcmpeqb b00, %%mm2 \n\t" // diff <= QP -> FF |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
458 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
459 "pand %%mm2, %%mm7 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
460 "pandn %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
461 "por %%mm2, %%mm7 \n\t" // First Line to Filter |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
462 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
463 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
464 // 1 2 3 4 5 6 7 8 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
465 // %0 %0+%1 %0+2%1 eax %0+4%1 eax+2%1 ebx eax+4%1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
466 // 6 4 2 2 1 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
467 // 6 4 4 2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
468 // 6 8 2 |
2246 | 469 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
470 "movq (%0, %1), %%mm0 \n\t" // 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
471 "movq %%mm0, %%mm1 \n\t" // 1 |
2159 | 472 PAVGB(%%mm6, %%mm0) //1 1 /2 |
473 PAVGB(%%mm6, %%mm0) //3 1 /4 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
474 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
475 "movq (%0, %1, 4), %%mm2 \n\t" // 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
476 "movq %%mm2, %%mm5 \n\t" // 1 |
2159 | 477 PAVGB((%%eax), %%mm2) // 11 /2 |
478 PAVGB((%0, %1, 2), %%mm2) // 211 /4 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
479 "movq %%mm2, %%mm3 \n\t" // 211 /4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
480 "movq (%0), %%mm4 \n\t" // 1 |
2159 | 481 PAVGB(%%mm4, %%mm3) // 4 211 /8 |
482 PAVGB(%%mm0, %%mm3) //642211 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
483 "movq %%mm3, (%0) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
484 // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
485 "movq %%mm1, %%mm0 \n\t" // 1 |
2159 | 486 PAVGB(%%mm6, %%mm0) //1 1 /2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
487 "movq %%mm4, %%mm3 \n\t" // 1 |
2159 | 488 PAVGB((%0,%1,2), %%mm3) // 1 1 /2 |
489 PAVGB((%%eax,%1,2), %%mm5) // 11 /2 | |
490 PAVGB((%%eax), %%mm5) // 211 /4 | |
491 PAVGB(%%mm5, %%mm3) // 2 2211 /8 | |
492 PAVGB(%%mm0, %%mm3) //4242211 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
493 "movq %%mm3, (%0,%1) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
494 // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9 |
2159 | 495 PAVGB(%%mm4, %%mm6) //11 /2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
496 "movq (%%ebx), %%mm0 \n\t" // 1 |
2159 | 497 PAVGB((%%eax, %1, 2), %%mm0) // 11/2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
498 "movq %%mm0, %%mm3 \n\t" // 11/2 |
2159 | 499 PAVGB(%%mm1, %%mm0) // 2 11/4 |
500 PAVGB(%%mm6, %%mm0) //222 11/8 | |
501 PAVGB(%%mm2, %%mm0) //22242211/16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
502 "movq (%0, %1, 2), %%mm2 \n\t" // 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
503 "movq %%mm0, (%0, %1, 2) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
504 // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
505 "movq (%%eax, %1, 4), %%mm0 \n\t" // 1 |
2159 | 506 PAVGB((%%ebx), %%mm0) // 11 /2 |
507 PAVGB(%%mm0, %%mm6) //11 11 /4 | |
508 PAVGB(%%mm1, %%mm4) // 11 /2 | |
509 PAVGB(%%mm2, %%mm1) // 11 /2 | |
510 PAVGB(%%mm1, %%mm6) //1122 11 /8 | |
511 PAVGB(%%mm5, %%mm6) //112242211 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
512 "movq (%%eax), %%mm5 \n\t" // 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
513 "movq %%mm6, (%%eax) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
514 // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
515 "movq (%%eax, %1, 4), %%mm6 \n\t" // 1 |
2159 | 516 PAVGB(%%mm7, %%mm6) // 11 /2 |
517 PAVGB(%%mm4, %%mm6) // 11 11 /4 | |
518 PAVGB(%%mm3, %%mm6) // 11 2211 /8 | |
519 PAVGB(%%mm5, %%mm2) // 11 /2 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
520 "movq (%0, %1, 4), %%mm4 \n\t" // 1 |
2159 | 521 PAVGB(%%mm4, %%mm2) // 112 /4 |
522 PAVGB(%%mm2, %%mm6) // 112242211 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
523 "movq %%mm6, (%0, %1, 4) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
524 // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9 |
2159 | 525 PAVGB(%%mm7, %%mm1) // 11 2 /4 |
526 PAVGB(%%mm4, %%mm5) // 11 /2 | |
527 PAVGB(%%mm5, %%mm0) // 11 11 /4 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
528 "movq (%%eax, %1, 2), %%mm6 \n\t" // 1 |
2159 | 529 PAVGB(%%mm6, %%mm1) // 11 4 2 /8 |
530 PAVGB(%%mm0, %%mm1) // 11224222 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
531 "movq %%mm1, (%%eax, %1, 2) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
532 // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9 |
2159 | 533 PAVGB((%%ebx), %%mm2) // 112 4 /8 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
534 "movq (%%eax, %1, 4), %%mm0 \n\t" // 1 |
2159 | 535 PAVGB(%%mm0, %%mm6) // 1 1 /2 |
536 PAVGB(%%mm7, %%mm6) // 1 12 /4 | |
537 PAVGB(%%mm2, %%mm6) // 1122424 /4 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
538 "movq %%mm6, (%%ebx) \n\t" // X |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
539 // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9 |
2159 | 540 PAVGB(%%mm7, %%mm5) // 11 2 /4 |
541 PAVGB(%%mm7, %%mm5) // 11 6 /8 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
542 |
2159 | 543 PAVGB(%%mm3, %%mm0) // 112 /4 |
544 PAVGB(%%mm0, %%mm5) // 112246 /16 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
545 "movq %%mm5, (%%eax, %1, 4) \n\t" // X |
2570 | 546 "subl %1, %0 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
547 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
548 : |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
549 : "r" (src), "r" (stride) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
550 : "%eax", "%ebx" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
551 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
552 #else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
553 const int l1= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
554 const int l2= stride + l1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
555 const int l3= stride + l2; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
556 const int l4= stride + l3; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
557 const int l5= stride + l4; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
558 const int l6= stride + l5; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
559 const int l7= stride + l6; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
560 const int l8= stride + l7; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
561 const int l9= stride + l8; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
562 int x; |
2246 | 563 src+= stride*3; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
564 for(x=0; x<BLOCK_SIZE; x++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
565 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
566 const int first= ABS(src[0] - src[l1]) < QP ? src[0] : src[l1]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
567 const int last= ABS(src[l8] - src[l9]) < QP ? src[l9] : src[l8]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
568 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
569 int sums[9]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
570 sums[0] = first + src[l1]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
571 sums[1] = src[l1] + src[l2]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
572 sums[2] = src[l2] + src[l3]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
573 sums[3] = src[l3] + src[l4]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
574 sums[4] = src[l4] + src[l5]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
575 sums[5] = src[l5] + src[l6]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
576 sums[6] = src[l6] + src[l7]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
577 sums[7] = src[l7] + src[l8]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
578 sums[8] = src[l8] + last; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
579 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
580 src[l1]= ((sums[0]<<2) + ((first + sums[2])<<1) + sums[4] + 8)>>4; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
581 src[l2]= ((src[l2]<<2) + ((first + sums[0] + sums[3])<<1) + sums[5] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
582 src[l3]= ((src[l3]<<2) + ((first + sums[1] + sums[4])<<1) + sums[6] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
583 src[l4]= ((src[l4]<<2) + ((sums[2] + sums[5])<<1) + sums[0] + sums[7] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
584 src[l5]= ((src[l5]<<2) + ((sums[3] + sums[6])<<1) + sums[1] + sums[8] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
585 src[l6]= ((src[l6]<<2) + ((last + sums[7] + sums[4])<<1) + sums[2] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
586 src[l7]= (((last + src[l7])<<2) + ((src[l8] + sums[5])<<1) + sums[3] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
587 src[l8]= ((sums[8]<<2) + ((last + sums[6])<<1) + sums[4] + 8)>>4; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
588 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
589 src++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
590 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
591 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
592 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
593 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
594 |
2159 | 595 /** |
596 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar | |
597 * values are correctly clipped (MMX2) | |
598 * values are wraparound (C) | |
599 * conclusion: its fast, but introduces ugly horizontal patterns if there is a continious gradient | |
600 0 8 16 24 | |
601 x = 8 | |
602 x/2 = 4 | |
603 x/8 = 1 | |
604 1 12 12 23 | |
605 */ | |
2179 | 606 static inline void vertRK1Filter(uint8_t *src, int stride, int QP) |
2159 | 607 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
608 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2246 | 609 src+= stride*3; |
2159 | 610 // FIXME rounding |
611 asm volatile( | |
612 "pxor %%mm7, %%mm7 \n\t" // 0 | |
613 "movq b80, %%mm6 \n\t" // MIN_SIGNED_BYTE | |
614 "leal (%0, %1), %%eax \n\t" | |
615 "leal (%%eax, %1, 4), %%ebx \n\t" | |
616 // 0 1 2 3 4 5 6 7 8 9 | |
617 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 | |
618 "movq pQPb, %%mm0 \n\t" // QP,..., QP | |
619 "movq %%mm0, %%mm1 \n\t" // QP,..., QP | |
620 "paddusb b02, %%mm0 \n\t" | |
621 "psrlw $2, %%mm0 \n\t" | |
622 "pand b3F, %%mm0 \n\t" // QP/4,..., QP/4 | |
623 "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ... | |
624 "movq (%0, %1, 4), %%mm2 \n\t" // line 4 | |
625 "movq (%%ebx), %%mm3 \n\t" // line 5 | |
626 "movq %%mm2, %%mm4 \n\t" // line 4 | |
627 "pcmpeqb %%mm5, %%mm5 \n\t" // -1 | |
628 "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1 | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
629 PAVGB(%%mm3, %%mm5) |
2159 | 630 "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2 |
631 "psubusb %%mm3, %%mm4 \n\t" | |
632 "psubusb %%mm2, %%mm3 \n\t" | |
633 "por %%mm3, %%mm4 \n\t" // |l4 - l5| | |
634 "psubusb %%mm0, %%mm4 \n\t" | |
635 "pcmpeqb %%mm7, %%mm4 \n\t" | |
636 "pand %%mm4, %%mm5 \n\t" // d/2 | |
637 | |
638 // "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80 | |
639 "paddb %%mm5, %%mm2 \n\t" | |
640 // "psubb %%mm6, %%mm2 \n\t" | |
641 "movq %%mm2, (%0,%1, 4) \n\t" | |
642 | |
643 "movq (%%ebx), %%mm2 \n\t" | |
644 // "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80 | |
645 "psubb %%mm5, %%mm2 \n\t" | |
646 // "psubb %%mm6, %%mm2 \n\t" | |
647 "movq %%mm2, (%%ebx) \n\t" | |
648 | |
649 "paddb %%mm6, %%mm5 \n\t" | |
650 "psrlw $2, %%mm5 \n\t" | |
651 "pand b3F, %%mm5 \n\t" | |
652 "psubb b20, %%mm5 \n\t" // (l5-l4)/8 | |
653 | |
654 "movq (%%eax, %1, 2), %%mm2 \n\t" | |
655 "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80 | |
656 "paddsb %%mm5, %%mm2 \n\t" | |
657 "psubb %%mm6, %%mm2 \n\t" | |
658 "movq %%mm2, (%%eax, %1, 2) \n\t" | |
659 | |
660 "movq (%%ebx, %1), %%mm2 \n\t" | |
661 "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80 | |
662 "psubsb %%mm5, %%mm2 \n\t" | |
663 "psubb %%mm6, %%mm2 \n\t" | |
664 "movq %%mm2, (%%ebx, %1) \n\t" | |
665 | |
666 : | |
667 : "r" (src), "r" (stride) | |
668 : "%eax", "%ebx" | |
669 ); | |
670 #else | |
671 const int l1= stride; | |
672 const int l2= stride + l1; | |
673 const int l3= stride + l2; | |
674 const int l4= stride + l3; | |
675 const int l5= stride + l4; | |
676 const int l6= stride + l5; | |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
677 // const int l7= stride + l6; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
678 // const int l8= stride + l7; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
679 // const int l9= stride + l8; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
680 int x; |
2586 | 681 const int QP15= QP + (QP>>2); |
2246 | 682 src+= stride*3; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
683 for(x=0; x<BLOCK_SIZE; x++) |
2159 | 684 { |
2586 | 685 const int v = (src[x+l5] - src[x+l4]); |
686 if(ABS(v) < QP15) | |
2159 | 687 { |
2586 | 688 src[x+l3] +=v>>3; |
689 src[x+l4] +=v>>1; | |
690 src[x+l5] -=v>>1; | |
691 src[x+l6] -=v>>3; | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
692 |
2159 | 693 } |
694 } | |
695 | |
696 #endif | |
697 } | |
698 | |
699 /** | |
700 * Experimental Filter 1 | |
2179 | 701 * will not damage linear gradients |
702 * Flat blocks should look like they where passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
703 * can only smooth blocks at the expected locations (it cant smooth them if they did move) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
704 * MMX2 version does correct clipping C version doesnt |
2159 | 705 */ |
706 static inline void vertX1Filter(uint8_t *src, int stride, int QP) | |
707 { | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
708 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2246 | 709 src+= stride*3; |
710 | |
2159 | 711 asm volatile( |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
712 "pxor %%mm7, %%mm7 \n\t" // 0 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
713 // "movq b80, %%mm6 \n\t" // MIN_SIGNED_BYTE |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
714 "leal (%0, %1), %%eax \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
715 "leal (%%eax, %1, 4), %%ebx \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
716 // 0 1 2 3 4 5 6 7 8 9 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
717 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
718 "movq (%%eax, %1, 2), %%mm0 \n\t" // line 3 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
719 "movq (%0, %1, 4), %%mm1 \n\t" // line 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
720 "movq %%mm1, %%mm2 \n\t" // line 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
721 "psubusb %%mm0, %%mm1 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
722 "psubusb %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
723 "por %%mm1, %%mm0 \n\t" // |l2 - l3| |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
724 "movq (%%ebx), %%mm3 \n\t" // line 5 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
725 "movq (%%ebx, %1), %%mm4 \n\t" // line 6 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
726 "movq %%mm3, %%mm5 \n\t" // line 5 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
727 "psubusb %%mm4, %%mm3 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
728 "psubusb %%mm5, %%mm4 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
729 "por %%mm4, %%mm3 \n\t" // |l5 - l6| |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
730 PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
731 "movq %%mm2, %%mm1 \n\t" // line 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
732 "psubusb %%mm5, %%mm2 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
733 "movq %%mm2, %%mm4 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
734 "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
735 "psubusb %%mm1, %%mm5 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
736 "por %%mm5, %%mm4 \n\t" // |l4 - l5| |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
737 "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
738 "movq %%mm4, %%mm3 \n\t" // d |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
739 "psubusb pQPb, %%mm4 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
740 "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0 |
2179 | 741 "psubusb b01, %%mm3 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
742 "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
743 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
744 PAVGB(%%mm7, %%mm3) // d/2 |
2179 | 745 "movq %%mm3, %%mm1 \n\t" // d/2 |
746 PAVGB(%%mm7, %%mm3) // d/4 | |
747 PAVGB(%%mm1, %%mm3) // 3*d/8 | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
748 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
749 "movq (%0, %1, 4), %%mm0 \n\t" // line 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
750 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
751 "psubusb %%mm3, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
752 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
753 "movq %%mm0, (%0, %1, 4) \n\t" // line 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
754 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
755 "movq (%%ebx), %%mm0 \n\t" // line 5 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
756 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
757 "paddusb %%mm3, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
758 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
759 "movq %%mm0, (%%ebx) \n\t" // line 5 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
760 |
2179 | 761 PAVGB(%%mm7, %%mm1) // d/4 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
762 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
763 "movq (%%eax, %1, 2), %%mm0 \n\t" // line 3 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
764 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4 |
2179 | 765 "psubusb %%mm1, %%mm0 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
766 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
767 "movq %%mm0, (%%eax, %1, 2) \n\t" // line 3 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
768 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
769 "movq (%%ebx, %1), %%mm0 \n\t" // line 6 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
770 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5 |
2179 | 771 "paddusb %%mm1, %%mm0 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
772 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
773 "movq %%mm0, (%%ebx, %1) \n\t" // line 6 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
774 |
2179 | 775 PAVGB(%%mm7, %%mm1) // d/8 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
776 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
777 "movq (%%eax, %1), %%mm0 \n\t" // line 2 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
778 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2 |
2179 | 779 "psubusb %%mm1, %%mm0 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
780 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
781 "movq %%mm0, (%%eax, %1) \n\t" // line 2 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
782 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
783 "movq (%%ebx, %1, 2), %%mm0 \n\t" // line 7 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
784 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7 |
2179 | 785 "paddusb %%mm1, %%mm0 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
786 "pxor %%mm2, %%mm0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
787 "movq %%mm0, (%%ebx, %1, 2) \n\t" // line 7 |
2159 | 788 |
789 : | |
790 : "r" (src), "r" (stride) | |
791 : "%eax", "%ebx" | |
792 ); | |
793 #else | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
794 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
795 const int l1= stride; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
796 const int l2= stride + l1; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
797 const int l3= stride + l2; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
798 const int l4= stride + l3; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
799 const int l5= stride + l4; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
800 const int l6= stride + l5; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
801 const int l7= stride + l6; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
802 // const int l8= stride + l7; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
803 // const int l9= stride + l8; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
804 int x; |
2246 | 805 |
806 src+= stride*3; | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
807 for(x=0; x<BLOCK_SIZE; x++) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
808 { |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
809 int a= src[l3] - src[l4]; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
810 int b= src[l4] - src[l5]; |
2179 | 811 int c= src[l5] - src[l6]; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
812 |
2586 | 813 int d= ABS(b) - ((ABS(a) + ABS(c))>>1); |
814 d= MAX(d, 0); | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
815 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
816 if(d < QP) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
817 { |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
818 int v = d * SIGN(-b); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
819 |
2586 | 820 src[l2] +=v>>3; |
821 src[l3] +=v>>2; | |
822 src[l4] +=(3*v)>>3; | |
823 src[l5] -=(3*v)>>3; | |
824 src[l6] -=v>>2; | |
825 src[l7] -=v>>3; | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
826 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
827 } |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
828 src++; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
829 } |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
830 /* |
2159 | 831 const int l1= stride; |
832 const int l2= stride + l1; | |
833 const int l3= stride + l2; | |
834 const int l4= stride + l3; | |
835 const int l5= stride + l4; | |
836 const int l6= stride + l5; | |
837 const int l7= stride + l6; | |
838 const int l8= stride + l7; | |
839 const int l9= stride + l8; | |
840 for(int x=0; x<BLOCK_SIZE; x++) | |
841 { | |
842 int v2= src[l2]; | |
843 int v3= src[l3]; | |
844 int v4= src[l4]; | |
845 int v5= src[l5]; | |
846 int v6= src[l6]; | |
847 int v7= src[l7]; | |
848 | |
849 if(ABS(v4-v5)<QP && ABS(v4-v5) - (ABS(v3-v4) + ABS(v5-v6))>0 ) | |
850 { | |
851 src[l3] = (6*v2 + 4*v3 + 3*v4 + 2*v5 + v6 )/16; | |
852 src[l4] = (3*v2 + 3*v3 + 4*v4 + 3*v5 + 2*v6 + v7 )/16; | |
853 src[l5] = (1*v2 + 2*v3 + 3*v4 + 4*v5 + 3*v6 + 3*v7)/16; | |
854 src[l6] = ( 1*v3 + 2*v4 + 3*v5 + 4*v6 + 6*v7)/16; | |
855 } | |
856 src++; | |
857 } | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
858 */ |
2159 | 859 #endif |
860 } | |
861 | |
2179 | 862 /** |
863 * Experimental Filter 1 (Horizontal) | |
864 * will not damage linear gradients | |
865 * Flat blocks should look like they where passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter | |
866 * can only smooth blocks at the expected locations (it cant smooth them if they did move) | |
867 * MMX2 version does correct clipping C version doesnt | |
868 * not identical with the vertical one | |
869 */ | |
870 static inline void horizX1Filter(uint8_t *src, int stride, int QP) | |
871 { | |
872 int y; | |
873 static uint64_t *lut= NULL; | |
874 if(lut==NULL) | |
875 { | |
876 int i; | |
877 lut= (uint64_t*)memalign(8, 256*8); | |
878 for(i=0; i<256; i++) | |
879 { | |
880 int v= i < 128 ? 2*i : 2*(i-256); | |
881 /* | |
882 //Simulate 112242211 9-Tap filter | |
883 uint64_t a= (v/16) & 0xFF; | |
884 uint64_t b= (v/8) & 0xFF; | |
885 uint64_t c= (v/4) & 0xFF; | |
886 uint64_t d= (3*v/8) & 0xFF; | |
887 */ | |
888 //Simulate piecewise linear interpolation | |
889 uint64_t a= (v/16) & 0xFF; | |
890 uint64_t b= (v*3/16) & 0xFF; | |
891 uint64_t c= (v*5/16) & 0xFF; | |
892 uint64_t d= (7*v/16) & 0xFF; | |
893 uint64_t A= (0x100 - a)&0xFF; | |
894 uint64_t B= (0x100 - b)&0xFF; | |
895 uint64_t C= (0x100 - c)&0xFF; | |
896 uint64_t D= (0x100 - c)&0xFF; | |
897 | |
898 lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) | | |
899 (D<<24) | (C<<16) | (B<<8) | (A); | |
900 //lut[i] = (v<<32) | (v<<24); | |
901 } | |
902 } | |
903 | |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
904 #if 0 |
2179 | 905 asm volatile( |
906 "pxor %%mm7, %%mm7 \n\t" // 0 | |
907 // "movq b80, %%mm6 \n\t" // MIN_SIGNED_BYTE | |
908 "leal (%0, %1), %%eax \n\t" | |
909 "leal (%%eax, %1, 4), %%ebx \n\t" | |
910 | |
911 "movq b80, %%mm6 \n\t" | |
2180 | 912 "movd pQPb, %%mm5 \n\t" // QP |
2179 | 913 "movq %%mm5, %%mm4 \n\t" |
914 "paddusb %%mm5, %%mm5 \n\t" // 2QP | |
915 "paddusb %%mm5, %%mm4 \n\t" // 3QP | |
916 "pxor %%mm5, %%mm5 \n\t" // 0 | |
917 "psubb %%mm4, %%mm5 \n\t" // -3QP | |
918 "por bm11111110, %%mm5 \n\t" // ...,FF,FF,-3QP | |
919 "psllq $24, %%mm5 \n\t" | |
920 | |
921 // 0 1 2 3 4 5 6 7 8 9 | |
922 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 | |
923 | |
924 #define HX1old(a) \ | |
925 "movd " #a ", %%mm0 \n\t"\ | |
926 "movd 4" #a ", %%mm1 \n\t"\ | |
927 "punpckldq %%mm1, %%mm0 \n\t"\ | |
928 "movq %%mm0, %%mm1 \n\t"\ | |
929 "movq %%mm0, %%mm2 \n\t"\ | |
930 "psrlq $8, %%mm1 \n\t"\ | |
931 "psubusb %%mm1, %%mm2 \n\t"\ | |
932 "psubusb %%mm0, %%mm1 \n\t"\ | |
933 "por %%mm2, %%mm1 \n\t" /* p´x = |px - p(x+1)| */\ | |
934 "pcmpeqb %%mm7, %%mm2 \n\t" /* p´x = sgn[px - p(x+1)] */\ | |
935 "pshufw $0x00, %%mm1, %%mm3 \n\t" /* p´5 = |p1 - p2| */\ | |
936 PAVGB(%%mm1, %%mm3) /* p´5 = (|p2-p1| + |p6-p5|)/2 */\ | |
937 "psrlq $16, %%mm3 \n\t" /* p´3 = (|p2-p1| + |p6-p5|)/2 */\ | |
938 "psubusb %%mm3, %%mm1 \n\t" /* |p3-p4|-(|p2-p1| + |p6-p5|)/2 */\ | |
939 "paddb %%mm5, %%mm1 \n\t"\ | |
940 "psubusb %%mm5, %%mm1 \n\t"\ | |
941 PAVGB(%%mm7, %%mm1)\ | |
942 "pxor %%mm2, %%mm1 \n\t"\ | |
943 "psubb %%mm2, %%mm1 \n\t"\ | |
944 "psrlq $24, %%mm1 \n\t"\ | |
945 "movd %%mm1, %%ecx \n\t"\ | |
946 "paddb %%mm6, %%mm0 \n\t"\ | |
947 "paddsb (%3, %%ecx, 8), %%mm0 \n\t"\ | |
948 "paddb %%mm6, %%mm0 \n\t"\ | |
949 "movq %%mm0, " #a " \n\t"\ | |
950 | |
951 /* | |
952 HX1old((%0)) | |
953 HX1old((%%eax)) | |
954 HX1old((%%eax, %1)) | |
955 HX1old((%%eax, %1, 2)) | |
956 HX1old((%0, %1, 4)) | |
957 HX1old((%%ebx)) | |
958 HX1old((%%ebx, %1)) | |
959 HX1old((%%ebx, %1, 2)) | |
960 */ | |
961 | |
962 //FIXME add some comments, its unreadable ... | |
963 #define HX1b(a, c, b, d) \ | |
964 "movd " #a ", %%mm0 \n\t"\ | |
965 "movd 4" #a ", %%mm1 \n\t"\ | |
966 "punpckldq %%mm1, %%mm0 \n\t"\ | |
967 "movd " #b ", %%mm4 \n\t"\ | |
968 "movq %%mm0, %%mm1 \n\t"\ | |
969 "movq %%mm0, %%mm2 \n\t"\ | |
970 "psrlq $8, %%mm1 \n\t"\ | |
971 "movd 4" #b ", %%mm3 \n\t"\ | |
972 "psubusb %%mm1, %%mm2 \n\t"\ | |
973 "psubusb %%mm0, %%mm1 \n\t"\ | |
974 "por %%mm2, %%mm1 \n\t" /* p´x = |px - p(x+1)| */\ | |
975 "pcmpeqb %%mm7, %%mm2 \n\t" /* p´x = sgn[px - p(x+1)] */\ | |
976 "punpckldq %%mm3, %%mm4 \n\t"\ | |
977 "movq %%mm1, %%mm3 \n\t"\ | |
978 "psllq $32, %%mm3 \n\t" /* p´5 = |p1 - p2| */\ | |
979 PAVGB(%%mm1, %%mm3) /* p´5 = (|p2-p1| + |p6-p5|)/2 */\ | |
980 "paddb %%mm6, %%mm0 \n\t"\ | |
981 "psrlq $16, %%mm3 \n\t" /* p´3 = (|p2-p1| + |p6-p5|)/2 */\ | |
982 "psubusb %%mm3, %%mm1 \n\t" /* |p3-p4|-(|p2-p1| + |p6-p5|)/2 */\ | |
983 "movq %%mm4, %%mm3 \n\t"\ | |
984 "paddb %%mm5, %%mm1 \n\t"\ | |
985 "psubusb %%mm5, %%mm1 \n\t"\ | |
986 "psrlq $8, %%mm3 \n\t"\ | |
987 PAVGB(%%mm7, %%mm1)\ | |
988 "pxor %%mm2, %%mm1 \n\t"\ | |
989 "psubb %%mm2, %%mm1 \n\t"\ | |
990 "movq %%mm4, %%mm2 \n\t"\ | |
991 "psrlq $24, %%mm1 \n\t"\ | |
992 "psubusb %%mm3, %%mm2 \n\t"\ | |
993 "movd %%mm1, %%ecx \n\t"\ | |
994 "psubusb %%mm4, %%mm3 \n\t"\ | |
2180 | 995 "paddsb (%2, %%ecx, 8), %%mm0 \n\t"\ |
2179 | 996 "por %%mm2, %%mm3 \n\t" /* p´x = |px - p(x+1)| */\ |
997 "paddb %%mm6, %%mm0 \n\t"\ | |
998 "pcmpeqb %%mm7, %%mm2 \n\t" /* p´x = sgn[px - p(x+1)] */\ | |
999 "movq %%mm3, %%mm1 \n\t"\ | |
1000 "psllq $32, %%mm1 \n\t" /* p´5 = |p1 - p2| */\ | |
1001 "movq %%mm0, " #a " \n\t"\ | |
1002 PAVGB(%%mm3, %%mm1) /* p´5 = (|p2-p1| + |p6-p5|)/2 */\ | |
1003 "paddb %%mm6, %%mm4 \n\t"\ | |
1004 "psrlq $16, %%mm1 \n\t" /* p´3 = (|p2-p1| + |p6-p5|)/2 */\ | |
1005 "psubusb %%mm1, %%mm3 \n\t" /* |p3-p4|-(|p2-p1| + |p6-p5|)/2 */\ | |
1006 "paddb %%mm5, %%mm3 \n\t"\ | |
1007 "psubusb %%mm5, %%mm3 \n\t"\ | |
1008 PAVGB(%%mm7, %%mm3)\ | |
1009 "pxor %%mm2, %%mm3 \n\t"\ | |
1010 "psubb %%mm2, %%mm3 \n\t"\ | |
1011 "psrlq $24, %%mm3 \n\t"\ | |
1012 "movd " #c ", %%mm0 \n\t"\ | |
1013 "movd 4" #c ", %%mm1 \n\t"\ | |
1014 "punpckldq %%mm1, %%mm0 \n\t"\ | |
1015 "paddb %%mm6, %%mm0 \n\t"\ | |
2180 | 1016 "paddsb (%2, %%ecx, 8), %%mm0 \n\t"\ |
2179 | 1017 "paddb %%mm6, %%mm0 \n\t"\ |
1018 "movq %%mm0, " #c " \n\t"\ | |
1019 "movd %%mm3, %%ecx \n\t"\ | |
1020 "movd " #d ", %%mm0 \n\t"\ | |
2180 | 1021 "paddsb (%2, %%ecx, 8), %%mm4 \n\t"\ |
2179 | 1022 "movd 4" #d ", %%mm1 \n\t"\ |
1023 "paddb %%mm6, %%mm4 \n\t"\ | |
1024 "punpckldq %%mm1, %%mm0 \n\t"\ | |
1025 "movq %%mm4, " #b " \n\t"\ | |
1026 "paddb %%mm6, %%mm0 \n\t"\ | |
2180 | 1027 "paddsb (%2, %%ecx, 8), %%mm0 \n\t"\ |
2179 | 1028 "paddb %%mm6, %%mm0 \n\t"\ |
1029 "movq %%mm0, " #d " \n\t"\ | |
1030 | |
1031 HX1b((%0),(%%eax),(%%eax, %1),(%%eax, %1, 2)) | |
1032 HX1b((%0, %1, 4),(%%ebx),(%%ebx, %1),(%%ebx, %1, 2)) | |
1033 | |
1034 | |
1035 : | |
2180 | 1036 : "r" (src), "r" (stride), "r" (lut) |
2179 | 1037 : "%eax", "%ebx", "%ecx" |
1038 ); | |
1039 #else | |
1040 | |
1041 //FIXME (has little in common with the mmx2 version) | |
1042 for(y=0; y<BLOCK_SIZE; y++) | |
1043 { | |
1044 int a= src[1] - src[2]; | |
1045 int b= src[3] - src[4]; | |
1046 int c= src[5] - src[6]; | |
1047 | |
1048 int d= MAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); | |
1049 | |
1050 if(d < QP) | |
1051 { | |
1052 int v = d * SIGN(-b); | |
1053 | |
1054 src[1] +=v/8; | |
1055 src[2] +=v/4; | |
1056 src[3] +=3*v/8; | |
1057 src[4] -=3*v/8; | |
1058 src[5] -=v/4; | |
1059 src[6] -=v/8; | |
1060 | |
1061 } | |
1062 src+=stride; | |
1063 } | |
1064 #endif | |
1065 } | |
1066 | |
2159 | 1067 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1068 static inline void doVertDefFilter(uint8_t src[], int stride, int QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1069 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1070 #ifdef HAVE_MMX |
2246 | 1071 src+= stride*4; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1072 //FIXME try pmul for *5 stuff |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1073 // src[0]=0; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1074 asm volatile( |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1075 "pxor %%mm7, %%mm7 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1076 "leal (%0, %1), %%eax \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1077 "leal (%%eax, %1, 4), %%ebx \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1078 // 0 1 2 3 4 5 6 7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1079 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ebx+%1 ebx+2%1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1080 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1081 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1082 "movq (%0), %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1083 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1084 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1085 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1086 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1087 "movq (%%eax), %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1088 "movq %%mm2, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1089 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1090 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1091 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1092 "movq (%%eax, %1), %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1093 "movq %%mm4, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1094 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1095 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1096 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1097 "paddw %%mm0, %%mm0 \n\t" // 2L0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1098 "paddw %%mm1, %%mm1 \n\t" // 2H0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1099 "psubw %%mm4, %%mm2 \n\t" // L1 - L2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1100 "psubw %%mm5, %%mm3 \n\t" // H1 - H2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1101 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1102 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1103 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1104 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1105 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1106 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1107 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1108 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1109 "movq (%%eax, %1, 2), %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1110 "movq %%mm2, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1111 "punpcklbw %%mm7, %%mm2 \n\t" // L3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1112 "punpckhbw %%mm7, %%mm3 \n\t" // H3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1113 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1114 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1115 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1116 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1117 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1118 "movq %%mm0, temp0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1119 "movq %%mm1, temp1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1120 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1121 "movq (%0, %1, 4), %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1122 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1123 "punpcklbw %%mm7, %%mm0 \n\t" // L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1124 "punpckhbw %%mm7, %%mm1 \n\t" // H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1125 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1126 "psubw %%mm0, %%mm2 \n\t" // L3 - L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1127 "psubw %%mm1, %%mm3 \n\t" // H3 - H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1128 "movq %%mm2, temp2 \n\t" // L3 - L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1129 "movq %%mm3, temp3 \n\t" // H3 - H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1130 "paddw %%mm4, %%mm4 \n\t" // 2L2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1131 "paddw %%mm5, %%mm5 \n\t" // 2H2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1132 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1133 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1134 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1135 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1136 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1137 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1138 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1139 //50 opcodes so far |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1140 "movq (%%ebx), %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1141 "movq %%mm2, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1142 "punpcklbw %%mm7, %%mm2 \n\t" // L5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1143 "punpckhbw %%mm7, %%mm3 \n\t" // H5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1144 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1145 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1146 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1147 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1148 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1149 "movq (%%ebx, %1), %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1150 "punpcklbw %%mm7, %%mm6 \n\t" // L6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1151 "psubw %%mm6, %%mm2 \n\t" // L5 - L6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1152 "movq (%%ebx, %1), %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1153 "punpckhbw %%mm7, %%mm6 \n\t" // H6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1154 "psubw %%mm6, %%mm3 \n\t" // H5 - H6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1155 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1156 "paddw %%mm0, %%mm0 \n\t" // 2L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1157 "paddw %%mm1, %%mm1 \n\t" // 2H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1158 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1159 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1160 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1161 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1162 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1163 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1164 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1165 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1166 "movq (%%ebx, %1, 2), %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1167 "movq %%mm2, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1168 "punpcklbw %%mm7, %%mm2 \n\t" // L7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1169 "punpckhbw %%mm7, %%mm3 \n\t" // H7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1170 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1171 "paddw %%mm2, %%mm2 \n\t" // 2L7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1172 "paddw %%mm3, %%mm3 \n\t" // 2H7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1173 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1174 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1175 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1176 "movq temp0, %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1177 "movq temp1, %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3 |
2570 | 1178 |
1179 #ifdef HAVE_MMX2 | |
1180 "movq %%mm7, %%mm6 \n\t" // 0 | |
1181 "psubw %%mm0, %%mm6 \n\t" | |
1182 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7| | |
1183 "movq %%mm7, %%mm6 \n\t" // 0 | |
1184 "psubw %%mm1, %%mm6 \n\t" | |
1185 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7| | |
1186 "movq %%mm7, %%mm6 \n\t" // 0 | |
1187 "psubw %%mm2, %%mm6 \n\t" | |
1188 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3| | |
1189 "movq %%mm7, %%mm6 \n\t" // 0 | |
1190 "psubw %%mm3, %%mm6 \n\t" | |
1191 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3| | |
1192 #else | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1193 "movq %%mm7, %%mm6 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1194 "pcmpgtw %%mm0, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1195 "pxor %%mm6, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1196 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1197 "movq %%mm7, %%mm6 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1198 "pcmpgtw %%mm1, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1199 "pxor %%mm6, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1200 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1201 "movq %%mm7, %%mm6 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1202 "pcmpgtw %%mm2, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1203 "pxor %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1204 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1205 "movq %%mm7, %%mm6 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1206 "pcmpgtw %%mm3, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1207 "pxor %%mm6, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1208 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3| |
2570 | 1209 #endif |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1210 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1211 #ifdef HAVE_MMX2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1212 "pminsw %%mm2, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1213 "pminsw %%mm3, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1214 #else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1215 "movq %%mm0, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1216 "psubusw %%mm2, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1217 "psubw %%mm6, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1218 "movq %%mm1, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1219 "psubusw %%mm3, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1220 "psubw %%mm6, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1221 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1222 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1223 "movq %%mm7, %%mm6 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1224 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1225 "pxor %%mm6, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1226 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1227 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1228 "pxor %%mm7, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1229 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1230 // 100 opcodes |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1231 "movd %2, %%mm2 \n\t" // QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1232 "punpcklwd %%mm2, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1233 "punpcklwd %%mm2, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1234 "psllw $3, %%mm2 \n\t" // 8QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1235 "movq %%mm2, %%mm3 \n\t" // 8QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1236 "pcmpgtw %%mm4, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1237 "pcmpgtw %%mm5, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1238 "pand %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1239 "pand %%mm3, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1240 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1241 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1242 "psubusw %%mm0, %%mm4 \n\t" // hd |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1243 "psubusw %%mm1, %%mm5 \n\t" // ld |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1244 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1245 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1246 "movq w05, %%mm2 \n\t" // 5 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1247 "pmullw %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1248 "pmullw %%mm2, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1249 "movq w20, %%mm2 \n\t" // 32 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1250 "paddw %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1251 "paddw %%mm2, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1252 "psrlw $6, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1253 "psrlw $6, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1254 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1255 /* |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1256 "movq w06, %%mm2 \n\t" // 6 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1257 "paddw %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1258 "paddw %%mm2, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1259 "movq w1400, %%mm2 \n\t" // 1400h = 5120 = 5/64*2^16 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1260 //FIXME if *5/64 is supposed to be /13 then we should use 5041 instead of 5120 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1261 "pmulhw %%mm2, %%mm4 \n\t" // hd/13 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1262 "pmulhw %%mm2, %%mm5 \n\t" // ld/13 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1263 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1264 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1265 "movq temp2, %%mm0 \n\t" // L3 - L4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1266 "movq temp3, %%mm1 \n\t" // H3 - H4 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1267 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1268 "pxor %%mm2, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1269 "pxor %%mm3, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1270 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1271 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1272 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1273 "pxor %%mm2, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1274 "pxor %%mm3, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1275 "psubw %%mm2, %%mm0 \n\t" // |L3-L4| |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1276 "psubw %%mm3, %%mm1 \n\t" // |H3-H4| |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1277 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2 |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1278 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1279 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1280 "pxor %%mm6, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1281 "pxor %%mm7, %%mm3 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1282 "pand %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1283 "pand %%mm3, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1284 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1285 #ifdef HAVE_MMX2 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1286 "pminsw %%mm0, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1287 "pminsw %%mm1, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1288 #else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1289 "movq %%mm4, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1290 "psubusw %%mm0, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1291 "psubw %%mm2, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1292 "movq %%mm5, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1293 "psubusw %%mm1, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1294 "psubw %%mm2, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1295 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1296 "pxor %%mm6, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1297 "pxor %%mm7, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1298 "psubw %%mm6, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1299 "psubw %%mm7, %%mm5 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1300 "packsswb %%mm5, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1301 "movq (%%eax, %1, 2), %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1302 "paddb %%mm4, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1303 "movq %%mm0, (%%eax, %1, 2) \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1304 "movq (%0, %1, 4), %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1305 "psubb %%mm4, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1306 "movq %%mm0, (%0, %1, 4) \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1307 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1308 : |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1309 : "r" (src), "r" (stride), "r" (QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1310 : "%eax", "%ebx" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1311 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1312 #else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1313 const int l1= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1314 const int l2= stride + l1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1315 const int l3= stride + l2; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1316 const int l4= stride + l3; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1317 const int l5= stride + l4; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1318 const int l6= stride + l5; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1319 const int l7= stride + l6; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1320 const int l8= stride + l7; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1321 // const int l9= stride + l8; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1322 int x; |
2246 | 1323 src+= stride*3; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1324 for(x=0; x<BLOCK_SIZE; x++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1325 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1326 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1327 if(ABS(middleEnergy) < 8*QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1328 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1329 const int q=(src[l4] - src[l5])/2; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1330 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1331 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1332 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1333 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1334 d= MAX(d, 0); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1335 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1336 d= (5*d + 32) >> 6; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1337 d*= SIGN(-middleEnergy); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1338 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1339 if(q>0) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1340 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1341 d= d<0 ? 0 : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1342 d= d>q ? q : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1343 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1344 else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1345 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1346 d= d>0 ? 0 : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1347 d= d<q ? q : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1348 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1349 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1350 src[l4]-= d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1351 src[l5]+= d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1352 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1353 src++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1354 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1355 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1356 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1357 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1358 //FIXME? |255-0| = 1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1359 /** |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1360 * Check if the given 8x8 Block is mostly "flat" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1361 */ |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1362 static inline int isHorizDC(uint8_t src[], int stride) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1363 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1364 // src++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1365 int numEq= 0; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1366 #if 0 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1367 asm volatile ( |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1368 // "int $3 \n\t" |
2416 | 1369 "leal (%1, %2), %%ecx \n\t" |
1370 "leal (%%ecx, %2, 4), %%ebx \n\t" | |
1371 // 0 1 2 3 4 5 6 7 8 9 | |
1372 // %1 ecx ecx+%2 ecx+2%2 %1+4%2 ebx ebx+%2 ebx+2%2 %1+8%2 ebx+4%2 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1373 "movq b7E, %%mm7 \n\t" // mm7 = 0x7F |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1374 "movq b7C, %%mm6 \n\t" // mm6 = 0x7D |
2416 | 1375 "pxor %%mm0, %%mm0 \n\t" |
1376 "movl %1, %%eax \n\t" | |
1377 "andl $0x1F, %%eax \n\t" | |
1378 "cmpl $24, %%eax \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1379 "leal tempBlock, %%eax \n\t" |
2416 | 1380 "jb 1f \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1381 |
2416 | 1382 #define HDC_CHECK_AND_CPY(src, dst) \ |
1383 "movd " #src ", %%mm2 \n\t"\ | |
1384 "punpckldq 4" #src ", %%mm2 \n\t" /* (%1) */\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1385 "movq %%mm2, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1386 "psrlq $8, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1387 "psubb %%mm1, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1388 "paddb %%mm7, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1389 "pcmpgtb %%mm6, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1390 "paddb %%mm2, %%mm0 \n\t"\ |
2416 | 1391 "movq %%mm1," #dst "(%%eax) \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1392 |
2416 | 1393 HDC_CHECK_AND_CPY((%1),0) |
1394 HDC_CHECK_AND_CPY((%%ecx),8) | |
1395 HDC_CHECK_AND_CPY((%%ecx, %2),16) | |
1396 HDC_CHECK_AND_CPY((%%ecx, %2, 2),24) | |
1397 HDC_CHECK_AND_CPY((%1, %2, 4),32) | |
1398 HDC_CHECK_AND_CPY((%%ebx),40) | |
1399 HDC_CHECK_AND_CPY((%%ebx, %2),48) | |
1400 HDC_CHECK_AND_CPY((%%ebx, %2, 2),56) | |
1401 "jmp 2f \n\t" | |
1402 "1: \n\t" | |
1403 // src does not cross a 32 byte cache line so dont waste time with alignment | |
1404 #define HDC_CHECK_AND_CPY2(src, dst) \ | |
1405 "movq " #src ", %%mm2 \n\t"\ | |
1406 "movq " #src ", %%mm1 \n\t"\ | |
1407 "psrlq $8, %%mm2 \n\t"\ | |
1408 "psubb %%mm1, %%mm2 \n\t"\ | |
1409 "paddb %%mm7, %%mm2 \n\t"\ | |
1410 "pcmpgtb %%mm6, %%mm2 \n\t"\ | |
1411 "paddb %%mm2, %%mm0 \n\t"\ | |
1412 "movq %%mm1," #dst "(%%eax) \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1413 |
2416 | 1414 HDC_CHECK_AND_CPY2((%1),0) |
1415 HDC_CHECK_AND_CPY2((%%ecx),8) | |
1416 HDC_CHECK_AND_CPY2((%%ecx, %2),16) | |
1417 HDC_CHECK_AND_CPY2((%%ecx, %2, 2),24) | |
1418 HDC_CHECK_AND_CPY2((%1, %2, 4),32) | |
1419 HDC_CHECK_AND_CPY2((%%ebx),40) | |
1420 HDC_CHECK_AND_CPY2((%%ebx, %2),48) | |
1421 HDC_CHECK_AND_CPY2((%%ebx, %2, 2),56) | |
1422 "2: \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1423 "psllq $8, %%mm0 \n\t" // remove dummy value |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1424 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1425 "psrlw $8, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1426 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1427 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1428 "psrlq $16, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1429 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1430 "movq %%mm0, %%mm1 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1431 "psrlq $32, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1432 "paddb %%mm1, %%mm0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1433 "movd %%mm0, %0 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1434 : "=r" (numEq) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1435 : "r" (src), "r" (stride) |
2416 | 1436 : "%eax", "%ebx", "%ecx" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1437 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1438 // printf("%d\n", numEq); |
2416 | 1439 numEq= (256 - numEq) &0xFF; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1440 #else |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1441 int y; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1442 for(y=0; y<BLOCK_SIZE; y++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1443 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1444 if(((src[0] - src[1] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1445 if(((src[1] - src[2] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1446 if(((src[2] - src[3] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1447 if(((src[3] - src[4] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1448 if(((src[4] - src[5] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1449 if(((src[5] - src[6] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1450 if(((src[6] - src[7] + 1) & 0xFFFF) < 3) numEq++; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1451 src+= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1452 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1453 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1454 /* if(abs(numEq - asmEq) > 0) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1455 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1456 // printf("\nasm:%d c:%d\n", asmEq, numEq); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1457 for(int y=0; y<8; y++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1458 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1459 for(int x=0; x<8; x++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1460 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1461 printf("%d ", src[x + y*stride]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1462 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1463 printf("\n"); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1464 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1465 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1466 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1467 // printf("%d\n", numEq); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1468 return numEq > hFlatnessThreshold; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1469 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1470 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1471 static inline int isHorizMinMaxOk(uint8_t src[], int stride, int QP) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1472 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1473 if(abs(src[0] - src[7]) > 2*QP) return 0; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1474 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1475 return 1; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1476 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1477 |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1478 static inline void doHorizDefFilter(uint8_t dst[], int stride, int QP) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1479 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1480 #if 0 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1481 asm volatile( |
2428 | 1482 "leal (%0, %1), %%ecx \n\t" |
1483 "leal (%%ecx, %1, 4), %%ebx \n\t" | |
1484 // 0 1 2 3 4 5 6 7 8 9 | |
1485 // %0 ecx ecx+%1 ecx+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1486 "pxor %%mm7, %%mm7 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1487 "movq bm00001000, %%mm6 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1488 "movd %2, %%mm5 \n\t" // QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1489 "movq %%mm5, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1490 "paddusb %%mm5, %%mm5 \n\t" // 2QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1491 "paddusb %%mm5, %%mm4 \n\t" // 3QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1492 "psllq $24, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1493 "pxor %%mm5, %%mm5 \n\t" // 0 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1494 "psubb %%mm4, %%mm5 \n\t" // -QP |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1495 "leal tempBlock, %%eax \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1496 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1497 //FIXME? "unroll by 2" and mix |
2159 | 1498 #ifdef HAVE_MMX2 |
2428 | 1499 #define HDF(src, dst) \ |
1500 "movq " #src "(%%eax), %%mm0 \n\t"\ | |
1501 "movq " #src "(%%eax), %%mm1 \n\t"\ | |
1502 "movq " #src "(%%eax), %%mm2 \n\t"\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1503 "psrlq $8, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1504 "psubusb %%mm1, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1505 "psubusb %%mm0, %%mm1 \n\t"\ |
2159 | 1506 "por %%mm2, %%mm1 \n\t" /* p´x = |px - p(x+1)| */\ |
1507 "pcmpeqb %%mm7, %%mm2 \n\t" /* p´x = sgn[px - p(x+1)] */\ | |
1508 "pshufw $0x00, %%mm1, %%mm3 \n\t" /* p´5 = |p1 - p2| */\ | |
1509 "pminub %%mm1, %%mm3 \n\t" /* p´5 = min(|p2-p1|, |p6-p5|)*/\ | |
1510 "psrlq $16, %%mm3 \n\t" /* p´3 = min(|p2-p1|, |p6-p5|)*/\ | |
1511 "psubusb %%mm3, %%mm1 \n\t" /* |p3-p4|-min(|p1-p2|,|p5-p6|) */\ | |
1512 "paddb %%mm5, %%mm1 \n\t"\ | |
1513 "psubusb %%mm5, %%mm1 \n\t"\ | |
1514 "psrlw $2, %%mm1 \n\t"\ | |
1515 "pxor %%mm2, %%mm1 \n\t"\ | |
1516 "psubb %%mm2, %%mm1 \n\t"\ | |
1517 "pand %%mm6, %%mm1 \n\t"\ | |
1518 "psubb %%mm1, %%mm0 \n\t"\ | |
1519 "psllq $8, %%mm1 \n\t"\ | |
1520 "paddb %%mm1, %%mm0 \n\t"\ | |
2428 | 1521 "movd %%mm0, " #dst" \n\t"\ |
2159 | 1522 "psrlq $32, %%mm0 \n\t"\ |
2428 | 1523 "movd %%mm0, 4" #dst" \n\t" |
2159 | 1524 #else |
2428 | 1525 #define HDF(src, dst)\ |
1526 "movq " #src "(%%eax), %%mm0 \n\t"\ | |
2159 | 1527 "movq %%mm0, %%mm1 \n\t"\ |
1528 "movq %%mm0, %%mm2 \n\t"\ | |
1529 "psrlq $8, %%mm1 \n\t"\ | |
1530 "psubusb %%mm1, %%mm2 \n\t"\ | |
1531 "psubusb %%mm0, %%mm1 \n\t"\ | |
1532 "por %%mm2, %%mm1 \n\t" /* p´x = |px - p(x+1)| */\ | |
1533 "pcmpeqb %%mm7, %%mm2 \n\t" /* p´x = sgn[px - p(x+1)] */\ | |
1534 "movq %%mm1, %%mm3 \n\t"\ | |
1535 "psllq $32, %%mm3 \n\t"\ | |
1536 "movq %%mm3, %%mm4 \n\t"\ | |
1537 "psubusb %%mm1, %%mm4 \n\t"\ | |
1538 "psubb %%mm4, %%mm3 \n\t"\ | |
1539 "psrlq $16, %%mm3 \n\t" /* p´3 = min(|p2-p1|, |p6-p5|)*/\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1540 "psubusb %%mm3, %%mm1 \n\t" /* |p3-p4|-min(|p1-p2|,|p5,ü6|) */\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1541 "paddb %%mm5, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1542 "psubusb %%mm5, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1543 "psrlw $2, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1544 "pxor %%mm2, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1545 "psubb %%mm2, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1546 "pand %%mm6, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1547 "psubb %%mm1, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1548 "psllq $8, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1549 "paddb %%mm1, %%mm0 \n\t"\ |
2428 | 1550 "movd %%mm0, " #dst " \n\t"\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1551 "psrlq $32, %%mm0 \n\t"\ |
2428 | 1552 "movd %%mm0, 4" #dst " \n\t" |
2159 | 1553 #endif |
2428 | 1554 HDF(0,(%0)) |
1555 HDF(8,(%%ecx)) | |
1556 HDF(16,(%%ecx, %1)) | |
1557 HDF(24,(%%ecx, %1, 2)) | |
1558 HDF(32,(%0, %1, 4)) | |
1559 HDF(40,(%%ebx)) | |
1560 HDF(48,(%%ebx, %1)) | |
1561 HDF(56,(%%ebx, %1, 2)) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1562 : |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1563 : "r" (dst), "r" (stride), "r" (QP) |
2428 | 1564 : "%eax", "%ebx", "%ecx" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1565 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1566 #else |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1567 int y; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1568 for(y=0; y<BLOCK_SIZE; y++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1569 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1570 const int middleEnergy= 5*(dst[4] - dst[5]) + 2*(dst[2] - dst[5]); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1571 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1572 if(ABS(middleEnergy) < 8*QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1573 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1574 const int q=(dst[3] - dst[4])/2; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1575 const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1576 const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1577 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1578 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1579 d= MAX(d, 0); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1580 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1581 d= (5*d + 32) >> 6; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1582 d*= SIGN(-middleEnergy); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1583 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1584 if(q>0) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1585 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1586 d= d<0 ? 0 : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1587 d= d>q ? q : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1588 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1589 else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1590 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1591 d= d>0 ? 0 : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1592 d= d<q ? q : d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1593 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1594 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1595 dst[3]-= d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1596 dst[4]+= d; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1597 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1598 dst+= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1599 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1600 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1601 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1602 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1603 /** |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1604 * Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block) |
2221 | 1605 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version) |
1606 * using the 7-Tap Filter (2,2,2,4,2,2,2)/16 (MMX2/3DNOW version) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1607 */ |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1608 static inline void doHorizLowPass(uint8_t dst[], int stride, int QP) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1609 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1610 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1611 #if 0 |
2428 | 1612 asm volatile( |
1613 "leal (%0, %1), %%ecx \n\t" | |
1614 "leal (%%ecx, %1, 4), %%ebx \n\t" | |
1615 // 0 1 2 3 4 5 6 7 8 9 | |
1616 // %0 ecx ecx+%1 ecx+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1617 "pxor %%mm7, %%mm7 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1618 "leal tempBlock, %%eax \n\t" |
2159 | 1619 /* |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1620 #define HLP1 "movq (%0), %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1621 "movq %%mm0, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1622 "psllq $8, %%mm0 \n\t"\ |
2159 | 1623 PAVGB(%%mm1, %%mm0)\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1624 "psrlw $8, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1625 "pxor %%mm1, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1626 "packuswb %%mm1, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1627 "movq %%mm0, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1628 "movq %%mm0, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1629 "psllq $32, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1630 "paddb %%mm0, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1631 "psllq $16, %%mm2 \n\t"\ |
2159 | 1632 PAVGB(%%mm2, %%mm0)\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1633 "movq %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1634 "pand bm11001100, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1635 "paddusb %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1636 "psrlq $8, %%mm3 \n\t"\ |
2159 | 1637 PAVGB(%%mm1, %%mm4)\ |
1638 PAVGB(%%mm3, %%mm2)\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1639 "psrlq $16, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1640 "punpcklbw %%mm2, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1641 "movq %%mm2, (%0) \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1642 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1643 #define HLP2 "movq (%0), %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1644 "movq %%mm0, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1645 "psllq $8, %%mm0 \n\t"\ |
2159 | 1646 PAVGB(%%mm1, %%mm0)\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1647 "psrlw $8, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1648 "pxor %%mm1, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1649 "packuswb %%mm1, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1650 "movq %%mm0, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1651 "psllq $32, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1652 "psllq $16, %%mm2 \n\t"\ |
2159 | 1653 PAVGB(%%mm2, %%mm0)\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1654 "movq %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1655 "pand bm11001100, %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1656 "paddusb %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1657 "psrlq $8, %%mm3 \n\t"\ |
2159 | 1658 PAVGB(%%mm3, %%mm2)\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1659 "psrlq $16, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1660 "punpcklbw %%mm2, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1661 "movq %%mm2, (%0) \n\t"\ |
2159 | 1662 */ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1663 // approximately a 7-Tap Filter with Vector (1,2,3,4,3,2,1)/16 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1664 /* |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1665 Implemented Exact 7-Tap |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1666 9421 A321 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1667 36421 64321 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1668 334321 = |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1669 1234321 = |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1670 1234321 = |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1671 123433 = |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1672 12463 12346 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1673 1249 123A |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1674 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1675 */ |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1676 |
2159 | 1677 #ifdef HAVE_MMX2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1678 #define HLP3(i) "movq " #i "(%%eax), %%mm0 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1679 "movq %%mm0, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1680 "movq %%mm0, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1681 "movq %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1682 "movq %%mm0, %%mm4 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1683 "psllq $8, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1684 "psrlq $8, %%mm2 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1685 "pand bm00000001, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1686 "pand bm10000000, %%mm4 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1687 "por %%mm3, %%mm1 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1688 "por %%mm4, %%mm2 \n\t"\ |
2159 | 1689 PAVGB(%%mm2, %%mm1)\ |
1690 PAVGB(%%mm1, %%mm0)\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1691 \ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1692 "pshufw $0xF9, %%mm0, %%mm3 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1693 "pshufw $0x90, %%mm0, %%mm4 \n\t"\ |
2159 | 1694 PAVGB(%%mm3, %%mm4)\ |
1695 PAVGB(%%mm4, %%mm0)\ | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1696 "movd %%mm0, (%0) \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1697 "psrlq $32, %%mm0 \n\t"\ |
2159 | 1698 "movd %%mm0, 4(%0) \n\t" |
1699 #else | |
1700 #define HLP3(i) "movq " #i "(%%eax), %%mm0 \n\t"\ | |
1701 "movq %%mm0, %%mm1 \n\t"\ | |
1702 "movq %%mm0, %%mm2 \n\t"\ | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1703 "movd -4(%0), %%mm3 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1704 "movd 8(%0), %%mm4 \n\t" /*0001000*/\ |
2159 | 1705 "psllq $8, %%mm1 \n\t"\ |
1706 "psrlq $8, %%mm2 \n\t"\ | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1707 "psrlq $24, %%mm3 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1708 "psllq $56, %%mm4 \n\t"\ |
2159 | 1709 "por %%mm3, %%mm1 \n\t"\ |
1710 "por %%mm4, %%mm2 \n\t"\ | |
1711 PAVGB(%%mm2, %%mm1)\ | |
1712 PAVGB(%%mm1, %%mm0)\ | |
1713 \ | |
1714 "movq %%mm0, %%mm3 \n\t"\ | |
1715 "movq %%mm0, %%mm4 \n\t"\ | |
1716 "movq %%mm0, %%mm5 \n\t"\ | |
1717 "psrlq $16, %%mm3 \n\t"\ | |
1718 "psllq $16, %%mm4 \n\t"\ | |
1719 "pand bm11000000, %%mm5 \n\t"\ | |
1720 "por %%mm5, %%mm3 \n\t"\ | |
1721 "movq %%mm0, %%mm5 \n\t"\ | |
1722 "pand bm00000011, %%mm5 \n\t"\ | |
1723 "por %%mm5, %%mm4 \n\t"\ | |
1724 PAVGB(%%mm3, %%mm4)\ | |
1725 PAVGB(%%mm4, %%mm0)\ | |
1726 "movd %%mm0, (%0) \n\t"\ | |
1727 "psrlq $32, %%mm0 \n\t"\ | |
1728 "movd %%mm0, 4(%0) \n\t" | |
1729 #endif | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1730 |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1731 /* uses the 7-Tap Filter: 1112111 */ |
2428 | 1732 #define NEW_HLP(src, dst)\ |
1733 "movq " #src "(%%eax), %%mm1 \n\t"\ | |
1734 "movq " #src "(%%eax), %%mm2 \n\t"\ | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1735 "psllq $8, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1736 "psrlq $8, %%mm2 \n\t"\ |
2428 | 1737 "movd -4" #dst ", %%mm3 \n\t" /*0001000*/\ |
1738 "movd 8" #dst ", %%mm4 \n\t" /*0001000*/\ | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1739 "psrlq $24, %%mm3 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1740 "psllq $56, %%mm4 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1741 "por %%mm3, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1742 "por %%mm4, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1743 "movq %%mm1, %%mm5 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1744 PAVGB(%%mm2, %%mm1)\ |
2428 | 1745 "movq " #src "(%%eax), %%mm0 \n\t"\ |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1746 PAVGB(%%mm1, %%mm0)\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1747 "psllq $8, %%mm5 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1748 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1749 "por %%mm3, %%mm5 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1750 "por %%mm4, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1751 "movq %%mm5, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1752 PAVGB(%%mm2, %%mm5)\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1753 "psllq $8, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1754 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1755 "por %%mm3, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1756 "por %%mm4, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1757 PAVGB(%%mm2, %%mm1)\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1758 PAVGB(%%mm1, %%mm5)\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1759 PAVGB(%%mm5, %%mm0)\ |
2428 | 1760 "movd %%mm0, " #dst " \n\t"\ |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1761 "psrlq $32, %%mm0 \n\t"\ |
2428 | 1762 "movd %%mm0, 4" #dst " \n\t" |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1763 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1764 /* uses the 9-Tap Filter: 112242211 */ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1765 #define NEW_HLP2(i)\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1766 "movq " #i "(%%eax), %%mm0 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1767 "movq %%mm0, %%mm1 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1768 "movq %%mm0, %%mm2 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1769 "movd -4(%0), %%mm3 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1770 "movd 8(%0), %%mm4 \n\t" /*0001000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1771 "psllq $8, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1772 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1773 "psrlq $24, %%mm3 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1774 "psllq $56, %%mm4 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1775 "por %%mm3, %%mm1 \n\t" /*0010000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1776 "por %%mm4, %%mm2 \n\t" /*0000100*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1777 "movq %%mm1, %%mm5 \n\t" /*0010000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1778 PAVGB(%%mm2, %%mm1) /*0010100*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1779 PAVGB(%%mm1, %%mm0) /*0012100*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1780 "psllq $8, %%mm5 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1781 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1782 "por %%mm3, %%mm5 \n\t" /*0100000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1783 "por %%mm4, %%mm2 \n\t" /*0000010*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1784 "movq %%mm5, %%mm1 \n\t" /*0100000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1785 PAVGB(%%mm2, %%mm5) /*0100010*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1786 "psllq $8, %%mm1 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1787 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1788 "por %%mm3, %%mm1 \n\t" /*1000000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1789 "por %%mm4, %%mm2 \n\t" /*0000001*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1790 "movq %%mm1, %%mm6 \n\t" /*1000000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1791 PAVGB(%%mm2, %%mm1) /*1000001*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1792 "psllq $8, %%mm6 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1793 "psrlq $8, %%mm2 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1794 "por %%mm3, %%mm6 \n\t"/*100000000*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1795 "por %%mm4, %%mm2 \n\t"/*000000001*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1796 PAVGB(%%mm2, %%mm6) /*100000001*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1797 PAVGB(%%mm6, %%mm1) /*110000011*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1798 PAVGB(%%mm1, %%mm5) /*112000211*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1799 PAVGB(%%mm5, %%mm0) /*112242211*/\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1800 "movd %%mm0, (%0) \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1801 "psrlq $32, %%mm0 \n\t"\ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1802 "movd %%mm0, 4(%0) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
1803 |
2428 | 1804 #define HLP(src, dst) NEW_HLP(src, dst) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1805 |
2428 | 1806 HLP(0, (%0)) |
1807 HLP(8, (%%ecx)) | |
1808 HLP(16, (%%ecx, %1)) | |
1809 HLP(24, (%%ecx, %1, 2)) | |
1810 HLP(32, (%0, %1, 4)) | |
1811 HLP(40, (%%ebx)) | |
1812 HLP(48, (%%ebx, %1)) | |
1813 HLP(56, (%%ebx, %1, 2)) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1814 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1815 : |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1816 : "r" (dst), "r" (stride) |
2428 | 1817 : "%eax", "%ebx", "%ecx" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1818 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1819 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1820 #else |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1821 int y; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
1822 for(y=0; y<BLOCK_SIZE; y++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1823 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1824 const int first= ABS(dst[-1] - dst[0]) < QP ? dst[-1] : dst[0]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1825 const int last= ABS(dst[8] - dst[7]) < QP ? dst[8] : dst[7]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1826 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1827 int sums[9]; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1828 sums[0] = first + dst[0]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1829 sums[1] = dst[0] + dst[1]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1830 sums[2] = dst[1] + dst[2]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1831 sums[3] = dst[2] + dst[3]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1832 sums[4] = dst[3] + dst[4]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1833 sums[5] = dst[4] + dst[5]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1834 sums[6] = dst[5] + dst[6]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1835 sums[7] = dst[6] + dst[7]; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
1836 sums[8] = dst[7] + last; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1837 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1838 dst[0]= ((sums[0]<<2) + ((first + sums[2])<<1) + sums[4] + 8)>>4; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1839 dst[1]= ((dst[1]<<2) + ((first + sums[0] + sums[3])<<1) + sums[5] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1840 dst[2]= ((dst[2]<<2) + ((first + sums[1] + sums[4])<<1) + sums[6] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1841 dst[3]= ((dst[3]<<2) + ((sums[2] + sums[5])<<1) + sums[0] + sums[7] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1842 dst[4]= ((dst[4]<<2) + ((sums[3] + sums[6])<<1) + sums[1] + sums[8] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1843 dst[5]= ((dst[5]<<2) + ((last + sums[7] + sums[4])<<1) + sums[2] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1844 dst[6]= (((last + dst[6])<<2) + ((dst[7] + sums[5])<<1) + sums[3] + 8)>>4; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1845 dst[7]= ((sums[8]<<2) + ((last + sums[6])<<1) + sums[4] + 8)>>4; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1846 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1847 dst+= stride; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1848 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1849 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1850 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1851 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1852 static inline void dering(uint8_t src[], int stride, int QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1853 { |
2475 | 1854 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1855 asm volatile( |
2473 | 1856 "movq pQPb, %%mm0 \n\t" |
1857 "paddusb %%mm0, %%mm0 \n\t" | |
1858 "movq %%mm0, pQPb2 \n\t" | |
1859 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1860 "leal (%0, %1), %%eax \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1861 "leal (%%eax, %1, 4), %%ebx \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1862 // 0 1 2 3 4 5 6 7 8 9 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1863 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1864 |
2473 | 1865 "pcmpeqb %%mm6, %%mm6 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1866 "pxor %%mm7, %%mm7 \n\t" |
2475 | 1867 #ifdef HAVE_MMX2 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1868 #define FIND_MIN_MAX(addr)\ |
2473 | 1869 "movq " #addr ", %%mm0 \n\t"\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1870 "pminub %%mm0, %%mm6 \n\t"\ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1871 "pmaxub %%mm0, %%mm7 \n\t" |
2475 | 1872 #else |
1873 #define FIND_MIN_MAX(addr)\ | |
1874 "movq " #addr ", %%mm0 \n\t"\ | |
1875 "movq %%mm6, %%mm1 \n\t"\ | |
1876 "psubusb %%mm0, %%mm7 \n\t"\ | |
1877 "paddb %%mm0, %%mm7 \n\t"\ | |
1878 "psubusb %%mm0, %%mm1 \n\t"\ | |
1879 "psubb %%mm1, %%mm6 \n\t" | |
1880 #endif | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1881 |
2473 | 1882 FIND_MIN_MAX((%%eax)) |
1883 FIND_MIN_MAX((%%eax, %1)) | |
1884 FIND_MIN_MAX((%%eax, %1, 2)) | |
1885 FIND_MIN_MAX((%0, %1, 4)) | |
1886 FIND_MIN_MAX((%%ebx)) | |
1887 FIND_MIN_MAX((%%ebx, %1)) | |
1888 FIND_MIN_MAX((%%ebx, %1, 2)) | |
1889 FIND_MIN_MAX((%0, %1, 8)) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1890 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1891 "movq %%mm6, %%mm4 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1892 "psrlq $8, %%mm6 \n\t" |
2475 | 1893 #ifdef HAVE_MMX2 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1894 "pminub %%mm4, %%mm6 \n\t" // min of pixels |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1895 "pshufw $0xF9, %%mm6, %%mm4 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1896 "pminub %%mm4, %%mm6 \n\t" // min of pixels |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1897 "pshufw $0xFE, %%mm6, %%mm4 \n\t" |
2475 | 1898 "pminub %%mm4, %%mm6 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1899 #else |
2475 | 1900 "movq %%mm6, %%mm1 \n\t" |
1901 "psubusb %%mm4, %%mm1 \n\t" | |
1902 "psubb %%mm1, %%mm6 \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1903 "movq %%mm6, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1904 "psrlq $16, %%mm6 \n\t" |
2475 | 1905 "movq %%mm6, %%mm1 \n\t" |
1906 "psubusb %%mm4, %%mm1 \n\t" | |
1907 "psubb %%mm1, %%mm6 \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1908 "movq %%mm6, %%mm4 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1909 "psrlq $32, %%mm6 \n\t" |
2475 | 1910 "movq %%mm6, %%mm1 \n\t" |
1911 "psubusb %%mm4, %%mm1 \n\t" | |
1912 "psubb %%mm1, %%mm6 \n\t" | |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1913 #endif |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1914 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1915 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1916 "movq %%mm7, %%mm4 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1917 "psrlq $8, %%mm7 \n\t" |
2475 | 1918 #ifdef HAVE_MMX2 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1919 "pmaxub %%mm4, %%mm7 \n\t" // max of pixels |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1920 "pshufw $0xF9, %%mm7, %%mm4 \n\t" |
2475 | 1921 "pmaxub %%mm4, %%mm7 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1922 "pshufw $0xFE, %%mm7, %%mm4 \n\t" |
2475 | 1923 "pmaxub %%mm4, %%mm7 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1924 #else |
2475 | 1925 "psubusb %%mm4, %%mm7 \n\t" |
1926 "paddb %%mm4, %%mm7 \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1927 "movq %%mm7, %%mm4 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1928 "psrlq $16, %%mm7 \n\t" |
2475 | 1929 "psubusb %%mm4, %%mm7 \n\t" |
1930 "paddb %%mm4, %%mm7 \n\t" | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1931 "movq %%mm7, %%mm4 \n\t" |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1932 "psrlq $32, %%mm7 \n\t" |
2475 | 1933 "psubusb %%mm4, %%mm7 \n\t" |
1934 "paddb %%mm4, %%mm7 \n\t" | |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1935 #endif |
2473 | 1936 PAVGB(%%mm6, %%mm7) // a=(max + min)/2 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1937 "punpcklbw %%mm7, %%mm7 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1938 "punpcklbw %%mm7, %%mm7 \n\t" |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
1939 "punpcklbw %%mm7, %%mm7 \n\t" |
2473 | 1940 "movq %%mm7, temp0 \n\t" |
1941 | |
1942 "movq (%0), %%mm0 \n\t" // L10 | |
1943 "movq %%mm0, %%mm1 \n\t" // L10 | |
1944 "movq %%mm0, %%mm2 \n\t" // L10 | |
1945 "psllq $8, %%mm1 \n\t" | |
1946 "psrlq $8, %%mm2 \n\t" | |
1947 "movd -4(%0), %%mm3 \n\t" | |
1948 "movd 8(%0), %%mm4 \n\t" | |
1949 "psrlq $24, %%mm3 \n\t" | |
1950 "psllq $56, %%mm4 \n\t" | |
1951 "por %%mm3, %%mm1 \n\t" // L00 | |
1952 "por %%mm4, %%mm2 \n\t" // L20 | |
1953 "movq %%mm1, %%mm3 \n\t" // L00 | |
1954 PAVGB(%%mm2, %%mm1) // (L20 + L00)/2 | |
1955 PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4 | |
1956 "psubusb %%mm7, %%mm0 \n\t" | |
1957 "psubusb %%mm7, %%mm2 \n\t" | |
1958 "psubusb %%mm7, %%mm3 \n\t" | |
1959 "pcmpeqb b00, %%mm0 \n\t" // L10 > a ? 0 : -1 | |
1960 "pcmpeqb b00, %%mm2 \n\t" // L20 > a ? 0 : -1 | |
1961 "pcmpeqb b00, %%mm3 \n\t" // L00 > a ? 0 : -1 | |
1962 "paddb %%mm2, %%mm0 \n\t" | |
1963 "paddb %%mm3, %%mm0 \n\t" | |
1964 | |
1965 "movq (%%eax), %%mm2 \n\t" // L11 | |
1966 "movq %%mm2, %%mm3 \n\t" // L11 | |
1967 "movq %%mm2, %%mm4 \n\t" // L11 | |
1968 "psllq $8, %%mm3 \n\t" | |
1969 "psrlq $8, %%mm4 \n\t" | |
1970 "movd -4(%%eax), %%mm5 \n\t" | |
1971 "movd 8(%%eax), %%mm6 \n\t" | |
1972 "psrlq $24, %%mm5 \n\t" | |
1973 "psllq $56, %%mm6 \n\t" | |
1974 "por %%mm5, %%mm3 \n\t" // L01 | |
1975 "por %%mm6, %%mm4 \n\t" // L21 | |
1976 "movq %%mm3, %%mm5 \n\t" // L01 | |
1977 PAVGB(%%mm4, %%mm3) // (L21 + L01)/2 | |
1978 PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4 | |
1979 "psubusb %%mm7, %%mm2 \n\t" | |
1980 "psubusb %%mm7, %%mm4 \n\t" | |
1981 "psubusb %%mm7, %%mm5 \n\t" | |
1982 "pcmpeqb b00, %%mm2 \n\t" // L11 > a ? 0 : -1 | |
1983 "pcmpeqb b00, %%mm4 \n\t" // L21 > a ? 0 : -1 | |
1984 "pcmpeqb b00, %%mm5 \n\t" // L01 > a ? 0 : -1 | |
1985 "paddb %%mm4, %%mm2 \n\t" | |
1986 "paddb %%mm5, %%mm2 \n\t" | |
1987 // 0, 2, 3, 1 | |
1988 #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \ | |
1989 "movq " #src ", " #sx " \n\t" /* src[0] */\ | |
1990 "movq " #sx ", " #lx " \n\t" /* src[0] */\ | |
1991 "movq " #sx ", " #t0 " \n\t" /* src[0] */\ | |
1992 "psllq $8, " #lx " \n\t"\ | |
1993 "psrlq $8, " #t0 " \n\t"\ | |
1994 "movd -4" #src ", " #t1 " \n\t"\ | |
1995 "psrlq $24, " #t1 " \n\t"\ | |
1996 "por " #t1 ", " #lx " \n\t" /* src[-1] */\ | |
1997 "movd 8" #src ", " #t1 " \n\t"\ | |
1998 "psllq $56, " #t1 " \n\t"\ | |
1999 "por " #t1 ", " #t0 " \n\t" /* src[+1] */\ | |
2000 "movq " #lx ", " #t1 " \n\t" /* src[-1] */\ | |
2001 PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\ | |
2002 PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\ | |
2478 | 2003 PAVGB(lx, pplx) \ |
2004 "movq " #lx ", temp1 \n\t"\ | |
2005 "movq temp0, " #lx " \n\t"\ | |
2570 | 2006 "psubusb " #lx ", " #t1 " \n\t"\ |
2007 "psubusb " #lx ", " #t0 " \n\t"\ | |
2008 "psubusb " #lx ", " #sx " \n\t"\ | |
2478 | 2009 "movq b00, " #lx " \n\t"\ |
2570 | 2010 "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\ |
2011 "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\ | |
2012 "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\ | |
2473 | 2013 "paddb " #t1 ", " #t0 " \n\t"\ |
2014 "paddb " #t0 ", " #sx " \n\t"\ | |
2015 \ | |
2016 PAVGB(plx, pplx) /* filtered */\ | |
2017 "movq " #dst ", " #t0 " \n\t" /* dst */\ | |
2477 | 2018 "movq " #t0 ", " #t1 " \n\t" /* dst */\ |
2019 "psubusb pQPb2, " #t0 " \n\t"\ | |
2020 "paddusb pQPb2, " #t1 " \n\t"\ | |
2021 PMAXUB(t0, pplx)\ | |
2022 PMINUB(t1, pplx, t0)\ | |
2473 | 2023 "paddb " #sx ", " #ppsx " \n\t"\ |
2024 "paddb " #psx ", " #ppsx " \n\t"\ | |
2025 "#paddb b02, " #ppsx " \n\t"\ | |
2026 "pand b08, " #ppsx " \n\t"\ | |
2570 | 2027 "pcmpeqb " #lx ", " #ppsx " \n\t"\ |
2477 | 2028 "pand " #ppsx ", " #pplx " \n\t"\ |
2473 | 2029 "pandn " #dst ", " #ppsx " \n\t"\ |
2570 | 2030 "por " #pplx ", " #ppsx " \n\t"\ |
2478 | 2031 "movq " #ppsx ", " #dst " \n\t"\ |
2032 "movq temp1, " #lx " \n\t" | |
2477 | 2033 |
2473 | 2034 /* |
2035 0000000 | |
2036 1111111 | |
2037 | |
2038 1111110 | |
2039 1111101 | |
2040 1111100 | |
2041 1111011 | |
2042 1111010 | |
2043 1111001 | |
2044 | |
2045 1111000 | |
2046 1110111 | |
2047 | |
2048 */ | |
2049 //DERING_CORE(dst,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1) | |
2050 DERING_CORE((%%eax),(%%eax, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) | |
2051 DERING_CORE((%%eax, %1),(%%eax, %1, 2) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
2052 DERING_CORE((%%eax, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) | |
2053 DERING_CORE((%0, %1, 4),(%%ebx) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) | |
2054 DERING_CORE((%%ebx),(%%ebx, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
2055 DERING_CORE((%%ebx, %1), (%%ebx, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) | |
2056 DERING_CORE((%%ebx, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) | |
2057 DERING_CORE((%0, %1, 8),(%%ebx, %1, 4) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2058 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2059 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2060 : : "r" (src), "r" (stride), "r" (QP) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2061 : "%eax", "%ebx" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2062 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2063 #else |
2477 | 2064 int y; |
2065 int min=255; | |
2066 int max=0; | |
2067 int avg; | |
2068 uint8_t *p; | |
2069 int s[10]; | |
2070 | |
2071 for(y=1; y<9; y++) | |
2072 { | |
2073 int x; | |
2074 p= src + stride*y; | |
2075 for(x=1; x<9; x++) | |
2076 { | |
2077 p++; | |
2078 if(*p > max) max= *p; | |
2079 if(*p < min) min= *p; | |
2080 } | |
2081 } | |
2082 avg= (min + max + 1)/2; | |
2083 | |
2084 for(y=0; y<10; y++) | |
2085 { | |
2086 int x; | |
2087 int t = 0; | |
2088 p= src + stride*y; | |
2089 for(x=0; x<10; x++) | |
2090 { | |
2091 if(*p > avg) t |= (1<<x); | |
2092 p++; | |
2093 } | |
2094 t |= (~t)<<16; | |
2095 t &= (t<<1) & (t>>1); | |
2096 s[y] = t; | |
2097 } | |
2098 | |
2099 for(y=1; y<9; y++) | |
2100 { | |
2101 int x; | |
2102 int t = s[y-1] & s[y] & s[y+1]; | |
2103 t|= t>>16; | |
2104 | |
2105 p= src + stride*y; | |
2106 for(x=1; x<9; x++) | |
2107 { | |
2108 p++; | |
2109 if(t & (1<<x)) | |
2110 { | |
2111 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1)) | |
2112 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1)) | |
2113 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1)); | |
2114 f= (f + 8)>>4; | |
2115 | |
2116 if (*p + 2*QP < f) *p= *p + 2*QP; | |
2117 else if(*p - 2*QP > f) *p= *p - 2*QP; | |
2118 else *p=f; | |
2119 } | |
2120 } | |
2121 } | |
2122 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2123 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2124 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2125 |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2126 /** |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2127 * Deinterlaces the given block |
2595 | 2128 * will be called for every 8x8 block and can read & write from line 4-15 |
2129 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
2130 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2131 */ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2132 static inline void deInterlaceInterpolateLinear(uint8_t src[], int stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2133 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2134 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2595 | 2135 src+= 4*stride; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2136 asm volatile( |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2137 "leal (%0, %1), %%eax \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2138 "leal (%%eax, %1, 4), %%ebx \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2139 // 0 1 2 3 4 5 6 7 8 9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2140 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2141 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2142 "movq (%0), %%mm0 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2143 "movq (%%eax, %1), %%mm1 \n\t" |
2246 | 2144 PAVGB(%%mm1, %%mm0) |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2145 "movq %%mm0, (%%eax) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2146 "movq (%0, %1, 4), %%mm0 \n\t" |
2246 | 2147 PAVGB(%%mm0, %%mm1) |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2148 "movq %%mm1, (%%eax, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2149 "movq (%%ebx, %1), %%mm1 \n\t" |
2246 | 2150 PAVGB(%%mm1, %%mm0) |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2151 "movq %%mm0, (%%ebx) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2152 "movq (%0, %1, 8), %%mm0 \n\t" |
2246 | 2153 PAVGB(%%mm0, %%mm1) |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2154 "movq %%mm1, (%%ebx, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2155 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2156 : : "r" (src), "r" (stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2157 : "%eax", "%ebx" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2158 ); |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2159 #else |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2160 int x; |
2595 | 2161 src+= 4*stride; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2162 for(x=0; x<8; x++) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2163 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2164 src[stride] = (src[0] + src[stride*2])>>1; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2165 src[stride*3] = (src[stride*2] + src[stride*4])>>1; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2166 src[stride*5] = (src[stride*4] + src[stride*6])>>1; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2167 src[stride*7] = (src[stride*6] + src[stride*8])>>1; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2168 src++; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2169 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2170 #endif |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2171 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2172 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2173 /** |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2174 * Deinterlaces the given block |
2595 | 2175 * will be called for every 8x8 block and can read & write from line 4-15 |
2176 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
2177 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
2178 * this filter will read lines 3-15 and write 7-13 | |
2246 | 2179 * no cliping in C version |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2180 */ |
2246 | 2181 static inline void deInterlaceInterpolateCubic(uint8_t src[], int stride) |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2182 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2183 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2595 | 2184 src+= stride*3; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2185 asm volatile( |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2186 "leal (%0, %1), %%eax \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2187 "leal (%%eax, %1, 4), %%ebx \n\t" |
2246 | 2188 "leal (%%ebx, %1, 4), %%ecx \n\t" |
2189 "addl %1, %%ecx \n\t" | |
2190 "pxor %%mm7, %%mm7 \n\t" | |
2191 // 0 1 2 3 4 5 6 7 8 9 10 | |
2192 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 ecx | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2193 |
2246 | 2194 #define DEINT_CUBIC(a,b,c,d,e)\ |
2195 "movq " #a ", %%mm0 \n\t"\ | |
2196 "movq " #b ", %%mm1 \n\t"\ | |
2197 "movq " #d ", %%mm2 \n\t"\ | |
2198 "movq " #e ", %%mm3 \n\t"\ | |
2199 PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\ | |
2200 PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\ | |
2201 "movq %%mm0, %%mm2 \n\t"\ | |
2202 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
2203 "punpckhbw %%mm7, %%mm2 \n\t"\ | |
2204 "movq %%mm1, %%mm3 \n\t"\ | |
2205 "punpcklbw %%mm7, %%mm1 \n\t"\ | |
2206 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
2207 "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\ | |
2208 "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\ | |
2209 "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\ | |
2210 "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\ | |
2211 "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\ | |
2212 "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\ | |
2213 "packuswb %%mm3, %%mm1 \n\t"\ | |
2214 "movq %%mm1, " #c " \n\t" | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2215 |
2246 | 2216 DEINT_CUBIC((%0), (%%eax, %1), (%%eax, %1, 2), (%0, %1, 4), (%%ebx, %1)) |
2217 DEINT_CUBIC((%%eax, %1), (%0, %1, 4), (%%ebx), (%%ebx, %1), (%0, %1, 8)) | |
2218 DEINT_CUBIC((%0, %1, 4), (%%ebx, %1), (%%ebx, %1, 2), (%0, %1, 8), (%%ecx)) | |
2219 DEINT_CUBIC((%%ebx, %1), (%0, %1, 8), (%%ebx, %1, 4), (%%ecx), (%%ecx, %1, 2)) | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2220 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2221 : : "r" (src), "r" (stride) |
2246 | 2222 : "%eax", "%ebx", "ecx" |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2223 ); |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2224 #else |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2225 int x; |
2595 | 2226 src+= stride*3; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2227 for(x=0; x<8; x++) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2228 { |
2246 | 2229 src[stride*3] = (-src[0] + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4; |
2230 src[stride*5] = (-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4; | |
2231 src[stride*7] = (-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4; | |
2232 src[stride*9] = (-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4; | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2233 src++; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2234 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2235 #endif |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2236 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2237 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2238 /** |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2239 * Deinterlaces the given block |
2595 | 2240 * will be called for every 8x8 block and can read & write from line 4-15 |
2241 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
2242 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2243 * will shift the image up by 1 line (FIXME if this is a problem) |
2595 | 2244 * this filter will read lines 4-13 and write 4-11 |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2245 */ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2246 static inline void deInterlaceBlendLinear(uint8_t src[], int stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2247 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2248 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
2595 | 2249 src+= 4*stride; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2250 asm volatile( |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2251 "leal (%0, %1), %%eax \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2252 "leal (%%eax, %1, 4), %%ebx \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2253 // 0 1 2 3 4 5 6 7 8 9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2254 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2255 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2256 "movq (%0), %%mm0 \n\t" // L0 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2257 "movq (%%eax, %1), %%mm1 \n\t" // L2 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2258 PAVGB(%%mm1, %%mm0) // L0+L2 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2259 "movq (%%eax), %%mm2 \n\t" // L1 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2260 PAVGB(%%mm2, %%mm0) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2261 "movq %%mm0, (%0) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2262 "movq (%%eax, %1, 2), %%mm0 \n\t" // L3 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2263 PAVGB(%%mm0, %%mm2) // L1+L3 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2264 PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2265 "movq %%mm2, (%%eax) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2266 "movq (%0, %1, 4), %%mm2 \n\t" // L4 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2267 PAVGB(%%mm2, %%mm1) // L2+L4 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2268 PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2269 "movq %%mm1, (%%eax, %1) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2270 "movq (%%ebx), %%mm1 \n\t" // L5 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2271 PAVGB(%%mm1, %%mm0) // L3+L5 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2272 PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2273 "movq %%mm0, (%%eax, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2274 "movq (%%ebx, %1), %%mm0 \n\t" // L6 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2275 PAVGB(%%mm0, %%mm2) // L4+L6 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2276 PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2277 "movq %%mm2, (%0, %1, 4) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2278 "movq (%%ebx, %1, 2), %%mm2 \n\t" // L7 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2279 PAVGB(%%mm2, %%mm1) // L5+L7 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2280 PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2281 "movq %%mm1, (%%ebx) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2282 "movq (%0, %1, 8), %%mm1 \n\t" // L8 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2283 PAVGB(%%mm1, %%mm0) // L6+L8 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2284 PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2285 "movq %%mm0, (%%ebx, %1) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2286 "movq (%%ebx, %1, 4), %%mm0 \n\t" // L9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2287 PAVGB(%%mm0, %%mm2) // L7+L9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2288 PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2289 "movq %%mm2, (%%ebx, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2290 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2291 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2292 : : "r" (src), "r" (stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2293 : "%eax", "%ebx" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2294 ); |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2295 #else |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2296 int x; |
2595 | 2297 src+= 4*stride; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2298 for(x=0; x<8; x++) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2299 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2300 src[0 ] = (src[0 ] + 2*src[stride ] + src[stride*2])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2301 src[stride ] = (src[stride ] + 2*src[stride*2] + src[stride*3])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2302 src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2303 src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2304 src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2305 src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2306 src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2307 src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2308 src++; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2309 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2310 #endif |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2311 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2312 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2313 /** |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2314 * Deinterlaces the given block |
2595 | 2315 * will be called for every 8x8 block and can read & write from line 4-15, |
2316 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
2317 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2318 */ |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2319 static inline void deInterlaceMedian(uint8_t src[], int stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2320 { |
2221 | 2321 #ifdef HAVE_MMX |
2595 | 2322 src+= 4*stride; |
2221 | 2323 #ifdef HAVE_MMX2 |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2324 asm volatile( |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2325 "leal (%0, %1), %%eax \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2326 "leal (%%eax, %1, 4), %%ebx \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2327 // 0 1 2 3 4 5 6 7 8 9 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2328 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2329 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2330 "movq (%0), %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2331 "movq (%%eax, %1), %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2332 "movq (%%eax), %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2333 "movq %%mm0, %%mm3 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2334 "pmaxub %%mm1, %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2335 "pminub %%mm3, %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2336 "pmaxub %%mm2, %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2337 "pminub %%mm1, %%mm0 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2338 "movq %%mm0, (%%eax) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2339 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2340 "movq (%0, %1, 4), %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2341 "movq (%%eax, %1, 2), %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2342 "movq %%mm2, %%mm3 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2343 "pmaxub %%mm1, %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2344 "pminub %%mm3, %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2345 "pmaxub %%mm0, %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2346 "pminub %%mm1, %%mm2 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2347 "movq %%mm2, (%%eax, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2348 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2349 "movq (%%ebx), %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2350 "movq (%%ebx, %1), %%mm1 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2351 "movq %%mm2, %%mm3 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2352 "pmaxub %%mm0, %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2353 "pminub %%mm3, %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2354 "pmaxub %%mm1, %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2355 "pminub %%mm0, %%mm2 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2356 "movq %%mm2, (%%ebx) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2357 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2358 "movq (%%ebx, %1, 2), %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2359 "movq (%0, %1, 8), %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2360 "movq %%mm2, %%mm3 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2361 "pmaxub %%mm0, %%mm2 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2362 "pminub %%mm3, %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2363 "pmaxub %%mm1, %%mm0 \n\t" // |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2364 "pminub %%mm0, %%mm2 \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2365 "movq %%mm2, (%%ebx, %1, 2) \n\t" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2366 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2367 |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2368 : : "r" (src), "r" (stride) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2369 : "%eax", "%ebx" |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2370 ); |
2221 | 2371 |
2372 #else // MMX without MMX2 | |
2373 asm volatile( | |
2374 "leal (%0, %1), %%eax \n\t" | |
2375 "leal (%%eax, %1, 4), %%ebx \n\t" | |
2376 // 0 1 2 3 4 5 6 7 8 9 | |
2377 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 | |
2378 "pxor %%mm7, %%mm7 \n\t" | |
2379 | |
2380 #define MEDIAN(a,b,c)\ | |
2381 "movq " #a ", %%mm0 \n\t"\ | |
2382 "movq " #b ", %%mm2 \n\t"\ | |
2383 "movq " #c ", %%mm1 \n\t"\ | |
2384 "movq %%mm0, %%mm3 \n\t"\ | |
2385 "movq %%mm1, %%mm4 \n\t"\ | |
2386 "movq %%mm2, %%mm5 \n\t"\ | |
2387 "psubusb %%mm1, %%mm3 \n\t"\ | |
2388 "psubusb %%mm2, %%mm4 \n\t"\ | |
2389 "psubusb %%mm0, %%mm5 \n\t"\ | |
2390 "pcmpeqb %%mm7, %%mm3 \n\t"\ | |
2391 "pcmpeqb %%mm7, %%mm4 \n\t"\ | |
2392 "pcmpeqb %%mm7, %%mm5 \n\t"\ | |
2393 "movq %%mm3, %%mm6 \n\t"\ | |
2394 "pxor %%mm4, %%mm3 \n\t"\ | |
2395 "pxor %%mm5, %%mm4 \n\t"\ | |
2396 "pxor %%mm6, %%mm5 \n\t"\ | |
2397 "por %%mm3, %%mm1 \n\t"\ | |
2398 "por %%mm4, %%mm2 \n\t"\ | |
2399 "por %%mm5, %%mm0 \n\t"\ | |
2400 "pand %%mm2, %%mm0 \n\t"\ | |
2401 "pand %%mm1, %%mm0 \n\t"\ | |
2402 "movq %%mm0, " #b " \n\t" | |
2403 | |
2404 MEDIAN((%0), (%%eax), (%%eax, %1)) | |
2405 MEDIAN((%%eax, %1), (%%eax, %1, 2), (%0, %1, 4)) | |
2406 MEDIAN((%0, %1, 4), (%%ebx), (%%ebx, %1)) | |
2407 MEDIAN((%%ebx, %1), (%%ebx, %1, 2), (%0, %1, 8)) | |
2408 | |
2409 : : "r" (src), "r" (stride) | |
2410 : "%eax", "%ebx" | |
2411 ); | |
2412 #endif // MMX | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2413 #else |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2414 //FIXME |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2415 int x; |
2595 | 2416 src+= 4*stride; |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2417 for(x=0; x<8; x++) |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2418 { |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2419 src[0 ] = (src[0 ] + 2*src[stride ] + src[stride*2])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2420 src[stride ] = (src[stride ] + 2*src[stride*2] + src[stride*3])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2421 src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2422 src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2423 src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2424 src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2425 src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2426 src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2427 src++; |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2428 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2429 #endif |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2430 } |
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
2431 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
2432 #ifdef HAVE_MMX |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2433 /** |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2434 * transposes and shift the given 8x8 Block into dst1 and dst2 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2435 */ |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2436 static inline void transpose1(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2437 { |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2438 asm( |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2439 "leal (%0, %1), %%eax \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2440 "leal (%%eax, %1, 4), %%ebx \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2441 // 0 1 2 3 4 5 6 7 8 9 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2442 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2443 "movq (%0), %%mm0 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2444 "movq (%%eax), %%mm1 \n\t" // abcdefgh |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2445 "movq %%mm0, %%mm2 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2446 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2447 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2448 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2449 "movq (%%eax, %1), %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2450 "movq (%%eax, %1, 2), %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2451 "movq %%mm1, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2452 "punpcklbw %%mm3, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2453 "punpckhbw %%mm3, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2454 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2455 "movq %%mm0, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2456 "punpcklwd %%mm1, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2457 "punpckhwd %%mm1, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2458 "movq %%mm2, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2459 "punpcklwd %%mm4, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2460 "punpckhwd %%mm4, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2461 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2462 "movd %%mm0, 128(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2463 "psrlq $32, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2464 "movd %%mm0, 144(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2465 "movd %%mm3, 160(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2466 "psrlq $32, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2467 "movd %%mm3, 176(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2468 "movd %%mm3, 48(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2469 "movd %%mm2, 192(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2470 "movd %%mm2, 64(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2471 "psrlq $32, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2472 "movd %%mm2, 80(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2473 "movd %%mm1, 96(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2474 "psrlq $32, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2475 "movd %%mm1, 112(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2476 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2477 "movq (%0, %1, 4), %%mm0 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2478 "movq (%%ebx), %%mm1 \n\t" // abcdefgh |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2479 "movq %%mm0, %%mm2 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2480 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2481 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2482 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2483 "movq (%%ebx, %1), %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2484 "movq (%%ebx, %1, 2), %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2485 "movq %%mm1, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2486 "punpcklbw %%mm3, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2487 "punpckhbw %%mm3, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2488 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2489 "movq %%mm0, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2490 "punpcklwd %%mm1, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2491 "punpckhwd %%mm1, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2492 "movq %%mm2, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2493 "punpcklwd %%mm4, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2494 "punpckhwd %%mm4, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2495 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2496 "movd %%mm0, 132(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2497 "psrlq $32, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2498 "movd %%mm0, 148(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2499 "movd %%mm3, 164(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2500 "psrlq $32, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2501 "movd %%mm3, 180(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2502 "movd %%mm3, 52(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2503 "movd %%mm2, 196(%2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2504 "movd %%mm2, 68(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2505 "psrlq $32, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2506 "movd %%mm2, 84(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2507 "movd %%mm1, 100(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2508 "psrlq $32, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2509 "movd %%mm1, 116(%3) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2510 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2511 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2512 :: "r" (src), "r" (srcStride), "r" (dst1), "r" (dst2) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2513 : "%eax", "%ebx" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2514 ); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2515 } |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2516 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2517 /** |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2518 * transposes the given 8x8 block |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2519 */ |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2520 static inline void transpose2(uint8_t *dst, int dstStride, uint8_t *src) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2521 { |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2522 asm( |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2523 "leal (%0, %1), %%eax \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2524 "leal (%%eax, %1, 4), %%ebx \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2525 // 0 1 2 3 4 5 6 7 8 9 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2526 // %0 eax eax+%1 eax+2%1 %0+4%1 ebx ebx+%1 ebx+2%1 %0+8%1 ebx+4%1 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2527 "movq (%2), %%mm0 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2528 "movq 16(%2), %%mm1 \n\t" // abcdefgh |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2529 "movq %%mm0, %%mm2 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2530 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2531 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2532 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2533 "movq 32(%2), %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2534 "movq 48(%2), %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2535 "movq %%mm1, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2536 "punpcklbw %%mm3, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2537 "punpckhbw %%mm3, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2538 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2539 "movq %%mm0, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2540 "punpcklwd %%mm1, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2541 "punpckhwd %%mm1, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2542 "movq %%mm2, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2543 "punpcklwd %%mm4, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2544 "punpckhwd %%mm4, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2545 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2546 "movd %%mm0, (%0) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2547 "psrlq $32, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2548 "movd %%mm0, (%%eax) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2549 "movd %%mm3, (%%eax, %1) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2550 "psrlq $32, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2551 "movd %%mm3, (%%eax, %1, 2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2552 "movd %%mm2, (%0, %1, 4) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2553 "psrlq $32, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2554 "movd %%mm2, (%%ebx) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2555 "movd %%mm1, (%%ebx, %1) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2556 "psrlq $32, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2557 "movd %%mm1, (%%ebx, %1, 2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2558 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2559 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2560 "movq 64(%2), %%mm0 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2561 "movq 80(%2), %%mm1 \n\t" // abcdefgh |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2562 "movq %%mm0, %%mm2 \n\t" // 12345678 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2563 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2564 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2565 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2566 "movq 96(%2), %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2567 "movq 112(%2), %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2568 "movq %%mm1, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2569 "punpcklbw %%mm3, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2570 "punpckhbw %%mm3, %%mm4 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2571 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2572 "movq %%mm0, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2573 "punpcklwd %%mm1, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2574 "punpckhwd %%mm1, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2575 "movq %%mm2, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2576 "punpcklwd %%mm4, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2577 "punpckhwd %%mm4, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2578 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2579 "movd %%mm0, 4(%0) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2580 "psrlq $32, %%mm0 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2581 "movd %%mm0, 4(%%eax) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2582 "movd %%mm3, 4(%%eax, %1) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2583 "psrlq $32, %%mm3 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2584 "movd %%mm3, 4(%%eax, %1, 2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2585 "movd %%mm2, 4(%0, %1, 4) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2586 "psrlq $32, %%mm2 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2587 "movd %%mm2, 4(%%ebx) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2588 "movd %%mm1, 4(%%ebx, %1) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2589 "psrlq $32, %%mm1 \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2590 "movd %%mm1, 4(%%ebx, %1, 2) \n\t" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2591 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2592 :: "r" (dst), "r" (dstStride), "r" (src) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2593 : "%eax", "%ebx" |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2594 ); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2595 } |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
2596 #endif |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2597 //static int test=0; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
2598 |
2860 | 2599 static void inline tempNoiseReducer(uint8_t *src, int stride, |
2899 | 2600 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise) |
2860 | 2601 { |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2602 #define FAST_L2_DIFF |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2603 //#define L1_DIFF //u should change the thresholds too if u try that one |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2604 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2605 asm volatile( |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2606 "leal (%2, %2, 2), %%eax \n\t" // 3*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2607 "leal (%2, %2, 4), %%ebx \n\t" // 5*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2608 "leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2609 // 0 1 2 3 4 5 6 7 8 9 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2610 // %x %x+%2 %x+2%2 %x+eax %x+4%2 %x+ebx %x+2eax %x+ecx %x+8%2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2611 //FIXME reorder? |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2612 #ifdef L1_DIFF //needs mmx2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2613 "movq (%0), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2614 "psadbw (%1), %%mm0 \n\t" // |L0-R0| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2615 "movq (%0, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2616 "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2617 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2618 "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2619 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2620 "psadbw (%1, %%eax), %%mm3 \n\t" // |L3-R3| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2621 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2622 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2623 "paddw %%mm1, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2624 "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2625 "movq (%0, %%ebx), %%mm5 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2626 "paddw %%mm2, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2627 "psadbw (%1, %%ebx), %%mm5 \n\t" // |L5-R5| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2628 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2629 "paddw %%mm3, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2630 "psadbw (%1, %%eax, 2), %%mm6 \n\t" // |L6-R6| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2631 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2632 "paddw %%mm4, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2633 "psadbw (%1, %%ecx), %%mm7 \n\t" // |L7-R7| |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2634 "paddw %%mm5, %%mm6 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2635 "paddw %%mm7, %%mm6 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2636 "paddw %%mm6, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2637 #elif defined (FAST_L2_DIFF) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2638 "pcmpeqb %%mm7, %%mm7 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2639 "movq b80, %%mm6 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2640 "pxor %%mm0, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2641 #define L2_DIFF_CORE(a, b)\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2642 "movq " #a ", %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2643 "movq " #b ", %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2644 "pxor %%mm7, %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2645 PAVGB(%%mm2, %%mm5)\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2646 "paddb %%mm6, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2647 "movq %%mm5, %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2648 "psllw $8, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2649 "pmaddwd %%mm5, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2650 "pmaddwd %%mm2, %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2651 "paddd %%mm2, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2652 "psrld $14, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2653 "paddd %%mm5, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2654 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2655 L2_DIFF_CORE((%0), (%1)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2656 L2_DIFF_CORE((%0, %2), (%1, %2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2657 L2_DIFF_CORE((%0, %2, 2), (%1, %2, 2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2658 L2_DIFF_CORE((%0, %%eax), (%1, %%eax)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2659 L2_DIFF_CORE((%0, %2, 4), (%1, %2, 4)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2660 L2_DIFF_CORE((%0, %%ebx), (%1, %%ebx)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2661 L2_DIFF_CORE((%0, %%eax,2), (%1, %%eax,2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2662 L2_DIFF_CORE((%0, %%ecx), (%1, %%ecx)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2663 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2664 #else |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2665 "pxor %%mm7, %%mm7 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2666 "pxor %%mm0, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2667 #define L2_DIFF_CORE(a, b)\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2668 "movq " #a ", %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2669 "movq " #b ", %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2670 "movq %%mm5, %%mm1 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2671 "movq %%mm2, %%mm3 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2672 "punpcklbw %%mm7, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2673 "punpckhbw %%mm7, %%mm1 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2674 "punpcklbw %%mm7, %%mm2 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2675 "punpckhbw %%mm7, %%mm3 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2676 "psubw %%mm2, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2677 "psubw %%mm3, %%mm1 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2678 "pmaddwd %%mm5, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2679 "pmaddwd %%mm1, %%mm1 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2680 "paddd %%mm1, %%mm5 \n\t"\ |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2681 "paddd %%mm5, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2682 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2683 L2_DIFF_CORE((%0), (%1)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2684 L2_DIFF_CORE((%0, %2), (%1, %2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2685 L2_DIFF_CORE((%0, %2, 2), (%1, %2, 2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2686 L2_DIFF_CORE((%0, %%eax), (%1, %%eax)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2687 L2_DIFF_CORE((%0, %2, 4), (%1, %2, 4)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2688 L2_DIFF_CORE((%0, %%ebx), (%1, %%ebx)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2689 L2_DIFF_CORE((%0, %%eax,2), (%1, %%eax,2)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2690 L2_DIFF_CORE((%0, %%ecx), (%1, %%ecx)) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2691 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2692 #endif |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2693 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2694 "movq %%mm0, %%mm4 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2695 "psrlq $32, %%mm0 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2696 "paddd %%mm0, %%mm4 \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2697 "movd %%mm4, %%ecx \n\t" |
2899 | 2698 "shll $2, %%ecx \n\t" |
2699 "movl %3, %%ebx \n\t" | |
2700 "addl -4(%%ebx), %%ecx \n\t" | |
2701 "addl 4(%%ebx), %%ecx \n\t" | |
2702 "addl -1024(%%ebx), %%ecx \n\t" | |
2703 "addl $4, %%ecx \n\t" | |
2704 "addl 1024(%%ebx), %%ecx \n\t" | |
2705 "shrl $3, %%ecx \n\t" | |
2706 "movl %%ecx, (%%ebx) \n\t" | |
2707 "leal (%%eax, %2, 2), %%ebx \n\t" // 5*stride | |
2708 | |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2709 // "movl %3, %%ecx \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2710 // "movl %%ecx, test \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2711 // "jmp 4f \n\t" |
2899 | 2712 "cmpl 4+maxTmpNoise, %%ecx \n\t" |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2713 " jb 2f \n\t" |
2899 | 2714 "cmpl 8+maxTmpNoise, %%ecx \n\t" |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2715 " jb 1f \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2716 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2717 "leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2718 "movq (%0), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2719 "movq (%0, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2720 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2721 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2722 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2723 "movq (%0, %%ebx), %%mm5 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2724 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2725 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2726 "movq %%mm0, (%1) \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2727 "movq %%mm1, (%1, %2) \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2728 "movq %%mm2, (%1, %2, 2) \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2729 "movq %%mm3, (%1, %%eax) \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2730 "movq %%mm4, (%1, %2, 4) \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2731 "movq %%mm5, (%1, %%ebx) \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2732 "movq %%mm6, (%1, %%eax, 2) \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2733 "movq %%mm7, (%1, %%ecx) \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2734 "jmp 4f \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2735 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2736 "1: \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2737 "leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2738 "movq (%0), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2739 "pavgb (%1), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2740 "movq (%0, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2741 "pavgb (%1, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2742 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2743 "pavgb (%1, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2744 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2745 "pavgb (%1, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2746 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2747 "pavgb (%1, %2, 4), %%mm4 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2748 "movq (%0, %%ebx), %%mm5 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2749 "pavgb (%1, %%ebx), %%mm5 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2750 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2751 "pavgb (%1, %%eax, 2), %%mm6 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2752 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2753 "pavgb (%1, %%ecx), %%mm7 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2754 "movq %%mm0, (%1) \n\t" // R0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2755 "movq %%mm1, (%1, %2) \n\t" // R1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2756 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2757 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2758 "movq %%mm4, (%1, %2, 4) \n\t" // R4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2759 "movq %%mm5, (%1, %%ebx) \n\t" // R5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2760 "movq %%mm6, (%1, %%eax, 2) \n\t" // R6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2761 "movq %%mm7, (%1, %%ecx) \n\t" // R7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2762 "movq %%mm0, (%0) \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2763 "movq %%mm1, (%0, %2) \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2764 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2765 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2766 "movq %%mm4, (%0, %2, 4) \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2767 "movq %%mm5, (%0, %%ebx) \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2768 "movq %%mm6, (%0, %%eax, 2) \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2769 "movq %%mm7, (%0, %%ecx) \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2770 "jmp 4f \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2771 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2772 "2: \n\t" |
2899 | 2773 "cmpl maxTmpNoise, %%ecx \n\t" |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2774 " jb 3f \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2775 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2776 "leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2777 "movq (%0), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2778 "movq (%0, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2779 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2780 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2781 "movq (%1), %%mm4 \n\t" // R0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2782 "movq (%1, %2), %%mm5 \n\t" // R1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2783 "movq (%1, %2, 2), %%mm6 \n\t" // R2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2784 "movq (%1, %%eax), %%mm7 \n\t" // R3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2785 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2786 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2787 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2788 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2789 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2790 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2791 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2792 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2793 "movq %%mm0, (%1) \n\t" // R0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2794 "movq %%mm1, (%1, %2) \n\t" // R1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2795 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2796 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2797 "movq %%mm0, (%0) \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2798 "movq %%mm1, (%0, %2) \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2799 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2800 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2801 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2802 "movq (%0, %2, 4), %%mm0 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2803 "movq (%0, %%ebx), %%mm1 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2804 "movq (%0, %%eax, 2), %%mm2 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2805 "movq (%0, %%ecx), %%mm3 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2806 "movq (%1, %2, 4), %%mm4 \n\t" // R4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2807 "movq (%1, %%ebx), %%mm5 \n\t" // R5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2808 "movq (%1, %%eax, 2), %%mm6 \n\t" // R6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2809 "movq (%1, %%ecx), %%mm7 \n\t" // R7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2810 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2811 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2812 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2813 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2814 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2815 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2816 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2817 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2818 "movq %%mm0, (%1, %2, 4) \n\t" // R4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2819 "movq %%mm1, (%1, %%ebx) \n\t" // R5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2820 "movq %%mm2, (%1, %%eax, 2) \n\t" // R6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2821 "movq %%mm3, (%1, %%ecx) \n\t" // R7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2822 "movq %%mm0, (%0, %2, 4) \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2823 "movq %%mm1, (%0, %%ebx) \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2824 "movq %%mm2, (%0, %%eax, 2) \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2825 "movq %%mm3, (%0, %%ecx) \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2826 "jmp 4f \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2827 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2828 "3: \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2829 "leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2830 "movq (%0), %%mm0 \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2831 "movq (%0, %2), %%mm1 \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2832 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2833 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2834 "movq (%1), %%mm4 \n\t" // R0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2835 "movq (%1, %2), %%mm5 \n\t" // R1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2836 "movq (%1, %2, 2), %%mm6 \n\t" // R2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2837 "movq (%1, %%eax), %%mm7 \n\t" // R3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2838 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2839 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2840 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2841 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2842 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2843 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2844 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2845 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2846 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2847 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2848 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2849 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2850 "movq %%mm0, (%1) \n\t" // R0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2851 "movq %%mm1, (%1, %2) \n\t" // R1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2852 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2853 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2854 "movq %%mm0, (%0) \n\t" // L0 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2855 "movq %%mm1, (%0, %2) \n\t" // L1 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2856 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2857 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2858 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2859 "movq (%0, %2, 4), %%mm0 \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2860 "movq (%0, %%ebx), %%mm1 \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2861 "movq (%0, %%eax, 2), %%mm2 \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2862 "movq (%0, %%ecx), %%mm3 \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2863 "movq (%1, %2, 4), %%mm4 \n\t" // R4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2864 "movq (%1, %%ebx), %%mm5 \n\t" // R5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2865 "movq (%1, %%eax, 2), %%mm6 \n\t" // R6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2866 "movq (%1, %%ecx), %%mm7 \n\t" // R7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2867 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2868 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2869 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2870 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2871 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2872 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2873 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2874 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2875 PAVGB(%%mm4, %%mm0) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2876 PAVGB(%%mm5, %%mm1) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2877 PAVGB(%%mm6, %%mm2) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2878 PAVGB(%%mm7, %%mm3) |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2879 "movq %%mm0, (%1, %2, 4) \n\t" // R4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2880 "movq %%mm1, (%1, %%ebx) \n\t" // R5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2881 "movq %%mm2, (%1, %%eax, 2) \n\t" // R6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2882 "movq %%mm3, (%1, %%ecx) \n\t" // R7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2883 "movq %%mm0, (%0, %2, 4) \n\t" // L4 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2884 "movq %%mm1, (%0, %%ebx) \n\t" // L5 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2885 "movq %%mm2, (%0, %%eax, 2) \n\t" // L6 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2886 "movq %%mm3, (%0, %%ecx) \n\t" // L7 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2887 |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2888 "4: \n\t" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2889 |
2899 | 2890 :: "r" (src), "r" (tempBlured), "r"(stride), "m" (tempBluredPast) |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2891 : "%eax", "%ebx", "%ecx", "memory" |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2892 ); |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2893 //printf("%d\n", test); |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2894 #else |
2860 | 2895 int y; |
2896 int d=0; | |
2897 int sysd=0; | |
2899 | 2898 int i; |
2860 | 2899 |
2900 for(y=0; y<8; y++) | |
2901 { | |
2902 int x; | |
2903 for(x=0; x<8; x++) | |
2904 { | |
2905 int ref= tempBlured[ x + y*stride ]; | |
2906 int cur= src[ x + y*stride ]; | |
2907 int d1=ref - cur; | |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2908 // if(x==0 || x==7) d1+= d1>>1; |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2909 // if(y==0 || y==7) d1+= d1>>1; |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2910 // d+= ABS(d1); |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2911 d+= d1*d1; |
2860 | 2912 sysd+= d1; |
2913 } | |
2914 } | |
2899 | 2915 i=d; |
2916 d= ( | |
2917 4*d | |
2918 +(*(tempBluredPast-256)) | |
2919 +(*(tempBluredPast-1))+ (*(tempBluredPast+1)) | |
2920 +(*(tempBluredPast+256)) | |
2921 +4)>>3; | |
2922 *tempBluredPast=i; | |
2923 // ((*tempBluredPast)*3 + d + 2)>>2; | |
2924 | |
2860 | 2925 //printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[2]); |
2926 /* | |
2927 Switch between | |
2928 1 0 0 0 0 0 0 (0) | |
2929 64 32 16 8 4 2 1 (1) | |
2930 64 48 36 27 20 15 11 (33) (approx) | |
2931 64 56 49 43 37 33 29 (200) (approx) | |
2932 */ | |
2933 if(d > maxNoise[1]) | |
2934 { | |
2935 if(d < maxNoise[2]) | |
2936 { | |
2937 for(y=0; y<8; y++) | |
2938 { | |
2939 int x; | |
2940 for(x=0; x<8; x++) | |
2941 { | |
2942 int ref= tempBlured[ x + y*stride ]; | |
2943 int cur= src[ x + y*stride ]; | |
2944 tempBlured[ x + y*stride ]= | |
2945 src[ x + y*stride ]= | |
2946 (ref + cur + 1)>>1; | |
2947 } | |
2948 } | |
2949 } | |
2950 else | |
2951 { | |
2952 for(y=0; y<8; y++) | |
2953 { | |
2954 int x; | |
2955 for(x=0; x<8; x++) | |
2956 { | |
2957 tempBlured[ x + y*stride ]= src[ x + y*stride ]; | |
2958 } | |
2959 } | |
2960 } | |
2961 } | |
2962 else | |
2963 { | |
2964 if(d < maxNoise[0]) | |
2965 { | |
2966 for(y=0; y<8; y++) | |
2967 { | |
2968 int x; | |
2969 for(x=0; x<8; x++) | |
2970 { | |
2971 int ref= tempBlured[ x + y*stride ]; | |
2972 int cur= src[ x + y*stride ]; | |
2973 tempBlured[ x + y*stride ]= | |
2974 src[ x + y*stride ]= | |
2975 (ref*7 + cur + 4)>>3; | |
2976 } | |
2977 } | |
2978 } | |
2979 else | |
2980 { | |
2981 for(y=0; y<8; y++) | |
2982 { | |
2983 int x; | |
2984 for(x=0; x<8; x++) | |
2985 { | |
2986 int ref= tempBlured[ x + y*stride ]; | |
2987 int cur= src[ x + y*stride ]; | |
2988 tempBlured[ x + y*stride ]= | |
2989 src[ x + y*stride ]= | |
2990 (ref*3 + cur + 2)>>2; | |
2991 } | |
2992 } | |
2993 } | |
2994 } | |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
2995 #endif |
2860 | 2996 } |
2997 | |
2185 | 2998 #ifdef HAVE_ODIVX_POSTPROCESS |
2999 #include "../opendivx/postprocess.h" | |
3000 int use_old_pp=0; | |
3001 #endif | |
2159 | 3002 |
2185 | 3003 static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
2860 | 3004 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode); |
2159 | 3005 |
2389 | 3006 /* -pp Command line Help |
3007 NOTE/FIXME: put this at an appropriate place (--help, html docs, man mplayer)? | |
3008 | |
3009 -pp <filterName>[:<option>[:<option>...]][,[-]<filterName>[:<option>...]]... | |
3010 | |
3011 long form example: | |
3012 -pp vdeblock:autoq,hdeblock:autoq,linblenddeint -pp default,-vdeblock | |
3013 short form example: | |
3014 -pp vb:a,hb:a,lb -pp de,-vb | |
2860 | 3015 more examples: |
3016 -pp tn:64:128:256 | |
2389 | 3017 |
3018 Filters Options | |
3019 short long name short long option Description | |
3020 * * a autoq cpu power dependant enabler | |
3021 c chrom chrominance filtring enabled | |
3022 y nochrom chrominance filtring disabled | |
3023 hb hdeblock horizontal deblocking filter | |
3024 vb vdeblock vertical deblocking filter | |
3025 vr rkvdeblock | |
3026 h1 x1hdeblock Experimental horizontal deblock filter 1 | |
3027 v1 x1vdeblock Experimental vertical deblock filter 1 | |
3028 dr dering not implemented yet | |
3029 al autolevels automatic brightness / contrast fixer | |
3030 f fullyrange stretch luminance range to (0..255) | |
3031 lb linblenddeint linear blend deinterlacer | |
3032 li linipoldeint linear interpolating deinterlacer | |
3033 ci cubicipoldeint cubic interpolating deinterlacer | |
3034 md mediandeint median deinterlacer | |
3035 de default hdeblock:a,vdeblock:a,dering:a,autolevels | |
3036 fa fast x1hdeblock:a,x1vdeblock:a,dering:a,autolevels | |
2860 | 3037 tn tmpnoise (3 Thresholds) Temporal Noise Reducer |
2389 | 3038 */ |
3039 | |
3040 /** | |
3041 * returns a PPMode struct which will have a non 0 error variable if an error occured | |
3042 * name is the string after "-pp" on the command line | |
3043 * quality is a number from 0 to GET_PP_QUALITY_MAX | |
3044 */ | |
3045 struct PPMode getPPModeByNameAndQuality(char *name, int quality) | |
3046 { | |
3047 char temp[GET_MODE_BUFFER_SIZE]; | |
3048 char *p= temp; | |
3049 char *filterDelimiters= ","; | |
3050 char *optionDelimiters= ":"; | |
2860 | 3051 struct PPMode ppMode= {0,0,0,0,0,0,{150,200,400}}; |
2389 | 3052 char *filterToken; |
3053 | |
3054 strncpy(temp, name, GET_MODE_BUFFER_SIZE); | |
3055 | |
2860 | 3056 printf("%s\n", name); |
3057 | |
2389 | 3058 for(;;){ |
3059 char *filterName; | |
2860 | 3060 int q= 1000000; //GET_PP_QUALITY_MAX; |
2389 | 3061 int chrom=-1; |
3062 char *option; | |
3063 char *options[OPTIONS_ARRAY_SIZE]; | |
3064 int i; | |
3065 int filterNameOk=0; | |
3066 int numOfUnknownOptions=0; | |
3067 int enable=1; //does the user want us to enabled or disabled the filter | |
3068 | |
3069 filterToken= strtok(p, filterDelimiters); | |
3070 if(filterToken == NULL) break; | |
2860 | 3071 p+= strlen(filterToken) + 1; // p points to next filterToken |
2389 | 3072 filterName= strtok(filterToken, optionDelimiters); |
3073 printf("%s::%s\n", filterToken, filterName); | |
3074 | |
3075 if(*filterName == '-') | |
3076 { | |
3077 enable=0; | |
3078 filterName++; | |
3079 } | |
2860 | 3080 |
2389 | 3081 for(;;){ //for all options |
3082 option= strtok(NULL, optionDelimiters); | |
3083 if(option == NULL) break; | |
3084 | |
3085 printf("%s\n", option); | |
3086 if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality; | |
3087 else if(!strcmp("nochrom", option) || !strcmp("y", option)) chrom=0; | |
3088 else if(!strcmp("chrom", option) || !strcmp("c", option)) chrom=1; | |
3089 else | |
3090 { | |
3091 options[numOfUnknownOptions] = option; | |
3092 numOfUnknownOptions++; | |
3093 } | |
3094 if(numOfUnknownOptions >= OPTIONS_ARRAY_SIZE-1) break; | |
3095 } | |
2860 | 3096 options[numOfUnknownOptions] = NULL; |
2389 | 3097 |
3098 /* replace stuff from the replace Table */ | |
3099 for(i=0; replaceTable[2*i]!=NULL; i++) | |
3100 { | |
3101 if(!strcmp(replaceTable[2*i], filterName)) | |
3102 { | |
3103 int newlen= strlen(replaceTable[2*i + 1]); | |
3104 int plen; | |
3105 int spaceLeft; | |
3106 | |
3107 if(p==NULL) p= temp, *p=0; //last filter | |
3108 else p--, *p=','; //not last filter | |
3109 | |
3110 plen= strlen(p); | |
3111 spaceLeft= (int)p - (int)temp + plen; | |
3112 if(spaceLeft + newlen >= GET_MODE_BUFFER_SIZE) | |
3113 { | |
3114 ppMode.error++; | |
3115 break; | |
3116 } | |
3117 memmove(p + newlen, p, plen+1); | |
3118 memcpy(p, replaceTable[2*i + 1], newlen); | |
3119 filterNameOk=1; | |
3120 } | |
3121 } | |
3122 | |
3123 for(i=0; filters[i].shortName!=NULL; i++) | |
3124 { | |
2860 | 3125 // printf("Compareing %s, %s, %s\n", filters[i].shortName,filters[i].longName, filterName); |
2389 | 3126 if( !strcmp(filters[i].longName, filterName) |
3127 || !strcmp(filters[i].shortName, filterName)) | |
3128 { | |
3129 ppMode.lumMode &= ~filters[i].mask; | |
3130 ppMode.chromMode &= ~filters[i].mask; | |
3131 | |
3132 filterNameOk=1; | |
3133 if(!enable) break; // user wants to disable it | |
3134 | |
3135 if(q >= filters[i].minLumQuality) | |
3136 ppMode.lumMode|= filters[i].mask; | |
3137 if(chrom==1 || (chrom==-1 && filters[i].chromDefault)) | |
3138 if(q >= filters[i].minChromQuality) | |
3139 ppMode.chromMode|= filters[i].mask; | |
3140 | |
3141 if(filters[i].mask == LEVEL_FIX) | |
3142 { | |
3143 int o; | |
3144 ppMode.minAllowedY= 16; | |
3145 ppMode.maxAllowedY= 234; | |
3146 for(o=0; options[o]!=NULL; o++) | |
3147 if( !strcmp(options[o],"fullyrange") | |
3148 ||!strcmp(options[o],"f")) | |
3149 { | |
3150 ppMode.minAllowedY= 0; | |
3151 ppMode.maxAllowedY= 255; | |
3152 numOfUnknownOptions--; | |
3153 } | |
3154 } | |
2860 | 3155 else if(filters[i].mask == TEMP_NOISE_FILTER) |
3156 { | |
3157 int o; | |
3158 int numOfNoises=0; | |
3159 ppMode.maxTmpNoise[0]= 150; | |
3160 ppMode.maxTmpNoise[1]= 200; | |
3161 ppMode.maxTmpNoise[2]= 400; | |
3162 | |
3163 for(o=0; options[o]!=NULL; o++) | |
3164 { | |
3165 char *tail; | |
3166 ppMode.maxTmpNoise[numOfNoises]= | |
3167 strtol(options[o], &tail, 0); | |
3168 if(tail!=options[o]) | |
3169 { | |
3170 numOfNoises++; | |
3171 numOfUnknownOptions--; | |
3172 if(numOfNoises >= 3) break; | |
3173 } | |
3174 } | |
3175 } | |
2389 | 3176 } |
3177 } | |
3178 if(!filterNameOk) ppMode.error++; | |
3179 ppMode.error += numOfUnknownOptions; | |
3180 } | |
3181 | |
2808 | 3182 #ifdef HAVE_ODIVX_POSTPROCESS |
2389 | 3183 if(ppMode.lumMode & H_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_Y_H; |
3184 if(ppMode.lumMode & V_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_Y_V; | |
3185 if(ppMode.chromMode & H_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_C_H; | |
3186 if(ppMode.chromMode & V_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_C_V; | |
3187 if(ppMode.lumMode & DERING) ppMode.oldMode |= PP_DERING_Y; | |
3188 if(ppMode.chromMode & DERING) ppMode.oldMode |= PP_DERING_C; | |
2808 | 3189 #endif |
2389 | 3190 |
3191 return ppMode; | |
3192 } | |
3193 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3194 /** |
2860 | 3195 * Obsolete, dont use it, use postprocess2() instead |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3196 */ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3197 void postprocess(unsigned char * src[], int src_stride, |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3198 unsigned char * dst[], int dst_stride, |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3199 int horizontal_size, int vertical_size, |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3200 QP_STORE_T *QP_store, int QP_stride, |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3201 int mode) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3202 { |
2860 | 3203 struct PPMode ppMode; |
3204 static QP_STORE_T zeroArray[2048/8]; | |
2389 | 3205 /* |
3206 static int qual=0; | |
3207 | |
2860 | 3208 ppMode= getPPModeByNameAndQuality("fast,default,-hdeblock,-vdeblock,tmpnoise:150:200:300", qual); |
3209 printf("OK\n"); | |
2389 | 3210 qual++; |
3211 qual%=7; | |
2860 | 3212 printf("\n%X %X %X %X :%d: %d %d %d\n", ppMode.lumMode, ppMode.chromMode, ppMode.oldMode, ppMode.error, |
3213 qual, ppMode.maxTmpNoise[0], ppMode.maxTmpNoise[1], ppMode.maxTmpNoise[2]); | |
2389 | 3214 postprocess2(src, src_stride, dst, dst_stride, |
3215 horizontal_size, vertical_size, QP_store, QP_stride, &ppMode); | |
3216 | |
3217 return; | |
3218 */ | |
2808 | 3219 if(QP_store==NULL) |
3220 { | |
3221 QP_store= zeroArray; | |
3222 QP_stride= 0; | |
3223 } | |
2159 | 3224 |
2860 | 3225 ppMode.lumMode= mode; |
3226 mode= ((mode&0xFF)>>4) | (mode&0xFFFFFF00); | |
3227 ppMode.chromMode= mode; | |
2895
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
3228 ppMode.maxTmpNoise[0]= 700; |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
3229 ppMode.maxTmpNoise[1]= 1500; |
dd3fabd01df0
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
2860
diff
changeset
|
3230 ppMode.maxTmpNoise[2]= 3000; |
2860 | 3231 |
2185 | 3232 #ifdef HAVE_ODIVX_POSTPROCESS |
3233 // Note: I could make this shit outside of this file, but it would mean one | |
3234 // more function call... | |
3235 if(use_old_pp){ | |
3236 odivx_postprocess(src,src_stride,dst,dst_stride,horizontal_size,vertical_size,QP_store,QP_stride,mode); | |
3237 return; | |
3238 } | |
3239 #endif | |
3240 | |
2159 | 3241 postProcess(src[0], src_stride, dst[0], dst_stride, |
2860 | 3242 horizontal_size, vertical_size, QP_store, QP_stride, 0, &ppMode); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3243 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3244 horizontal_size >>= 1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3245 vertical_size >>= 1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3246 src_stride >>= 1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3247 dst_stride >>= 1; |
2595 | 3248 // mode&= ~(LINEAR_IPOL_DEINT_FILTER | LINEAR_BLEND_DEINT_FILTER | |
3249 // MEDIAN_DEINT_FILTER | CUBIC_IPOL_DEINT_FILTER); | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3250 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3251 if(1) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3252 { |
2159 | 3253 postProcess(src[1], src_stride, dst[1], dst_stride, |
2860 | 3254 horizontal_size, vertical_size, QP_store, QP_stride, 1, &ppMode); |
2159 | 3255 postProcess(src[2], src_stride, dst[2], dst_stride, |
2860 | 3256 horizontal_size, vertical_size, QP_store, QP_stride, 2, &ppMode); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3257 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3258 else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3259 { |
2860 | 3260 memset(dst[1], 128, dst_stride*vertical_size); |
3261 memset(dst[2], 128, dst_stride*vertical_size); | |
3262 // memcpy(dst[1], src[1], src_stride*horizontal_size); | |
3263 // memcpy(dst[2], src[2], src_stride*horizontal_size); | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3264 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3265 } |
2185 | 3266 |
2389 | 3267 void postprocess2(unsigned char * src[], int src_stride, |
3268 unsigned char * dst[], int dst_stride, | |
3269 int horizontal_size, int vertical_size, | |
3270 QP_STORE_T *QP_store, int QP_stride, | |
3271 struct PPMode *mode) | |
3272 { | |
3273 | |
2808 | 3274 static QP_STORE_T zeroArray[2048/8]; |
3275 if(QP_store==NULL) | |
3276 { | |
3277 QP_store= zeroArray; | |
3278 QP_stride= 0; | |
3279 } | |
3280 | |
2389 | 3281 #ifdef HAVE_ODIVX_POSTPROCESS |
3282 // Note: I could make this shit outside of this file, but it would mean one | |
3283 // more function call... | |
3284 if(use_old_pp){ | |
3285 odivx_postprocess(src,src_stride,dst,dst_stride,horizontal_size,vertical_size,QP_store,QP_stride, | |
3286 mode->oldMode); | |
3287 return; | |
3288 } | |
3289 #endif | |
3290 | |
3291 postProcess(src[0], src_stride, dst[0], dst_stride, | |
2860 | 3292 horizontal_size, vertical_size, QP_store, QP_stride, 0, mode); |
2389 | 3293 |
3294 horizontal_size >>= 1; | |
3295 vertical_size >>= 1; | |
3296 src_stride >>= 1; | |
3297 dst_stride >>= 1; | |
3298 | |
3299 postProcess(src[1], src_stride, dst[1], dst_stride, | |
2860 | 3300 horizontal_size, vertical_size, QP_store, QP_stride, 1, mode); |
2389 | 3301 postProcess(src[2], src_stride, dst[2], dst_stride, |
2860 | 3302 horizontal_size, vertical_size, QP_store, QP_stride, 2, mode); |
2389 | 3303 } |
3304 | |
3305 | |
2159 | 3306 /** |
3307 * gets the mode flags for a given quality (larger values mean slower but better postprocessing) | |
2185 | 3308 * 0 <= quality <= 6 |
2159 | 3309 */ |
2185 | 3310 int getPpModeForQuality(int quality){ |
3311 int modes[1+GET_PP_QUALITY_MAX]= { | |
3312 0, | |
3313 #if 1 | |
3314 // horizontal filters first | |
3315 LUM_H_DEBLOCK, | |
3316 LUM_H_DEBLOCK | LUM_V_DEBLOCK, | |
3317 LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK, | |
3318 LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK, | |
3319 LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING, | |
3320 LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING | CHROM_DERING | |
3321 #else | |
3322 // vertical filters first | |
2159 | 3323 LUM_V_DEBLOCK, |
3324 LUM_V_DEBLOCK | LUM_H_DEBLOCK, | |
3325 LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK, | |
3326 LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK, | |
3327 LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING, | |
3328 LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING | CHROM_DERING | |
2185 | 3329 #endif |
3330 }; | |
2159 | 3331 |
2185 | 3332 #ifdef HAVE_ODIVX_POSTPROCESS |
3333 int odivx_modes[1+GET_PP_QUALITY_MAX]= { | |
3334 0, | |
3335 PP_DEBLOCK_Y_H, | |
3336 PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V, | |
3337 PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H, | |
3338 PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V, | |
3339 PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y, | |
3340 PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y|PP_DERING_C | |
3341 }; | |
3342 if(use_old_pp) return odivx_modes[quality]; | |
3343 #endif | |
3344 return modes[quality]; | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3345 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3346 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3347 /** |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3348 * Copies a block from src to dst and fixes the blacklevel |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3349 * numLines must be a multiple of 4 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3350 * levelFix == 0 -> dont touch the brighness & contrast |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3351 */ |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3352 static inline void blockCopy(uint8_t dst[], int dstStride, uint8_t src[], int srcStride, |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3353 int numLines, int levelFix) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3354 { |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3355 #ifndef HAVE_MMX |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3356 int i; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3357 #endif |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3358 if(levelFix) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3359 { |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3360 #ifdef HAVE_MMX |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3361 asm volatile( |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3362 "leal (%2,%2), %%eax \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3363 "leal (%3,%3), %%ebx \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3364 "movq packedYOffset, %%mm2 \n\t" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3365 "movq packedYScale, %%mm3 \n\t" |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3366 "pxor %%mm4, %%mm4 \n\t" |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3367 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3368 #define SCALED_CPY \ |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3369 "movq (%0), %%mm0 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3370 "movq (%0), %%mm5 \n\t"\ |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3371 "punpcklbw %%mm4, %%mm0 \n\t"\ |
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3372 "punpckhbw %%mm4, %%mm5 \n\t"\ |
2394 | 3373 "psubw %%mm2, %%mm0 \n\t"\ |
3374 "psubw %%mm2, %%mm5 \n\t"\ | |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3375 "movq (%0,%2), %%mm1 \n\t"\ |
2394 | 3376 "psllw $6, %%mm0 \n\t"\ |
3377 "psllw $6, %%mm5 \n\t"\ | |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3378 "pmulhw %%mm3, %%mm0 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3379 "movq (%0,%2), %%mm6 \n\t"\ |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3380 "pmulhw %%mm3, %%mm5 \n\t"\ |
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3381 "punpcklbw %%mm4, %%mm1 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3382 "punpckhbw %%mm4, %%mm6 \n\t"\ |
2394 | 3383 "psubw %%mm2, %%mm1 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3384 "psubw %%mm2, %%mm6 \n\t"\ |
2394 | 3385 "psllw $6, %%mm1 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3386 "psllw $6, %%mm6 \n\t"\ |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3387 "pmulhw %%mm3, %%mm1 \n\t"\ |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3388 "pmulhw %%mm3, %%mm6 \n\t"\ |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3389 "addl %%eax, %0 \n\t"\ |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3390 "packuswb %%mm5, %%mm0 \n\t"\ |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3391 "packuswb %%mm6, %%mm1 \n\t"\ |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3392 "movq %%mm0, (%1) \n\t"\ |
2181
d90f8fc7ead6
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
2180
diff
changeset
|
3393 "movq %%mm1, (%1, %3) \n\t"\ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3394 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3395 SCALED_CPY |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3396 "addl %%ebx, %1 \n\t" |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3397 SCALED_CPY |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3398 "addl %%ebx, %1 \n\t" |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3399 SCALED_CPY |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3400 "addl %%ebx, %1 \n\t" |
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3401 SCALED_CPY |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3402 |
2413 | 3403 : "+r"(src), |
3404 "+r"(dst) | |
3405 :"r" (srcStride), | |
2401
bc69d7c0e1dc
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
2394
diff
changeset
|
3406 "r" (dstStride) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3407 : "%eax", "%ebx" |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3408 ); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3409 #else |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3410 for(i=0; i<numLines; i++) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3411 memcpy( &(dst[dstStride*i]), |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3412 &(src[srcStride*i]), BLOCK_SIZE); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3413 #endif |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3414 } |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3415 else |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3416 { |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3417 #ifdef HAVE_MMX |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3418 asm volatile( |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3419 "movl %4, %%eax \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3420 "movl %%eax, temp0\n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3421 "pushl %0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3422 "pushl %1 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3423 "leal (%2,%2), %%eax \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3424 "leal (%3,%3), %%ebx \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3425 "movq packedYOffset, %%mm2 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3426 "movq packedYScale, %%mm3 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3427 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3428 #define SIMPLE_CPY \ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3429 "movq (%0), %%mm0 \n\t"\ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3430 "movq (%0,%2), %%mm1 \n\t"\ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3431 "movq %%mm0, (%1) \n\t"\ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3432 "movq %%mm1, (%1, %3) \n\t"\ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3433 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3434 "1: \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3435 SIMPLE_CPY |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3436 "addl %%eax, %0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3437 "addl %%ebx, %1 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3438 SIMPLE_CPY |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3439 "addl %%eax, %0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3440 "addl %%ebx, %1 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3441 "decl temp0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3442 "jnz 1b \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3443 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3444 "popl %1 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3445 "popl %0 \n\t" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3446 : : "r" (src), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3447 "r" (dst), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3448 "r" (srcStride), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3449 "r" (dstStride), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3450 "m" (numLines>>2) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3451 : "%eax", "%ebx" |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3452 ); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3453 #else |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3454 for(i=0; i<numLines; i++) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3455 memcpy( &(dst[dstStride*i]), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3456 &(src[srcStride*i]), BLOCK_SIZE); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3457 #endif |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3458 } |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3459 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3460 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3461 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3462 /** |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3463 * Filters array of bytes (Y or U or V values) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3464 */ |
2185 | 3465 static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
2860 | 3466 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3467 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3468 int x,y; |
2860 | 3469 const int mode= isColor ? ppMode->chromMode : ppMode->lumMode; |
3470 | |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3471 /* we need 64bit here otherwise we´ll going to have a problem |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3472 after watching a black picture for 5 hours*/ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3473 static uint64_t *yHistogram= NULL; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3474 int black=0, white=255; // blackest black and whitest white in the picture |
2437 | 3475 int QPCorrecture= 256; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3476 |
2246 | 3477 /* Temporary buffers for handling the last row(s) */ |
3478 static uint8_t *tempDst= NULL; | |
3479 static uint8_t *tempSrc= NULL; | |
3480 | |
2285 | 3481 /* Temporary buffers for handling the last block */ |
3482 static uint8_t *tempDstBlock= NULL; | |
3483 static uint8_t *tempSrcBlock= NULL; | |
3484 | |
2860 | 3485 /* Temporal noise reducing buffers */ |
3486 static uint8_t *tempBlured[3]= {NULL,NULL,NULL}; | |
2899 | 3487 static uint32_t *tempBluredPast[3]= {NULL,NULL,NULL}; |
2860 | 3488 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3489 #ifdef PP_FUNNY_STRIDE |
2285 | 3490 uint8_t *dstBlockPtrBackup; |
3491 uint8_t *srcBlockPtrBackup; | |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3492 #endif |
2285 | 3493 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3494 #ifdef MORE_TIMING |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3495 long long T0, T1, diffTime=0; |
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3496 #endif |
2221 | 3497 #ifdef TIMING |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3498 long long memcpyTime=0, vertTime=0, horizTime=0, sumTime; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3499 sumTime= rdtsc(); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3500 #endif |
2570 | 3501 //mode= 0x7F; |
2899 | 3502 #ifdef HAVE_MMX |
3503 maxTmpNoise[0]= ppMode->maxTmpNoise[0]; | |
3504 maxTmpNoise[1]= ppMode->maxTmpNoise[1]; | |
3505 maxTmpNoise[2]= ppMode->maxTmpNoise[2]; | |
3506 #endif | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3507 |
2246 | 3508 if(tempDst==NULL) |
3509 { | |
3510 tempDst= (uint8_t*)memalign(8, 1024*24); | |
3511 tempSrc= (uint8_t*)memalign(8, 1024*24); | |
2285 | 3512 tempDstBlock= (uint8_t*)memalign(8, 1024*24); |
3513 tempSrcBlock= (uint8_t*)memalign(8, 1024*24); | |
2246 | 3514 } |
3515 | |
2860 | 3516 if(tempBlured[isColor]==NULL && (mode & TEMP_NOISE_FILTER)) |
3517 { | |
3518 // printf("%d %d %d\n", isColor, dstStride, height); | |
3519 //FIXME works only as long as the size doesnt increase | |
3520 //Note:the +17*1024 is just there so i dont have to worry about r/w over te end | |
3521 tempBlured[isColor]= (uint8_t*)memalign(8, dstStride*((height+7)&(~7)) + 17*1024); | |
2899 | 3522 tempBluredPast[isColor]= (uint32_t*)memalign(8, 256*((height+7)&(~7))/2 + 17*1024); |
2860 | 3523 |
3524 memset(tempBlured[isColor], 0, dstStride*((height+7)&(~7)) + 17*1024); | |
2899 | 3525 memset(tempBluredPast[isColor], 0, 256*((height+7)&(~7))/2 + 17*1024); |
2860 | 3526 } |
3527 | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3528 if(!yHistogram) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3529 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3530 int i; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3531 yHistogram= (uint64_t*)malloc(8*256); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3532 for(i=0; i<256; i++) yHistogram[i]= width*height/64*15/256; |
2285 | 3533 |
3534 if(mode & FULL_Y_RANGE) | |
3535 { | |
3536 maxAllowedY=255; | |
3537 minAllowedY=0; | |
3538 } | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3539 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3540 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3541 if(!isColor) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3542 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3543 uint64_t sum= 0; |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3544 int i; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3545 static int framenum= -1; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3546 uint64_t maxClipped; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3547 uint64_t clipped; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3548 double scale; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3549 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3550 framenum++; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3551 if(framenum == 1) yHistogram[0]= width*height/64*15/256; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3552 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3553 for(i=0; i<256; i++) |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3554 { |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3555 sum+= yHistogram[i]; |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3556 // printf("%d ", yHistogram[i]); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3557 } |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3558 // printf("\n\n"); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3559 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3560 /* we allways get a completly black picture first */ |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3561 maxClipped= (uint64_t)(sum * maxClippedThreshold); |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3562 |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3563 clipped= sum; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3564 for(black=255; black>0; black--) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3565 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3566 if(clipped < maxClipped) break; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3567 clipped-= yHistogram[black]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3568 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3569 |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3570 clipped= sum; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3571 for(white=0; white<256; white++) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3572 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3573 if(clipped < maxClipped) break; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3574 clipped-= yHistogram[white]; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3575 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3576 |
2394 | 3577 packedYOffset= (black - minAllowedY) & 0xFFFF; |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3578 packedYOffset|= packedYOffset<<32; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3579 packedYOffset|= packedYOffset<<16; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3580 |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3581 scale= (double)(maxAllowedY - minAllowedY) / (double)(white-black); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3582 |
2394 | 3583 packedYScale= (uint16_t)(scale*1024.0 + 0.5); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3584 packedYScale|= packedYScale<<32; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3585 packedYScale|= packedYScale<<16; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3586 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3587 else |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3588 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3589 packedYScale= 0x0100010001000100LL; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3590 packedYOffset= 0; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3591 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3592 |
2437 | 3593 if(mode & LEVEL_FIX) QPCorrecture= packedYScale &0xFFFF; |
3594 else QPCorrecture= 256; | |
3595 | |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
3596 /* copy & deinterlace first row of blocks */ |
2595 | 3597 y=-BLOCK_SIZE; |
3598 { | |
3599 //1% speedup if these are here instead of the inner loop | |
3600 uint8_t *srcBlock= &(src[y*srcStride]); | |
3601 uint8_t *dstBlock= &(dst[y*dstStride]); | |
3602 | |
3603 dstBlock= tempDst + dstStride; | |
3604 | |
3605 // From this point on it is guranteed that we can read and write 16 lines downward | |
3606 // finish 1 block before the next otherwise we´ll might have a problem | |
3607 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing | |
3608 for(x=0; x<width; x+=BLOCK_SIZE) | |
3609 { | |
3610 | |
3611 #ifdef HAVE_MMX2 | |
3612 /* | |
3613 prefetchnta(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); | |
3614 prefetchnta(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
3615 prefetcht0(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
3616 prefetcht0(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
3617 */ | |
3618 /* | |
3619 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32); | |
3620 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32); | |
3621 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32); | |
3622 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32); | |
3623 */ | |
3624 | |
3625 asm( | |
3626 "movl %4, %%eax \n\t" | |
3627 "shrl $2, %%eax \n\t" | |
3628 "andl $6, %%eax \n\t" | |
3629 "addl $8, %%eax \n\t" | |
3630 "movl %%eax, %%ebx \n\t" | |
3631 "imul %1, %%eax \n\t" | |
3632 "imul %3, %%ebx \n\t" | |
3633 "prefetchnta 32(%%eax, %0) \n\t" | |
3634 "prefetcht0 32(%%ebx, %2) \n\t" | |
3635 "addl %1, %%eax \n\t" | |
3636 "addl %3, %%ebx \n\t" | |
3637 "prefetchnta 32(%%eax, %0) \n\t" | |
3638 "prefetcht0 32(%%ebx, %2) \n\t" | |
3639 :: "r" (srcBlock), "r" (srcStride), "r" (dstBlock), "r" (dstStride), | |
3640 "m" (x) | |
3641 : "%eax", "%ebx" | |
3642 ); | |
3643 | |
3644 #elif defined(HAVE_3DNOW) | |
3645 //FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ... | |
3646 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); | |
3647 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
3648 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
3649 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
3650 */ | |
3651 #endif | |
3652 | |
3653 blockCopy(dstBlock + dstStride*8, dstStride, | |
3654 srcBlock + srcStride*8, srcStride, 8, mode & LEVEL_FIX); | |
3655 | |
3656 if(mode & LINEAR_IPOL_DEINT_FILTER) | |
3657 deInterlaceInterpolateLinear(dstBlock, dstStride); | |
3658 else if(mode & LINEAR_BLEND_DEINT_FILTER) | |
3659 deInterlaceBlendLinear(dstBlock, dstStride); | |
3660 else if(mode & MEDIAN_DEINT_FILTER) | |
3661 deInterlaceMedian(dstBlock, dstStride); | |
3662 else if(mode & CUBIC_IPOL_DEINT_FILTER) | |
3663 deInterlaceInterpolateCubic(dstBlock, dstStride); | |
3664 /* else if(mode & CUBIC_BLEND_DEINT_FILTER) | |
3665 deInterlaceBlendCubic(dstBlock, dstStride); | |
3666 */ | |
3667 dstBlock+=8; | |
3668 srcBlock+=8; | |
3669 } | |
3670 memcpy(&(dst[y*dstStride]) + 8*dstStride, tempDst + 9*dstStride, 8*dstStride ); | |
3671 } | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3672 |
2246 | 3673 for(y=0; y<height; y+=BLOCK_SIZE) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3674 { |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3675 //1% speedup if these are here instead of the inner loop |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3676 uint8_t *srcBlock= &(src[y*srcStride]); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3677 uint8_t *dstBlock= &(dst[y*dstStride]); |
2437 | 3678 #ifdef ARCH_X86 |
3679 int *QPptr= isColor ? &QPs[(y>>3)*QPStride] :&QPs[(y>>4)*QPStride]; | |
3680 int QPDelta= isColor ? 1<<(32-3) : 1<<(32-4); | |
3681 int QPFrac= QPDelta; | |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3682 uint8_t *tempBlock1= tempBlocks; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3683 uint8_t *tempBlock2= tempBlocks + 8; |
2437 | 3684 #endif |
2860 | 3685 int QP=0; |
2473 | 3686 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards |
3687 if not than use a temporary buffer */ | |
2246 | 3688 if(y+15 >= height) |
3689 { | |
2860 | 3690 int i; |
2595 | 3691 /* copy from line 8 to 15 of src, these will be copied with |
2246 | 3692 blockcopy to dst later */ |
2595 | 3693 memcpy(tempSrc + srcStride*8, srcBlock + srcStride*8, |
3694 srcStride*MAX(height-y-8, 0) ); | |
3695 | |
2860 | 3696 /* duplicate last line of src to fill the void upto line 15 */ |
3697 for(i=MAX(height-y, 8); i<=15; i++) | |
3698 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), srcStride); | |
3699 | |
3700 /* copy up to 9 lines of dst (line -1 to 7)*/ | |
2595 | 3701 memcpy(tempDst, dstBlock - dstStride, dstStride*MIN(height-y+1, 9) ); |
2860 | 3702 |
3703 /* duplicate last line of dst to fill the void upto line 8 */ | |
3704 for(i=height-y+1; i<=8; i++) | |
3705 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), dstStride); | |
3706 | |
2473 | 3707 dstBlock= tempDst + dstStride; |
2246 | 3708 srcBlock= tempSrc; |
3709 } | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3710 |
2285 | 3711 // From this point on it is guranteed that we can read and write 16 lines downward |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3712 // finish 1 block before the next otherwise we´ll might have a problem |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3713 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3714 for(x=0; x<width; x+=BLOCK_SIZE) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3715 { |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3716 const int stride= dstStride; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3717 uint8_t *tmpXchg; |
2437 | 3718 #ifdef ARCH_X86 |
2860 | 3719 QP= *QPptr; |
2437 | 3720 asm volatile( |
3721 "addl %2, %1 \n\t" | |
3722 "sbbl %%eax, %%eax \n\t" | |
3723 "shll $2, %%eax \n\t" | |
3724 "subl %%eax, %0 \n\t" | |
3725 : "+r" (QPptr), "+m" (QPFrac) | |
3726 : "r" (QPDelta) | |
3727 : "%eax" | |
3728 ); | |
3729 #else | |
2860 | 3730 QP= isColor ? |
2437 | 3731 QPs[(y>>3)*QPStride + (x>>3)]: |
3732 QPs[(y>>4)*QPStride + (x>>4)]; | |
3733 #endif | |
3734 if(!isColor) | |
2428 | 3735 { |
2437 | 3736 QP= (QP* QPCorrecture)>>8; |
2742
d5636499cafd
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
2595
diff
changeset
|
3737 yHistogram[ srcBlock[srcStride*12 + 4] ]++; |
2428 | 3738 } |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3739 #ifdef HAVE_MMX |
2246 | 3740 asm volatile( |
3741 "movd %0, %%mm7 \n\t" | |
3742 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP | |
3743 "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP | |
3744 "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP | |
3745 "movq %%mm7, pQPb \n\t" | |
3746 : : "r" (QP) | |
3747 ); | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3748 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3749 |
2221 | 3750 #ifdef MORE_TIMING |
2246 | 3751 T0= rdtsc(); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3752 #endif |
2159 | 3753 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3754 #ifdef HAVE_MMX2 |
2437 | 3755 /* |
2246 | 3756 prefetchnta(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); |
3757 prefetchnta(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
3758 prefetcht0(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
3759 prefetcht0(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
2437 | 3760 */ |
3761 /* | |
3762 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32); | |
3763 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32); | |
3764 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32); | |
3765 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32); | |
3766 */ | |
3767 | |
3768 asm( | |
3769 "movl %4, %%eax \n\t" | |
3770 "shrl $2, %%eax \n\t" | |
3771 "andl $6, %%eax \n\t" | |
2595 | 3772 "addl $8, %%eax \n\t" |
2437 | 3773 "movl %%eax, %%ebx \n\t" |
3774 "imul %1, %%eax \n\t" | |
3775 "imul %3, %%ebx \n\t" | |
3776 "prefetchnta 32(%%eax, %0) \n\t" | |
3777 "prefetcht0 32(%%ebx, %2) \n\t" | |
3778 "addl %1, %%eax \n\t" | |
3779 "addl %3, %%ebx \n\t" | |
3780 "prefetchnta 32(%%eax, %0) \n\t" | |
3781 "prefetcht0 32(%%ebx, %2) \n\t" | |
3782 :: "r" (srcBlock), "r" (srcStride), "r" (dstBlock), "r" (dstStride), | |
3783 "m" (x) | |
3784 : "%eax", "%ebx" | |
3785 ); | |
3786 | |
2159 | 3787 #elif defined(HAVE_3DNOW) |
3788 //FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ... | |
2246 | 3789 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); |
3790 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
3791 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
3792 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
2159 | 3793 */ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3794 #endif |
2246 | 3795 |
2286 | 3796 #ifdef PP_FUNNY_STRIDE |
2285 | 3797 //can we mess with a 8x16 block, if not use a temp buffer, yes again |
3798 if(x+7 >= width) | |
3799 { | |
3800 int i; | |
3801 dstBlockPtrBackup= dstBlock; | |
3802 srcBlockPtrBackup= srcBlock; | |
3803 | |
3804 for(i=0;i<BLOCK_SIZE*2; i++) | |
3805 { | |
3806 memcpy(tempSrcBlock+i*srcStride, srcBlock+i*srcStride, width-x); | |
3807 memcpy(tempDstBlock+i*dstStride, dstBlock+i*dstStride, width-x); | |
3808 } | |
3809 | |
3810 dstBlock= tempDstBlock; | |
3811 srcBlock= tempSrcBlock; | |
3812 } | |
2286 | 3813 #endif |
2285 | 3814 |
2595 | 3815 blockCopy(dstBlock + dstStride*8, dstStride, |
3816 srcBlock + srcStride*8, srcStride, 8, mode & LEVEL_FIX); | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3817 |
2246 | 3818 if(mode & LINEAR_IPOL_DEINT_FILTER) |
3819 deInterlaceInterpolateLinear(dstBlock, dstStride); | |
3820 else if(mode & LINEAR_BLEND_DEINT_FILTER) | |
3821 deInterlaceBlendLinear(dstBlock, dstStride); | |
3822 else if(mode & MEDIAN_DEINT_FILTER) | |
3823 deInterlaceMedian(dstBlock, dstStride); | |
3824 else if(mode & CUBIC_IPOL_DEINT_FILTER) | |
3825 deInterlaceInterpolateCubic(dstBlock, dstStride); | |
3826 /* else if(mode & CUBIC_BLEND_DEINT_FILTER) | |
3827 deInterlaceBlendCubic(dstBlock, dstStride); | |
2203
f90b6e259dc8
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
2195
diff
changeset
|
3828 */ |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3829 |
2246 | 3830 /* only deblock if we have 2 blocks */ |
3831 if(y + 8 < height) | |
3832 { | |
2221 | 3833 #ifdef MORE_TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3834 T1= rdtsc(); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3835 memcpyTime+= T1-T0; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3836 T0=T1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3837 #endif |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3838 if(mode & V_RK1_FILTER) |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3839 vertRK1Filter(dstBlock, stride, QP); |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3840 else if(mode & V_X1_FILTER) |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3841 vertX1Filter(dstBlock, stride, QP); |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3842 else if(mode & V_DEBLOCK) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3843 { |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3844 if( isVertDC(dstBlock, stride)) |
2159 | 3845 { |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3846 if(isVertMinMaxOk(dstBlock, stride, QP)) |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3847 doVertLowPass(dstBlock, stride, QP); |
2159 | 3848 } |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3849 else |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3850 doVertDefFilter(dstBlock, stride, QP); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3851 } |
2221 | 3852 #ifdef MORE_TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3853 T1= rdtsc(); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3854 vertTime+= T1-T0; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3855 T0=T1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3856 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3857 } |
2473 | 3858 |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3859 #ifdef HAVE_MMX |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3860 transpose1(tempBlock1, tempBlock2, dstBlock, dstStride); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3861 #endif |
2246 | 3862 /* check if we have a previous block to deblock it with dstBlock */ |
2285 | 3863 if(x - 8 >= 0) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3864 { |
2221 | 3865 #ifdef MORE_TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3866 T0= rdtsc(); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3867 #endif |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3868 #ifdef HAVE_MMX |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3869 if(mode & H_RK1_FILTER) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3870 vertRK1Filter(tempBlock1, 16, QP); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3871 else if(mode & H_X1_FILTER) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3872 vertX1Filter(tempBlock1, 16, QP); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3873 else if(mode & H_DEBLOCK) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3874 { |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3875 if( isVertDC(tempBlock1, 16)) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3876 { |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3877 if(isVertMinMaxOk(tempBlock1, 16, QP)) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3878 doVertLowPass(tempBlock1, 16, QP); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3879 } |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3880 else |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3881 doVertDefFilter(tempBlock1, 16, QP); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3882 } |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3883 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3884 transpose2(dstBlock-4, dstStride, tempBlock1 + 4*16); |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3885 |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3886 #else |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3887 if(mode & H_X1_FILTER) |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3888 horizX1Filter(dstBlock-4, stride, QP); |
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3889 else if(mode & H_DEBLOCK) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3890 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3891 if( isHorizDC(dstBlock-4, stride)) |
2159 | 3892 { |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3893 if(isHorizMinMaxOk(dstBlock-4, stride, QP)) |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3894 doHorizLowPass(dstBlock-4, stride, QP); |
2159 | 3895 } |
2300
e10f7dc4938f
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
2286
diff
changeset
|
3896 else |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3897 doHorizDefFilter(dstBlock-4, stride, QP); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3898 } |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3899 #endif |
2221 | 3900 #ifdef MORE_TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3901 T1= rdtsc(); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3902 horizTime+= T1-T0; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3903 T0=T1; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3904 #endif |
2473 | 3905 if(mode & DERING) |
3906 { | |
3907 //FIXME filter first line | |
3908 if(y>0) dering(dstBlock - stride - 8, stride, QP); | |
3909 } | |
2860 | 3910 |
3911 if(mode & TEMP_NOISE_FILTER) | |
3912 { | |
3913 tempNoiseReducer(dstBlock-8, stride, | |
3914 tempBlured[isColor] + y*dstStride + x, | |
2899 | 3915 tempBluredPast[isColor] + (y>>3)*256 + (x>>3), |
2860 | 3916 ppMode->maxTmpNoise); |
3917 } | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3918 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3919 |
2286 | 3920 #ifdef PP_FUNNY_STRIDE |
2285 | 3921 /* did we use a tmp-block buffer */ |
3922 if(x+7 >= width) | |
3923 { | |
3924 int i; | |
3925 dstBlock= dstBlockPtrBackup; | |
3926 srcBlock= srcBlockPtrBackup; | |
3927 | |
3928 for(i=0;i<BLOCK_SIZE*2; i++) | |
3929 { | |
3930 memcpy(dstBlock+i*dstStride, tempDstBlock+i*dstStride, width-x); | |
3931 } | |
3932 } | |
2286 | 3933 #endif |
2285 | 3934 |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3935 dstBlock+=8; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3936 srcBlock+=8; |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3937 |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3938 #ifdef HAVE_MMX |
2454
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3939 tmpXchg= tempBlock1; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3940 tempBlock1= tempBlock2; |
b74c2a08eac9
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
2437
diff
changeset
|
3941 tempBlock2 = tmpXchg; |
2461
60f16575bece
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
2454
diff
changeset
|
3942 #endif |
2246 | 3943 } |
3944 | |
2860 | 3945 if(mode & DERING) |
3946 { | |
3947 if(y > 0) dering(dstBlock - dstStride - 8, dstStride, QP); | |
3948 } | |
3949 | |
3950 if((mode & TEMP_NOISE_FILTER)) | |
3951 { | |
3952 tempNoiseReducer(dstBlock-8, dstStride, | |
3953 tempBlured[isColor] + y*dstStride + x, | |
2899 | 3954 tempBluredPast[isColor] + (y>>3)*256 + (x>>3), |
2860 | 3955 ppMode->maxTmpNoise); |
3956 } | |
3957 | |
2595 | 3958 /* did we use a tmp buffer for the last lines*/ |
2285 | 3959 if(y+15 >= height) |
2246 | 3960 { |
3961 uint8_t *dstBlock= &(dst[y*dstStride]); | |
2473 | 3962 memcpy(dstBlock, tempDst + dstStride, dstStride*(height-y) ); |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3963 } |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3964 } |
2159 | 3965 #ifdef HAVE_3DNOW |
3966 asm volatile("femms"); | |
3967 #elif defined (HAVE_MMX) | |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3968 asm volatile("emms"); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3969 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3970 |
2221 | 3971 #ifdef TIMING |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3972 // FIXME diff is mostly the time spent for rdtsc (should subtract that but ...) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3973 sumTime= rdtsc() - sumTime; |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3974 if(!isColor) |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3975 printf("cpy:%4dk, vert:%4dk, horiz:%4dk, sum:%4dk, diff:%4dk, color: %d/%d \r", |
2168
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3976 (int)(memcpyTime/1000), (int)(vertTime/1000), (int)(horizTime/1000), |
21a8f158d19f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
2159
diff
changeset
|
3977 (int)(sumTime/1000), (int)((sumTime-memcpyTime-vertTime-horizTime)/1000) |
2158
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3978 , black, white); |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3979 #endif |
508468a75be0
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3980 } |