Commit 140069eb authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Use aom_writer with od_laplace_encode_special().

Change the od_laplace_encode_special() function to take an aom_writer
 struct instead of an od_ec_enc struct.
Rename od_laplace_encode_special() to aom_laplace_encode_special().

Change-Id: Ieba63c8519d363081124a11e633b437adccfa500
parent 58ef551f
......@@ -122,12 +122,7 @@ void generic_encode(aom_writer *w, generic_encoder *model, int x, int max,
e = ((2**ex_q16 >> 8) + (1 << shift >> 1)) >> shift;
decay = OD_MAXI(2, OD_MINI(254, 256*e/(e + 256)));
/* Encode the tail of the distribution assuming exponential decay. */
#if CONFIG_DAALA_EC
od_laplace_encode_special(&w->ec, xs - 15, decay,
(max == -1) ? -1 : ms - 15);
#else
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
aom_laplace_encode_special(w, xs - 15, decay, (max == -1) ? -1 : ms - 15);
}
if (shift != 0) {
int special;
......
......@@ -17,6 +17,7 @@
#include <stdio.h>
#include "aom_dsp/bitwriter.h"
#include "aom_dsp/entdec.h"
#include "aom_dsp/entenc.h"
#include "av1/common/odintrin.h"
......@@ -85,7 +86,7 @@ void aom_encode_band_pvq_splits(aom_writer *w, od_pvq_codeword_ctx *adapt,
* @param [in] max maximum possible value of x (used to truncate
* the pdf)
*/
void od_laplace_encode_special(od_ec_enc *enc, int x, unsigned decay, int max) {
void aom_laplace_encode_special(aom_writer *w, int x, unsigned decay, int max) {
int shift;
int xs;
int ms;
......@@ -119,14 +120,18 @@ void od_laplace_encode_special(od_ec_enc *enc, int x, unsigned decay, int max) {
}
if (ms > 0 && ms < 15) {
/* Simple way of truncating the pdf when we have a bound */
od_ec_encode_cdf_unscaled(enc, sym, cdf, ms + 1);
aom_write_cdf_unscaled(w, sym, cdf, ms + 1);
}
else {
od_ec_encode_cdf_q15(enc, sym, cdf, 16);
aom_write_cdf(w, sym, cdf, 16);
}
xs -= 15;
ms -= 15;
}
while (sym >= 15 && ms != 0);
if (shift) od_ec_enc_bits(enc, x & ((1 << shift) - 1), shift);
#if CONFIG_DAALA_EC
if (shift) od_ec_enc_bits(&w->ec, x & ((1 << shift) - 1), shift);
#else
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
}
......@@ -24,7 +24,7 @@
void aom_encode_band_pvq_splits(aom_writer *w, od_pvq_codeword_ctx *adapt,
const int *y, int n, int k, int level);
void od_laplace_encode_special(od_ec_enc *enc, int x, unsigned decay, int max);
void aom_laplace_encode_special(aom_writer *w, int x, unsigned decay, int max);
#if OD_SIGNAL_Q_SCALING
void od_encode_quantizer_scaling(daala_enc_ctx *enc, int q_scaling, int bx,
......
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