This file is indexed.

/usr/include/mjpegtools/mpeg2enc/ratectl.hh is in libmjpegtools-dev 1:2.1.0+debian-2.1.

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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef _RATECTL_HH
#define _RATECTL_HH

/*  (C) 2003 Andrew Stevens */

/*  This is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2 of
 *  the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 */

#include <deque>
#include "mjpeg_types.h"
#include "mpeg2syntaxcodes.h"

class MacroBlock;
class EncoderParams;
class Picture;



/*
	Base class for state of rate-controller.
	Factory allows us to generate appropriate state
	objects for a given rate-controller object.

	Set allow us to set set of a rate-controller from
	a previously copied state...
*/
class RateCtlState
{
public:
	virtual ~RateCtlState() {}
	virtual RateCtlState *New() const = 0;
	virtual void Set( const RateCtlState &state) = 0;
	virtual const RateCtlState &Get() const = 0;
};

class RateCtl 
{
public:
    RateCtl( EncoderParams &_encparams, RateCtlState &_state );

    virtual ~RateCtl() {}

    /*********************
    *
    * Initialise rate control parameters for start of encoding
    * based on encoding parameters
    *
    ********************/

    virtual void Init() = 0;

    /*********************
    *
    * Setup rate control for a new picture
    * IF it is first of sequence new seq. is initialized first
    * IF it is first of GOP new GOP is initialized 2nd
    * Finally Picture specific initialization is done.
    *
    ********************/

    virtual void PictSetup (Picture &picture);

    /*********************
    *
    * Update rate control after coding of new picture (minus padding)
    *
    ********************/
    virtual void PictUpdate (Picture &picture, int &padding_needed ) = 0;


    virtual int MacroBlockQuant(  const MacroBlock &mb) = 0;
    virtual int  InitialMacroBlockQuant() = 0;

    inline RateCtlState *NewState() const { return state.New(); }
    inline void SetState( const RateCtlState &toset) { state.Set( toset ); }
    inline const RateCtlState &GetState() const { return state.Get(); }

    // TODO DEBUG
    virtual double SumAvgActivity() = 0;

    static double ClipQuant( int q_scale_type, double quant );
    static double InvScaleQuant(  int q_scale_type, int raw_code );
    static int ScaleQuant( int q_scale_type, double quant );
protected:

    /*********************
    *
    * Reinitialize rate control parameters for start of new sequence
    *
    ********************/

    virtual void InitSeq( ) = 0;

    /*********************
    *
    * Reinitialize rate control parameters for start of new GOP
    *
    ********************/

    virtual void InitGOP( ) = 0;

    /* ****************************
    *
    * Reinitialize rate control parameters for start of new Picture
    *
    * @return (re)encoding of picture to achieve rate-control mandatory
    *
    * ****************************/

    virtual void InitPict( Picture &picture ) = 0;


    double ScaleQuantf( int q_scale_type, double quant );
    EncoderParams &encparams;
    RateCtlState &state;
};

class Pass1RateCtl : public RateCtl
{    
public:
    Pass1RateCtl( EncoderParams &encoder, RateCtlState &state );

    /*********************
    *
    * Setup GOP structure for coding from nominal GOP size parameters
    *
    ********************/

    virtual void GopSetup( int nb, int np ) = 0;

};

class Pass2RateCtl : public RateCtl
{
public:
    Pass2RateCtl( EncoderParams &encoder, RateCtlState &state );

    /*********************
    *
    * Setup GOP structure for coding based on look-ahead data from pass-1
    *
    ********************/
    virtual void GopSetup( std::deque<Picture *>::iterator gop_begin,
                           std::deque<Picture *>::iterator gop_end ) = 0;

    /*********************
    * @pre PictureSetup called...
    * @return Re-encoding of picture to achieve rate control mandatory
    *
    *********************/
 
    virtual bool ReencodeRequired() const = 0;


    virtual unsigned int getEncodedFrames() const = 0;

    virtual double getStreamComplexity() const = 0;
};

/* 
 * Local variables:
 *  c-file-style: "stroustrup"
 *  tab-width: 4
 *  indent-tabs-mode: nil
 * End:
 */
#endif