123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #include "postp.h"
- void ClampLevels_C
- (
- POSTPROC_INSTANCE *pbi,
- INT32 BlackClamp,
- INT32 WhiteClamp,
- UINT8 *Src,
- UINT8 *Dst
- )
- {
- int i;
- int row,col;
- unsigned char clamped[256];
- int width = pbi->HFragments*8;
- int height = pbi->VFragments*8;
- UINT8 *SrcPtr = Src + pbi->ReconYDataOffset;
- UINT8 *DestPtr = Dst + pbi->ReconYDataOffset;
- UINT32 LineLength = pbi->YStride;
-
- for ( i=0; i<256; i++ )
- {
- clamped[i] = i;
- if ( i<BlackClamp )
- clamped[i] = BlackClamp;
- if ( i>(255-WhiteClamp) )
- clamped[i] = 255-WhiteClamp;
- }
-
- for ( row=0 ; row<height; row++ )
- {
- for ( col=0; col<width; col++ )
- SrcPtr[col] = clamped[DestPtr[col]];
- SrcPtr += LineLength;
- DestPtr += LineLength;
- }
- }
|