/usr/include/mjpegtools/mpeg2enc/encoderparams.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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | #ifndef _ENCODERPARAMS_HH
#define _ENCODERPARAMS_HH
/* encoderparams - class holding all the various control parameters for
and individual encoder instance. For speed a lot of address offsets/sizes
are computed once-and-for-all and held in this object.
*/
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
/*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee or
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
* any and all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and user's
* customers, employees, agents, transferees, successors, and assigns.
*
* The MPEG Software Simulation Group does not represent or warrant that the
* programs furnished hereunder are free of infringement of any third-party
* patents.
*
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
* are subject to royalty fees to patent holders. Many of these patents are
* general enough such that they are unavoidable regardless of implementation
* design.
*
*/
/* Modifications and enhancements (C) 2000,2001,2002,2003 Andrew Stevens */
/* These modifications are 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 "mjpeg_types.h"
#include "syntaxconsts.h"
#include <deque>
using std::deque;
/*
Ensure we don't bury a system in wild spawning of
threads...
*/
#define MAX_WORKER_THREADS 16
/* motion data */
struct motion_data {
unsigned int forw_hor_f_code,forw_vert_f_code; /* vector range */
unsigned int sxf,syf; /* search range */
unsigned int back_hor_f_code,back_vert_f_code;
unsigned int sxb,syb;
};
struct RateCtl;
class MPEG2EncOptions;
class EncoderParams
{
public:
EncoderParams( const MPEG2EncOptions &options);
void Init(const MPEG2EncOptions &options);
private:
void InitQuantMatrices(const class MPEG2EncOptions &options);
void InitEncodingControls(const class MPEG2EncOptions &options);
void RangeChecks();
void ProfileAndLevelChecks();
public:
/**************
*
* Global MPEG parameters (set by supplied stream, never
* change in a run)
*
*************/
unsigned int horizontal_size, vertical_size;
unsigned int aspectratio; /* aspect ratio information (pel or display) */
unsigned int frame_rate_code; /* coded value of playback display
* frame rate */
int dctsatlim; /* Value to saturated DCT coeffs to */
double frame_rate; /* Playback display frames per second
N.b. when 3:2 pullback is active
this is higher than the frame
decode rate. */
double bit_rate; /* bits per second, rate decode buffers filled (max rate) */
double target_bitrate; /* Target bit rate to achieve overall for VBR 0 if no target set */
unsigned int stream_frames; /* # Frames to representatively sample stream */
double stream_Xhi; /* Total stream complexity */
bool seq_hdr_every_gop;
bool seq_end_every_gop; /* Useful for Stills sequences... */
bool svcd_scan_data;
unsigned int vbv_buffer_code; /* Code for size of VBV buffer (*
* 16 kbit) */
double vbv_buffer_size;
unsigned int still_size; /* If non-0 encode a stills sequence: 1
I-frame per sequence pseudo VBR. Each
frame sized to still_size KB */
unsigned int vbv_buffer_still_size; /* vbv_buffer_size holds
still size. Ensure still
size matches. */
bool constrparms; /* constrained parameters flag, MPEG-1 only */
bool load_iquant;
bool load_niquant; /* use non-default quant. matrices */
int profile, level; /* syntax / parameter constraints */
bool ignore_constraints; /* Disabled conformance checking of
* hor_size, vert_size and
* samp_rate */
bool dualprime; /* Allow dual prime motion compensation */
bool prog_seq; /* progressive sequence */
int low_delay; /* no B pictures, skipped pictures */
/*******
*
* sequence specific data (sequence display extension)
*
******/
unsigned int video_format; /* component, PAL, NTSC, SECAM or MAC */
unsigned int color_primaries; /* source primary chromaticity coordinates */
unsigned int transfer_characteristics; /* opto-electronic transfer char. (gamma) */
unsigned int matrix_coefficients; /* Eg,Eb,Er / Y,Cb,Cr matrix coefficients */
unsigned int display_horizontal_size; /* display size */
unsigned int display_vertical_size;
bool mpeg1; /* ISO/IEC IS 11172-2 sequence */
bool fieldpic; /* use field pictures */
bool pulldown_32; /* 3:2 Pulldown of movie material */
bool topfirst;
/************
*
* Picture kind specific informatino (picture header flags)
*
***********/
int frame_pred_dct_tab[3]; /* use only frame prediction and frame
DCT (I,P,B) */
int qscale_tab[3]; /* linear/non-linear quantizaton table */
int intravlc_tab[3]; /* intra vlc format (I,P,B) */
int altscan_tab[3]; /* alternate scan (I,P,B */
unsigned int dc_prec;
/****************************
* Encoder internal derived values and parameters
*************************** */
int enc_width,
enc_height; /* encoded frame size (pels) multiples of 16 or 32 */
int phy_width,
phy_height; /* Physical Frame buffer size (pels) may differ
from encoded size due to alignment
constraints */
int enc_chrom_width,enc_chrom_height;
int phy_chrom_width,phy_chrom_height;
int lum_buffer_size, chrom_buffer_size;
int mb_width, mb_height; /* frame size (macroblocks) */
/* Picture dimensioning (allowing for interlaced/non-interlaced coding) */
int phy_width2, phy_height2, enc_height2,
mb_height2, phy_chrom_width2;
int qsubsample_offset,
fsubsample_offset;
int mb_per_pict; /* Number of macro-blocks in a picture */
struct motion_data *motion_data;
/* Selected intra/non_intra quantization matrices both ordinary*/
/* and inverted */
uint16_t *intra_q, *inter_q;
/* **************************
* Global flags controlling encoding behaviour
************************** */
double decode_frame_rate; /* Actual stream frame
* decode-rate. This is lower than
* playback rate if 3:2 pulldown is
* active.
*/
int video_buffer_size; /* Video buffer requirement target */
unsigned int N_max; /* number of frames in Group of Pictures (max) */
unsigned int N_min; /* number of frames in Group of Pictures (min) */
int M; /* distance between I/P frames */
int M_min; /* Minimum distance between I/P frames */
bool closed_GOPs; /* Force all GOPs to be closed - useful
* for satisfying requirements for
* multi-angle DVD authoring */
int me44_red; /* Sub-mean population reduction passes
* for 4x4 and 2x2 */
int me22_red; /* Motion compensation stages */
int seq_length_limit;
double nonvid_bit_rate; /* Bit-rate for non-video to assume for
sequence splitting calculations */
double quant_floor; /* quantisation floor [1..10] (0 for
* CBR) */
double act_boost; /* Quantisation reduction factor for blocks
with little texture (low variance) */
double boost_var_ceil; /* Variance below which
* quantisation boost cuts in */
int encoding_parallelism; /* Maximum number of concurrent worker threads
to be used for encoding */
int unit_coeff_elim; /* Threshold of unit coefficient
density below which unit
coefficient blocks should be
zeroed. < 0 implies DCT
coefficient should be included. */
double coding_tolerance; /* Fraction of bit allocation that
actual coding size may deviate from
target set by rate controller before
a re-encoding is forced */
deque<int> chapter_points; /* Frame #'s for where chapters occur (I frames, closed GOP's) */
};
#endif
/*
* Local variables:
* c-file-style: "stroustrup"
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
|