modules/video_coding refactorings
The main purpose was the interface-> include rename, but other files were also moved, eliminating the "main" dir. To avoid breaking downstream, the "interface" directories were copied into a new "video_coding/include" dir. The old headers got pragma warnings added about deprecation (a very short deprecation since I plan to remove them as soon downstream is updated). Other files also moved: video_coding/main/source -> video_coding video_coding/main/test -> video_coding/test BUG=webrtc:5095 TESTED=Passing compile-trybots with --clobber flag: git cl try --clobber --bot=win_compile_rel --bot=linux_compile_rel --bot=android_compile_rel --bot=mac_compile_rel --bot=ios_rel --bot=linux_gn_rel --bot=win_x64_gn_rel --bot=mac_x64_gn_rel --bot=android_gn_rel -m tryserver.webrtc R=stefan@webrtc.org, tommi@webrtc.org Review URL: https://codereview.webrtc.org/1417283007 . Cr-Commit-Position: refs/heads/master@{#10694}
This commit is contained in:
82
webrtc/modules/video_coding/decoding_state.h
Normal file
82
webrtc/modules/video_coding/decoding_state.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_DECODING_STATE_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_DECODING_STATE_H_
|
||||
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Forward declarations
|
||||
class VCMFrameBuffer;
|
||||
class VCMPacket;
|
||||
|
||||
class VCMDecodingState {
|
||||
public:
|
||||
// The max number of bits used to reference back
|
||||
// to a previous frame when using flexible mode.
|
||||
static const uint16_t kNumRefBits = 7;
|
||||
static const uint16_t kFrameDecodedLength = 1 << kNumRefBits;
|
||||
|
||||
VCMDecodingState();
|
||||
~VCMDecodingState();
|
||||
// Check for old frame
|
||||
bool IsOldFrame(const VCMFrameBuffer* frame) const;
|
||||
// Check for old packet
|
||||
bool IsOldPacket(const VCMPacket* packet) const;
|
||||
// Check for frame continuity based on current decoded state. Use best method
|
||||
// possible, i.e. temporal info, picture ID or sequence number.
|
||||
bool ContinuousFrame(const VCMFrameBuffer* frame) const;
|
||||
void SetState(const VCMFrameBuffer* frame);
|
||||
void CopyFrom(const VCMDecodingState& state);
|
||||
bool UpdateEmptyFrame(const VCMFrameBuffer* frame);
|
||||
// Update the sequence number if the timestamp matches current state and the
|
||||
// sequence number is higher than the current one. This accounts for packets
|
||||
// arriving late.
|
||||
void UpdateOldPacket(const VCMPacket* packet);
|
||||
void SetSeqNum(uint16_t new_seq_num);
|
||||
void Reset();
|
||||
uint32_t time_stamp() const;
|
||||
uint16_t sequence_num() const;
|
||||
// Return true if at initial state.
|
||||
bool in_initial_state() const;
|
||||
// Return true when sync is on - decode all layers.
|
||||
bool full_sync() const;
|
||||
|
||||
private:
|
||||
void UpdateSyncState(const VCMFrameBuffer* frame);
|
||||
// Designated continuity functions
|
||||
bool ContinuousPictureId(int picture_id) const;
|
||||
bool ContinuousSeqNum(uint16_t seq_num) const;
|
||||
bool ContinuousLayer(int temporal_id, int tl0_pic_id) const;
|
||||
bool ContinuousFrameRefs(const VCMFrameBuffer* frame) const;
|
||||
bool UsingPictureId(const VCMFrameBuffer* frame) const;
|
||||
bool UsingFlexibleMode(const VCMFrameBuffer* frame) const;
|
||||
bool AheadOfFramesDecodedClearedTo(uint16_t index) const;
|
||||
|
||||
// Keep state of last decoded frame.
|
||||
// TODO(mikhal/stefan): create designated classes to handle these types.
|
||||
uint16_t sequence_num_;
|
||||
uint32_t time_stamp_;
|
||||
int picture_id_;
|
||||
int temporal_id_;
|
||||
int tl0_pic_id_;
|
||||
bool full_sync_; // Sync flag when temporal layers are used.
|
||||
bool in_initial_state_;
|
||||
|
||||
// Used to check references in flexible mode.
|
||||
bool frame_decoded_[kFrameDecodedLength];
|
||||
uint16_t frame_decoded_cleared_to_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_VIDEO_CODING_DECODING_STATE_H_
|
Reference in New Issue
Block a user