This file is indexed.

/usr/include/CharLS/losslesstraits.h is in libcharls-dev 1.0-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// 
// (C) Jan de Vaan 2007-2010, all rights reserved. See the accompanying "License.txt" for licensed use. 
// 



#ifndef CHARLS_LOSSLESSTRAITS
#define CHARLS_LOSSLESSTRAITS

#include "header.h"

//
// optimized trait classes for lossless compression of 8 bit color and 8/16 bit monochrome images.
// This class is assumes MAXVAL correspond to a whole number of bits, and no custom RESET value is set when encoding.
// The point of this is to have the most optimized code for the most common and most demanding scenario. 

template <class sample, LONG bitsperpixel>
struct LosslessTraitsImplT 
{
	typedef sample SAMPLE;
	enum { 
		NEAR  = 0,
		bpp   = bitsperpixel,
		qbpp  = bitsperpixel,
		RANGE = (1 << bpp),
		MAXVAL= (1 << bpp) - 1,
		LIMIT = 2 * (bitsperpixel + MAX(8,bitsperpixel)),
		RESET = BASIC_RESET
	};

	static inlinehint LONG ComputeErrVal(LONG d)
	{ return ModRange(d); }
		
	static inlinehint bool IsNear(LONG lhs, LONG rhs) 
		{ return lhs == rhs; }

	static inlinehint LONG ModRange(LONG Errval) 
	{
		return LONG(Errval << (LONG_BITCOUNT  - bpp)) >> (LONG_BITCOUNT  - bpp); 
	}
	
	static inlinehint SAMPLE ComputeReconstructedSample(LONG Px, LONG ErrVal)
	{
		return SAMPLE(MAXVAL & (Px + ErrVal)); 
	}

	static inlinehint LONG CorrectPrediction(LONG Pxc) 
	{
		if ((Pxc & MAXVAL) == Pxc)
			return Pxc;
		
		return (~(Pxc >> (LONG_BITCOUNT-1))) & MAXVAL;		
	}

};

template <class SAMPLE, LONG bpp>
struct LosslessTraitsT : public LosslessTraitsImplT<SAMPLE, bpp> 
{
	typedef SAMPLE PIXEL;
};



template<>
struct LosslessTraitsT<BYTE,8> : public LosslessTraitsImplT<BYTE, 8> 
{
	typedef SAMPLE PIXEL;

	static inlinehint signed char ModRange(LONG Errval) 
		{ return (signed char)Errval; }

	static inlinehint LONG ComputeErrVal(LONG d)
	{ return (signed char)(d); }

	static inlinehint BYTE ComputeReconstructedSample(LONG Px, LONG ErrVal)
		{ return BYTE(Px + ErrVal);  }
	
};



template<>
struct LosslessTraitsT<USHORT,16> : public LosslessTraitsImplT<USHORT,16> 
{
	typedef SAMPLE PIXEL;

	static inlinehint short ModRange(LONG Errval) 
		{ return short(Errval); }

	static inlinehint LONG ComputeErrVal(LONG d)
	{ return short(d); }

	static inlinehint SAMPLE ComputeReconstructedSample(LONG Px, LONG ErrVal)
		{ return SAMPLE(Px + ErrVal);  }

};




template<class SAMPLE, LONG bpp>
struct LosslessTraitsT<Triplet<SAMPLE>,bpp> : public LosslessTraitsImplT<SAMPLE,bpp>
{
	typedef Triplet<SAMPLE> PIXEL;

	static inlinehint bool IsNear(LONG lhs, LONG rhs) 
		{ return lhs == rhs; }

	static inlinehint bool IsNear(PIXEL lhs, PIXEL rhs) 
		{ return lhs == rhs; }


	static inlinehint SAMPLE ComputeReconstructedSample(LONG Px, LONG ErrVal)
		{ return SAMPLE(Px + ErrVal);  }


};

#endif