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

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

Issue 2849723002: Extract TL config to VP8 libvpx flag conversion. (Closed)
Patch Set: rebase return type Created 3 years, 7 months 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h" 10 #include "webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 // TODO(pbos): Name method so that it's obvious that it updates state. 247 // TODO(pbos): Name method so that it's obvious that it updates state.
248 TemporalReferences DefaultTemporalLayers::UpdateLayerConfig( 248 TemporalReferences DefaultTemporalLayers::UpdateLayerConfig(
249 uint32_t timestamp) { 249 uint32_t timestamp) {
250 RTC_DCHECK_GT(num_layers_, 0); 250 RTC_DCHECK_GT(num_layers_, 0);
251 RTC_DCHECK_LT(0, temporal_pattern_.size()); 251 RTC_DCHECK_LT(0, temporal_pattern_.size());
252 return temporal_pattern_[++pattern_idx_ % temporal_pattern_.size()]; 252 return temporal_pattern_[++pattern_idx_ % temporal_pattern_.size()];
253 } 253 }
254 254
255 int TemporalLayers::EncodeFlags(uint32_t timestamp) {
256 TemporalReferences references = UpdateLayerConfig(timestamp);
257 if (references.drop_frame)
258 return -1;
259
260 int flags = 0;
261
262 if ((references.last_buffer_flags & kReference) == 0)
263 flags |= VP8_EFLAG_NO_REF_LAST;
264 if ((references.last_buffer_flags & kUpdate) == 0)
265 flags |= VP8_EFLAG_NO_UPD_LAST;
266 if ((references.golden_buffer_flags & kReference) == 0)
267 flags |= VP8_EFLAG_NO_REF_GF;
268 if ((references.golden_buffer_flags & kUpdate) == 0)
269 flags |= VP8_EFLAG_NO_UPD_GF;
270 if ((references.arf_buffer_flags & kReference) == 0)
271 flags |= VP8_EFLAG_NO_REF_ARF;
272 if ((references.arf_buffer_flags & kUpdate) == 0)
273 flags |= VP8_EFLAG_NO_UPD_ARF;
274 if (references.freeze_entropy)
275 flags |= VP8_EFLAG_NO_UPD_ENTROPY;
276
277 return flags;
278 }
279
280 void DefaultTemporalLayers::PopulateCodecSpecific( 255 void DefaultTemporalLayers::PopulateCodecSpecific(
281 bool frame_is_keyframe, 256 bool frame_is_keyframe,
282 CodecSpecificInfoVP8* vp8_info, 257 CodecSpecificInfoVP8* vp8_info,
283 uint32_t timestamp) { 258 uint32_t timestamp) {
284 RTC_DCHECK_GT(num_layers_, 0); 259 RTC_DCHECK_GT(num_layers_, 0);
285 260
286 if (num_layers_ == 1) { 261 if (num_layers_ == 1) {
287 vp8_info->temporalIdx = kNoTemporalIdx; 262 vp8_info->temporalIdx = kNoTemporalIdx;
288 vp8_info->layerSync = false; 263 vp8_info->layerSync = false;
289 vp8_info->tl0PicIdx = kNoTl0PicIdx; 264 vp8_info->tl0PicIdx = kNoTl0PicIdx;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (listener_) 296 if (listener_)
322 listener_->OnTemporalLayersCreated(simulcast_id, tl); 297 listener_->OnTemporalLayersCreated(simulcast_id, tl);
323 return tl; 298 return tl;
324 } 299 }
325 300
326 void TemporalLayersFactory::SetListener(TemporalLayersListener* listener) { 301 void TemporalLayersFactory::SetListener(TemporalLayersListener* listener) {
327 listener_ = listener; 302 listener_ = listener;
328 } 303 }
329 304
330 } // namespace webrtc 305 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698