There is actually a bit of a trick when extending the bitdepth of a full range signal, you fill the new bits with the leading bits of the pixel, ie. like this for 8 to 10-bit:
- You shift to 10-bit first, which adds two empty bits.
- Then you fill those empty bits with the top bits from the original signal
Code:
1111111100
+ 11111111
= 1111111111
This has several good properties, namely:
- All 1 also remains all 1, ie. maximum 8-bit (255) remains maximum 10-bit (1023)
- Zero also remains zero
- Its easy and fast
I can't say that this is what its doing, but it is generally regarded as producing a more faithful signal when increasing bitdepth then plain zero padding, and a full stretch from 0-255 to 0-1023 is computationally rather expensive.
Note that this does not apply when you are dealing with limited range (ie. 16-235), because 16 and 235 map to the limited-range 10-bit values exactly when you simply shift them up (ie. 64 to 940)
But when handling full-range signals like RGB, plain zero padding is not entirely accurate.