HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GuessLambdaModifiers.h
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2  * License, included below. This software may be subject to other third party
3  * and contributor rights, including patent rights, and no such rights are
4  * granted under this license.
5  *
6  * Copyright (c) 2010-2017, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __GUESSLAMBDAMODIFIERS__
35 #define __GUESSLAMBDAMODIFIERS__
36 
37 #include "RuntimeError.h"
38 #include <vector>
39 #include <map>
40 #include <list>
41 #include <set>
42 #include <limits>
43 
46 {
47  public:
49  protected:
50  void outputWhat( std::ostream& o ) const { o << "Error parsing the initial-adjustment parameter"; }
51 };
52 
55 {
56  public:
57  virtual ~TargetsParseException( ) throw( ) { }
58  protected:
59  void outputWhat( std::ostream& o ) const { o << "Error parsing targets"; }
60 };
61 
64 {
65  public:
66  virtual ~MetaLogParseException( ) throw( ) { }
67  protected:
68  void outputWhat( std::ostream& o ) const { o << "Error parsing meta log"; }
69 };
70 
73 {
74  public:
75  virtual ~MismatchedIndexesException( ) throw( ) { }
76  protected:
77  void outputWhat( std::ostream& o ) const { o << "Mismatched vector sizes or lambda modifier indexes"; }
78 };
79 
81 template< typename TLambdaModifier >
83 {
84  TLambdaModifier lambdaModifiers;
85  std::vector< double > bitrateVector;
86 };
87 
89 struct Point
90 {
92  double bitrate;
93 };
94 
102 double polateLambdaModifier( double targetBitrate, const Point& point1, const Point& point2 );
103 
112 double guessLambdaModifier(
113  double initialAdjustmentParameter,
114  double targetBitrate,
115  const std::list< Point >& pointList,
116  double interDampeningFactor );
117 
127 std::vector< double > guessLambdaModifiers(
128  double initialAdjustmentParameter,
129  const std::vector< double > &targetBitrateVector,
130  const std::list< MetaLogEntry< std::vector< double > > >& metaLogEntryList );
131 
143  std::ostream& o,
144  std::istream& initialAdjustmentParameterIstream,
145  std::istream& targetsIstream,
146  std::istream& metaLogIstream );
147 
148 #endif
double bitrate
void outputWhat(std::ostream &o) const
Contains a Lambda-modifier and bitrate for only a single index.
Thrown if there is an error parsing the initial adjustment parameter.
Thrown if there is an error parsing the targets.
std::vector< double > guessLambdaModifiers(double initialAdjustmentParameter, const std::vector< double > &targetBitrateVector, const std::list< MetaLogEntry< std::vector< double > > > &metaLogEntryList)
TLambdaModifier lambdaModifiers
std::vector< double > bitrateVector
Thrown if there is an error parsing the meta-log.
Full meta-log entry.
double polateLambdaModifier(double targetBitrate, const Point &point1, const Point &point2)
double lambdaModifier
double guessLambdaModifier(double initialAdjustmentParameter, double targetBitrate, const std::list< Point > &pointList, double interDampeningFactor)
Thrown if there is a mismatch in the vector sizes or the Lambda-modifier indexes. ...
void outputWhat(std::ostream &o) const
void outputWhat(std::ostream &o) const
This class serves the same purpose as std::runtime_error, but it can be more convenient to use...
Definition: RuntimeError.h:41