~ubuntu-branches/ubuntu/wily/libde265/wily

« back to all changes in this revision

Viewing changes to libde265/encoder/algo/pb-mv.h

  • Committer: Package Import Robot
  • Author(s): Joachim Bauch
  • Date: 2015-07-16 11:07:46 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20150716110746-76vsv24j3yux7tnu
Tags: 1.0.2-1
* Imported Upstream version 1.0.2
* Added new files to copyright information.
* Only export decoder API and update symbols for new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 PB_MV_H
 
24
#define PB_MV_H
 
25
 
 
26
#include "libde265/nal-parser.h"
 
27
#include "libde265/decctx.h"
 
28
#include "libde265/encoder/encode.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
 
 
38
#include "libde265/encoder/algo/algo.h"
 
39
 
 
40
 
 
41
// ========== CB Intra/Inter decision ==========
 
42
 
 
43
class Algo_TB_Split;
 
44
 
 
45
 
 
46
class Algo_PB_MV : public Algo_PB
 
47
{
 
48
 public:
 
49
 Algo_PB_MV() : mTBSplitAlgo(NULL) { }
 
50
  virtual ~Algo_PB_MV() { }
 
51
 
 
52
  void setChildAlgo(Algo_TB_Split* algo) { mTBSplitAlgo = algo; }
 
53
 
 
54
 protected:
 
55
  Algo_TB_Split* mTBSplitAlgo;
 
56
};
 
57
 
 
58
 
 
59
 
 
60
 
 
61
enum MVTestMode
 
62
  {
 
63
    MVTestMode_Zero,
 
64
    MVTestMode_Random,
 
65
    MVTestMode_Horizontal,
 
66
    MVTestMode_Vertical
 
67
  };
 
68
 
 
69
class option_MVTestMode : public choice_option<enum MVTestMode>
 
70
{
 
71
 public:
 
72
  option_MVTestMode() {
 
73
    add_choice("zero",   MVTestMode_Zero);
 
74
    add_choice("random", MVTestMode_Random);
 
75
    add_choice("horiz",  MVTestMode_Horizontal, true);
 
76
    add_choice("verti",  MVTestMode_Vertical);
 
77
  }
 
78
};
 
79
 
 
80
 
 
81
class Algo_PB_MV_Test : public Algo_PB_MV
 
82
{
 
83
 public:
 
84
 Algo_PB_MV_Test() : mCodeResidual(false) { }
 
85
 
 
86
  struct params
 
87
  {
 
88
    params() {
 
89
      testMode.set_ID("PB-MV-TestMode");
 
90
      range.set_ID   ("PB-MV-Range");
 
91
      range.set_default(4);
 
92
    }
 
93
 
 
94
    option_MVTestMode testMode;
 
95
    option_int        range;
 
96
  };
 
97
 
 
98
  void registerParams(config_parameters& config) {
 
99
    config.add_option(&mParams.testMode);
 
100
    config.add_option(&mParams.range);
 
101
  }
 
102
 
 
103
  void setParams(const params& p) { mParams=p; }
 
104
 
 
105
  virtual enc_cb* analyze(encoder_context*,
 
106
                          context_model_table&,
 
107
                          enc_cb* cb,
 
108
                          int PBidx, int x,int y,int w,int h);
 
109
 
 
110
 private:
 
111
  params mParams;
 
112
 
 
113
  bool mCodeResidual;
 
114
};
 
115
 
 
116
 
 
117
 
 
118
 
 
119
enum MVSearchAlgo
 
120
  {
 
121
    MVSearchAlgo_Zero,
 
122
    MVSearchAlgo_Full,
 
123
    MVSearchAlgo_Diamond,
 
124
    MVSearchAlgo_PMVFast
 
125
  };
 
126
 
 
127
class option_MVSearchAlgo : public choice_option<enum MVSearchAlgo>
 
128
{
 
129
 public:
 
130
  option_MVSearchAlgo() {
 
131
    add_choice("zero",   MVSearchAlgo_Zero);
 
132
    add_choice("full",   MVSearchAlgo_Full, true);
 
133
    add_choice("diamond",MVSearchAlgo_Diamond);
 
134
    add_choice("pmvfast",MVSearchAlgo_PMVFast);
 
135
  }
 
136
};
 
137
 
 
138
 
 
139
class Algo_PB_MV_Search : public Algo_PB_MV
 
140
{
 
141
 public:
 
142
 Algo_PB_MV_Search() : mCodeResidual(false) { }
 
143
 
 
144
  struct params
 
145
  {
 
146
    params() {
 
147
      mvSearchAlgo.set_ID("PB-MV-Search-Algo");
 
148
      hrange.set_ID      ("PB-MV-Search-HRange");
 
149
      vrange.set_ID      ("PB-MV-Search-VRange");
 
150
      hrange.set_default(8);
 
151
      vrange.set_default(8);
 
152
    }
 
153
 
 
154
    option_MVSearchAlgo mvSearchAlgo;
 
155
    option_int        hrange;
 
156
    option_int        vrange;
 
157
  };
 
158
 
 
159
  void registerParams(config_parameters& config) {
 
160
    config.add_option(&mParams.mvSearchAlgo);
 
161
    config.add_option(&mParams.hrange);
 
162
    config.add_option(&mParams.vrange);
 
163
  }
 
164
 
 
165
  void setParams(const params& p) { mParams=p; }
 
166
 
 
167
  virtual enc_cb* analyze(encoder_context*,
 
168
                          context_model_table&,
 
169
                          enc_cb* cb,
 
170
                          int PBidx, int x,int y,int w,int h);
 
171
 
 
172
 private:
 
173
  params mParams;
 
174
 
 
175
  bool mCodeResidual;
 
176
};
 
177
 
 
178
#endif