Mercurial > mplayer.hg
annotate libmpcodecs/vf_pp7.c @ 28875:8cfb1d6272fe
Allocate buffer for lzo compression correctly also for large frame sizes.
author | reimar |
---|---|
date | Mon, 09 Mar 2009 14:30:41 +0000 |
parents | df67d03dde3b |
children | 0f1b5b68af32 |
rev | line source |
---|---|
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
1 /* |
26727 | 2 * Copyright (C) 2005 Michael Niedermayer <michaelni@gmx.at> |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
20 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
21 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
22 #include <stdio.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
23 #include <stdlib.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
24 #include <string.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
25 #include <inttypes.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
26 #include <math.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
27 |
17012 | 28 #include "config.h" |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
29 |
17012 | 30 #include "mp_msg.h" |
31 #include "cpudetect.h" | |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
32 |
28594
df67d03dde3b
Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents:
28290
diff
changeset
|
33 #if HAVE_MALLOC_H |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
34 #include <malloc.h> |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
35 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
36 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
37 #include "img_format.h" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
38 #include "mp_image.h" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
39 #include "vf.h" |
17012 | 40 #include "libvo/fastmemcpy.h" |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
41 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
42 #define XMIN(a,b) ((a) < (b) ? (a) : (b)) |
19165
7e4f5f62703d
-vf pp7 overblurs still parts of the image, which
gpoirier
parents:
17906
diff
changeset
|
43 #define XMAX(a,b) ((a) > (b) ? (a) : (b)) |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
44 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
45 typedef short DCTELEM; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
46 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
47 //===========================================================================// |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
48 static const uint8_t __attribute__((aligned(8))) dither[8][8]={ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
49 { 0, 48, 12, 60, 3, 51, 15, 63, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
50 { 32, 16, 44, 28, 35, 19, 47, 31, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
51 { 8, 56, 4, 52, 11, 59, 7, 55, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
52 { 40, 24, 36, 20, 43, 27, 39, 23, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
53 { 2, 50, 14, 62, 1, 49, 13, 61, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
54 { 34, 18, 46, 30, 33, 17, 45, 29, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
55 { 10, 58, 6, 54, 9, 57, 5, 53, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
56 { 42, 26, 38, 22, 41, 25, 37, 21, }, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
57 }; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
58 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
59 struct vf_priv_s { |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
60 int qp; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
61 int mode; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
62 int mpeg2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
63 int temp_stride; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
64 uint8_t *src; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
65 }; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
66 #if 0 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
67 static inline void dct7_c(DCTELEM *dst, int s0, int s1, int s2, int s3, int step){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
68 int s, d; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
69 int dst2[64]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
70 //#define S0 (1024/0.37796447300922719759) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
71 #define C0 ((int)(1024*0.37796447300922719759+0.5)) //sqrt(1/7) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
72 #define C1 ((int)(1024*0.53452248382484879308/6+0.5)) //sqrt(2/7)/6 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
73 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
74 #define C2 ((int)(1024*0.45221175985034745004/2+0.5)) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
75 #define C3 ((int)(1024*0.36264567479870879474/2+0.5)) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
76 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
77 //0.1962505182412941918 0.0149276808419397944-0.2111781990832339584 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
78 #define C4 ((int)(1024*0.1962505182412941918+0.5)) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
79 #define C5 ((int)(1024*0.0149276808419397944+0.5)) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
80 //#define C6 ((int)(1024*0.2111781990832339584+0.5)) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
81 #if 0 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
82 s= s0 + s1 + s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
83 dst[0*step] = ((s + s3)*C0 + 512) >> 10; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
84 s= (s - 6*s3)*C1 + 512; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
85 d= (s0-s2)*C4 + (s1-s2)*C5; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
86 dst[1*step] = (s + 2*d)>>10; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
87 s -= d; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
88 d= (s1-s0)*C2 + (s1-s2)*C3; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
89 dst[2*step] = (s + d)>>10; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
90 dst[3*step] = (s - d)>>10; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
91 #elif 1 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
92 s = s3+s3; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
93 s3= s-s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
94 s0= s+s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
95 s = s2+s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
96 s2= s2-s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
97 dst[0*step]= s0 + s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
98 dst[2*step]= s0 - s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
99 dst[1*step]= 2*s3 + s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
100 dst[3*step]= s3 - 2*s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
101 #else |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
102 int i,j,n=7; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
103 for(i=0; i<7; i+=2){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
104 dst2[i*step/2]= 0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
105 for(j=0; j<4; j++) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
106 dst2[i*step/2] += src[j*step] * cos(i*M_PI/n*(j+0.5)) * sqrt((i?2.0:1.0)/n); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
107 if(fabs(dst2[i*step/2] - dst[i*step/2]) > 20) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
108 printf("%d %d %d (%d %d %d %d) -> (%d %d %d %d)\n", i,dst2[i*step/2], dst[i*step/2],src[0*step], src[1*step], src[2*step], src[3*step], dst[0*step], dst[1*step],dst[2*step],dst[3*step]); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
109 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
110 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
111 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
112 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
113 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
114 static inline void dctA_c(DCTELEM *dst, uint8_t *src, int stride){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
115 int i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
116 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
117 for(i=0; i<4; i++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
118 int s0= src[0*stride] + src[6*stride]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
119 int s1= src[1*stride] + src[5*stride]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
120 int s2= src[2*stride] + src[4*stride]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
121 int s3= src[3*stride]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
122 int s= s3+s3; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
123 s3= s-s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
124 s0= s+s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
125 s = s2+s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
126 s2= s2-s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
127 dst[0]= s0 + s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
128 dst[2]= s0 - s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
129 dst[1]= 2*s3 + s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
130 dst[3]= s3 - 2*s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
131 src++; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
132 dst+=4; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
133 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
134 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
135 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
136 static void dctB_c(DCTELEM *dst, DCTELEM *src){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
137 int i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
138 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
139 for(i=0; i<4; i++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
140 int s0= src[0*4] + src[6*4]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
141 int s1= src[1*4] + src[5*4]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
142 int s2= src[2*4] + src[4*4]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
143 int s3= src[3*4]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
144 int s= s3+s3; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
145 s3= s-s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
146 s0= s+s0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
147 s = s2+s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
148 s2= s2-s1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
149 dst[0*4]= s0 + s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
150 dst[2*4]= s0 - s; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
151 dst[1*4]= 2*s3 + s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
152 dst[3*4]= s3 - 2*s2; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
153 src++; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
154 dst++; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
155 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
156 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
157 |
28290 | 158 #if HAVE_MMX |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
159 static void dctB_mmx(DCTELEM *dst, DCTELEM *src){ |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
160 __asm__ volatile ( |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
161 "movq (%0), %%mm0 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
162 "movq 1*4*2(%0), %%mm1 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
163 "paddw 6*4*2(%0), %%mm0 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
164 "paddw 5*4*2(%0), %%mm1 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
165 "movq 2*4*2(%0), %%mm2 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
166 "movq 3*4*2(%0), %%mm3 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
167 "paddw 4*4*2(%0), %%mm2 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
168 "paddw %%mm3, %%mm3 \n\t" //s |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
169 "movq %%mm3, %%mm4 \n\t" //s |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
170 "psubw %%mm0, %%mm3 \n\t" //s-s0 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
171 "paddw %%mm0, %%mm4 \n\t" //s+s0 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
172 "movq %%mm2, %%mm0 \n\t" //s2 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
173 "psubw %%mm1, %%mm2 \n\t" //s2-s1 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
174 "paddw %%mm1, %%mm0 \n\t" //s2+s1 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
175 "movq %%mm4, %%mm1 \n\t" //s0' |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
176 "psubw %%mm0, %%mm4 \n\t" //s0'-s' |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
177 "paddw %%mm0, %%mm1 \n\t" //s0'+s' |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
178 "movq %%mm3, %%mm0 \n\t" //s3' |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
179 "psubw %%mm2, %%mm3 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
180 "psubw %%mm2, %%mm3 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
181 "paddw %%mm0, %%mm2 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
182 "paddw %%mm0, %%mm2 \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
183 "movq %%mm1, (%1) \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
184 "movq %%mm4, 2*4*2(%1) \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
185 "movq %%mm2, 1*4*2(%1) \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
186 "movq %%mm3, 3*4*2(%1) \n\t" |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
187 :: "r" (src), "r"(dst) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
188 ); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
189 } |
15962 | 190 #endif |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
191 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
192 static void (*dctB)(DCTELEM *dst, DCTELEM *src)= dctB_c; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
193 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
194 #define N0 4 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
195 #define N1 5 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
196 #define N2 10 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
197 #define SN0 2 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
198 #define SN1 2.2360679775 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
199 #define SN2 3.16227766017 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
200 #define N (1<<16) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
201 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
202 static const int factor[16]={ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
203 N/(N0*N0), N/(N0*N1), N/(N0*N0),N/(N0*N2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
204 N/(N1*N0), N/(N1*N1), N/(N1*N0),N/(N1*N2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
205 N/(N0*N0), N/(N0*N1), N/(N0*N0),N/(N0*N2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
206 N/(N2*N0), N/(N2*N1), N/(N2*N0),N/(N2*N2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
207 }; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
208 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
209 static const int thres[16]={ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
210 N/(SN0*SN0), N/(SN0*SN2), N/(SN0*SN0),N/(SN0*SN2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
211 N/(SN2*SN0), N/(SN2*SN2), N/(SN2*SN0),N/(SN2*SN2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
212 N/(SN0*SN0), N/(SN0*SN2), N/(SN0*SN0),N/(SN0*SN2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
213 N/(SN2*SN0), N/(SN2*SN2), N/(SN2*SN0),N/(SN2*SN2), |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
214 }; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
215 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
216 static int thres2[99][16]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
217 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
218 static void init_thres2(void){ |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
219 int qp, i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
220 int bias= 0; //FIXME |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
221 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
222 for(qp=0; qp<99; qp++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
223 for(i=0; i<16; i++){ |
19165
7e4f5f62703d
-vf pp7 overblurs still parts of the image, which
gpoirier
parents:
17906
diff
changeset
|
224 thres2[qp][i]= ((i&1)?SN2:SN0) * ((i&4)?SN2:SN0) * XMAX(1,qp) * (1<<2) - 1 - bias; |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
225 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
226 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
227 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
228 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
229 static int hardthresh_c(DCTELEM *src, int qp){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
230 int i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
231 int a; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
232 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
233 a= src[0] * factor[0]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
234 for(i=1; i<16; i++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
235 unsigned int threshold1= thres2[qp][i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
236 unsigned int threshold2= (threshold1<<1); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
237 int level= src[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
238 if(((unsigned)(level+threshold1))>threshold2){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
239 a += level * factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
240 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
241 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
242 return (a + (1<<11))>>12; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
243 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
244 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
245 static int mediumthresh_c(DCTELEM *src, int qp){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
246 int i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
247 int a; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
248 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
249 a= src[0] * factor[0]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
250 for(i=1; i<16; i++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
251 unsigned int threshold1= thres2[qp][i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
252 unsigned int threshold2= (threshold1<<1); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
253 int level= src[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
254 if(((unsigned)(level+threshold1))>threshold2){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
255 if(((unsigned)(level+2*threshold1))>2*threshold2){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
256 a += level * factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
257 }else{ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
258 if(level>0) a+= 2*(level - (int)threshold1)*factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
259 else a+= 2*(level + (int)threshold1)*factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
260 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
261 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
262 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
263 return (a + (1<<11))>>12; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
264 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
265 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
266 static int softthresh_c(DCTELEM *src, int qp){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
267 int i; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
268 int a; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
269 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
270 a= src[0] * factor[0]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
271 for(i=1; i<16; i++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
272 unsigned int threshold1= thres2[qp][i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
273 unsigned int threshold2= (threshold1<<1); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
274 int level= src[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
275 if(((unsigned)(level+threshold1))>threshold2){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
276 if(level>0) a+= (level - (int)threshold1)*factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
277 else a+= (level + (int)threshold1)*factor[i]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
278 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
279 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
280 return (a + (1<<11))>>12; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
281 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
282 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
283 static int (*requantize)(DCTELEM *src, int qp)= hardthresh_c; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
284 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
285 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
286 int x, y; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
287 const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
288 uint8_t *p_src= p->src + 8*stride; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
289 DCTELEM *block= p->src; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
290 DCTELEM *temp= p->src + 32; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
291 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
292 if (!src || !dst) return; // HACK avoid crash for Y8 colourspace |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
293 for(y=0; y<height; y++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
294 int index= 8 + 8*stride + y*stride; |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19165
diff
changeset
|
295 fast_memcpy(p_src + index, src + y*src_stride, width); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
296 for(x=0; x<8; x++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
297 p_src[index - x - 1]= p_src[index + x ]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
298 p_src[index + width + x ]= p_src[index + width - x - 1]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
299 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
300 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
301 for(y=0; y<8; y++){ |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19165
diff
changeset
|
302 fast_memcpy(p_src + ( 7-y)*stride, p_src + ( y+8)*stride, stride); |
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19165
diff
changeset
|
303 fast_memcpy(p_src + (height+8+y)*stride, p_src + (height-y+7)*stride, stride); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
304 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
305 //FIXME (try edge emu) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
306 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
307 for(y=0; y<height; y++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
308 for(x=-8; x<0; x+=4){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
309 const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
310 uint8_t *src = p_src + index; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
311 DCTELEM *tp= temp+4*x; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
312 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
313 dctA_c(tp+4*8, src, stride); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
314 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
315 for(x=0; x<width; ){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
316 const int qps= 3 + is_luma; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
317 int qp; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
318 int end= XMIN(x+8, width); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
319 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
320 if(p->qp) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
321 qp= p->qp; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
322 else{ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
323 qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
324 if(p->mpeg2) qp>>=1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
325 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
326 for(; x<end; x++){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
327 const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
328 uint8_t *src = p_src + index; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
329 DCTELEM *tp= temp+4*x; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
330 int v; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
331 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
332 if((x&3)==0) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
333 dctA_c(tp+4*8, src, stride); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
334 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
335 dctB(block, tp); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
336 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
337 v= requantize(block, qp); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
338 v= (v + dither[y&7][x&7])>>6; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
339 if((unsigned)v > 255) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
340 v= (-v)>>31; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
341 dst[x + y*dst_stride]= v; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
342 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
343 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
344 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
345 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
346 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
347 static int config(struct vf_instance_s* vf, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
348 int width, int height, int d_width, int d_height, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
349 unsigned int flags, unsigned int outfmt){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
350 int h= (height+16+15)&(~15); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
351 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
352 vf->priv->temp_stride= (width+16+15)&(~15); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
353 vf->priv->src = memalign(8, vf->priv->temp_stride*(h+8)*sizeof(uint8_t)); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
354 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
355 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
356 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
357 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
358 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
359 if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
360 // ok, we can do pp in-place (or pp disabled): |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
361 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
16018
bdf1b4ecb906
use stored dimensions instead of visible one when (vf_)get_image is called
iive
parents:
15965
diff
changeset
|
362 mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
363 mpi->planes[0]=vf->dmpi->planes[0]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
364 mpi->stride[0]=vf->dmpi->stride[0]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
365 mpi->width=vf->dmpi->width; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
366 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
367 mpi->planes[1]=vf->dmpi->planes[1]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
368 mpi->planes[2]=vf->dmpi->planes[2]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
369 mpi->stride[1]=vf->dmpi->stride[1]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
370 mpi->stride[2]=vf->dmpi->stride[2]; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
371 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
372 mpi->flags|=MP_IMGFLAG_DIRECT; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
373 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
374 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17566
diff
changeset
|
375 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
376 mp_image_t *dmpi; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
377 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
378 if(mpi->flags&MP_IMGFLAG_DIRECT){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
379 dmpi=vf->dmpi; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
380 }else{ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
381 // no DR, so get a new image! hope we'll get DR buffer: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
382 dmpi=vf_get_image(vf->next,mpi->imgfmt, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
383 MP_IMGTYPE_TEMP, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
384 MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, |
16018
bdf1b4ecb906
use stored dimensions instead of visible one when (vf_)get_image is called
iive
parents:
15965
diff
changeset
|
385 mpi->width,mpi->height); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
386 vf_clone_mpi_attributes(dmpi, mpi); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
387 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
388 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
389 vf->priv->mpeg2= mpi->qscale_type; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
390 if(mpi->qscale || vf->priv->qp){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
391 filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, mpi->qscale, mpi->qstride, 1); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
392 filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
393 filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
394 }else{ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
395 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
396 memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
397 memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
398 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
399 |
28290 | 400 #if HAVE_MMX |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
401 if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
402 #endif |
28290 | 403 #if HAVE_MMX2 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
404 if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
405 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
406 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17566
diff
changeset
|
407 return vf_next_put_image(vf,dmpi, pts); |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
408 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
409 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
410 static void uninit(struct vf_instance_s* vf){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
411 if(!vf->priv) return; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
412 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
413 if(vf->priv->src) free(vf->priv->src); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
414 vf->priv->src= NULL; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
415 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
416 free(vf->priv); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
417 vf->priv=NULL; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
418 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
419 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
420 //===========================================================================// |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
421 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
422 switch(fmt){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
423 case IMGFMT_YVU9: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
424 case IMGFMT_IF09: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
425 case IMGFMT_YV12: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
426 case IMGFMT_I420: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
427 case IMGFMT_IYUV: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
428 case IMGFMT_CLPL: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
429 case IMGFMT_Y800: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
430 case IMGFMT_Y8: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
431 case IMGFMT_444P: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
432 case IMGFMT_422P: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
433 case IMGFMT_411P: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
434 return vf_next_query_format(vf,fmt); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
435 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
436 return 0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
437 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
438 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
439 static int control(struct vf_instance_s* vf, int request, void* data){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
440 return vf_next_control(vf,request,data); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
441 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
442 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
443 static int open(vf_instance_t *vf, char* args){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
444 vf->config=config; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
445 vf->put_image=put_image; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
446 vf->get_image=get_image; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
447 vf->query_format=query_format; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
448 vf->uninit=uninit; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
449 vf->control= control; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
450 vf->priv=malloc(sizeof(struct vf_priv_s)); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
451 memset(vf->priv, 0, sizeof(struct vf_priv_s)); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
452 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
453 if (args) sscanf(args, "%d:%d", &vf->priv->qp, &vf->priv->mode); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
454 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
455 if(vf->priv->qp < 0) |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
456 vf->priv->qp = 0; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
457 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
458 init_thres2(); |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
459 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
460 switch(vf->priv->mode){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
461 case 0: requantize= hardthresh_c; break; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
462 case 1: requantize= softthresh_c; break; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
463 default: |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
464 case 2: requantize= mediumthresh_c; break; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
465 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
466 |
28290 | 467 #if HAVE_MMX |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
468 if(gCpuCaps.hasMMX){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
469 dctB= dctB_mmx; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
470 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
471 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
472 #if 0 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
473 if(gCpuCaps.hasMMX){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
474 switch(vf->priv->mode){ |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
475 case 0: requantize= hardthresh_mmx; break; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
476 case 1: requantize= softthresh_mmx; break; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
477 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
478 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
479 #endif |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
480 |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
481 return 1; |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
482 } |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
483 |
25221 | 484 const vf_info_t vf_info_pp7 = { |
15944
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
485 "postprocess 7", |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
486 "pp7", |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
487 "Michael Niedermayer", |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
488 "", |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
489 open, |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
490 NULL |
1a0c715343d2
pp7 filter (spp=6 filter with 7 point dct where only the center sample is used after idct)
michael
parents:
diff
changeset
|
491 }; |