X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=ycbcr.cpp;fp=ycbcr.cpp;h=8ae8d34328c1e05c61635515c9a177260cd28e07;hp=eaa2ee8c3bb277903bef8ab7a8a33f6c137aecf1;hb=e8ef17c8b7187764952f8e45771f97bcaf6abca9;hpb=50da1040ef322e7a6325b70bc8c87d35825536f2 diff --git a/ycbcr.cpp b/ycbcr.cpp index eaa2ee8..8ae8d34 100644 --- a/ycbcr.cpp +++ b/ycbcr.cpp @@ -89,7 +89,11 @@ void compute_ycbcr_matrix(YCbCrFormat ycbcr_format, float* offset, Matrix3d* ycb 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.