Mercurial > mplayer.hg
annotate libmpcodecs/vf_spp.c @ 35883:804c3926503b
Fix a potential integer overflow.
author | reimar |
---|---|
date | Sat, 16 Mar 2013 10:32:42 +0000 |
parents | 68db224c2275 |
children | 488545e72316 |
rev | line source |
---|---|
11277 | 1 /* |
26727 | 2 * Copyright (C) 2003 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 */ | |
11277 | 20 |
21 /* | |
22 * This implementation is based on an algorithm described in | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
23 * "Aria Nosratinia Embedded Post-Processing for |
11277 | 24 * Enhancement of Compressed Images (1999)" |
25 * (http://citeseer.nj.nec.com/nosratinia99embedded.html) | |
26 */ | |
27 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
28 |
11277 | 29 #include <stdio.h> |
30 #include <stdlib.h> | |
31 #include <string.h> | |
32 #include <inttypes.h> | |
33 #include <math.h> | |
34 | |
17012 | 35 #include "config.h" |
11335 | 36 |
17012 | 37 #include "mp_msg.h" |
38 #include "cpudetect.h" | |
11568
cf76671b3d77
Fix compilation if lavc is compiled as a shared lib. Patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
alex
parents:
11477
diff
changeset
|
39 |
35712
d206960484fe
Add a number of missing libavutil header #includes.
diego
parents:
34728
diff
changeset
|
40 #include "libavutil/common.h" |
28329
ed42e982e79f
Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents:
28290
diff
changeset
|
41 #include "libavutil/internal.h" |
24977 | 42 #include "libavutil/intreadwrite.h" |
17012 | 43 #include "libavcodec/avcodec.h" |
44 #include "libavcodec/dsputil.h" | |
11277 | 45 |
28329
ed42e982e79f
Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents:
28290
diff
changeset
|
46 #undef fprintf |
ed42e982e79f
Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents:
28290
diff
changeset
|
47 #undef free |
ed42e982e79f
Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents:
28290
diff
changeset
|
48 #undef malloc |
ed42e982e79f
Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents:
28290
diff
changeset
|
49 |
11277 | 50 #include "img_format.h" |
51 #include "mp_image.h" | |
52 #include "vf.h" | |
33871
30f5e5cd3676
Move code for setting up libav* logging callbacks from vd_ffmpeg to a
reimar
parents:
32702
diff
changeset
|
53 #include "av_helpers.h" |
17012 | 54 #include "libvo/fastmemcpy.h" |
11277 | 55 |
56 #define XMIN(a,b) ((a) < (b) ? (a) : (b)) | |
57 | |
58 //===========================================================================// | |
11477
9785bff83777
memcpy pix instead of black screen if no DR and codec provides no qscale table
michael
parents:
11335
diff
changeset
|
59 static const uint8_t __attribute__((aligned(8))) dither[8][8]={ |
11277 | 60 { 0, 48, 12, 60, 3, 51, 15, 63, }, |
61 { 32, 16, 44, 28, 35, 19, 47, 31, }, | |
62 { 8, 56, 4, 52, 11, 59, 7, 55, }, | |
63 { 40, 24, 36, 20, 43, 27, 39, 23, }, | |
64 { 2, 50, 14, 62, 1, 49, 13, 61, }, | |
65 { 34, 18, 46, 30, 33, 17, 45, 29, }, | |
66 { 10, 58, 6, 54, 9, 57, 5, 53, }, | |
67 { 42, 26, 38, 22, 41, 25, 37, 21, }, | |
68 }; | |
69 | |
11477
9785bff83777
memcpy pix instead of black screen if no DR and codec provides no qscale table
michael
parents:
11335
diff
changeset
|
70 static const uint8_t offset[127][2]= { |
11298 | 71 {0,0}, |
72 {0,0}, {4,4}, | |
73 {0,0}, {2,2}, {6,4}, {4,6}, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
74 {0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7}, |
11298 | 75 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
76 {0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
77 {0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7}, |
11298 | 78 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
79 {0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
80 {2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
81 {4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
82 {6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7}, |
11298 | 83 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
84 {0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
85 {0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
86 {1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
87 {1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
88 {0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
89 {0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1}, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
90 {1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2}, |
11277 | 91 {1,2}, {5,6}, {1,6}, {5,2}, {3,0}, {7,4}, {3,4}, {7,0}, |
92 }; | |
93 | |
94 struct vf_priv_s { | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
95 int log2_count; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
96 int qp; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
97 int mode; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
98 int mpeg2; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
99 int temp_stride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
100 uint8_t *src; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
101 int16_t *temp; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
102 AVCodecContext *avctx; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
103 DSPContext dsp; |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
104 char *non_b_qp; |
11277 | 105 }; |
106 | |
107 #define SHIFT 22 | |
108 | |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
109 static void hardthresh_c(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
110 int i; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
111 int bias= 0; //FIXME |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
112 unsigned int threshold1, threshold2; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
113 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
114 threshold1= qp*((1<<4) - bias) - 1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
115 threshold2= (threshold1<<1); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
116 |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
117 memset(dst, 0, 64*sizeof(int16_t)); |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
118 dst[0]= (src[0] + 4)>>3; |
11277 | 119 |
11296 | 120 for(i=1; i<64; i++){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
121 int level= src[i]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
122 if(((unsigned)(level+threshold1))>threshold2){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
123 const int j= permutation[i]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
124 dst[j]= (level + 4)>>3; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
125 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
126 } |
11277 | 127 } |
128 | |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
129 static void softthresh_c(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
130 int i; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
131 int bias= 0; //FIXME |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
132 unsigned int threshold1, threshold2; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
133 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
134 threshold1= qp*((1<<4) - bias) - 1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
135 threshold2= (threshold1<<1); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
136 |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
137 memset(dst, 0, 64*sizeof(int16_t)); |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
138 dst[0]= (src[0] + 4)>>3; |
11993
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
139 |
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
140 for(i=1; i<64; i++){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
141 int level= src[i]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
142 if(((unsigned)(level+threshold1))>threshold2){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
143 const int j= permutation[i]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
144 if(level>0) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
145 dst[j]= (level - threshold1 + 4)>>3; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
146 else |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
147 dst[j]= (level + threshold1 + 4)>>3; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
148 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
149 } |
11993
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
150 } |
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
151 |
28290 | 152 #if HAVE_MMX |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
153 static void hardthresh_mmx(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
154 int bias= 0; //FIXME |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
155 unsigned int threshold1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
156 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
157 threshold1= qp*((1<<4) - bias) - 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
158 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
159 __asm__ volatile( |
11301 | 160 #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
161 "movq " #src0 ", %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
162 "movq " #src1 ", %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
163 "movq " #src2 ", %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
164 "movq " #src3 ", %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
165 "psubw %%mm4, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
166 "psubw %%mm4, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
167 "psubw %%mm4, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
168 "psubw %%mm4, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
169 "paddusw %%mm5, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
170 "paddusw %%mm5, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
171 "paddusw %%mm5, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
172 "paddusw %%mm5, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
173 "paddw %%mm6, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
174 "paddw %%mm6, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
175 "paddw %%mm6, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
176 "paddw %%mm6, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
177 "psubusw %%mm6, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
178 "psubusw %%mm6, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
179 "psubusw %%mm6, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
180 "psubusw %%mm6, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
181 "psraw $3, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
182 "psraw $3, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
183 "psraw $3, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
184 "psraw $3, %%mm3 \n\t"\ |
11301 | 185 \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
186 "movq %%mm0, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
187 "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
188 "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
189 "movq %%mm1, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
190 "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
191 "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
192 "movq %%mm0, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
193 "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
194 "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
195 "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
196 "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ |
11301 | 197 \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
198 "movq %%mm0, " #dst0 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
199 "movq %%mm7, " #dst1 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
200 "movq %%mm3, " #dst2 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
201 "movq %%mm1, " #dst3 " \n\t" |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
202 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
203 "movd %2, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
204 "movd %3, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
205 "movd %4, %%mm6 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
206 "packssdw %%mm4, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
207 "packssdw %%mm5, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
208 "packssdw %%mm6, %%mm6 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
209 "packssdw %%mm4, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
210 "packssdw %%mm5, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
211 "packssdw %%mm6, %%mm6 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
212 REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
213 REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
214 REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
215 REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
216 : : "r" (src), "r" (dst), "g" (threshold1+1), "g" (threshold1+5), "g" (threshold1-4) //FIXME maybe more accurate then needed? |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
217 ); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
218 dst[0]= (src[0] + 4)>>3; |
11301 | 219 } |
11994 | 220 |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
221 static void softthresh_mmx(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
222 int bias= 0; //FIXME |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
223 unsigned int threshold1; |
11994 | 224 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
225 threshold1= qp*((1<<4) - bias) - 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
226 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
227 __asm__ volatile( |
11994 | 228 #undef REQUANT_CORE |
229 #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
230 "movq " #src0 ", %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
231 "movq " #src1 ", %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
232 "pxor %%mm6, %%mm6 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
233 "pxor %%mm7, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
234 "pcmpgtw %%mm0, %%mm6 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
235 "pcmpgtw %%mm1, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
236 "pxor %%mm6, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
237 "pxor %%mm7, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
238 "psubusw %%mm4, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
239 "psubusw %%mm4, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
240 "pxor %%mm6, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
241 "pxor %%mm7, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
242 "movq " #src2 ", %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
243 "movq " #src3 ", %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
244 "pxor %%mm6, %%mm6 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
245 "pxor %%mm7, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
246 "pcmpgtw %%mm2, %%mm6 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
247 "pcmpgtw %%mm3, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
248 "pxor %%mm6, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
249 "pxor %%mm7, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
250 "psubusw %%mm4, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
251 "psubusw %%mm4, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
252 "pxor %%mm6, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
253 "pxor %%mm7, %%mm3 \n\t"\ |
11994 | 254 \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
255 "paddsw %%mm5, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
256 "paddsw %%mm5, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
257 "paddsw %%mm5, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
258 "paddsw %%mm5, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
259 "psraw $3, %%mm0 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
260 "psraw $3, %%mm1 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
261 "psraw $3, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
262 "psraw $3, %%mm3 \n\t"\ |
11994 | 263 \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
264 "movq %%mm0, %%mm7 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
265 "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
266 "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
267 "movq %%mm1, %%mm2 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
268 "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
269 "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
270 "movq %%mm0, %%mm3 \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
271 "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
272 "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
273 "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
274 "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ |
11994 | 275 \ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
276 "movq %%mm0, " #dst0 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
277 "movq %%mm7, " #dst1 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
278 "movq %%mm3, " #dst2 " \n\t"\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
279 "movq %%mm1, " #dst3 " \n\t" |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
280 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
281 "movd %2, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
282 "movd %3, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
283 "packssdw %%mm4, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
284 "packssdw %%mm5, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
285 "packssdw %%mm4, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
286 "packssdw %%mm5, %%mm5 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
287 REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
288 REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
289 REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
290 REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
291 : : "r" (src), "r" (dst), "g" (threshold1), "rm" (4) //FIXME maybe more accurate then needed? |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
292 ); |
11994 | 293 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
294 dst[0]= (src[0] + 4)>>3; |
11994 | 295 } |
11301 | 296 #endif |
297 | |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
298 static inline void add_block(int16_t *dst, int stride, int16_t block[64]){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
299 int y; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
300 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
301 for(y=0; y<8; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
302 *(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
303 *(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
304 *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
305 *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
306 } |
11277 | 307 } |
308 | |
11305 | 309 static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
310 int y, x; |
11299 | 311 |
312 #define STORE(pos) \ | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
313 temp= ((src[x + y*src_stride + pos]<<log2_scale) + d[pos])>>6;\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
314 if(temp & 0x100) temp= ~(temp>>31);\ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
315 dst[x + y*dst_stride + pos]= temp; |
11299 | 316 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
317 for(y=0; y<height; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
318 const uint8_t *d= dither[y]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
319 for(x=0; x<width; x+=8){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
320 int temp; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
321 STORE(0); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
322 STORE(1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
323 STORE(2); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
324 STORE(3); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
325 STORE(4); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
326 STORE(5); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
327 STORE(6); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
328 STORE(7); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
329 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
330 } |
11299 | 331 } |
332 | |
28290 | 333 #if HAVE_MMX |
11305 | 334 static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
335 int y; |
11299 | 336 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
337 for(y=0; y<height; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
338 uint8_t *dst1= dst; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
339 int16_t *src1= src; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
340 __asm__ volatile( |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
341 "movq (%3), %%mm3 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
342 "movq (%3), %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
343 "movd %4, %%mm2 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
344 "pxor %%mm0, %%mm0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
345 "punpcklbw %%mm0, %%mm3 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
346 "punpckhbw %%mm0, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
347 "psraw %%mm2, %%mm3 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
348 "psraw %%mm2, %%mm4 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
349 "movd %5, %%mm2 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
350 "1: \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
351 "movq (%0), %%mm0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
352 "movq 8(%0), %%mm1 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
353 "paddw %%mm3, %%mm0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
354 "paddw %%mm4, %%mm1 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
355 "psraw %%mm2, %%mm0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
356 "psraw %%mm2, %%mm1 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
357 "packuswb %%mm1, %%mm0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
358 "movq %%mm0, (%1) \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
359 "add $16, %0 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
360 "add $8, %1 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
361 "cmp %2, %1 \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
362 " jb 1b \n\t" |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
363 : "+r" (src1), "+r"(dst1) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
364 : "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(6-log2_scale) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
365 ); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
366 src += src_stride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
367 dst += dst_stride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
368 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
369 // if(width != mmxw) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
370 // store_slice_c(dst + mmxw, src + mmxw, dst_stride, src_stride, width - mmxw, log2_scale); |
11299 | 371 } |
372 #endif | |
373 | |
11305 | 374 static void (*store_slice)(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)= store_slice_c; |
11299 | 375 |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
376 static void (*requantize)(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation)= hardthresh_c; |
11301 | 377 |
11277 | 378 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){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
379 int x, y, i; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
380 const int count= 1<<p->log2_count; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
381 const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
382 uint64_t __attribute__((aligned(16))) block_align[32]; |
35743
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
383 int16_t *block = (int16_t *)block_align; |
68db224c2275
libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg.
michael
parents:
35712
diff
changeset
|
384 int16_t *block2= (int16_t *)(block_align+16); |
11301 | 385 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
386 if (!src || !dst) return; // HACK avoid crash for Y8 colourspace |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
387 for(y=0; y<height; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
388 int index= 8 + 8*stride + y*stride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
389 fast_memcpy(p->src + index, src + y*src_stride, width); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
390 for(x=0; x<8; x++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
391 p->src[index - x - 1]= p->src[index + x ]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
392 p->src[index + width + x ]= p->src[index + width - x - 1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
393 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
394 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
395 for(y=0; y<8; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
396 fast_memcpy(p->src + ( 7-y)*stride, p->src + ( y+8)*stride, stride); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
397 fast_memcpy(p->src + (height+8+y)*stride, p->src + (height-y+7)*stride, stride); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
398 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
399 //FIXME (try edge emu) |
11277 | 400 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
401 for(y=0; y<height+8; y+=8){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
402 memset(p->temp + (8+y)*stride, 0, 8*stride*sizeof(int16_t)); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
403 for(x=0; x<width+8; x+=8){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
404 const int qps= 3 + is_luma; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
405 int qp; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
406 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
407 if(p->qp) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
408 qp= p->qp; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
409 else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
410 qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
411 qp = FFMAX(1, norm_qscale(qp, p->mpeg2)); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
412 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
413 for(i=0; i<count; i++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
414 const int x1= x + offset[i+count-1][0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
415 const int y1= y + offset[i+count-1][1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
416 const int index= x1 + y1*stride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
417 p->dsp.get_pixels(block, p->src + index, stride); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
418 p->dsp.fdct(block); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
419 requantize(block2, block, qp, p->dsp.idct_permutation); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
420 p->dsp.idct(block2); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
421 add_block(p->temp + index, stride, block2); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
422 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
423 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
424 if(y) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
425 store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, XMIN(8, height+8-y), 6-p->log2_count); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
426 } |
11295 | 427 #if 0 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
428 for(y=0; y<height; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
429 for(x=0; x<width; x++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
430 if((((x>>6) ^ (y>>6)) & 1) == 0) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
431 dst[x + y*dst_stride]= p->src[8 + 8*stride + x + y*stride]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
432 if((x&63) == 0 || (y&63)==0) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
433 dst[x + y*dst_stride] += 128; |
11295 | 434 } |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
435 } |
11295 | 436 #endif |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
437 //FIXME reorder for better caching |
11277 | 438 } |
439 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
440 static int config(struct vf_instance *vf, |
11277 | 441 int width, int height, int d_width, int d_height, |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
442 unsigned int flags, unsigned int outfmt){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
443 int h= (height+16+15)&(~15); |
11277 | 444 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
445 vf->priv->temp_stride= (width+16+15)&(~15); |
11305 | 446 vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t)); |
447 vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
448 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
449 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
11277 | 450 } |
451 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
452 static void get_image(struct vf_instance *vf, mp_image_t *mpi){ |
11277 | 453 if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change |
454 // ok, we can do pp in-place (or pp disabled): | |
455 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
|
456 mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height); |
11277 | 457 mpi->planes[0]=vf->dmpi->planes[0]; |
458 mpi->stride[0]=vf->dmpi->stride[0]; | |
459 mpi->width=vf->dmpi->width; | |
460 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
461 mpi->planes[1]=vf->dmpi->planes[1]; | |
462 mpi->planes[2]=vf->dmpi->planes[2]; | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
463 mpi->stride[1]=vf->dmpi->stride[1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
464 mpi->stride[2]=vf->dmpi->stride[2]; |
11277 | 465 } |
466 mpi->flags|=MP_IMGFLAG_DIRECT; | |
467 } | |
468 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
469 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
470 mp_image_t *dmpi; |
11277 | 471 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
472 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
473 // no DR, so get a new image! hope we'll get DR buffer: |
14022
803be9a78854
removing strange csp matching code (was copy&pasted from vf_pp where it originated from arpi 2.5 years ago) -> fixes spp+scale+x11 crash
michael
parents:
13729
diff
changeset
|
474 dmpi=vf_get_image(vf->next,mpi->imgfmt, |
12631
6cbccc0c7d7b
Fix memory corruption, noticable at reallocate image
iive
parents:
12163
diff
changeset
|
475 MP_IMGTYPE_TEMP, |
6cbccc0c7d7b
Fix memory corruption, noticable at reallocate image
iive
parents:
12163
diff
changeset
|
476 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
|
477 mpi->width,mpi->height); |
12631
6cbccc0c7d7b
Fix memory corruption, noticable at reallocate image
iive
parents:
12163
diff
changeset
|
478 vf_clone_mpi_attributes(dmpi, mpi); |
6cbccc0c7d7b
Fix memory corruption, noticable at reallocate image
iive
parents:
12163
diff
changeset
|
479 }else{ |
13149 | 480 dmpi=vf->dmpi; |
12631
6cbccc0c7d7b
Fix memory corruption, noticable at reallocate image
iive
parents:
12163
diff
changeset
|
481 } |
11277 | 482 |
483 vf->priv->mpeg2= mpi->qscale_type; | |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
484 if(mpi->pict_type != 3 && mpi->qscale && !vf->priv->qp){ |
30363
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
485 int w = mpi->qstride; |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
486 int h = (mpi->h + 15) >> 4; |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
487 if (!w) { |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
488 w = (mpi->w + 15) >> 4; |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
489 h = 1; |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
490 } |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
491 if(!vf->priv->non_b_qp) |
30363
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
492 vf->priv->non_b_qp= malloc(w*h); |
915be5c7a30c
Make sure that a qstride of 0 (intentional or not) does not completely break
reimar
parents:
29263
diff
changeset
|
493 fast_memcpy(vf->priv->non_b_qp, mpi->qscale, w*h); |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
494 } |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
495 if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
496 char *qp_tab= vf->priv->non_b_qp; |
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
497 if((vf->priv->mode&4) || !qp_tab) |
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
498 qp_tab= mpi->qscale; |
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
499 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
500 if(qp_tab || vf->priv->qp){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
501 filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, qp_tab, mpi->qstride, 1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
502 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, qp_tab, mpi->qstride, 0); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
503 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, qp_tab, mpi->qstride, 0); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
504 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
505 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
506 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]); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
507 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]); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
508 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
509 } |
11277 | 510 |
28290 | 511 #if HAVE_MMX |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
512 if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); |
11277 | 513 #endif |
28290 | 514 #if HAVE_MMX2 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
515 if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); |
11277 | 516 #endif |
517 | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
518 return vf_next_put_image(vf,dmpi, pts); |
11277 | 519 } |
520 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
521 static void uninit(struct vf_instance *vf){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
522 if(!vf->priv) return; |
11277 | 523 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
524 free(vf->priv->temp); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
525 vf->priv->temp= NULL; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
526 free(vf->priv->src); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
527 vf->priv->src= NULL; |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
31959
diff
changeset
|
528 free(vf->priv->avctx); |
11277 | 529 vf->priv->avctx= NULL; |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
31959
diff
changeset
|
530 free(vf->priv->non_b_qp); |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
531 vf->priv->non_b_qp= NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
532 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
533 free(vf->priv); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
534 vf->priv=NULL; |
11277 | 535 } |
536 | |
537 //===========================================================================// | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
538 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
11307 | 539 switch(fmt){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
540 case IMGFMT_YVU9: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
541 case IMGFMT_IF09: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
542 case IMGFMT_YV12: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
543 case IMGFMT_I420: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
544 case IMGFMT_IYUV: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
545 case IMGFMT_CLPL: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
546 case IMGFMT_Y800: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
547 case IMGFMT_Y8: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
548 case IMGFMT_444P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
549 case IMGFMT_422P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
550 case IMGFMT_411P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
551 return vf_next_query_format(vf,fmt); |
11307 | 552 } |
553 return 0; | |
11277 | 554 } |
555 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
556 static int control(struct vf_instance *vf, int request, void* data){ |
11307 | 557 switch(request){ |
558 case VFCTRL_QUERY_MAX_PP_LEVEL: | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
559 return 6; |
11307 | 560 case VFCTRL_SET_PP_LEVEL: |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
561 vf->priv->log2_count= *((unsigned int*)data); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
562 return CONTROL_TRUE; |
11307 | 563 } |
564 return vf_next_control(vf,request,data); | |
565 } | |
566 | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30412
diff
changeset
|
567 static int vf_open(vf_instance_t *vf, char *args){ |
12157 | 568 |
14022
803be9a78854
removing strange csp matching code (was copy&pasted from vf_pp where it originated from arpi 2.5 years ago) -> fixes spp+scale+x11 crash
michael
parents:
13729
diff
changeset
|
569 int log2c=-1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
570 |
11277 | 571 vf->config=config; |
572 vf->put_image=put_image; | |
573 vf->get_image=get_image; | |
574 vf->query_format=query_format; | |
575 vf->uninit=uninit; | |
11307 | 576 vf->control= control; |
11277 | 577 vf->priv=malloc(sizeof(struct vf_priv_s)); |
578 memset(vf->priv, 0, sizeof(struct vf_priv_s)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
579 |
31959
f957f330aa6d
Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
diego
parents:
30642
diff
changeset
|
580 init_avcodec(); |
11280 | 581 |
34566
f3d53cd55376
Update deprecated avcodec_alloc_context()/avcodec_open() API calls
siretart
parents:
33871
diff
changeset
|
582 vf->priv->avctx= avcodec_alloc_context3(NULL); |
34728
a28c4ba97171
Replace use of deprecated dsputil_init() by ff_dsputil_init().
diego
parents:
34566
diff
changeset
|
583 ff_dsputil_init(&vf->priv->dsp, vf->priv->avctx); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
584 |
11993
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
585 vf->priv->log2_count= 3; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
586 |
12157 | 587 if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode); |
588 | |
589 if( log2c >=0 && log2c <=6 ) | |
590 vf->priv->log2_count = log2c; | |
591 | |
592 if(vf->priv->qp < 0) | |
593 vf->priv->qp = 0; | |
594 | |
17110
ba9bf9beb23f
prevent flicker, to get old behaviour use spp=x:y:4 / x:y:5
michael
parents:
17082
diff
changeset
|
595 switch(vf->priv->mode&3){ |
12157 | 596 default: |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
597 case 0: requantize= hardthresh_c; break; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
598 case 1: requantize= softthresh_c; break; |
11993
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
599 } |
4e2d99dbef78
spp soft thresholding patch by (James Crowson <jbcrowso at ncsu dot edu>)
michael
parents:
11568
diff
changeset
|
600 |
28290 | 601 #if HAVE_MMX |
11299 | 602 if(gCpuCaps.hasMMX){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
603 store_slice= store_slice_mmx; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
604 switch(vf->priv->mode&3){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
605 case 0: requantize= hardthresh_mmx; break; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
606 case 1: requantize= softthresh_mmx; break; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
607 } |
11299 | 608 } |
11304 | 609 #endif |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
610 |
11277 | 611 return 1; |
612 } | |
613 | |
25221 | 614 const vf_info_t vf_info_spp = { |
11277 | 615 "simple postprocess", |
616 "spp", | |
617 "Michael Niedermayer", | |
618 "", | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30412
diff
changeset
|
619 vf_open, |
11277 | 620 NULL |
621 }; |