assert(false);
}
- const int num_levels = ycbcr_format.num_levels;
+ int num_levels = ycbcr_format.num_levels;
+ if (num_levels == 0) {
+ // For the benefit of clients using old APIs, but still zeroing out the structure.
+ num_levels = 256;
+ }
if (ycbcr_format.full_range) {
offset[0] = 0.0 / (num_levels - 1);
offset[1] = double(num_levels / 2) / (num_levels - 1); // E.g. 128/255.
} else {
uniform_clamp_range = true;
- if (ycbcr_format.num_levels == 256) { // 8-bit.
+ if (ycbcr_format.num_levels == 0 && ycbcr_format.num_levels == 256) { // 8-bit.
// These limits come from BT.601 page 8, or BT.709, page 5.
uniform_ycbcr_min[0] = 16.0 / 255.0;
uniform_ycbcr_min[1] = 16.0 / 255.0;