Commit 0c3545b6 authored by David Barker's avatar David Barker Committed by Debargha Mukherjee

Disallow 4:4:0 subsampling

BUG=aomedia:1233

Change-Id: Ib740ee063b87003cf8c6cbd8f2ae4b917892e41c
parent 99350a62
......@@ -240,7 +240,10 @@ static int parse_bitdepth_colorspace_sampling(BITSTREAM_PROFILE profile,
} else if (profile == PROFILE_2) {
if (bit_depth == AOM_BITS_12) {
subsampling_x = aom_rb_read_bit(rb);
subsampling_y = aom_rb_read_bit(rb);
if (subsampling_x == 0)
subsampling_y = 0;
else
subsampling_y = aom_rb_read_bit(rb);
} else {
subsampling_x = 1;
subsampling_y = 0;
......
......@@ -2237,7 +2237,10 @@ void av1_read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
} else if (cm->profile == PROFILE_2) {
if (cm->bit_depth == AOM_BITS_12) {
cm->subsampling_x = aom_rb_read_bit(rb);
cm->subsampling_y = aom_rb_read_bit(rb);
if (cm->subsampling_x == 0)
cm->subsampling_y = 0; // 444
else
cm->subsampling_y = aom_rb_read_bit(rb); // 422 or 420
} else {
// 422
cm->subsampling_x = 1;
......
......@@ -3303,7 +3303,12 @@ static void write_bitdepth_colorspace_sampling(
if (cm->bit_depth == AOM_BITS_12) {
// 420, 444 or 422
aom_wb_write_bit(wb, cm->subsampling_x);
aom_wb_write_bit(wb, cm->subsampling_y);
if (cm->subsampling_x == 0) {
assert(cm->subsampling_y == 0 &&
"4:4:0 subsampling not allowed in AV1");
} else {
aom_wb_write_bit(wb, cm->subsampling_y);
}
} else {
// 422 only
assert(cm->subsampling_x == 1 && cm->subsampling_y == 0);
......
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