Commit | Line | Data |
---|---|---|
3057fa66 A |
1 | /* |
2 | Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at) | |
3 | ||
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 2 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
18 | ||
19 | /* | |
20 | C MMX MMX2 | |
21 | isVertDC Ec Ec | |
22 | isVertMinMaxOk Ec Ec | |
23 | doVertLowPass E e | |
24 | doVertDefFilter Ec Ec Ec | |
25 | isHorizDC Ec Ec | |
26 | isHorizMinMaxOk a | |
27 | doHorizLowPass E a | |
28 | doHorizDefFilter E a | |
29 | deRing | |
30 | ||
31 | E = Exact implementation | |
32 | e = allmost exact implementation | |
33 | a = alternative / approximate impl | |
34 | c = checked against the other implementations (-vo md5) | |
35 | */ | |
36 | ||
37 | /* | |
38 | TODO: | |
39 | verify that everything workes as it should | |
40 | reduce the time wasted on the mem transfer | |
41 | implement dering | |
42 | implement everything in C at least | |
43 | figure range of QP out (assuming <256 for now) | |
44 | unroll stuff if instructions depend too much on the prior one | |
45 | we use 8x8 blocks for the horizontal filters, opendivx seems to use 8x4? | |
46 | move YScale thing to the end instead of fixing QP | |
47 | ... | |
48 | ||
49 | Notes: | |
50 | ||
51 | */ | |
52 | ||
53 | ||
54 | #include <inttypes.h> | |
55 | #include <stdio.h> | |
56 | #include "../config.h" | |
57 | #include "postprocess.h" | |
58 | //#undef HAVE_MMX2 | |
59 | //#undef HAVE_MMX | |
60 | ||
61 | ||
62 | ||
63 | static uint64_t packedYOffset= 0x0000000000000000LL; | |
64 | static uint64_t packedYScale= 0x0100010001000100LL; | |
65 | static uint64_t w05= 0x0005000500050005LL; | |
66 | static uint64_t w20= 0x0020002000200020LL; | |
67 | static uint64_t w1400= 0x1400140014001400LL; | |
68 | static uint64_t bm00000001= 0x00000000000000FFLL; | |
69 | static uint64_t bm00010000= 0x000000FF00000000LL; | |
70 | static uint64_t bm00001000= 0x00000000FF000000LL; | |
71 | static uint64_t bm10000000= 0xFF00000000000000LL; | |
72 | static uint64_t bm10000001= 0xFF000000000000FFLL; | |
73 | static uint64_t bm11000011= 0xFFFF00000000FFFFLL; | |
74 | static uint64_t bm00011000= 0x000000FFFF000000LL; | |
75 | static uint64_t bm00110011= 0x0000FFFF0000FFFFLL; | |
76 | static uint64_t bm11001100= 0xFFFF0000FFFF0000LL; | |
77 | static uint64_t b00= 0x0000000000000000LL; | |
78 | static uint64_t b02= 0x0202020202020202LL; | |
79 | static uint64_t b0F= 0x0F0F0F0F0F0F0F0FLL; | |
80 | static uint64_t bFF= 0xFFFFFFFFFFFFFFFFLL; | |
81 | static uint64_t b7E= 0x7E7E7E7E7E7E7E7ELL; | |
82 | static uint64_t b7C= 0x7C7C7C7C7C7C7C7CLL; | |
83 | static uint64_t b3F= 0x3F3F3F3F3F3F3F3FLL; | |
84 | static uint64_t temp0=0; | |
85 | static uint64_t temp1=0; | |
86 | static uint64_t temp2=0; | |
87 | static uint64_t temp3=0; | |
88 | static uint64_t temp4=0; | |
89 | static uint64_t temp5=0; | |
90 | static uint64_t pQPb=0; | |
91 | static uint8_t tempBlock[16*16]; | |
92 | ||
93 | int hFlatnessThreshold= 56 - 16; | |
94 | int vFlatnessThreshold= 56 - 16; | |
95 | ||
96 | //amount of "black" u r willing to loose to get a brightness corrected picture | |
97 | double maxClippedThreshold= 0.01; | |
98 | ||
99 | int maxAllowedY=255; | |
100 |