Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc

Issue 1541803002: Lint fix for webrtc/modules/video_coding PART 1! (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
2 * 2 *
3 * Use of this source code is governed by a BSD-style license 3 * Use of this source code is governed by a BSD-style license
4 * that can be found in the LICENSE file in the root of the source 4 * that can be found in the LICENSE file in the root of the source
5 * tree. An additional intellectual property rights grant can be found 5 * tree. An additional intellectual property rights grant can be found
6 * in the file PATENTS. All contributing project authors may 6 * in the file PATENTS. All contributing project authors may
7 * be found in the AUTHORS file in the root of the source tree. 7 * be found in the AUTHORS file in the root of the source tree.
8 */ 8 */
9 9
10 #include <stdlib.h> 10 #include <stdlib.h>
11 #include <algorithm> 11 #include <algorithm>
12 12
13 #include "vpx/vpx_encoder.h" 13 #include "vpx/vpx_encoder.h"
14 #include "vpx/vp8cx.h" 14 #include "vpx/vp8cx.h"
15 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 15 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
18 18
19 // This file implements logic to adapt the number of temporal layers based on 19 // This file implements logic to adapt the number of temporal layers based on
20 // input frame rate in order to avoid having the base layer being relaying at 20 // input frame rate in order to avoid having the base layer being relaying at
21 // a below acceptable framerate. 21 // a below acceptable framerate.
22 namespace webrtc { 22 namespace webrtc {
23 namespace { 23 namespace {
24 enum { 24 enum {
25 kTemporalUpdateLast = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | 25 kTemporalUpdateLast = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
26 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF, 26 VP8_EFLAG_NO_REF_GF |
27 VP8_EFLAG_NO_REF_ARF,
27 28
28 kTemporalUpdateGolden = 29 kTemporalUpdateGolden =
29 VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST, 30 VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST,
30 31
31 kTemporalUpdateGoldenWithoutDependency = 32 kTemporalUpdateGoldenWithoutDependency =
32 kTemporalUpdateGolden | VP8_EFLAG_NO_REF_GF, 33 kTemporalUpdateGolden | VP8_EFLAG_NO_REF_GF,
33 34
34 kTemporalUpdateAltref = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST, 35 kTemporalUpdateAltref = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST,
35 36
36 kTemporalUpdateAltrefWithoutDependency = 37 kTemporalUpdateAltrefWithoutDependency =
37 kTemporalUpdateAltref | VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_REF_GF, 38 kTemporalUpdateAltref | VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_REF_GF,
38 39
39 kTemporalUpdateNone = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | 40 kTemporalUpdateNone = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
40 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_ENTROPY, 41 VP8_EFLAG_NO_UPD_LAST |
42 VP8_EFLAG_NO_UPD_ENTROPY,
41 43
42 kTemporalUpdateNoneNoRefAltref = kTemporalUpdateNone | VP8_EFLAG_NO_REF_ARF, 44 kTemporalUpdateNoneNoRefAltref = kTemporalUpdateNone | VP8_EFLAG_NO_REF_ARF,
43 45
44 kTemporalUpdateNoneNoRefGoldenRefAltRef = 46 kTemporalUpdateNoneNoRefGoldenRefAltRef =
45 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | 47 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
46 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_ENTROPY, 48 VP8_EFLAG_NO_UPD_LAST |
49 VP8_EFLAG_NO_UPD_ENTROPY,
47 50
48 kTemporalUpdateGoldenWithoutDependencyRefAltRef = 51 kTemporalUpdateGoldenWithoutDependencyRefAltRef =
49 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST, 52 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST,
50 53
51 kTemporalUpdateLastRefAltRef = 54 kTemporalUpdateLastRefAltRef =
52 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF, 55 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF,
53 56
54 kTemporalUpdateGoldenRefAltRef = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST, 57 kTemporalUpdateGoldenRefAltRef = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST,
55 58
56 kTemporalUpdateLastAndGoldenRefAltRef = 59 kTemporalUpdateLastAndGoldenRefAltRef =
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 cfg->ts_rate_decimator[0] = 1; 129 cfg->ts_rate_decimator[0] = 1;
127 cfg->ts_periodicity = layer_ids_length_; 130 cfg->ts_periodicity = layer_ids_length_;
128 } break; 131 } break;
129 132
130 case 2: { 133 case 2: {
131 static const unsigned int layer_ids[] = {0u, 1u}; 134 static const unsigned int layer_ids[] = {0u, 1u};
132 layer_ids_ = layer_ids; 135 layer_ids_ = layer_ids;
133 layer_ids_length_ = sizeof(layer_ids) / sizeof(*layer_ids); 136 layer_ids_length_ = sizeof(layer_ids) / sizeof(*layer_ids);
134 137
135 static const int encode_flags[] = { 138 static const int encode_flags[] = {
136 kTemporalUpdateLastAndGoldenRefAltRef, 139 kTemporalUpdateLastAndGoldenRefAltRef,
137 kTemporalUpdateGoldenWithoutDependencyRefAltRef, 140 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
138 kTemporalUpdateLastRefAltRef, kTemporalUpdateGoldenRefAltRef, 141 kTemporalUpdateLastRefAltRef,
139 kTemporalUpdateLastRefAltRef, kTemporalUpdateGoldenRefAltRef, 142 kTemporalUpdateGoldenRefAltRef,
140 kTemporalUpdateLastRefAltRef, kTemporalUpdateNone 143 kTemporalUpdateLastRefAltRef,
141 }; 144 kTemporalUpdateGoldenRefAltRef,
145 kTemporalUpdateLastRefAltRef,
146 kTemporalUpdateNone};
142 encode_flags_length_ = sizeof(encode_flags) / sizeof(*layer_ids); 147 encode_flags_length_ = sizeof(encode_flags) / sizeof(*layer_ids);
143 encode_flags_ = encode_flags; 148 encode_flags_ = encode_flags;
144 149
145 cfg->ts_rate_decimator[0] = 2; 150 cfg->ts_rate_decimator[0] = 2;
146 cfg->ts_rate_decimator[1] = 1; 151 cfg->ts_rate_decimator[1] = 1;
147 cfg->ts_periodicity = layer_ids_length_; 152 cfg->ts_periodicity = layer_ids_length_;
148 } break; 153 } break;
149 154
150 case 3: { 155 case 3: {
151 static const unsigned int layer_ids[] = {0u, 2u, 1u, 2u}; 156 static const unsigned int layer_ids[] = {0u, 2u, 1u, 2u};
152 layer_ids_ = layer_ids; 157 layer_ids_ = layer_ids;
153 layer_ids_length_ = sizeof(layer_ids) / sizeof(*layer_ids); 158 layer_ids_length_ = sizeof(layer_ids) / sizeof(*layer_ids);
154 159
155 static const int encode_flags[] = { 160 static const int encode_flags[] = {
156 kTemporalUpdateLastAndGoldenRefAltRef, 161 kTemporalUpdateLastAndGoldenRefAltRef,
157 kTemporalUpdateNoneNoRefGoldenRefAltRef, 162 kTemporalUpdateNoneNoRefGoldenRefAltRef,
158 kTemporalUpdateGoldenWithoutDependencyRefAltRef, kTemporalUpdateNone, 163 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
159 kTemporalUpdateLastRefAltRef, kTemporalUpdateNone, 164 kTemporalUpdateNone,
160 kTemporalUpdateGoldenRefAltRef, kTemporalUpdateNone 165 kTemporalUpdateLastRefAltRef,
161 }; 166 kTemporalUpdateNone,
167 kTemporalUpdateGoldenRefAltRef,
168 kTemporalUpdateNone};
162 encode_flags_length_ = sizeof(encode_flags) / sizeof(*layer_ids); 169 encode_flags_length_ = sizeof(encode_flags) / sizeof(*layer_ids);
163 encode_flags_ = encode_flags; 170 encode_flags_ = encode_flags;
164 171
165 cfg->ts_rate_decimator[0] = 4; 172 cfg->ts_rate_decimator[0] = 4;
166 cfg->ts_rate_decimator[1] = 2; 173 cfg->ts_rate_decimator[1] = 2;
167 cfg->ts_rate_decimator[2] = 1; 174 cfg->ts_rate_decimator[2] = 1;
168 cfg->ts_periodicity = layer_ids_length_; 175 cfg->ts_periodicity = layer_ids_length_;
169 } break; 176 } break;
170 177
171 default: 178 default:
172 assert(false); 179 assert(false);
173 return false; 180 return false;
174 } 181 }
175 memcpy( 182 memcpy(cfg->ts_layer_id, layer_ids_,
176 cfg->ts_layer_id, layer_ids_, sizeof(unsigned int) * layer_ids_length_); 183 sizeof(unsigned int) * layer_ids_length_);
177 return true; 184 return true;
178 } 185 }
179 186
180 virtual int EncodeFlags(uint32_t timestamp) { 187 virtual int EncodeFlags(uint32_t timestamp) {
181 frame_counter_++; 188 frame_counter_++;
182 return CurrentEncodeFlags(); 189 return CurrentEncodeFlags();
183 } 190 }
184 191
185 int CurrentEncodeFlags() const { 192 int CurrentEncodeFlags() const {
186 assert(encode_flags_length_ > 0 && encode_flags_ != NULL); 193 assert(encode_flags_length_ > 0 && encode_flags_ != NULL);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 const int* encode_flags_; 268 const int* encode_flags_;
262 }; 269 };
263 } // namespace 270 } // namespace
264 271
265 TemporalLayers* RealTimeTemporalLayersFactory::Create( 272 TemporalLayers* RealTimeTemporalLayersFactory::Create(
266 int max_temporal_layers, 273 int max_temporal_layers,
267 uint8_t initial_tl0_pic_idx) const { 274 uint8_t initial_tl0_pic_idx) const {
268 return new RealTimeTemporalLayers(max_temporal_layers, initial_tl0_pic_idx); 275 return new RealTimeTemporalLayers(max_temporal_layers, initial_tl0_pic_idx);
269 } 276 }
270 } // namespace webrtc 277 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698