Mercurial > libpostproc.hg
comparison postprocess_template.c @ 78:47ff4bd209cd libpostproc
const
| author | michael |
|---|---|
| date | Sat, 02 Feb 2008 21:24:54 +0000 |
| parents | 95d9409452f2 |
| children | 8e738e0a16f5 |
comparison
equal
deleted
inserted
replaced
| 77:13e4f6ebb206 | 78:47ff4bd209cd |
|---|---|
| 3178 STOP_TIMER("stepX") | 3178 STOP_TIMER("stepX") |
| 3179 }*/ | 3179 }*/ |
| 3180 } | 3180 } |
| 3181 #endif //HAVE_MMX | 3181 #endif //HAVE_MMX |
| 3182 | 3182 |
| 3183 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, | 3183 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 3184 QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c); | 3184 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c); |
| 3185 | 3185 |
| 3186 /** | 3186 /** |
| 3187 * Copies a block from src to dst and fixes the blacklevel. | 3187 * Copies a block from src to dst and fixes the blacklevel. |
| 3188 * levelFix == 0 -> do not touch the brighness & contrast | 3188 * levelFix == 0 -> do not touch the brighness & contrast |
| 3189 */ | 3189 */ |
| 3190 #undef SCALED_CPY | 3190 #undef SCALED_CPY |
| 3191 | 3191 |
| 3192 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride, | 3192 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride, |
| 3193 int levelFix, int64_t *packedOffsetAndScale) | 3193 int levelFix, int64_t *packedOffsetAndScale) |
| 3194 { | 3194 { |
| 3195 #ifndef HAVE_MMX | 3195 #ifndef HAVE_MMX |
| 3196 int i; | 3196 int i; |
| 3197 #endif | 3197 #endif |
| 3344 } | 3344 } |
| 3345 | 3345 |
| 3346 /** | 3346 /** |
| 3347 * Filters array of bytes (Y or U or V values) | 3347 * Filters array of bytes (Y or U or V values) |
| 3348 */ | 3348 */ |
| 3349 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, | 3349 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 3350 QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2) | 3350 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2) |
| 3351 { | 3351 { |
| 3352 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access | 3352 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access |
| 3353 int x,y; | 3353 int x,y; |
| 3354 #ifdef COMPILE_TIME_MODE | 3354 #ifdef COMPILE_TIME_MODE |
| 3355 const int mode= COMPILE_TIME_MODE; | 3355 const int mode= COMPILE_TIME_MODE; |
| 3460 } | 3460 } |
| 3461 | 3461 |
| 3462 /* copy & deinterlace first row of blocks */ | 3462 /* copy & deinterlace first row of blocks */ |
| 3463 y=-BLOCK_SIZE; | 3463 y=-BLOCK_SIZE; |
| 3464 { | 3464 { |
| 3465 uint8_t *srcBlock= &(src[y*srcStride]); | 3465 const uint8_t *srcBlock= &(src[y*srcStride]); |
| 3466 uint8_t *dstBlock= tempDst + dstStride; | 3466 uint8_t *dstBlock= tempDst + dstStride; |
| 3467 | 3467 |
| 3468 // From this point on it is guaranteed that we can read and write 16 lines downward | 3468 // From this point on it is guaranteed that we can read and write 16 lines downward |
| 3469 // finish 1 block before the next otherwise we might have a problem | 3469 // finish 1 block before the next otherwise we might have a problem |
| 3470 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing | 3470 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing |
| 3543 } | 3543 } |
| 3544 | 3544 |
| 3545 for(y=0; y<height; y+=BLOCK_SIZE) | 3545 for(y=0; y<height; y+=BLOCK_SIZE) |
| 3546 { | 3546 { |
| 3547 //1% speedup if these are here instead of the inner loop | 3547 //1% speedup if these are here instead of the inner loop |
| 3548 uint8_t *srcBlock= &(src[y*srcStride]); | 3548 const uint8_t *srcBlock= &(src[y*srcStride]); |
| 3549 uint8_t *dstBlock= &(dst[y*dstStride]); | 3549 uint8_t *dstBlock= &(dst[y*dstStride]); |
| 3550 #ifdef HAVE_MMX | 3550 #ifdef HAVE_MMX |
| 3551 uint8_t *tempBlock1= c.tempBlocks; | 3551 uint8_t *tempBlock1= c.tempBlocks; |
| 3552 uint8_t *tempBlock2= c.tempBlocks + 8; | 3552 uint8_t *tempBlock2= c.tempBlocks + 8; |
| 3553 #endif | 3553 #endif |
| 3554 int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride]; | 3554 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride]; |
| 3555 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)]; | 3555 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)]; |
| 3556 int QP=0; | 3556 int QP=0; |
| 3557 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards | 3557 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards |
| 3558 if not than use a temporary buffer */ | 3558 if not than use a temporary buffer */ |
| 3559 if(y+15 >= height) | 3559 if(y+15 >= height) |
