Commit 625cac19 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Remove dead functions

Change-Id: I834aaf5d043cf591ef3ba01abf7420f08080297d
parent bc51d0e6
......@@ -62,28 +62,6 @@ static uint16_t aom_rb_read_primitive_quniform(struct aom_read_bit_buffer *rb,
return v < m ? v : (v << 1) - m + aom_rb_read_bit(rb);
}
uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref ACCT_STR_PARAM) {
if (n <= 1) return 0;
assert(p > 0 && p <= n);
assert(ref < n);
int lolimit = ref - p / 2;
const int hilimit = lolimit + p - 1;
if (lolimit < 0) {
lolimit = 0;
} else if (hilimit >= n) {
lolimit = n - p;
}
int v;
if (aom_read_bit(r, ACCT_STR_NAME)) {
v = aom_read_primitive_quniform(r, p, ACCT_STR_NAME) + lolimit;
} else {
v = aom_read_primitive_quniform(r, n - p, ACCT_STR_NAME);
if (v >= lolimit) v += p;
}
return v;
}
// Decode finite subexponential code that for a symbol v in [0, n-1] with
// parameter k
uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
......
......@@ -23,12 +23,8 @@ extern "C" {
#include "aom_dsp/bitreader.h"
#include "aom_dsp/bitreader_buffer.h"
#define aom_read_primitive_symmetric(r, n, ACCT_STR_NAME) \
aom_read_primitive_symmetric_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_quniform(r, n, ACCT_STR_NAME) \
aom_read_primitive_quniform_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_refbilevel(r, n, p, ref, ACCT_STR_NAME) \
aom_read_primitive_refbilevel_(r, n, p, ref ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_subexpfin(r, n, k, ACCT_STR_NAME) \
aom_read_primitive_subexpfin_(r, n, k ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_refsubexpfin(r, n, k, ref, ACCT_STR_NAME) \
......@@ -40,8 +36,6 @@ extern "C" {
int16_t aom_read_primitive_symmetric_(aom_reader *r,
unsigned int mag_bits ACCT_STR_PARAM);
uint16_t aom_read_primitive_quniform_(aom_reader *r, uint16_t n ACCT_STR_PARAM);
uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref ACCT_STR_PARAM);
uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
uint16_t k ACCT_STR_PARAM);
uint16_t aom_read_primitive_refsubexpfin_(aom_reader *r, uint16_t n, uint16_t k,
......
......@@ -89,61 +89,6 @@ int aom_count_primitive_quniform(uint16_t n, uint16_t v) {
return v < m ? l - 1 : l;
}
// Encodes a value v in [0, n-1] based on a reference ref also in [0, n-1]
// The closest p values of v from ref are coded using a p-ary quasi-unoform
// short code while the remaining n-p values are coded with a longer code.
void aom_write_primitive_refbilevel(aom_writer *w, uint16_t n, uint16_t p,
uint16_t ref, uint16_t v) {
if (n <= 1) return;
assert(p > 0 && p <= n);
assert(ref < n);
int lolimit = ref - p / 2;
int hilimit = lolimit + p - 1;
if (lolimit < 0) {
lolimit = 0;
hilimit = p - 1;
} else if (hilimit >= n) {
hilimit = n - 1;
lolimit = n - p;
}
if (v >= lolimit && v <= hilimit) {
aom_write_bit(w, 1);
v = v - lolimit;
aom_write_primitive_quniform(w, p, v);
} else {
aom_write_bit(w, 0);
if (v > hilimit) v -= p;
aom_write_primitive_quniform(w, n - p, v);
}
}
int aom_count_primitive_refbilevel(uint16_t n, uint16_t p, uint16_t ref,
uint16_t v) {
if (n <= 1) return 0;
assert(p > 0 && p <= n);
assert(ref < n);
int lolimit = ref - p / 2;
int hilimit = lolimit + p - 1;
if (lolimit < 0) {
lolimit = 0;
hilimit = p - 1;
} else if (hilimit >= n) {
hilimit = n - 1;
lolimit = n - p;
}
int count = 0;
if (v >= lolimit && v <= hilimit) {
count++;
v = v - lolimit;
count += aom_count_primitive_quniform(p, v);
} else {
count++;
if (v > hilimit) v -= p;
count += aom_count_primitive_quniform(n - p, v);
}
return count;
}
// Finite subexponential code that codes a symbol v in [0, n-1] with parameter k
void aom_write_primitive_subexpfin(aom_writer *w, uint16_t n, uint16_t k,
uint16_t v) {
......
......@@ -33,12 +33,6 @@ void aom_write_primitive_symmetric(aom_writer *w, int16_t v,
// Encodes a value v in [0, n-1] quasi-uniformly
void aom_write_primitive_quniform(aom_writer *w, uint16_t n, uint16_t v);
// Encodes a value v in [0, n-1] based on a reference ref also in [0, n-1]
// The closest p values of v from ref are coded using a p-ary quasi-unoform
// short code while the remaining n-p values are coded with a longer code.
void aom_write_primitive_refbilevel(aom_writer *w, uint16_t n, uint16_t p,
uint16_t ref, uint16_t v);
// Finite subexponential code that codes a symbol v in [0, n-1] with parameter k
void aom_write_primitive_subexpfin(aom_writer *w, uint16_t n, uint16_t k,
uint16_t v);
......@@ -61,8 +55,6 @@ void aom_wb_write_signed_primitive_refsubexpfin(struct aom_write_bit_buffer *wb,
// Functions that counts bits for the above primitives
int aom_count_primitive_symmetric(int16_t v, unsigned int mag_bits);
int aom_count_primitive_quniform(uint16_t n, uint16_t v);
int aom_count_primitive_refbilevel(uint16_t n, uint16_t p, uint16_t ref,
uint16_t v);
int aom_count_primitive_subexpfin(uint16_t n, uint16_t k, uint16_t v);
int aom_count_primitive_refsubexpfin(uint16_t n, uint16_t k, uint16_t ref,
uint16_t v);
......
......@@ -29,57 +29,6 @@ using libaom_test::ACMRandom;
namespace {
// Test for Bilevel code with reference
TEST(AV1, TestPrimitiveRefbilivel) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int kBufferSize = 65536;
aom_writer bw;
uint8_t bw_buffer[kBufferSize];
const uint16_t kRanges = 8;
const uint16_t kNearRanges = 8;
const uint16_t kReferences = 8;
const uint16_t kValues = 16;
const uint16_t range_vals[kRanges] = { 1, 13, 64, 120, 230, 420, 1100, 8000 };
uint16_t enc_values[kRanges][kNearRanges][kReferences][kValues][4];
aom_start_encode(&bw, bw_buffer);
for (int n = 0; n < kRanges; ++n) {
const uint16_t range = range_vals[n];
for (int p = 0; p < kNearRanges; ++p) {
const uint16_t near_range = 1 + rnd(range);
for (int r = 0; r < kReferences; ++r) {
const uint16_t ref = rnd(range);
for (int v = 0; v < kValues; ++v) {
const uint16_t value = rnd(range);
enc_values[n][p][r][v][0] = range;
enc_values[n][p][r][v][1] = near_range;
enc_values[n][p][r][v][2] = ref;
enc_values[n][p][r][v][3] = value;
aom_write_primitive_refbilevel(&bw, range, near_range, ref, value);
}
}
}
}
aom_stop_encode(&bw);
aom_reader br;
aom_reader_init(&br, bw_buffer, bw.pos, NULL, NULL);
GTEST_ASSERT_GE(aom_reader_tell(&br), 0u);
GTEST_ASSERT_LE(aom_reader_tell(&br), 1u);
for (int n = 0; n < kRanges; ++n) {
for (int p = 0; p < kNearRanges; ++p) {
for (int r = 0; r < kReferences; ++r) {
for (int v = 0; v < kValues; ++v) {
const uint16_t range = enc_values[n][p][r][v][0];
const uint16_t near_range = enc_values[n][p][r][v][1];
const uint16_t ref = enc_values[n][p][r][v][2];
const uint16_t value = aom_read_primitive_refbilevel(
&br, range, near_range, ref, ACCT_STR);
GTEST_ASSERT_EQ(value, enc_values[n][p][r][v][3]);
}
}
}
}
}
// Test for Finite subexponential code with reference
TEST(AV1, TestPrimitiveRefsubexpfin) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment