@@ -56,6 +56,21 @@ size_t PixelProperties::getBitsPerPixel() const
56
56
return av_get_bits_per_pixel ( _pixelDesc );
57
57
}
58
58
59
+ size_t PixelProperties::getMaxNbBitsInChannels () const
60
+ {
61
+ if ( ! _pixelDesc )
62
+ throw std::runtime_error ( " unable to find pixel description." );
63
+
64
+ size_t maxNbBitsInChannels = 0 ;
65
+ for ( unsigned int channelIndex = 0 ; channelIndex < _pixelDesc->nb_components ; ++channelIndex )
66
+ {
67
+ const size_t nbBits = _pixelDesc->comp [channelIndex].depth_minus1 + 1 ;
68
+ if ( nbBits > maxNbBitsInChannels )
69
+ maxNbBitsInChannels = nbBits;
70
+ }
71
+ return maxNbBitsInChannels;
72
+ }
73
+
59
74
size_t PixelProperties::getNbComponents () const
60
75
{
61
76
if ( ! _pixelDesc )
@@ -230,6 +245,7 @@ PropertyVector PixelProperties::getPropertiesAsVector() const
230
245
addProperty ( data, " pixelName" , &PixelProperties::getPixelName );
231
246
addProperty ( data, " pixelFormatName" , &PixelProperties::getPixelFormatName );
232
247
addProperty ( data, " bitDepth" , &PixelProperties::getBitsPerPixel );
248
+ addProperty ( data, " maxNbBitsInChannels" , &PixelProperties::getMaxNbBitsInChannels );
233
249
addProperty ( data, " nbComponents" , &PixelProperties::getNbComponents );
234
250
addProperty ( data, " chromaWidth" , &PixelProperties::getChromaWidth );
235
251
addProperty ( data, " chromaHeight" , &PixelProperties::getChromaHeight );
0 commit comments