/usr/include/mjpegtools/mpeg2enc/mpeg2coder.hh is in libmjpegtools-dev 1:2.1.0+debian-5.
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 | #ifndef _MPEG2CODING_HH
#define _MPEG2CODING_HH
// TODO should be renamed to mpeg2codingbuf.hh
/* mpeg2encoding.hh - (Partial) MPEG2 packed bit / VLC syntax encoding of a Picture */
/* (C) 2003 Andrew Stevens */
/* This Software 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 <stdlib.h>
#include "mjpeg_types.h"
#include "synchrolib.h"
#include "elemstrmwriter.hh"
class Picture;
class MPEG2CodingBuf
{
public:
MPEG2CodingBuf( EncoderParams &encoder, ElemStrmWriter &writer );
virtual ~MPEG2CodingBuf();
void PutUserData( const uint8_t *userdata, int len);
void PutGopHdr(int frame, int closed_gop );
void PutSeqEnd();
void PutSeqHdr();
void PutIntraBlk(Picture *picture, int16_t *blk, int cc);
void PutNonIntraBlk(Picture *picture, int16_t *blk);
void PutMV(int dmv, int f_code);
void PutDMV(int dmv);
void PutAddrInc(int addrinc);
void PutMBType(int pict_type, int mb_type);
void PutMotionCode(int motion_code);
void PutCPB(int cbp);
inline void PutBits( uint32_t val, int n)
{
frag_buf->PutBits( val, n );
}
inline int ByteCount() const
{
return frag_buf->ByteCount();
}
inline void AlignBits()
{
frag_buf->AlignBits();
}
inline bool Aligned() const
{
return frag_buf->Aligned();
}
inline void FlushBuffer()
{
frag_buf->FlushBuffer();
}
inline void ResetBuffer()
{
frag_buf->ResetBuffer();
}
private:
void PutSeqExt();
void PutSeqDispExt();
int FrameToTimeCode( int gop_timecode0_frame );
inline void PutDClum(int val)
{
PutDC(DClumtab,val);
}
inline int DClum_bits( int val )
{
return DC_bits(DClumtab,val);
}
/* generate variable length code for chrominance DC coefficient */
inline void PutDCchrom(int val)
{
PutDC(DCchromtab,val);
}
inline int DCchrom_bits(int val)
{
return DC_bits(DClumtab,val);
}
/* type definitions for variable length code table entries */
typedef struct
{
unsigned char code; /* right justified */
char len;
} VLCtable;
/* for codes longer than 8 bits (excluding leading zeroes) */
typedef struct
{
unsigned short code; /* right justified */
char len;
} sVLCtable;
void PutDC(const sVLCtable *tab, int val);
int DC_bits(const sVLCtable *tab, int val);
void PutACfirst(int run, int val);
void PutAC(int run, int signed_level, int vlcformat);
int AC_bits(int run, int signed_level, int vlcformat);
int AddrInc_bits(int addrinc);
int MBType_bits( int pict_type, int mb_type);
int MotionCode_bits( int motion_code );
int DMV_bits(int dmv);
int CBP_bits(int cbp);
private:
EncoderParams &encparams;
ElemStrmFragBuf *frag_buf;
const static VLCtable addrinctab[33];
const static VLCtable mbtypetab[3][32];
const static VLCtable cbptable[64];
const static VLCtable motionvectab[17];
const static sVLCtable DClumtab[12];
const static sVLCtable DCchromtab[12];
const static VLCtable dct_code_tab1[2][40];
const static VLCtable dct_code_tab2[30][5];
const static VLCtable dct_code_tab1a[2][40];
const static VLCtable dct_code_tab2a[30][5];
};
/*
* Local variables:
* c-file-style: "stroustrup"
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
#endif
|