Commit 6675adff authored by Thomas Davies's avatar Thomas Davies

AOM_QM: redesign matrices and support CB_4X4 and RECT-TX.

All matrices are derived by subsampling 32x32 and 32x16 matrices.
Inter and intra matrices now use the same matrix set.

BUG=aomedia:520

AWCY results for default setting (qm-min=5, qm-max=9):

  PSNR  | PSNR Cb | PSNR Cr | PSNR HVS | SSIM  | MS SSIM | CIEDE 2000
   2.75 |  7.98   |    -    |  -3.52   |  0.73 |   -2.21 |   4.22

Change-Id: I8414d19eaf50cfe80d4fe2290da6cdf4ebb406cb
parent c9c193d9
......@@ -541,16 +541,14 @@ typedef struct macroblockd_plane {
uint8_t width, height;
#if CONFIG_AOM_QM
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
#endif
// encoder
const int16_t *dequant;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val_nuq[QUANT_PROFILES];
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
#endif
#if CONFIG_PVQ || CONFIG_DAALA_DIST
DECLARE_ALIGNED(16, int16_t, pred[MAX_SB_SQUARE]);
......
......@@ -234,15 +234,15 @@ typedef struct AV1Common {
#if CONFIG_AOM_QM
// Global quant matrix tables
qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
// Local quant matrix tables for each frame
qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
// Encoder
qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
int using_qmatrix;
int min_qmlevel;
......
This diff is collapsed.
......@@ -29,11 +29,11 @@ extern "C" {
// Total number of QM sets stored
#define QM_LEVEL_BITS 4
#define NUM_QM_LEVELS (1 << QM_LEVEL_BITS)
/* Offset into the list of QMs. Actual number of levels used is
(NUM_QM_LEVELS-AOM_QM_OFFSET)
Lower value of AOM_QM_OFFSET implies more heavily weighted matrices.*/
#define DEFAULT_QM_FIRST (NUM_QM_LEVELS / 2)
#define DEFAULT_QM_LAST (NUM_QM_LEVELS - 1)
/* Range of QMS is between first and last value, with offset applied to inter
* blocks*/
#define DEFAULT_QM_FIRST 5
#define DEFAULT_QM_LAST 9
#define DEFAULT_QM_INTER_OFFSET 0
#endif
struct AV1Common;
......@@ -54,9 +54,9 @@ static INLINE int aom_get_qmlevel(int qindex, int first, int last) {
}
void aom_qm_init(struct AV1Common *cm);
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
int log2sizem2, int is_intra);
TX_SIZE tx_size, int is_intra);
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
int log2sizem2, int is_intra);
TX_SIZE tx_size, int is_intra);
#endif
#if CONFIG_NEW_QUANT
......
......@@ -2865,7 +2865,7 @@ static void setup_segmentation_dequant(AV1_COMMON *const cm) {
const int qmlevel = (lossless || using_qm == 0)
? NUM_QM_LEVELS - 1
: aom_get_qmlevel(cm->base_qindex, minqm, maxqm);
for (int j = 0; j < TX_SIZES; ++j) {
for (int j = 0; j < TX_SIZES_ALL; ++j) {
cm->y_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 0, j, 1);
cm->y_iqmatrix[i][0][j] = aom_iqmatrix(cm, qmlevel, 0, j, 0);
cm->uv_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 1, j, 1);
......
......@@ -106,7 +106,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
dequant_val_type_nuq *dq_val,
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const qm_val_t *iqm[2][TX_SIZES],
const qm_val_t *iqm[2][TX_SIZES_ALL],
#endif // CONFIG_AOM_QM
int ctx, const int16_t *scan, const int16_t *nb,
int16_t *max_scan_line, aom_reader *r) {
......@@ -151,9 +151,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
const tran_low_t *dqv_val = &dq_val[0][0];
#endif // CONFIG_NEW_QUANT
(void)tx_type;
#if CONFIG_AOM_QM
(void)iqmatrix;
#endif // CONFIG_AOM_QM
if (counts) {
#if !(CONFIG_DAALA_EC || CONFIG_ANS) || !CONFIG_EC_ADAPT
......
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