| 256 | } |
| 257 | |
| 258 | bool decoderVTM::getNextFrameFromDecoder() |
| 259 | { |
| 260 | DEBUG_DECVTM("decoderVTM::getNextFrameFromDecoder"); |
| 261 | |
| 262 | currentVTMPic = this->lib.libVTMDec_get_picture(decoder); |
| 263 | if (currentVTMPic == nullptr) |
| 264 | { |
| 265 | decoderState = DecoderState::NeedsMoreData; |
| 266 | return false; |
| 267 | } |
| 268 | |
| 269 | // Check the validity of the picture |
| 270 | auto picSize = Size(this->lib.libVTMDec_get_picture_width(currentVTMPic, LIBVTMDEC_LUMA), |
| 271 | this->lib.libVTMDec_get_picture_height(currentVTMPic, LIBVTMDEC_LUMA)); |
| 272 | if (!picSize.isValid()) |
| 273 | DEBUG_DECVTM("decoderVTM::getNextFrameFromDecoder got invalid size"); |
| 274 | auto subsampling = |
| 275 | convertFromInternalSubsampling(this->lib.libVTMDec_get_chroma_format(currentVTMPic)); |
| 276 | if (subsampling == Subsampling::UNKNOWN) |
| 277 | DEBUG_DECVTM("decoderVTM::getNextFrameFromDecoder got invalid chroma format"); |
| 278 | auto bitDepth = functions::clipToUnsigned( |
| 279 | this->lib.libVTMDec_get_internal_bit_depth(currentVTMPic, LIBVTMDEC_LUMA)); |
| 280 | if (bitDepth < 8 || bitDepth > 16) |
| 281 | DEBUG_DECVTM("decoderVTM::getNextFrameFromDecoder got invalid bit depth"); |
| 282 | |
| 283 | if (!frameSize.isValid() && !formatYUV.isValid()) |
| 284 | { |
| 285 | // Set the values |
| 286 | frameSize = picSize; |
| 287 | formatYUV = video::yuv::PixelFormatYUV(subsampling, bitDepth); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | // Check the values against the previously set values |
| 292 | if (frameSize != picSize) |
| 293 | return setErrorB("Received a frame of different size"); |
| 294 | if (formatYUV.getSubsampling() != subsampling) |
| 295 | return setErrorB("Received a frame with different subsampling"); |
| 296 | if (formatYUV.getBitsPerSample() != bitDepth) |
| 297 | return setErrorB("Received a frame with different bit depth"); |
| 298 | } |
| 299 | |
| 300 | DEBUG_DECVTM("decoderVTM::getNextFrameFromDecoder got a valid frame wit POC %d", |
| 301 | this->lib.libVTMDec_get_POC(currentVTMPic)); |
| 302 | currentOutputBuffer.clear(); |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | bool decoderVTM::pushData(QByteArray &data) |
| 307 | { |
nothing calls this directly
no test coverage detected