From 337ccc50dc0eae2154ec9cdfcde003a6cb119f92 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Nov 2019 00:55:55 +0100 Subject: img_format: add more explanations to component_pad field Weird shit. I thought this was a clever way to elegantly handle two cases at once, but maybe it's just confusing. --- video/img_format.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video/img_format.h b/video/img_format.h index 5735b6bd72..39d0a4bdad 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -130,6 +130,11 @@ struct mp_regular_imgfmt { // If >0, LSB padding, if <0, MSB padding. The padding bits are always 0. // This applies: bit_depth = component_size * 8 - abs(component_pad) + // bit_size = component_size * 8 + MPMIN(0, component_pad) + // E.g. P010: component_pad=6 (LSB always implied 0, all data in MSB) + // => has a "depth" of 10 bit, but usually treated as 16 bit value + // yuv420p10: component_pad=-6 (like a 10 bit value 0-extended to 16) + // => has depth of 10 bit, needs <<6 to get a 16 bit value int8_t component_pad; uint8_t num_planes; -- cgit v1.2.3