Commit 6e42741f authored by Debargha Mukherjee's avatar Debargha Mukherjee

Change dq_type in frame header in new_quant expt

dq_type now takes 4 possible values, one of which is
the original multiply-only dequantizer.

Change-Id: I2180f632f0d7f91dc391a6e802a93a77de789228
parent 38cd2318
......@@ -671,10 +671,13 @@ typedef enum ATTRIBUTE_PACKED {
#if CONFIG_NEW_QUANT
typedef enum ATTRIBUTE_PACKED {
DQ_MULT_OFFSET,
DQ_MULT_OFFSET_DZ,
DQ_MULT, // Dequant is just multiplication
DQ_MULT_OFFSET1, // Dequant is multiplication and offset1
DQ_MULT_OFFSET2, // Dequant is multiplication and offset2
DQ_MULT_OFFSET3, // Dequant is multiplication and offset3
DQ_TYPES
} DqType;
#define DQ_TYPE_BITS 2
#endif // CONFIG_NEW_QUANT
#ifdef __cplusplus
......
......@@ -36,46 +36,132 @@ static const qprofile_type nuq[QUANT_PROFILES][2] = {
{ 64, 0 }, // dc
{ 64, 0 }, // ac
},
// dq_type = 1
{
// intra, dq_type 0, high quality
{ 64, 3 }, // dc
{ 64, 3 }, // ac
// Y/intra, dq_type 1, low quality
{ 66, 12 }, // dc
{ 66, 12 }, // ac
},
{
// intra, dq_type 0, low quality
{ 64, 14 }, // dc
{ 64, 14 }, // ac
// Y/intra, dq_type 1, high quality
{ 66, 6 }, // dc
{ 66, 6 }, // ac
},
{
// inter, dq_type 0, high quality
{ 64, 4 }, // dc
{ 64, 4 }, // ac
// UV/intra, dq_type 1, low quality
{ 66, 12 }, // dc
{ 66, 12 }, // ac
},
{
// inter, dq_type 0, low quality
{ 64, 8 }, // dc
{ 64, 8 }, // ac
// UV/intra, dq_type 1, high quality
{ 66, 6 }, // dc
{ 66, 6 }, // ac
},
{
// intra, dq_type 1, high quality
{ 82, 4 }, // dc
{ 80, 8 }, // ac
// Y/inter, dq_type 1, low quality
{ 66, 12 }, // dc
{ 66, 12 }, // ac
},
{
// intra, dq_type 1, low quality
{ 76, 12 }, // dc
{ 72, 16 }, // ac
// Y/inter, dq_type 1, high quality
{ 66, 6 }, // dc
{ 66, 6 }, // ac
},
{
// inter, dq_type 1, high quality
{ 82, 4 }, // dc
{ 80, 8 }, // ac
// UV/inter, dq_type 1, low quality
{ 66, 12 }, // dc
{ 66, 12 }, // ac
},
{
// inter, dq_type 1, low quality
{ 76, 12 }, // dc
{ 72, 16 }, // ac
}
// UV/inter, dq_type 1, high quality
{ 66, 6 }, // dc
{ 66, 6 }, // ac
},
// dq_type = 2
{
// Y/intra, dq_type 2, low quality
{ 72, 12 }, // dc
{ 72, 12 }, // ac
},
{
// Y/intra, dq_type 2, high quality
{ 72, 6 }, // dc
{ 72, 6 }, // ac
},
{
// UV/intra, dq_type 2, low quality
{ 72, 12 }, // dc
{ 72, 12 }, // ac
},
{
// UV/intra, dq_type 2, high quality
{ 72, 6 }, // dc
{ 72, 6 }, // ac
},
{
// Y/inter, dq_type 2, low quality
{ 72, 12 }, // dc
{ 72, 12 }, // ac
},
{
// Y/inter, dq_type 2, high quality
{ 72, 6 }, // dc
{ 72, 6 }, // ac
},
{
// UV/inter, dq_type 2, low quality
{ 72, 12 }, // dc
{ 72, 12 }, // ac
},
{
// UV/inter, dq_type 2, high quality
{ 72, 6 }, // dc
{ 72, 6 }, // ac
},
// dq_type = 3
{
// Y/intra, dq_type 3, low quality
{ 80, 12 }, // dc
{ 80, 12 }, // ac
},
{
// Y/intra, dq_type 3, high quality
{ 82, 6 }, // dc
{ 82, 6 }, // ac
},
{
// UV/intra, dq_type 3, low quality
{ 80, 12 }, // dc
{ 80, 12 }, // ac
},
{
// UV/intra, dq_type 3, high quality
{ 82, 6 }, // dc
{ 82, 6 }, // ac
},
{
// Y/inter, dq_type 3, low quality
{ 80, 12 }, // dc
{ 80, 12 }, // ac
},
{
// Y/inter, dq_type 3, high quality
{ 82, 6 }, // dc
{ 82, 6 }, // ac
},
{
// UV/inter, dq_type 3, low quality
{ 80, 12 }, // dc
{ 80, 12 }, // ac
},
{
// UV/inter, dq_type 3, high quality
{ 82, 6 }, // dc
{ 82, 6 }, // ac
},
};
static INLINE uint8_t get_nuq_zbin(int is_ac_coeff, int q_profile) {
......
......@@ -60,7 +60,7 @@ qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
#if CONFIG_NEW_QUANT
#define QUANT_PROFILES 9
#define QUANT_PROFILES ((DQ_TYPES - 1) * 8 + 1)
#define QUANT_RANGES 2
#define NUQ_KNOTS 1
......@@ -81,15 +81,24 @@ static INLINE int get_dq_profile(DqType dqtype, int qindex, int is_inter,
static const int
dq_profile_lookup[DQ_TYPES][REF_TYPES][PLANE_TYPES][QUANT_RANGES] = {
{
{ { 2, 1 }, { 2, 1 } }, // intra: Y, UV
{ { 4, 3 }, { 4, 3 } }, // inter: Y, UV
{ { 0, 0 }, { 0, 0 } }, // intra: Y, UV
{ { 0, 0 }, { 0, 0 } }, // inter: Y, UV
},
{
{ { 6, 5 }, { 6, 5 } }, // intra: Y, UV
{ { 8, 7 }, { 8, 7 } }, // inter: Y, UV
{ { 1, 2 }, { 3, 4 } }, // intra: Y, UV
{ { 5, 6 }, { 7, 8 } }, // inter: Y, UV
},
{
{ { 9, 10 }, { 11, 12 } }, // intra: Y, UV
{ { 13, 14 }, { 15, 16 } }, // inter: Y, UV
},
{
{ { 17, 18 }, { 19, 20 } }, // intra: Y, UV
{ { 21, 22 }, { 23, 24 } }, // inter: Y, UV
},
};
if (!qindex) return 0; // lossless
if (!dqtype) return 0; // DQ_MULT
return dq_profile_lookup[dqtype][is_inter][plane_type]
[qindex_to_qrange(qindex)];
}
......
......@@ -3058,9 +3058,9 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
setup_segmentation_dequant(cm);
#if CONFIG_NEW_QUANT
if (!cm->all_lossless) {
cm->dq_type = aom_rb_read_bit(rb);
cm->dq_type = aom_rb_read_literal(rb, DQ_TYPE_BITS);
} else {
cm->dq_type = DQ_MULT_OFFSET;
cm->dq_type = DQ_MULT;
}
#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
......
......@@ -3802,7 +3802,7 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
}
#if CONFIG_NEW_QUANT
if (!cm->all_lossless) {
aom_wb_write_bit(wb, cm->dq_type);
aom_wb_write_literal(wb, cm->dq_type, DQ_TYPE_BITS);
}
#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
......@@ -4184,7 +4184,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
}
#if CONFIG_NEW_QUANT
if (!cm->all_lossless) {
aom_wb_write_bit(wb, cm->dq_type);
aom_wb_write_literal(wb, cm->dq_type, DQ_TYPE_BITS);
}
#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
......
......@@ -4099,7 +4099,11 @@ void av1_encode_frame(AV1_COMP *cpi) {
// rather than the potential full set of 16 transforms
cm->reduced_tx_set_used = 0;
#if CONFIG_NEW_QUANT
cm->dq_type = cpi->sf.optimize_coefficients != FULL_TRELLIS_OPT;
switch (cpi->sf.optimize_coefficients) {
case NO_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET3; break;
case FINAL_PASS_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET2; break;
case FULL_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET1; break;
}
#endif // CONFIG_NEW_QUANT
#if CONFIG_FRAME_MARKER
......
......@@ -17,7 +17,8 @@
#include "aom_dsp/aom_dsp_common.h"
// Setting this to 1 will disable trellis optimization within the
// Setting this to 1 will disable trellis optimization completely.
// Setting this to 2 will disable trellis optimization within the
// transform search. Trellis optimization will still be applied
// in the final encode.
#define DISABLE_TRELLISQ_SEARCH 0
......@@ -433,10 +434,12 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
sf->mv.subpel_search_method = SUBPEL_TREE;
sf->mv.subpel_iters_per_step = 2;
sf->mv.subpel_force_stop = 0;
#if DISABLE_TRELLISQ_SEARCH
#if DISABLE_TRELLISQ_SEARCH == 2
sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf)
? FINAL_PASS_TRELLIS_OPT
: NO_TRELLIS_OPT;
#elif DISABLE_TRELLISQ_SEARCH == 1
sf->optimize_coefficients = NO_TRELLIS_OPT;
#else
sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
#endif // DISABLE_TRELLISQ_SEARCH
......
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