Commit fddd3eb6 authored by Nathan E. Egge's avatar Nathan E. Egge
Browse files

Use aom_reader with od_decode_cdf_adapt_q15().

Change the od_decode_cdf_adapt_q15() function to take an aom_reader
 struct instead of an od_ec_enc struct.
Rename od_decode_cdf_adapt_q15() to aom_decode_cdf_adapt_q15().

Change-Id: I72315c6e89d689e232c53a99a7d4e0f9cdcfbd0c
parent a653f20d
......@@ -14,6 +14,7 @@
#if !defined(_generic_code_H)
# define _generic_code_H
# include "aom_dsp/bitreader.h"
# include "aom_dsp/bitwriter.h"
# include "aom_dsp/entdec.h"
# include "aom_dsp/entenc.h"
......@@ -22,11 +23,13 @@
#if OD_ACCOUNTING
# define generic_decode(dec, model, max, ex_q16, integration, str) generic_decode_(dec, model, max, ex_q16, integration, str)
# define od_decode_cdf_adapt_q15(ec, cdf, n, count, rate, str) od_decode_cdf_adapt_q15_(ec, cdf, n, count, rate, str)
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate, str)
# define od_decode_cdf_adapt(ec, cdf, n, increment, str) od_decode_cdf_adapt_(ec, cdf, n, increment, str)
#else
# define generic_decode(dec, model, max, ex_q16, integration, str) generic_decode_(dec, model, max, ex_q16, integration)
# define od_decode_cdf_adapt_q15(ec, cdf, n, count, rate, str) od_decode_cdf_adapt_q15_(ec, cdf, n, count, rate)
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate)
# define od_decode_cdf_adapt(ec, cdf, n, increment, str) od_decode_cdf_adapt_(ec, cdf, n, increment)
#endif
......@@ -73,7 +76,7 @@ double generic_encode_cost(generic_encoder *model, int x, int max,
double od_encode_cdf_cost(int val, uint16_t *cdf, int n);
int od_decode_cdf_adapt_q15_(od_ec_dec *ec, uint16_t *cdf, int n,
int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
int *count, int rate OD_ACC_STR);
int generic_decode_(od_ec_dec *dec, generic_encoder *model, int max,
......
......@@ -17,6 +17,7 @@
#include <stdio.h>
#include "aom_dsp/bitreader.h"
#include "aom_dsp/entdec.h"
#include "av1/common/generic_code.h"
#include "av1/common/odintrin.h"
......@@ -25,14 +26,14 @@
/** Decodes a value from 0 to N-1 (with N up to 16) based on a cdf and adapts
* the cdf accordingly.
*
* @param [in,out] enc range encoder
* @param [in,out] r multi-symbol entropy decoder
* @param [in,out] cdf CDF of the variable (Q15)
* @param [in] n number of values possible
* @param [in,out] count number of symbols encoded with that cdf so far
* @param [in] rate adaptation rate shift (smaller is faster)
* @return decoded variable
*/
int od_decode_cdf_adapt_q15_(od_ec_dec *ec, uint16_t *cdf, int n,
int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
int *count, int rate OD_ACC_STR) {
int val;
int i;
......@@ -43,7 +44,7 @@ int od_decode_cdf_adapt_q15_(od_ec_dec *ec, uint16_t *cdf, int n,
cdf[i] = cdf[i]*32768/ft;
}
}
val = od_ec_decode_cdf_q15(ec, cdf, n);
val = aom_read_symbol(r, cdf, n, acc_str);
aom_cdf_adapt_q15(val, cdf, n, count, rate);
return val;
}
......
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