Commit 20be5450 authored by Andrey Norkin's avatar Andrey Norkin

[NORMATIVE] Monochrome support in film grain

BUG=aomedia:1346

Change-Id: I4247f1387022cfd3b69116f6f259eebbf61db791
parent 9a74bb68
This diff is collapsed.
......@@ -2207,9 +2207,10 @@ void av1_read_film_grain_params(AV1_COMMON *cm,
pars->scaling_points_y[i][1] = aom_rb_read_literal(rb, 8);
}
pars->chroma_scaling_from_luma = aom_rb_read_bit(rb);
if (!cm->seq_params.monochrome)
pars->chroma_scaling_from_luma = aom_rb_read_bit(rb);
if (pars->chroma_scaling_from_luma) {
if (cm->seq_params.monochrome || pars->chroma_scaling_from_luma) {
pars->num_cb_points = 0;
pars->num_cr_points = 0;
} else {
......@@ -2253,7 +2254,8 @@ void av1_read_film_grain_params(AV1_COMMON *cm,
pars->ar_coeff_lag = aom_rb_read_literal(rb, 2);
int num_pos_luma = 2 * pars->ar_coeff_lag * (pars->ar_coeff_lag + 1);
int num_pos_chroma = num_pos_luma + 1;
int num_pos_chroma = num_pos_luma;
if (pars->num_y_points > 0) ++num_pos_chroma;
if (pars->num_y_points)
for (int i = 0; i < num_pos_luma; i++)
......
......@@ -3223,11 +3223,12 @@ static void write_film_grain_params(AV1_COMMON *const cm,
aom_wb_write_literal(wb, pars->scaling_points_y[i][1], 8);
}
aom_wb_write_bit(wb, pars->chroma_scaling_from_luma);
if (!cm->seq_params.monochrome)
aom_wb_write_bit(wb, pars->chroma_scaling_from_luma);
if (pars->chroma_scaling_from_luma) {
assert(pars->num_cb_points == 0);
assert(pars->num_cr_points == 0);
if (cm->seq_params.monochrome || pars->chroma_scaling_from_luma) {
pars->num_cb_points = 0;
pars->num_cr_points = 0;
} else {
aom_wb_write_literal(wb, pars->num_cb_points, 4); // max 10
for (int i = 0; i < pars->num_cb_points; i++) {
......@@ -3251,7 +3252,8 @@ static void write_film_grain_params(AV1_COMMON *const cm,
aom_wb_write_literal(wb, pars->ar_coeff_lag, 2);
int num_pos_luma = 2 * pars->ar_coeff_lag * (pars->ar_coeff_lag + 1);
int num_pos_chroma = num_pos_luma + 1;
int num_pos_chroma = num_pos_luma;
if (pars->num_y_points > 0) ++num_pos_chroma;
if (pars->num_y_points)
for (int i = 0; i < num_pos_luma; i++)
......
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