digiKam
encoder-core.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 ANALYZE_H
24 #define ANALYZE_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 
46 //#include "libde265/encoder/algo/cb-skip-or-inter.h"
50 
51 
52 /* Encoder search tree, bottom up:
53 
54  - Algo_TB_Split - whether TB is split or not
55 
56  - Algo_TB_IntraPredMode - choose the intra prediction mode (or NOP, if at the wrong tree level)
57 
58  - Algo_CB_IntraPartMode - choose between NxN and 2Nx2N intra parts
59 
60  - Algo_CB_PredMode - intra / inter
61 
62  - Algo_CB_Split - whether CB is split or not
63 
64  - Algo_CTB_QScale - select QScale on CTB granularity
65  */
66 
67 
68 // ========== an encoding algorithm combines a set of algorithm modules ==========
69 
71 {
72  public:
73  virtual ~EncoderCore() { }
74 
76 
77  virtual int getPPS_QP() const = 0;
78  virtual int getSlice_QPDelta() const { return 0; }
79 };
80 
81 
83 {
84  public:
85 
86  void setParams(struct encoder_params& params);
87 
89  mAlgo_CTB_QScale_Constant.registerParams(config);
90  mAlgo_CB_IntraPartMode_Fixed.registerParams(config);
91  mAlgo_CB_InterPartMode_Fixed.registerParams(config);
92  mAlgo_PB_MV_Test.registerParams(config);
93  mAlgo_PB_MV_Search.registerParams(config);
94  mAlgo_TB_IntraPredMode_FastBrute.registerParams(config);
95  mAlgo_TB_IntraPredMode_MinResidual.registerParams(config);
96  mAlgo_TB_Split_BruteForce.registerParams(config);
97  }
98 
99  virtual Algo_CTB_QScale* getAlgoCTBQScale() { return &mAlgo_CTB_QScale_Constant; }
100 
101  virtual int getPPS_QP() const { return mAlgo_CTB_QScale_Constant.getQP(); }
102 
103  private:
104  Algo_CTB_QScale_Constant mAlgo_CTB_QScale_Constant;
105 
106  Algo_CB_Split_BruteForce mAlgo_CB_Split_BruteForce;
107  Algo_CB_Skip_BruteForce mAlgo_CB_Skip_BruteForce;
108  Algo_CB_IntraInter_BruteForce mAlgo_CB_IntraInter_BruteForce;
109 
110  Algo_CB_IntraPartMode_BruteForce mAlgo_CB_IntraPartMode_BruteForce;
111  Algo_CB_IntraPartMode_Fixed mAlgo_CB_IntraPartMode_Fixed;
112 
113  Algo_CB_InterPartMode_Fixed mAlgo_CB_InterPartMode_Fixed;
114  Algo_CB_MergeIndex_Fixed mAlgo_CB_MergeIndex_Fixed;
115 
116  Algo_PB_MV_Test mAlgo_PB_MV_Test;
117  Algo_PB_MV_Search mAlgo_PB_MV_Search;
118 
119  Algo_TB_Split_BruteForce mAlgo_TB_Split_BruteForce;
120 
121  Algo_TB_IntraPredMode_BruteForce mAlgo_TB_IntraPredMode_BruteForce;
122  Algo_TB_IntraPredMode_FastBrute mAlgo_TB_IntraPredMode_FastBrute;
123  Algo_TB_IntraPredMode_MinResidual mAlgo_TB_IntraPredMode_MinResidual;
124 
125  Algo_TB_Transform mAlgo_TB_Transform;
126  Algo_TB_RateEstimation_None mAlgo_TB_RateEstimation_None;
127  Algo_TB_RateEstimation_Exact mAlgo_TB_RateEstimation_Exact;
128 };
129 
130 
131 
133 
135 
136 
137 class Logging
138 {
139 public:
140  virtual ~Logging() { }
141 
142  static void print_logging(const encoder_context* ectx, const char* id, const char* filename);
143 
144  virtual const char* name() const = 0;
145  virtual void print(const encoder_context* ectx, const char* filename) = 0;
146 };
147 
148 
149 LIBDE265_API void en265_print_logging(const encoder_context* ectx, const char* id, const char* filename);
150 
151 #endif
Definition: cb-interpartmode.h:81
void registerParams(config_parameters &config)
Definition: cb-interpartmode.h:92
Definition: cb-intra-inter.h:61
Definition: cb-intrapartmode.h:95
Definition: cb-intrapartmode.h:119
void registerParams(config_parameters &config)
Definition: cb-intrapartmode.h:132
Definition: cb-mergeindex.h:63
Definition: cb-skip.h:63
Definition: cb-split.h:79
Definition: ctb-qscale.h:76
int getQP() const
Definition: ctb-qscale.h:100
void registerParams(config_parameters &config)
Definition: ctb-qscale.h:92
Definition: ctb-qscale.h:58
Definition: pb-mv.h:139
void registerParams(config_parameters &config)
Definition: pb-mv.h:158
Definition: pb-mv.h:81
void registerParams(config_parameters &config)
Definition: pb-mv.h:97
Definition: tb-intrapredmode.h:208
Definition: tb-intrapredmode.h:225
void registerParams(config_parameters &config)
Definition: tb-intrapredmode.h:242
Definition: tb-intrapredmode.h:267
void registerParams(config_parameters &config)
Definition: tb-intrapredmode.h:281
Definition: tb-rateestim.h:89
Definition: tb-rateestim.h:72
Definition: tb-split.h:97
void registerParams(config_parameters &config)
Definition: tb-split.h:110
Definition: tb-transform.h:67
Definition: encoder-core.h:83
virtual Algo_CTB_QScale * getAlgoCTBQScale()
Definition: encoder-core.h:99
void setParams(struct encoder_params &params)
virtual int getPPS_QP() const
Definition: encoder-core.h:101
void registerParams(config_parameters &config)
Definition: encoder-core.h:88
Definition: encoder-core.h:71
virtual ~EncoderCore()
Definition: encoder-core.h:73
virtual int getPPS_QP() const =0
virtual int getSlice_QPDelta() const
Definition: encoder-core.h:78
virtual Algo_CTB_QScale * getAlgoCTBQScale()=0
Definition: encoder-core.h:138
virtual void print(const encoder_context *ectx, const char *filename)=0
virtual const char * name() const =0
static void print_logging(const encoder_context *ectx, const char *id, const char *filename)
virtual ~Logging()
Definition: encoder-core.h:140
Definition: configparam.h:366
Definition: encoder-context.h:39
#define LIBDE265_API
Definition: de265.h:52
double encode_image(encoder_context *, const de265_image *input, EncoderCore &)
LIBDE265_API void en265_print_logging(const encoder_context *ectx, const char *id, const char *filename)
void encode_sequence(encoder_context *)
Definition: image.h:222
Definition: encoder-params.h:76