Mercurial > libavcodec.hg
comparison libpostproc/postprocess.c @ 148:1cfc4d567c0a libavcodec
minor changes (fixed some warnings, added attribute aligned(8) stuff)
| author | michael |
|---|---|
| date | Tue, 06 Nov 2001 16:53:47 +0000 |
| parents | da4c751fc151 |
| children | 3fc494e92f0d |
comparison
equal
deleted
inserted
replaced
| 147:598fdb31f213 | 148:1cfc4d567c0a |
|---|---|
| 113 | 113 |
| 114 | 114 |
| 115 #define GET_MODE_BUFFER_SIZE 500 | 115 #define GET_MODE_BUFFER_SIZE 500 |
| 116 #define OPTIONS_ARRAY_SIZE 10 | 116 #define OPTIONS_ARRAY_SIZE 10 |
| 117 | 117 |
| 118 | 118 #ifdef HAVE_MMX |
| 119 static uint64_t __attribute__((aligned(8))) packedYOffset= 0x0000000000000000LL; | |
| 120 static uint64_t __attribute__((aligned(8))) packedYScale= 0x0100010001000100LL; | |
| 121 static uint64_t __attribute__((aligned(8))) w05= 0x0005000500050005LL; | |
| 122 static uint64_t __attribute__((aligned(8))) w20= 0x0020002000200020LL; | |
| 123 static uint64_t __attribute__((aligned(8))) w1400= 0x1400140014001400LL; | |
| 124 static uint64_t __attribute__((aligned(8))) bm00000001= 0x00000000000000FFLL; | |
| 125 static uint64_t __attribute__((aligned(8))) bm00010000= 0x000000FF00000000LL; | |
| 126 static uint64_t __attribute__((aligned(8))) bm00001000= 0x00000000FF000000LL; | |
| 127 static uint64_t __attribute__((aligned(8))) bm10000000= 0xFF00000000000000LL; | |
| 128 static uint64_t __attribute__((aligned(8))) bm10000001= 0xFF000000000000FFLL; | |
| 129 static uint64_t __attribute__((aligned(8))) bm11000011= 0xFFFF00000000FFFFLL; | |
| 130 static uint64_t __attribute__((aligned(8))) bm00000011= 0x000000000000FFFFLL; | |
| 131 static uint64_t __attribute__((aligned(8))) bm11111110= 0xFFFFFFFFFFFFFF00LL; | |
| 132 static uint64_t __attribute__((aligned(8))) bm11000000= 0xFFFF000000000000LL; | |
| 133 static uint64_t __attribute__((aligned(8))) bm00011000= 0x000000FFFF000000LL; | |
| 134 static uint64_t __attribute__((aligned(8))) bm00110011= 0x0000FFFF0000FFFFLL; | |
| 135 static uint64_t __attribute__((aligned(8))) bm11001100= 0xFFFF0000FFFF0000LL; | |
| 136 static uint64_t __attribute__((aligned(8))) b00= 0x0000000000000000LL; | |
| 137 static uint64_t __attribute__((aligned(8))) b01= 0x0101010101010101LL; | |
| 138 static uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL; | |
| 139 static uint64_t __attribute__((aligned(8))) b0F= 0x0F0F0F0F0F0F0F0FLL; | |
| 140 static uint64_t __attribute__((aligned(8))) b04= 0x0404040404040404LL; | |
| 141 static uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL; | |
| 142 static uint64_t __attribute__((aligned(8))) bFF= 0xFFFFFFFFFFFFFFFFLL; | |
| 143 static uint64_t __attribute__((aligned(8))) b20= 0x2020202020202020LL; | |
| 144 static uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL; | |
| 145 static uint64_t __attribute__((aligned(8))) b7E= 0x7E7E7E7E7E7E7E7ELL; | |
| 146 static uint64_t __attribute__((aligned(8))) b7C= 0x7C7C7C7C7C7C7C7CLL; | |
| 147 static uint64_t __attribute__((aligned(8))) b3F= 0x3F3F3F3F3F3F3F3FLL; | |
| 148 static uint64_t __attribute__((aligned(8))) temp0=0; | |
| 149 static uint64_t __attribute__((aligned(8))) temp1=0; | |
| 150 static uint64_t __attribute__((aligned(8))) temp2=0; | |
| 151 static uint64_t __attribute__((aligned(8))) temp3=0; | |
| 152 static uint64_t __attribute__((aligned(8))) temp4=0; | |
| 153 static uint64_t __attribute__((aligned(8))) temp5=0; | |
| 154 static uint64_t __attribute__((aligned(8))) pQPb=0; | |
| 155 static uint64_t __attribute__((aligned(8))) pQPb2=0; | |
| 156 static uint8_t __attribute__((aligned(8))) tempBlocks[8*16*2]; //used for the horizontal code | |
| 157 #else | |
| 119 static uint64_t packedYOffset= 0x0000000000000000LL; | 158 static uint64_t packedYOffset= 0x0000000000000000LL; |
| 120 static uint64_t packedYScale= 0x0100010001000100LL; | 159 static uint64_t packedYScale= 0x0100010001000100LL; |
| 121 static uint64_t w05= 0x0005000500050005LL; | |
| 122 static uint64_t w20= 0x0020002000200020LL; | |
| 123 static uint64_t w1400= 0x1400140014001400LL; | |
| 124 static uint64_t bm00000001= 0x00000000000000FFLL; | |
| 125 static uint64_t bm00010000= 0x000000FF00000000LL; | |
| 126 static uint64_t bm00001000= 0x00000000FF000000LL; | |
| 127 static uint64_t bm10000000= 0xFF00000000000000LL; | |
| 128 static uint64_t bm10000001= 0xFF000000000000FFLL; | |
| 129 static uint64_t bm11000011= 0xFFFF00000000FFFFLL; | |
| 130 static uint64_t bm00000011= 0x000000000000FFFFLL; | |
| 131 static uint64_t bm11111110= 0xFFFFFFFFFFFFFF00LL; | |
| 132 static uint64_t bm11000000= 0xFFFF000000000000LL; | |
| 133 static uint64_t bm00011000= 0x000000FFFF000000LL; | |
| 134 static uint64_t bm00110011= 0x0000FFFF0000FFFFLL; | |
| 135 static uint64_t bm11001100= 0xFFFF0000FFFF0000LL; | |
| 136 static uint64_t b00= 0x0000000000000000LL; | |
| 137 static uint64_t b01= 0x0101010101010101LL; | |
| 138 static uint64_t b02= 0x0202020202020202LL; | |
| 139 static uint64_t b0F= 0x0F0F0F0F0F0F0F0FLL; | |
| 140 static uint64_t b04= 0x0404040404040404LL; | |
| 141 static uint64_t b08= 0x0808080808080808LL; | |
| 142 static uint64_t bFF= 0xFFFFFFFFFFFFFFFFLL; | |
| 143 static uint64_t b20= 0x2020202020202020LL; | |
| 144 static uint64_t b80= 0x8080808080808080LL; | |
| 145 static uint64_t b7E= 0x7E7E7E7E7E7E7E7ELL; | |
| 146 static uint64_t b7C= 0x7C7C7C7C7C7C7C7CLL; | |
| 147 static uint64_t b3F= 0x3F3F3F3F3F3F3F3FLL; | |
| 148 static uint64_t temp0=0; | |
| 149 static uint64_t temp1=0; | |
| 150 static uint64_t temp2=0; | |
| 151 static uint64_t temp3=0; | |
| 152 static uint64_t temp4=0; | |
| 153 static uint64_t temp5=0; | |
| 154 static uint64_t pQPb=0; | |
| 155 static uint64_t pQPb2=0; | |
| 156 static uint8_t tempBlocks[8*16*2]; //used for the horizontal code | 160 static uint8_t tempBlocks[8*16*2]; //used for the horizontal code |
| 161 #endif | |
| 157 | 162 |
| 158 int hFlatnessThreshold= 56 - 16; | 163 int hFlatnessThreshold= 56 - 16; |
| 159 int vFlatnessThreshold= 56 - 16; | 164 int vFlatnessThreshold= 56 - 16; |
| 160 | 165 |
| 161 //amount of "black" u r willing to loose to get a brightness corrected picture | 166 //amount of "black" u r willing to loose to get a brightness corrected picture |
| 187 "fast", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels", | 192 "fast", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels", |
| 188 "fa", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels", | 193 "fa", "x1hdeblock:a,x1vdeblock:a,dering:a,autolevels", |
| 189 NULL //End Marker | 194 NULL //End Marker |
| 190 }; | 195 }; |
| 191 | 196 |
| 197 #ifdef HAVE_MMX | |
| 192 static inline void unusedVariableWarningFixer() | 198 static inline void unusedVariableWarningFixer() |
| 193 { | 199 { |
| 194 if( | 200 if( |
| 195 packedYOffset + packedYScale + w05 + w20 + w1400 + bm00000001 + bm00010000 | 201 packedYOffset + packedYScale + w05 + w20 + w1400 + bm00000001 + bm00010000 |
| 196 + bm00001000 + bm10000000 + bm10000001 + bm11000011 + bm00000011 + bm11111110 | 202 + bm00001000 + bm10000000 + bm10000001 + bm11000011 + bm00000011 + bm11111110 |
| 197 + bm11000000 + bm00011000 + bm00110011 + bm11001100 + b00 + b01 + b02 + b0F | 203 + bm11000000 + bm00011000 + bm00110011 + bm11001100 + b00 + b01 + b02 + b0F |
| 198 + bFF + b20 + b80 + b7E + b7C + b3F + temp0 + temp1 + temp2 + temp3 + temp4 | 204 + bFF + b20 + b04+ b08 + pQPb2 + b80 + b7E + b7C + b3F + temp0 + temp1 + temp2 + temp3 + temp4 |
| 199 + temp5 + pQPb== 0) b00=0; | 205 + temp5 + pQPb== 0) b00=0; |
| 200 } | 206 } |
| 207 #endif | |
| 201 | 208 |
| 202 #ifdef TIMING | 209 #ifdef TIMING |
| 203 static inline long long rdtsc() | 210 static inline long long rdtsc() |
| 204 { | 211 { |
| 205 long long l; | 212 long long l; |
| 3106 } | 3113 } |
| 3107 | 3114 |
| 3108 if(mode & LEVEL_FIX) QPCorrecture= packedYScale &0xFFFF; | 3115 if(mode & LEVEL_FIX) QPCorrecture= packedYScale &0xFFFF; |
| 3109 else QPCorrecture= 256; | 3116 else QPCorrecture= 256; |
| 3110 | 3117 |
| 3111 /* line before the first one */ | 3118 /* copy & deinterlace first row of blocks */ |
| 3112 y=-BLOCK_SIZE; | 3119 y=-BLOCK_SIZE; |
| 3113 { | 3120 { |
| 3114 //1% speedup if these are here instead of the inner loop | 3121 //1% speedup if these are here instead of the inner loop |
| 3115 uint8_t *srcBlock= &(src[y*srcStride]); | 3122 uint8_t *srcBlock= &(src[y*srcStride]); |
| 3116 uint8_t *dstBlock= &(dst[y*dstStride]); | 3123 uint8_t *dstBlock= &(dst[y*dstStride]); |
| 3245 QPs[(y>>4)*QPStride + (x>>4)]; | 3252 QPs[(y>>4)*QPStride + (x>>4)]; |
| 3246 #endif | 3253 #endif |
| 3247 if(!isColor) | 3254 if(!isColor) |
| 3248 { | 3255 { |
| 3249 QP= (QP* QPCorrecture)>>8; | 3256 QP= (QP* QPCorrecture)>>8; |
| 3250 yHistogram[ srcBlock[srcStride*4 + 4] ]++; | 3257 yHistogram[ srcBlock[srcStride*12 + 4] ]++; |
| 3251 } | 3258 } |
| 3252 #ifdef HAVE_MMX | 3259 #ifdef HAVE_MMX |
| 3253 asm volatile( | 3260 asm volatile( |
| 3254 "movd %0, %%mm7 \n\t" | 3261 "movd %0, %%mm7 \n\t" |
| 3255 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP | 3262 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP |
