summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-02 00:55:55 +0100
committerwm4 <wm4@nowhere>2019-11-02 00:55:55 +0100
commit337ccc50dc0eae2154ec9cdfcde003a6cb119f92 (patch)
treedac65dabc85bb4484687dfdd69fd89978d3571e6
parent4b3666329e90bec6292566d0d447cefe035c039a (diff)
downloadmpv-337ccc50dc0eae2154ec9cdfcde003a6cb119f92.tar.bz2
mpv-337ccc50dc0eae2154ec9cdfcde003a6cb119f92.tar.xz
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.
-rw-r--r--video/img_format.h5
1 files changed, 5 insertions, 0 deletions
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;