Newer
Older

Karsten Suehring
committed
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
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2018, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file EncAppCfg.cpp
\brief Handle encoder configuration parameters
*/
#include "EncAppCfg.h"
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <string>
#include <fstream>
#include <limits>
#include "Utilities/program_options_lite.h"
#include "CommonLib/Rom.h"
#include "EncoderLib/RateCtrl.h"
#include "CommonLib/dtrace_next.h"
#define MACRO_TO_STRING_HELPER(val) #val
#define MACRO_TO_STRING(val) MACRO_TO_STRING_HELPER(val)
using namespace std;
namespace po = df::program_options_lite;
enum ExtendedProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
{
NONE = 0,
MAIN = 1,
MAIN10 = 2,
MAINSTILLPICTURE = 3,
MAINREXT = 4,
HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
// The following are RExt profiles, which would map to the MAINREXT profile idc.
// The enumeration indicates the bit-depth constraint in the bottom 2 digits
// the chroma format in the next digit
// the intra constraint in the next digit
// If it is a RExt still picture, there is a '1' for the top digit.
MONOCHROME_8 = 1008,
MONOCHROME_12 = 1012,
MONOCHROME_16 = 1016,
MAIN_12 = 1112,
MAIN_422_10 = 1210,
MAIN_422_12 = 1212,
MAIN_444 = 1308,
MAIN_444_10 = 1310,
MAIN_444_12 = 1312,
MAIN_444_16 = 1316, // non-standard profile definition, used for development purposes
MAIN_INTRA = 2108,
MAIN_10_INTRA = 2110,
MAIN_12_INTRA = 2112,
MAIN_422_10_INTRA = 2210,
MAIN_422_12_INTRA = 2212,
MAIN_444_INTRA = 2308,
MAIN_444_10_INTRA = 2310,
MAIN_444_12_INTRA = 2312,
MAIN_444_16_INTRA = 2316,
MAIN_444_STILL_PICTURE = 11308,
MAIN_444_16_STILL_PICTURE = 12316,
NEXT = 6
};
//! \ingroup EncoderApp
//! \{
// ====================================================================================================================
// Constructor / destructor / initialization / destroy
// ====================================================================================================================
EncAppCfg::EncAppCfg()
: m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
, m_snrInternalColourSpace(false)
, m_outputInternalColourSpace(false)
, m_packedYUVMode(false)

Karsten Suehring
committed
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
#if EXTENSION_360_VIDEO
, m_ext360(*this)
#endif
{
m_aidQP = NULL;
m_startOfCodedInterval = NULL;
m_codedPivotValue = NULL;
m_targetPivotValue = NULL;
}
EncAppCfg::~EncAppCfg()
{
if ( m_aidQP )
{
delete[] m_aidQP;
}
if ( m_startOfCodedInterval )
{
delete[] m_startOfCodedInterval;
m_startOfCodedInterval = NULL;
}
if ( m_codedPivotValue )
{
delete[] m_codedPivotValue;
m_codedPivotValue = NULL;
}
if ( m_targetPivotValue )
{
delete[] m_targetPivotValue;
m_targetPivotValue = NULL;
}
#if ENABLE_TRACING
tracing_uninit(g_trace_ctx);
#endif
}
void EncAppCfg::create()
{
}
void EncAppCfg::destroy()
{
}
std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input
{
in>>entry.m_sliceType;
in>>entry.m_POC;
in>>entry.m_QPOffset;
#if X0038_LAMBDA_FROM_QP_CAPABILITY
in>>entry.m_QPOffsetModelOffset;
in>>entry.m_QPOffsetModelScale;
#endif
#if W0038_CQP_ADJ
in>>entry.m_CbQPoffset;
in>>entry.m_CrQPoffset;
#endif
in>>entry.m_QPFactor;
in>>entry.m_tcOffsetDiv2;
in>>entry.m_betaOffsetDiv2;
in>>entry.m_temporalId;
in>>entry.m_numRefPicsActive;
in>>entry.m_numRefPics;
for ( int i = 0; i < entry.m_numRefPics; i++ )
{
in>>entry.m_referencePics[i];
}
in>>entry.m_interRPSPrediction;
if (entry.m_interRPSPrediction==1)
{
in>>entry.m_deltaRPS;
in>>entry.m_numRefIdc;
for ( int i = 0; i < entry.m_numRefIdc; i++ )
{
in>>entry.m_refIdc[i];
}
}
else if (entry.m_interRPSPrediction==2)
{
in>>entry.m_deltaRPS;
}
return in;
}
bool confirmPara(bool bflag, const char* message);
static inline ChromaFormat numberToChromaFormat(const int val)
{
switch (val)
Loading
Loading full blame...