digiKam
cb-intrapartmode.h
Go to the documentation of this file.
1 /*
2  * H.265 video codec.
3  * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
4  *
5  * Authors: Dirk Farin <farin@struktur.de>
6  *
7  * This file is part of libde265.
8  *
9  * libde265 is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation, either version 3 of
12  * the License, or (at your option) any later version.
13  *
14  * libde265 is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with libde265. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef CB_INTRAPARTMODE_H
24 #define CB_INTRAPARTMODE_H
25 
26 #include "libde265/nal-parser.h"
27 #include "libde265/decctx.h"
29 #include "libde265/slice.h"
30 #include "libde265/scan.h"
31 #include "libde265/intrapred.h"
32 #include "libde265/transform.h"
33 #include "libde265/fallback-dct.h"
34 #include "libde265/quality.h"
35 #include "libde265/fallback.h"
36 #include "libde265/configparam.h"
37 
41 
42 
43 /* Encoder search tree, bottom up:
44 
45  - Algo_TB_Split - whether TB is split or not
46 
47  - Algo_TB_IntraPredMode - choose the intra prediction mode (or NOP, if at the wrong tree level)
48 
49  - Algo_CB_IntraPartMode - choose between NxN and 2Nx2N intra parts
50 
51  - Algo_CB_Split - whether CB is split or not
52 
53  - Algo_CTB_QScale - select QScale on CTB granularity
54  */
55 
56 
57 // ========== CB intra NxN vs. 2Nx2N decision ==========
58 
62 };
63 
64 class option_ALGO_CB_IntraPartMode : public choice_option<enum ALGO_CB_IntraPartMode>
65 {
66  public:
69  add_choice("brute-force",ALGO_CB_IntraPartMode_BruteForce, true);
70  }
71 };
72 
73 
75 {
76  public:
78  virtual ~Algo_CB_IntraPartMode() { }
79 
82  enc_cb* cb) = 0;
83 
85 
86  virtual const char* name() const { return "cb-intrapartmode"; }
87 
88  protected:
90 };
91 
92 /* Try both NxN, 2Nx2N and choose better one.
93  */
95 {
96  public:
99  enc_cb* cb);
100 
101  virtual const char* name() const { return "cb-intrapartmode-bruteforce"; }
102 };
103 
104 
105 class option_PartMode : public choice_option<enum PartMode> // choice_option
106 {
107  public:
109  add_choice("NxN", PART_NxN);
110  add_choice("2Nx2N", PART_2Nx2N, true);
111  }
112 };
113 
114 
115 /* Always use choose selected part mode.
116  If NxN is chosen but cannot be applied (CB tree not at maximum depth), 2Nx2N is used instead.
117  */
119 {
120  public:
122 
123  struct params
124  {
125  params() {
126  partMode.set_ID("CB-IntraPartMode-Fixed-partMode");
127  }
128 
130  };
131 
133  config.add_option(&mParams.partMode);
134  }
135 
136  void setParams(const params& p) { mParams=p; }
137 
139  context_model_table& ctxModel,
140  enc_cb* cb);
141 
142  virtual const char* name() const { return "cb-intrapartmode-fixed"; }
143 
144  private:
145  params mParams;
146 };
147 
148 
149 #endif
ALGO_CB_IntraPartMode
Definition: cb-intrapartmode.h:59
@ ALGO_CB_IntraPartMode_BruteForce
Definition: cb-intrapartmode.h:60
@ ALGO_CB_IntraPartMode_Fixed
Definition: cb-intrapartmode.h:61
Definition: cb-intrapartmode.h:95
virtual enc_cb * analyze(encoder_context *, context_model_table &, enc_cb *cb)
virtual const char * name() const
Definition: cb-intrapartmode.h:101
Definition: cb-intrapartmode.h:119
void registerParams(config_parameters &config)
Definition: cb-intrapartmode.h:132
virtual const char * name() const
Definition: cb-intrapartmode.h:142
void setParams(const params &p)
Definition: cb-intrapartmode.h:136
Algo_CB_IntraPartMode_Fixed()
Definition: cb-intrapartmode.h:121
virtual enc_cb * analyze(encoder_context *ectx, context_model_table &ctxModel, enc_cb *cb)
Definition: cb-intrapartmode.h:75
Algo_CB_IntraPartMode()
Definition: cb-intrapartmode.h:77
virtual ~Algo_CB_IntraPartMode()
Definition: cb-intrapartmode.h:78
void setChildAlgo(Algo_TB_IntraPredMode *algo)
Definition: cb-intrapartmode.h:84
virtual const char * name() const
Definition: cb-intrapartmode.h:86
virtual enc_cb * analyze(encoder_context *, context_model_table &, enc_cb *cb)=0
Algo_TB_IntraPredMode * mTBIntraPredModeAlgo
Definition: cb-intrapartmode.h:89
Definition: algo.h:67
Definition: tb-intrapredmode.h:85
Definition: configparam.h:258
void add_choice(const std::string &s, enum ALGO_CB_IntraPartMode id, bool default_value=false)
Definition: configparam.h:264
Definition: configparam.h:366
void LIBDE265_API add_option(option_base *o)
Definition: contextmodel.h:100
Definition: encoder-types.h:248
Definition: encoder-context.h:39
Definition: cb-intrapartmode.h:65
option_ALGO_CB_IntraPartMode()
Definition: cb-intrapartmode.h:67
Definition: cb-intrapartmode.h:106
option_PartMode()
Definition: cb-intrapartmode.h:108
void set_ID(const char *name)
Definition: configparam.h:56
@ PART_2Nx2N
Definition: slice.h:76
@ PART_NxN
Definition: slice.h:79
Definition: cb-intrapartmode.h:124
option_PartMode partMode
Definition: cb-intrapartmode.h:129
params()
Definition: cb-intrapartmode.h:125