new postprocess code by Michael Niedermayer (michaelni@gmx.at)
[libav.git] / postproc / postprocess_template.c
CommitLineData
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
21isVertDC Ec Ec
22isVertMinMaxOk Ec Ec
23doVertLowPass E e
24doVertDefFilter Ec Ec Ec
25isHorizDC Ec Ec
26isHorizMinMaxOk a
27doHorizLowPass E a
28doHorizDefFilter E a
29deRing
30
31E = Exact implementation
32e = allmost exact implementation
33a = alternative / approximate impl
34c = checked against the other implementations (-vo md5)
35*/
36
37/*
38TODO:
39verify that everything workes as it should
40reduce the time wasted on the mem transfer
41implement dering
42implement everything in C at least
43figure range of QP out (assuming <256 for now)
44unroll stuff if instructions depend too much on the prior one
45we use 8x8 blocks for the horizontal filters, opendivx seems to use 8x4?
46move YScale thing to the end instead of fixing QP
47...
48
49Notes:
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
63static uint64_t packedYOffset= 0x0000000000000000LL;
64static uint64_t packedYScale= 0x0100010001000100LL;
65static uint64_t w05= 0x0005000500050005LL;
66static uint64_t w20= 0x0020002000200020LL;
67static uint64_t w1400= 0x1400140014001400LL;
68static uint64_t bm00000001= 0x00000000000000FFLL;
69static uint64_t bm00010000= 0x000000FF00000000LL;
70static uint64_t bm00001000= 0x00000000FF000000LL;
71static uint64_t bm10000000= 0xFF00000000000000LL;
72static uint64_t bm10000001= 0xFF000000000000FFLL;
73static uint64_t bm11000011= 0xFFFF00000000FFFFLL;
74static uint64_t bm00011000= 0x000000FFFF000000LL;
75static uint64_t bm00110011= 0x0000FFFF0000FFFFLL;
76static uint64_t bm11001100= 0xFFFF0000FFFF0000LL;
77static uint64_t b00= 0x0000000000000000LL;
78static uint64_t b02= 0x0202020202020202LL;
79static uint64_t b0F= 0x0F0F0F0F0F0F0F0FLL;
80static uint64_t bFF= 0xFFFFFFFFFFFFFFFFLL;
81static uint64_t b7E= 0x7E7E7E7E7E7E7E7ELL;
82static uint64_t b7C= 0x7C7C7C7C7C7C7C7CLL;
83static uint64_t b3F= 0x3F3F3F3F3F3F3F3FLL;
84static uint64_t temp0=0;
85static uint64_t temp1=0;
86static uint64_t temp2=0;
87static uint64_t temp3=0;
88static uint64_t temp4=0;
89static uint64_t temp5=0;
90static uint64_t pQPb=0;
91static uint8_t tempBlock[16*16];
92
93int hFlatnessThreshold= 56 - 16;
94int vFlatnessThreshold= 56 - 16;
95
96//amount of "black" u r willing to loose to get a brightness corrected picture
97double maxClippedThreshold= 0.01;
98
99int maxAllowedY=255;
100