Commit 18f4fb22 authored by Debargha Mukherjee's avatar Debargha Mukherjee
Browse files

Don't signal chroma lpf/cdef/quant info for mono

Change-Id: I3b0c83e8b0f7189d98562305dd913a8b934de83d
parent 07f93afb
......@@ -1178,9 +1178,11 @@ static void setup_loopfilter(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
#endif // CONFIG_LPF_SB
lf->filter_level[0] = aom_rb_read_literal(rb, 6);
lf->filter_level[1] = aom_rb_read_literal(rb, 6);
if (lf->filter_level[0] || lf->filter_level[1]) {
lf->filter_level_u = aom_rb_read_literal(rb, 6);
lf->filter_level_v = aom_rb_read_literal(rb, 6);
if (av1_num_planes(cm) > 1) {
if (lf->filter_level[0] || lf->filter_level[1]) {
lf->filter_level_u = aom_rb_read_literal(rb, 6);
lf->filter_level_v = aom_rb_read_literal(rb, 6);
}
}
#if CONFIG_LPF_SB
}
......@@ -1227,9 +1229,10 @@ static void setup_cdef(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
cm->nb_cdef_strengths = 1 << cm->cdef_bits;
for (int i = 0; i < cm->nb_cdef_strengths; i++) {
cm->cdef_strengths[i] = aom_rb_read_literal(rb, CDEF_STRENGTH_BITS);
cm->cdef_uv_strengths[i] = cm->subsampling_x == cm->subsampling_y
? aom_rb_read_literal(rb, CDEF_STRENGTH_BITS)
: 0;
cm->cdef_uv_strengths[i] =
cm->subsampling_x == cm->subsampling_y && av1_num_planes(cm) > 1
? aom_rb_read_literal(rb, CDEF_STRENGTH_BITS)
: 0;
}
}
......@@ -1241,18 +1244,20 @@ static void setup_quantization(AV1_COMMON *const cm,
struct aom_read_bit_buffer *rb) {
cm->base_qindex = aom_rb_read_literal(rb, QINDEX_BITS);
cm->y_dc_delta_q = read_delta_q(rb);
int diff_uv_delta = 0;
if (av1_num_planes(cm) > 1) {
int diff_uv_delta = 0;
#if CONFIG_EXT_QM
if (cm->separate_uv_delta_q) diff_uv_delta = aom_rb_read_bit(rb);
if (cm->separate_uv_delta_q) diff_uv_delta = aom_rb_read_bit(rb);
#endif
cm->u_dc_delta_q = read_delta_q(rb);
cm->u_ac_delta_q = read_delta_q(rb);
if (diff_uv_delta) {
cm->v_dc_delta_q = read_delta_q(rb);
cm->v_ac_delta_q = read_delta_q(rb);
} else {
cm->v_dc_delta_q = cm->u_dc_delta_q;
cm->v_ac_delta_q = cm->u_ac_delta_q;
cm->u_dc_delta_q = read_delta_q(rb);
cm->u_ac_delta_q = read_delta_q(rb);
if (diff_uv_delta) {
cm->v_dc_delta_q = read_delta_q(rb);
cm->v_ac_delta_q = read_delta_q(rb);
} else {
cm->v_dc_delta_q = cm->u_dc_delta_q;
cm->v_ac_delta_q = cm->u_ac_delta_q;
}
}
cm->dequant_bit_depth = cm->bit_depth;
#if CONFIG_AOM_QM
......
......@@ -2637,9 +2637,11 @@ static void encode_loopfilter(AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
#endif // CONFIG_LPF_SB
aom_wb_write_literal(wb, lf->filter_level[0], 6);
aom_wb_write_literal(wb, lf->filter_level[1], 6);
if (lf->filter_level[0] || lf->filter_level[1]) {
aom_wb_write_literal(wb, lf->filter_level_u, 6);
aom_wb_write_literal(wb, lf->filter_level_v, 6);
if (av1_num_planes(cm) > 1) {
if (lf->filter_level[0] || lf->filter_level[1]) {
aom_wb_write_literal(wb, lf->filter_level_u, 6);
aom_wb_write_literal(wb, lf->filter_level_v, 6);
}
}
#if CONFIG_LPF_SB
}
......@@ -2698,7 +2700,7 @@ static void encode_cdef(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
aom_wb_write_literal(wb, cm->cdef_bits, 2);
for (i = 0; i < cm->nb_cdef_strengths; i++) {
aom_wb_write_literal(wb, cm->cdef_strengths[i], CDEF_STRENGTH_BITS);
if (cm->subsampling_x == cm->subsampling_y)
if (cm->subsampling_x == cm->subsampling_y && av1_num_planes(cm) > 1)
aom_wb_write_literal(wb, cm->cdef_uv_strengths[i], CDEF_STRENGTH_BITS);
}
}
......@@ -2716,18 +2718,20 @@ static void encode_quantization(const AV1_COMMON *const cm,
struct aom_write_bit_buffer *wb) {
aom_wb_write_literal(wb, cm->base_qindex, QINDEX_BITS);
write_delta_q(wb, cm->y_dc_delta_q);
int diff_uv_delta = (cm->u_dc_delta_q != cm->v_dc_delta_q) ||
(cm->u_ac_delta_q != cm->v_ac_delta_q);
if (av1_num_planes(cm) > 1) {
int diff_uv_delta = (cm->u_dc_delta_q != cm->v_dc_delta_q) ||
(cm->u_ac_delta_q != cm->v_ac_delta_q);
#if CONFIG_EXT_QM
if (cm->separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta);
if (cm->separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta);
#else
assert(!diff_uv_delta);
assert(!diff_uv_delta);
#endif
write_delta_q(wb, cm->u_dc_delta_q);
write_delta_q(wb, cm->u_ac_delta_q);
if (diff_uv_delta) {
write_delta_q(wb, cm->v_dc_delta_q);
write_delta_q(wb, cm->v_ac_delta_q);
write_delta_q(wb, cm->u_dc_delta_q);
write_delta_q(wb, cm->u_ac_delta_q);
if (diff_uv_delta) {
write_delta_q(wb, cm->v_dc_delta_q);
write_delta_q(wb, cm->v_ac_delta_q);
}
}
#if CONFIG_AOM_QM
aom_wb_write_bit(wb, cm->using_qmatrix);
......
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