| 58 | |
| 59 | template <typename T> |
| 60 | bool PCCVideoDecoder::decompress( PCCVideo<T, 3>& video, |
| 61 | PCCContext& contexts, |
| 62 | const std::string& path, |
| 63 | PCCVideoBitstream& bitstream, |
| 64 | bool byteStreamVideoCoder, |
| 65 | PCCCodecId codecId, |
| 66 | const std::string& decoderPath, |
| 67 | size_t outputBitDepth, |
| 68 | const bool keepIntermediateFiles, |
| 69 | const size_t shvcLayerIndex, |
| 70 | const bool patchColorSubsampling, |
| 71 | const std::string& inverseColorSpaceConversionConfig, |
| 72 | const std::string& colorSpaceConversionPath, |
| 73 | const size_t upsamplingFilter ) { |
| 74 | const std::string type = bitstream.getExtension(); |
| 75 | const std::string fileName = path + type; |
| 76 | const std::string binFileName = fileName + ".bin"; |
| 77 | |
| 78 | printf( "byteStreamVideoCoder = %d codecId = %d \n", byteStreamVideoCoder, codecId ); |
| 79 | fflush( stdout ); |
| 80 | if ( byteStreamVideoCoder ) { |
| 81 | bitstream.sampleStreamToByteStream( |
| 82 | #if defined( USE_JMAPP_VIDEO_CODEC ) && defined( USE_JMLIB_VIDEO_CODEC ) |
| 83 | codecId == JMAPP || codecId == JMLIB, |
| 84 | #elif defined( USE_JMAPP_VIDEO_CODEC ) |
| 85 | codecId == JMAPP, |
| 86 | #elif defined( USE_JMLIB_VIDEO_CODEC ) |
| 87 | codecId == JMLIB, |
| 88 | #else |
| 89 | false, |
| 90 | #endif |
| 91 | #if defined( USE_VTMLIB_VIDEO_CODEC ) |
| 92 | codecId == VTMLIB |
| 93 | #else |
| 94 | false |
| 95 | #endif |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | // Decode video |
| 100 | auto decoder = PCCVirtualVideoDecoder<T>::create( codecId ); |
| 101 | printf( " decompress codecId = %d size(T) = %zu \n", (int)codecId, sizeof( T ) ); |
| 102 | fflush( stdout ); |
| 103 | #ifdef USE_SHMAPP_VIDEO_CODEC |
| 104 | if ( codecId == SHMAPP ) { |
| 105 | std::shared_ptr<PCCSHMAppVideoDecoder<T>> shmDecoder = |
| 106 | std::dynamic_pointer_cast<PCCSHMAppVideoDecoder<T>>( decoder ); |
| 107 | shmDecoder->setLayerIndex( shvcLayerIndex ); |
| 108 | } |
| 109 | #endif |
| 110 | decoder->decode( bitstream, video, outputBitDepth, decoderPath, fileName ); |
| 111 | size_t width = video.getWidth(); |
| 112 | size_t height = video.getHeight(); |
| 113 | bool is444 = video.is444(); |
| 114 | size_t frameIndex = 0; |
| 115 | for ( auto& image : video ) { |
| 116 | TRACE_PICTURE( " IdxOutOrderCntVal = %d, ", frameIndex++ ); |
| 117 | TRACE_PICTURE( " MD5checksumChan0 = %s, ", image.computeMD5( 0 ).c_str() ); |
no test coverage detected