Rename fec_tables_xor.h -> fec_rate_table.h

This is a slightly more descriptive name, since we only have one type
of erasure code (XOR), and we only have one table.

BUG=None

Review-Url: https://codereview.webrtc.org/2625903004
Cr-Commit-Position: refs/heads/master@{#16032}
This commit is contained in:
brandtr 2017-01-12 06:16:24 -08:00 committed by Commit bot
parent 7f9c7d9b45
commit 71b1c1fc1d
3 changed files with 15 additions and 13 deletions

View File

@ -18,7 +18,7 @@ rtc_static_library("video_coding") {
"decoding_state.h",
"encoded_frame.cc",
"encoded_frame.h",
"fec_tables_xor.h",
"fec_rate_table.h",
"frame_buffer.cc",
"frame_buffer.h",
"frame_buffer2.cc",

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_VIDEO_CODING_FEC_TABLES_XOR_H_
#define WEBRTC_MODULES_VIDEO_CODING_FEC_TABLES_XOR_H_
#ifndef WEBRTC_MODULES_VIDEO_CODING_FEC_RATE_TABLE_H_
#define WEBRTC_MODULES_VIDEO_CODING_FEC_RATE_TABLE_H_
// This is a private header for media_opt_util.cc.
// It should not be included by other files.
@ -18,10 +18,12 @@ namespace webrtc {
// Table for Protection factor (code rate) of delta frames, for the XOR FEC.
// Input is the packet loss and an effective rate (bits/frame).
// Output is array kCodeRateXORTable[k], where k = rate_i*129 + loss_j;
// Output is array kFecRateTable[k], where k = rate_i*129 + loss_j;
// loss_j = 0,1,..128, and rate_i varies over some range.
static const int kSizeCodeRateXORTable = 6450;
static const unsigned char kCodeRateXORTable[kSizeCodeRateXORTable] = {
// TODO(brandtr): Consider replacing this big static table with a closed-form
// expression instead.
static const int kFecRateTableSize = 6450;
static const unsigned char kFecRateTable[kFecRateTableSize] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
@ -456,4 +458,4 @@ static const unsigned char kCodeRateXORTable[kSizeCodeRateXORTable] = {
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CODING_FEC_TABLES_XOR_H_
#endif // WEBRTC_MODULES_VIDEO_CODING_FEC_RATE_TABLE_H_

View File

@ -20,7 +20,7 @@
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
#include "webrtc/modules/video_coding/fec_tables_xor.h"
#include "webrtc/modules/video_coding/fec_rate_table.h"
#include "webrtc/modules/video_coding/nack_fec_tables.h"
namespace webrtc {
@ -309,10 +309,10 @@ bool VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) {
uint16_t indexTable = rateIndexTable * kPacketLossMax + packetLoss;
// Check on table index
assert(indexTable < kSizeCodeRateXORTable);
RTC_DCHECK_LT(indexTable, kFecRateTableSize);
// Protection factor for P frame
codeRateDelta = kCodeRateXORTable[indexTable];
codeRateDelta = kFecRateTable[indexTable];
if (packetLoss > lossThr && avgTotPackets > packetNumThr) {
// Set a minimum based on first partition size.
@ -341,13 +341,13 @@ bool VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) {
0));
uint16_t indexTableKey = rateIndexTable * kPacketLossMax + packetLoss;
indexTableKey = VCM_MIN(indexTableKey, kSizeCodeRateXORTable);
indexTableKey = VCM_MIN(indexTableKey, kFecRateTableSize);
// Check on table index
assert(indexTableKey < kSizeCodeRateXORTable);
assert(indexTableKey < kFecRateTableSize);
// Protection factor for I frame
codeRateKey = kCodeRateXORTable[indexTableKey];
codeRateKey = kFecRateTable[indexTableKey];
// Boosting for Key frame.
int boostKeyProt = _scaleProtKey * codeRateDelta;