From bde4632d5eb32dc9c35a845383ca746b65bd8fdc Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Thu, 5 Nov 2015 14:35:28 +0100 Subject: [PATCH 1/4] PixelProperties: added getMaxBitPerChannel --- .../mediaProperty/PixelProperties.cpp | 15 +++++++++++++++ .../mediaProperty/PixelProperties.hpp | 1 + 2 files changed, 16 insertions(+) diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.cpp b/src/AvTranscoder/mediaProperty/PixelProperties.cpp index e476c435..853ba386 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.cpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.cpp @@ -56,6 +56,21 @@ size_t PixelProperties::getBitsPerPixel() const return av_get_bits_per_pixel( _pixelDesc ); } +size_t PixelProperties::getMaxBitPerChannel() const +{ + if( ! _pixelDesc ) + throw std::runtime_error( "unable to find pixel description." ); + + size_t maxBitPerChannel = 0; + for( unsigned int channelIndex = 0; channelIndex < _pixelDesc->nb_components; ++channelIndex ) + { + const size_t nbBits = _pixelDesc->comp[channelIndex].depth_minus1 + 1; + if( nbBits > maxBitPerChannel ) + maxBitPerChannel = nbBits; + } + return maxBitPerChannel; +} + size_t PixelProperties::getNbComponents() const { if( ! _pixelDesc ) diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.hpp b/src/AvTranscoder/mediaProperty/PixelProperties.hpp index bfb2522f..a1247c45 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.hpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.hpp @@ -56,6 +56,7 @@ class AvExport PixelProperties std::string getPixelFormatName() const; size_t getBitsPerPixel() const; + size_t getMaxBitPerChannel() const; size_t getNbComponents() const; size_t getChromaWidth() const; size_t getChromaHeight() const; From d3d9320d85b0b92cc7f14883d368a7f1674a8dad Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Thu, 5 Nov 2015 14:35:57 +0100 Subject: [PATCH 2/4] PixelProperties: added maxBitPerChannel when getPropertiesAsVector --- src/AvTranscoder/mediaProperty/PixelProperties.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.cpp b/src/AvTranscoder/mediaProperty/PixelProperties.cpp index 853ba386..afa1a271 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.cpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.cpp @@ -245,6 +245,7 @@ PropertyVector PixelProperties::getPropertiesAsVector() const addProperty( data, "pixelName", &PixelProperties::getPixelName ); addProperty( data, "pixelFormatName", &PixelProperties::getPixelFormatName ); addProperty( data, "bitDepth", &PixelProperties::getBitsPerPixel ); + addProperty( data, "maxBitPerChannel", &PixelProperties::getMaxBitPerChannel ); addProperty( data, "nbComponents", &PixelProperties::getNbComponents ); addProperty( data, "chromaWidth", &PixelProperties::getChromaWidth ); addProperty( data, "chromaHeight", &PixelProperties::getChromaHeight ); From 05ac08069c3f7467fbfde6bc6504a3bcc86d0483 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Thu, 5 Nov 2015 14:36:56 +0100 Subject: [PATCH 3/4] PixelProperties: added doc to getBitsPerPixel --- src/AvTranscoder/mediaProperty/PixelProperties.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.hpp b/src/AvTranscoder/mediaProperty/PixelProperties.hpp index a1247c45..1548ca11 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.hpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.hpp @@ -55,7 +55,7 @@ class AvExport PixelProperties std::string getPixelName() const; std::string getPixelFormatName() const; - size_t getBitsPerPixel() const; + size_t getBitsPerPixel() const; ///< padding bits are not counted size_t getMaxBitPerChannel() const; size_t getNbComponents() const; size_t getChromaWidth() const; From ee02960339099b536b460a1d412f0c78eadb77a1 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Thu, 5 Nov 2015 18:32:02 +0100 Subject: [PATCH 4/4] PixelProperties: rename getMaxBitPerChannel to getMaxNbBitsInChannels --- src/AvTranscoder/mediaProperty/PixelProperties.cpp | 12 ++++++------ src/AvTranscoder/mediaProperty/PixelProperties.hpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.cpp b/src/AvTranscoder/mediaProperty/PixelProperties.cpp index afa1a271..bce3f023 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.cpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.cpp @@ -56,19 +56,19 @@ size_t PixelProperties::getBitsPerPixel() const return av_get_bits_per_pixel( _pixelDesc ); } -size_t PixelProperties::getMaxBitPerChannel() const +size_t PixelProperties::getMaxNbBitsInChannels() const { if( ! _pixelDesc ) throw std::runtime_error( "unable to find pixel description." ); - size_t maxBitPerChannel = 0; + size_t maxNbBitsInChannels = 0; for( unsigned int channelIndex = 0; channelIndex < _pixelDesc->nb_components; ++channelIndex ) { const size_t nbBits = _pixelDesc->comp[channelIndex].depth_minus1 + 1; - if( nbBits > maxBitPerChannel ) - maxBitPerChannel = nbBits; + if( nbBits > maxNbBitsInChannels ) + maxNbBitsInChannels = nbBits; } - return maxBitPerChannel; + return maxNbBitsInChannels; } size_t PixelProperties::getNbComponents() const @@ -245,7 +245,7 @@ PropertyVector PixelProperties::getPropertiesAsVector() const addProperty( data, "pixelName", &PixelProperties::getPixelName ); addProperty( data, "pixelFormatName", &PixelProperties::getPixelFormatName ); addProperty( data, "bitDepth", &PixelProperties::getBitsPerPixel ); - addProperty( data, "maxBitPerChannel", &PixelProperties::getMaxBitPerChannel ); + addProperty( data, "maxNbBitsInChannels", &PixelProperties::getMaxNbBitsInChannels ); addProperty( data, "nbComponents", &PixelProperties::getNbComponents ); addProperty( data, "chromaWidth", &PixelProperties::getChromaWidth ); addProperty( data, "chromaHeight", &PixelProperties::getChromaHeight ); diff --git a/src/AvTranscoder/mediaProperty/PixelProperties.hpp b/src/AvTranscoder/mediaProperty/PixelProperties.hpp index 1548ca11..b1137199 100644 --- a/src/AvTranscoder/mediaProperty/PixelProperties.hpp +++ b/src/AvTranscoder/mediaProperty/PixelProperties.hpp @@ -56,7 +56,7 @@ class AvExport PixelProperties std::string getPixelFormatName() const; size_t getBitsPerPixel() const; ///< padding bits are not counted - size_t getMaxBitPerChannel() const; + size_t getMaxNbBitsInChannels() const; size_t getNbComponents() const; size_t getChromaWidth() const; size_t getChromaHeight() const;