Commit e5267697 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Rearrange the colorspace/mono deocde logic a bit

Change-Id: I0d76adba7c5ea387a9c58076369d1eba89b0fbfe
parent 5f0485b4
......@@ -212,6 +212,9 @@ static int parse_bitdepth_colorspace_sampling(BITSTREAM_PROFILE profile,
}
#endif // CONFIG_COLORSPACE_HEADERS
#endif // CONFIG_CICP
#if CONFIG_MONO_VIDEO
if (is_monochrome) return 1;
#endif // CONFIG_MONO_VIDEO
#if CONFIG_CICP
if (color_primaries == AOM_CICP_CP_BT_709 &&
transfer_characteristics == AOM_CICP_TC_SRGB &&
......@@ -225,10 +228,6 @@ static int parse_bitdepth_colorspace_sampling(BITSTREAM_PROFILE profile,
(profile == PROFILE_2 && bit_depth == AOM_BITS_12))) {
return 0;
}
#if CONFIG_MONO_VIDEO
} else if (is_monochrome) {
return 1;
#endif // CONFIG_MONO_VIDEO
} else {
rb->bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range.
......
......@@ -2197,6 +2197,19 @@ void av1_read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
if (!is_monochrome) cm->color_space = aom_rb_read_literal(rb, 4);
#endif // CONFIG_COLORSPACE_HEADERS
#endif // CONFIG_CICP
#if CONFIG_MONO_VIDEO
if (is_monochrome) {
cm->color_range = AOM_CR_FULL_RANGE;
cm->subsampling_y = cm->subsampling_x = 1;
#if CONFIG_COLORSPACE_HEADERS
cm->chroma_sample_position = AOM_CSP_UNKNOWN;
#endif // CONFIG_COLORSPACE_HEADERS
#if CONFIG_EXT_QM
cm->separate_uv_delta_q = 0;
#endif // CONFIG_EXT_QM
return;
}
#endif // CONFIG_MONO_VIDEO
#if CONFIG_CICP
if (cm->color_primaries == AOM_CICP_CP_BT_709 &&
cm->transfer_characteristics == AOM_CICP_TC_SRGB &&
......@@ -2212,18 +2225,6 @@ void av1_read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"SRGB colorspace not copatible with profile");
}
#if CONFIG_MONO_VIDEO
} else if (is_monochrome) {
cm->color_range = AOM_CR_FULL_RANGE;
cm->subsampling_y = cm->subsampling_x = 1;
#if CONFIG_COLORSPACE_HEADERS
cm->chroma_sample_position = AOM_CSP_UNKNOWN;
#endif // CONFIG_COLORSPACE_HEADERS
#if CONFIG_EXT_QM
cm->separate_uv_delta_q = 0;
#endif // CONFIG_EXT_QM
return;
#endif // CONFIG_MONO_VIDEO
} else {
// [16,235] (including xvycc) vs [0,255] range
cm->color_range = aom_rb_read_bit(rb);
......
......@@ -3282,6 +3282,9 @@ static void write_bitdepth_colorspace_sampling(
if (!is_monochrome) aom_wb_write_literal(wb, cm->color_space, 4);
#endif // CONFIG_COLORSPACE_HEADERS
#endif // CONFIG_CICP
#if CONFIG_MONO_VIDEO
if (is_monochrome) return;
#endif // CONFIG_MONO_VIDEO
#if CONFIG_CICP
if (cm->color_primaries == AOM_CICP_CP_BT_709 &&
cm->transfer_characteristics == AOM_CICP_TC_SRGB &&
......@@ -3294,10 +3297,6 @@ static void write_bitdepth_colorspace_sampling(
assert(cm->subsampling_x == 0 && cm->subsampling_y == 0);
assert(cm->profile == PROFILE_1 ||
(cm->profile == PROFILE_2 && cm->bit_depth == AOM_BITS_12));
#if CONFIG_MONO_VIDEO
} else if (is_monochrome) {
return;
#endif // CONFIG_MONO_VIDEO
} else {
// 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
aom_wb_write_bit(wb, cm->color_range);
......
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