| 280 | |
| 281 | template <typename T> |
| 282 | bool PCCVideoEncoder::compress( PCCVideo<T, 3>& video, |
| 283 | const std::string& path, |
| 284 | const int qp, |
| 285 | PCCVideoBitstream& bitstream, |
| 286 | const std::string& encoderConfig, |
| 287 | const std::string& encoderPath, |
| 288 | PCCCodecId codecId, |
| 289 | bool byteStreamVideoCoder, |
| 290 | PCCContext& contexts, |
| 291 | const size_t nbyte, |
| 292 | const bool use444CodecIo, |
| 293 | const bool use3dmv, |
| 294 | const bool usePccRDO, |
| 295 | const size_t shvcLayerIndex, |
| 296 | const size_t shvcRateX, |
| 297 | const size_t shvcRateY, |
| 298 | const size_t internalBitDepth, |
| 299 | const bool useConversion, |
| 300 | const bool keepIntermediateFiles, |
| 301 | const std::string& colorSpaceConversionConfig, |
| 302 | const std::string& inverseColorSpaceConversionConfig, |
| 303 | const std::string& colorSpaceConversionPath, |
| 304 | const size_t downsamplingFilter, |
| 305 | const size_t upsamplingFilter, |
| 306 | const bool patchColorSubsampling ) { |
| 307 | auto& frames = video.getFrames(); |
| 308 | if ( frames.empty() || frames[0].getChannelCount() != 3 ) { return false; } |
| 309 | const size_t width = frames[0].getWidth(); |
| 310 | const size_t height = frames[0].getHeight(); |
| 311 | const size_t depth = nbyte == 1 ? 8 : 10; |
| 312 | const std::string type = bitstream.getExtension(); |
| 313 | const std::string fileName = path + type; |
| 314 | const std::string binFileName = fileName + ".bin"; |
| 315 | const std::string blockToPatchFileName = path + "blockToPatch.txt"; |
| 316 | const std::string occupancyMapFileName = path + "occupancy.txt"; |
| 317 | const std::string patchInfoFileName = path + "patchInfo.txt"; |
| 318 | const char* bitdepth = nbyte == 2 ? "10" : "8"; |
| 319 | const std::string srcYuvFileName = |
| 320 | addVideoFormat( fileName, width, height, !use444CodecIo, !use444CodecIo, bitdepth ); |
| 321 | const std::string srcRgbFileName = addVideoFormat( fileName, width, height, false, !use444CodecIo, bitdepth ); |
| 322 | const std::string recYuvFileName = |
| 323 | addVideoFormat( fileName + "_rec", width, height, !use444CodecIo, !use444CodecIo, bitdepth ); |
| 324 | const bool yuvVideo = colorSpaceConversionConfig.empty() || use444CodecIo; |
| 325 | |
| 326 | std::shared_ptr<PCCVirtualColorConverter<T>> converter; |
| 327 | std::string configInverseColorSpace, configColorSpace; |
| 328 | if ( colorSpaceConversionPath.empty() ) { |
| 329 | converter = std::make_shared<PCCInternalColorConverter<T>>(); |
| 330 | configInverseColorSpace = stringFormat( "YUV420ToYUV444_%zu_%zu", depth, upsamplingFilter ); |
| 331 | configColorSpace = stringFormat( "RGB444ToYUV420_%zu_%zu", depth, downsamplingFilter ); |
| 332 | } else { |
| 333 | #ifdef USE_HDRTOOLS |
| 334 | converter = std::make_shared<PCCHDRToolsLibColorConverter<T>>(); |
| 335 | #else |
| 336 | converter = std::make_shared<PCCHDRToolsAppColorConverter<T>>(); |
| 337 | #endif |
| 338 | configInverseColorSpace = inverseColorSpaceConversionConfig; |
| 339 | configColorSpace = colorSpaceConversionConfig; |
no test coverage detected