Skip to content

Commit

Permalink
FEC classes: get rid of fft_full
Browse files Browse the repository at this point in the history
Thanks to new FFT::Radix2 based on bit-reversal algorithm, only FFT
operation uses data length parameter to decrease complexity. Hence
fft_full is no longer used.
  • Loading branch information
lamphamsy committed Aug 7, 2018
1 parent 619ebc4 commit 215b90b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 22 deletions.
8 changes: 2 additions & 6 deletions src/fec_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class FecCode {
T r;
std::unique_ptr<gf::Field<T>> gf = nullptr;
std::unique_ptr<fft::FourierTransform<T>> fft = nullptr;
std::unique_ptr<fft::FourierTransform<T>> fft_full = nullptr;
std::unique_ptr<fft::FourierTransform<T>> fft_2k = nullptr;
// This vector MUST be initialized by derived Class using multiplicative FFT
std::unique_ptr<vec::Vector<T>> inv_r_powers = nullptr;
Expand Down Expand Up @@ -736,9 +735,6 @@ FecCode<T>::init_context_dec(vec::Vector<T>& fragments_ids, size_t size)
if (this->fft == nullptr) {
throw LogicError("FEC base: FFT must be initialized");
}
if (this->fft_full == nullptr) {
throw LogicError("FEC base: FFT full must be initialized");
}

int k = this->n_data; // number of fragments received
// vector x=(x_0, x_1, ..., x_k-1)
Expand Down Expand Up @@ -814,7 +810,7 @@ void FecCode<T>::decode_apply(
}

// compute vec2_n = FFT(vec1_n)
this->fft_full->fft_inv(vec2_n, vec1_n);
this->fft->fft_inv(vec2_n, vec1_n);

// vec_tmp_2k: first k elements from vec2_n
// last (len_2k - k) elements are padded
Expand Down Expand Up @@ -1103,7 +1099,7 @@ void FecCode<T>::decode_apply(
}

// compute buf2_n
this->fft_full->fft_inv(buf2_n, buf1_n);
this->fft->fft_inv(buf2_n, buf1_n);

// buf1_2k: first k buffers point to first k buffers of buf2_n
// las k buffers point to a padded zero buffer
Expand Down
3 changes: 0 additions & 3 deletions src/fec_rs_fnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ class RsFnt : public FecCode<T> {
this->fft = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*(this->gf), this->n, m, this->pkt_size));

this->fft_full = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*(this->gf), this->n, this->n, this->pkt_size));

unsigned len_2k = this->gf->get_code_len_high_compo(2 * this->n_data);
this->fft_2k = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*(this->gf), len_2k, len_2k, this->pkt_size));
Expand Down
3 changes: 0 additions & 3 deletions src/fec_rs_gf2n_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ class RsGf2nFft : public FecCode<T> {
this->fft = std::unique_ptr<fft::CooleyTukey<T>>(
new fft::CooleyTukey<T>(*(this->gf), this->n));

this->fft_full = std::unique_ptr<fft::CooleyTukey<T>>(
new fft::CooleyTukey<T>(*(this->gf), this->n));

unsigned len_2k = this->gf->get_code_len_high_compo(2 * this->n_data);
this->fft_2k = std::unique_ptr<fft::CooleyTukey<T>>(
new fft::CooleyTukey<T>(*(this->gf), len_2k));
Expand Down
4 changes: 0 additions & 4 deletions src/fec_rs_gfp_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,9 @@ class RsGfpFft : public FecCode<T> {
if (arith::is_power_of_2<T>(this->n)) {
this->fft = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*(this->gf), this->n));
this->fft_full = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*(this->gf), this->n));
} else {
this->fft = std::unique_ptr<fft::CooleyTukey<T>>(
new fft::CooleyTukey<T>(*(this->gf), this->n));
this->fft_full = std::unique_ptr<fft::CooleyTukey<T>>(
new fft::CooleyTukey<T>(*(this->gf), this->n));
}

unsigned len_2k = this->gf->get_code_len_high_compo(2 * this->n_data);
Expand Down
6 changes: 0 additions & 6 deletions src/fec_rs_nf4.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ class RsNf4 : public FecCode<T> {
this->fft = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*ngff4, this->n, m, this->pkt_size));

this->fft_full = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*ngff4, this->n, this->n, this->pkt_size));

unsigned len_2k = this->gf->get_code_len_high_compo(2 * this->n_data);
this->fft_2k = std::unique_ptr<fft::Radix2<T>>(
new fft::Radix2<T>(*ngff4, len_2k, len_2k, this->pkt_size));
Expand Down Expand Up @@ -197,9 +194,6 @@ class RsNf4 : public FecCode<T> {
if (this->fft == nullptr) {
throw LogicError("FEC base: FFT must be initialized");
}
if (this->fft_full == nullptr) {
throw LogicError("FEC base: FFT full must be initialized");
}

int k = this->n_data; // number of fragments received
// vector x=(x_0, x_1, ..., x_k-1)
Expand Down

0 comments on commit 215b90b

Please sign in to comment.